• GTk Printing a obe page document

    From ldries46@21:1/5 to All on Wed Jan 25 14:15:30 2023
    In the same program I can print multiple page documents but one page
    documents are not printed.
    Set_N_Pages (Print_Op, nr_Pages); in this statement nr_Pages is filled correctly. What can I do or where should I look for some kind of bug.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ldries46@21:1/5 to All on Wed Jan 25 15:47:49 2023
    Op 25-1-2023 om 14:15 schreef ldries46:
    In the same program I can print multiple page documents but one page documents are not printed.
    Set_N_Pages (Print_Op, nr_Pages); in this statement nr_Pages is filled correctly. What can I do or where should I look for some kind of bug.
    Testing with a single page file resulted in an output of two pages.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ldries46@21:1/5 to All on Wed Jan 25 17:10:36 2023
    Op 25-1-2023 om 14:15 schreef ldries46:
    In the same program I can print multiple page documents but one page documents are not printed.
    Set_N_Pages (Print_Op, nr_Pages); in this statement nr_Pages is filled correctly. What can I do or where should I look for some kind of bug.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ldries46@21:1/5 to All on Thu Jan 26 12:03:46 2023
    Op 25-1-2023 om 17:10 schreef ldries46:
    Op 25-1-2023 om 14:15 schreef ldries46:
    In the same program I can print multiple page documents but one page
    documents are not printed.
    Set_N_Pages (Print_Op, nr_Pages); in this statement nr_Pages is
    filled correctly. What can I do or where should I look for some kind
    of bug.

    I stop with question and will start a new one because I think the
    original question was not clear enough and had a type error in the
    original title.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ldries46@21:1/5 to All on Thu Jan 26 12:40:35 2023
    This is a multi-part message in MIME format.
    I have a problem printing one page documents in GTK 3.0.
    Documents with more than one page are correctly printed but one page
    documents are not printed.
    Because using the debugger in GNAT Studio 23.0w (20220512)  is sometimes
    a problem I have used printed some results during running to the GTK
    textview. I found that the program not even reaches Draw_Page from Connect_and_Run.
    My question is what should I do to also correctly print one page documents.
    For your information On_Print the code is:

            Set_N_Pages (Print_Op, nr_Pages);
            Set_Use_Full_Page(Print_Op, true);
            Set_Unit (Print_Op, points); --DEBUG-------------------------------------------------------------------
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Set_Unit (Print_Op, points)"), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("nr_Pages       =") &
    Gint'image(nr_Pages) & " Filetype " & Windows'image(nb), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Ofirst_line    =") & integer'image(first_line), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("last_line      =") & integer'image(last_line), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("delta_lines    =") & integer'image(delta_lines), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Number         =") & long_float'image(Number), 0, true)); --------------------------------------------------------------------------
            Print_Op.Set_Print_Settings(Print_Set); -------------------------------------------------------------------
    --   procedure On_Draw_Page
    --      (Self  : not null access Gtk_Print_Operation_Record; --       Call  : Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Void; --       After : Boolean := False); -------------------------------------------------------------------- --DEBUG-------------------------------------------------------------------
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Print_Op.Set_Print_Settings(Print_Set)"),
    0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("nr_Pages       =") &
    Gint'image(nr_Pages) & " Filetype " & Windows'image(nb), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Ofirst_line    =") & integer'image(first_line), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("last_line      =") & integer'image(last_line), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("delta_lines    =") & integer'image(delta_lines), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Number         =") & long_float'image(Number), 0, true)); --------------------------------------------------------------------------
            On_Draw_Page(Print_Op, Draw); --DEBUG-------------------------------------------------------------------
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("On_Draw_Page(Print_Op, Draw)"), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("nr_Pages       =") &
    Gint'image(nr_Pages) & " Filetype " & Windows'image(nb), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Ofirst_line    =") & integer'image(first_line), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("last_line      =") & integer'image(last_line), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("delta_lines    =") & integer'image(delta_lines), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Number         =") & long_float'image(Number), 0, true)); --------------------------------------------------------------------------
            Result := Connect_and_Run(Print_Op ,Action_Print_Dialog, Main_Window);
    --
    --DEBUG-------------------------------------------------------------------
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Connect_and_Run(Print_Op
    ,Action_Print_Dialog, Main_Window)"), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("nr_Pages       =") &
    Gint'image(nr_Pages) & " Filetype " & Windows'image(nb), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Ofirst_line    =") & integer'image(first_line), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("last_line      =") & integer'image(last_line), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("delta_lines    =") & integer'image(delta_lines), 0, true));
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Number         =") & long_float'image(Number), 0, true)); --------------------------------------------------------------------------

    In Draw_Page also someinformation lines are presented:

          nr := first_line;
          Cr := Get_Cairo_Context (Context);
          Set_Source_Rgb (Cr, 0.0, 0.0, 0.0);
          Select_font_face(Cr, "Consolas", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
          Set_Font_Size(Cr, GDouble(10));
          if nr = 1 then
             pagenr := 1;
          else
             pagenr := pagenr + 1;
          end if;
          if pagenr rem 2 = 1 then
             width := 70;
          else
             width := 40;
          end if;
          if last_page_line > last_line then
             last_page_line := last_line;
          end if;
          len := 3;
          nr1 := 10;
          while last_line > nr1 - 1 loop
             nr1 := nr1 * 10;
             len := len + 1;
          end loop; --DEBUG-------------------------------------------------------------------
         Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("Draw_Page "), 0, true));
         Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("pagenr         = ") & integer'image(pagenr), 0, true));
         Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("first_line     = " & integer'image(first_line) & " Buffer = " & Windows'image(Window_Type)),
    0, true));
         Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("last_line      = ") & integer'image(last_line), 0, true));
         Insert_At_Cursor(Text_Buffers(Window_Type), buf_string(To_Unbounded_String("last_page_line = ") & integer'image(last_page_line), 0, true)); --------------------------------------------------------------------------


    With a one page document I got:
    Set_Unit (Print_Op, points)
    nr_Pages       = 1 Filetype GL
    Ofirst_line    = 1
    last_line      = 15
    delta_lines    = 56
    Number         = 1.00000000000000E+00 Print_Op.Set_Print_Settings(Print_Set)
    nr_Pages       = 1 Filetype GL
    Ofirst_line    = 1
    last_line      = 15
    delta_lines    = 56
    Number         = 1.00000000000000E+00
    On_Draw_Page(Print_Op, Draw)
    nr_Pages       = 1 Filetype GL
    Ofirst_line    = 1
    last_line      = 15
    delta_lines    = 56
    Number         = 1.00000000000000E+00
    Connect_and_Run(Print_Op ,Action_Print_Dialog, Main_Window) nr_Pages       = 1 Filetype GL
    Ofirst_line    = 1
    last_line      = 15
    delta_lines    = 56
    Number         = 1.00000000000000E+00

    With a Multipage document I got:
    Set_Unit (Print_Op, points)
    nr_Pages       = 2 Filetype BI
    Ofirst_line    = 1
    last_line      = 68
    delta_lines    = 56
    Number         = 2.00000000000000E+00 Print_Op.Set_Print_Settings(Print_Set)
    nr_Pages       = 2 Filetype BI
    Ofirst_line    = 1
    last_line      = 68
    delta_lines    = 56
    Number         = 2.00000000000000E+00
    On_Draw_Page(Print_Op, Draw)
    nr_Pages       = 2 Filetype BI
    Ofirst_line    = 1
    last_line      = 68
    delta_lines    = 56
    Number         = 2.00000000000000E+00
    Draw_Page
    pagenr         =  1
    first_line     =  1 Buffer = BI
    last_line      =  68
    last_page_line =  57
    Draw_Page
    pagenr         =  2
    first_line     =  58 Buffer = BI
    last_line      =  68
    last_page_line =  68
    Connect_and_Run(Print_Op ,Action_Print_Dialog, Main_Window) nr_Pages       = 2 Filetype BI
    Ofirst_line    = 69
    last_line      = 68
    delta_lines    = 56
    Number         = 2.00000000000000E+00

    <html>
    <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    </head>
    <body>
    <font size="1" face="Monospac821 BT">I have a problem printing one
    page documents in GTK 3.0.<br>
    Documents with more than one page are correctly printed but one
    page documents are not printed.<br>
    Because using the debugger in GNAT Studio 23.0w (20220512)  is
    sometimes a problem I have used printed some results during
    running to the GTK textview. I found that the program not even
    reaches Draw_Page from Connect_and_Run. <br>
    My question is what should I do to also correctly print one page
    documents.<br>
    For your information On_Print the code is:<br>
    <br>
            Set_N_Pages (Print_Op, nr_Pages);<br>
            Set_Use_Full_Page(Print_Op, true);<br>
            Set_Unit (Print_Op, points);<br>
            --DEBUG-------------------------------------------------------------------<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Set_Unit (Print_Op, points)"), 0,
    true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("nr_Pages       =") &amp;
    Gint'image(nr_Pages) &amp; " Filetype " &amp; Windows'image(nb),
    0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Ofirst_line    =") &amp;
    integer'image(first_line), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("last_line      =") &amp;
    integer'image(last_line), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("delta_lines    =") &amp;
    integer'image(delta_lines), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Number         =") &amp;
    long_float'image(Number), 0, true));<br>
            --------------------------------------------------------------------------<br>
            Print_Op.Set_Print_Settings(Print_Set);<br> -------------------------------------------------------------------<br>
    --   procedure On_Draw_Page<br>
    --      (Self  : not null access Gtk_Print_Operation_Record;<br>
    --       Call  :
    Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Void;<br>
    --       After : Boolean := False);<br> --------------------------------------------------------------------<br>
            --DEBUG-------------------------------------------------------------------<br>
            Insert_At_Cursor(Text_Buffers(nb), buf_string(To_Unbounded_String("Print_Op.Set_Print_Settings(Print_Set)"),
    0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("nr_Pages       =") &amp;
    Gint'image(nr_Pages) &amp; " Filetype " &amp; Windows'image(nb),
    0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Ofirst_line    =") &amp;
    integer'image(first_line), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("last_line      =") &amp;
    integer'image(last_line), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("delta_lines    =") &amp;
    integer'image(delta_lines), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Number         =") &amp;
    long_float'image(Number), 0, true));<br>
            --------------------------------------------------------------------------<br>
            On_Draw_Page(Print_Op, Draw);<br>
            --DEBUG-------------------------------------------------------------------<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("On_Draw_Page(Print_Op, Draw)"), 0,
    true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("nr_Pages       =") &amp;
    Gint'image(nr_Pages) &amp; " Filetype " &amp; Windows'image(nb),
    0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Ofirst_line    =") &amp;
    integer'image(first_line), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("last_line      =") &amp;
    integer'image(last_line), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("delta_lines    =") &amp;
    integer'image(delta_lines), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Number         =") &amp;
    long_float'image(Number), 0, true));<br>
            --------------------------------------------------------------------------<br>
            Result := Connect_and_Run(Print_Op ,Action_Print_Dialog,
    Main_Window);<br>
    --        --DEBUG-------------------------------------------------------------------<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Connect_and_Run(Print_Op
    ,Action_Print_Dialog, Main_Window)"), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("nr_Pages       =") &amp;
    Gint'image(nr_Pages) &amp; " Filetype " &amp; Windows'image(nb),
    0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Ofirst_line    =") &amp;
    integer'image(first_line), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("last_line      =") &amp;
    integer'image(last_line), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("delta_lines    =") &amp;
    integer'image(delta_lines), 0, true));<br>
            Insert_At_Cursor(Text_Buffers(nb),
    buf_string(To_Unbounded_String("Number         =") &amp;
    long_float'image(Number), 0, true));<br>
            --------------------------------------------------------------------------<br>
    <br>
    In Draw_Page also someinformation lines are presented:<br>
    <br>
          nr := first_line;<br>
          Cr := Get_Cairo_Context (Context);<br>
          Set_Source_Rgb (Cr, 0.0, 0.0, 0.0);<br>
          Select_font_face(Cr, "Consolas", CAIRO_FONT_SLANT_NORMAL,
    CAIRO_FONT_WEIGHT_NORMAL);<br>
          Set_Font_Size(Cr, GDouble(10));<br>
          if nr = 1 then<br>
             pagenr := 1;<br>
          else<br>
             pagenr := pagenr + 1;<br>
          end if;<br>
          if pagenr rem 2 = 1 then<br>
             width := 70;<br>
          else<br>
             width := 40;<br>
          end if;<br>
          if last_page_line &gt; last_line then<br>
             last_page_line := last_line;<br>
          end if;<br>
          len := 3;<br>
          nr1 := 10;<br>
          while last_line &gt; nr1 - 1 loop<br>
             nr1 := nr1 * 10;<br>
             len := len + 1;<br>
          end loop;<br>
         --DEBUG-------------------------------------------------------------------<br>
         Insert_At_Cursor(Text_Buffers(Window_Type),
    buf_string(To_Unbounded_String("Draw_Page "), 0, true));<br>
         Insert_At_Cursor(Text_Buffers(Window_Type),
    buf_string(To_Unbounded_String("pagenr         = ") &amp;
    integer'image(pagenr), 0, true));<br>
         Insert_At_Cursor(Text_Buffers(Window_Type),
    buf_string(To_Unbounded_String("first_line     = " &amp;
    integer'image(first_line) &amp; " Buffer = " &amp;
    Windows'image(Window_Type)), 0, true));<br>
         Insert_At_Cursor(Text_Buffers(Window_Type),
    buf_string(To_Unbounded_String("last_line      = ") &amp;
    integer'image(last_line), 0, true));<br>
         Insert_At_Cursor(Text_Buffers(Window_Type),
    buf_string(To_Unbounded_String("last_page_line = ") &amp;
    integer'image(last_page_line), 0, true));<br>
         --------------------------------------------------------------------------<br>
    <br>
    <br>
    With a one page document I got:<br>
    Set_Unit (Print_Op, points)<br>
    nr_Pages       = 1 Filetype GL<br>
    Ofirst_line    = 1<br>
    last_line      = 15<br>
    delta_lines    = 56<br>
    Number         = 1.00000000000000E+00<br>
    Print_Op.Set_Print_Settings(Print_Set)<br>
    nr_Pages       = 1 Filetype GL<br>
    Ofirst_line    = 1<br>
    last_line      = 15<br>
    delta_lines    = 56<br>
    Number         = 1.00000000000000E+00<br>
    On_Draw_Page(Print_Op, Draw)<br>
    nr_Pages       = 1 Filetype GL<br>
    Ofirst_line    = 1<br>
    last_line      = 15<br>
    delta_lines    = 56<br>
    Number         = 1.00000000000000E+00<br>
    Connect_and_Run(Print_Op ,Action_Print_Dialog, Main_Window)<br>
    nr_Pages       = 1 Filetype GL<br>
    Ofirst_line    = 1<br>
    last_line      = 15<br>
    delta_lines    = 56<br>
    Number         = 1.00000000000000E+00<br>
    <br>
    With a Multipage document I got:<br>
    Set_Unit (Print_Op, points)<br>
    nr_Pages       = 2 Filetype BI<br>
    Ofirst_line    = 1<br>
    last_line      = 68<br>
    delta_lines    = 56<br>
    Number         = 2.00000000000000E+00<br>
    Print_Op.Set_Print_Settings(Print_Set)<br>
    nr_Pages       = 2 Filetype BI<br>
    Ofirst_line    = 1<br>
    last_line      = 68<br>
    delta_lines    = 56<br>
    Number         = 2.00000000000000E+00<br>
    On_Draw_Page(Print_Op, Draw)<br>
    nr_Pages       = 2 Filetype BI<br>
    Ofirst_line    = 1<br>
    last_line      = 68<br>
    delta_lines    = 56<br>
    Number         = 2.00000000000000E+00<br>
    Draw_Page <br>
    pagenr         =  1<br>
    first_line     =  1 Buffer = BI<br>
    last_line      =  68<br>
    last_page_line =  57<br>
    Draw_Page <br>
    pagenr         =  2<br>
    first_line     =  58 Buffer = BI<br>
    last_line      =  68<br>
    last_page_line =  68<br>
    Connect_and_Run(Print_Op ,Action_Print_Dialog, Main_Window)<br>
    nr_Pages       = 2 Filetype BI<br>
    Ofirst_line    = 69<br>
    last_line      = 68<br>
    delta_lines    = 56<br>
    Number         = 2.00000000000000E+00<br>
    </font><br>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)