Print question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Print question

bertus.dries
I am creating a program that makes some kind of drawing with cairo and pango on my screen.
Now I want to print that drawing I thought I could solve that by:
 
Drawing on the screen:
 
procedure Draw_Grid(CR : Cairo_Context) is
..
..
..
end Draw_ Grid;
 
The drawing on the screen works.
 
Till now I have used:
 
with Gtk.Print_Context;     use Gtk.Print_Context;
with Gtk.Print_Operation;   use Gtk.Print_Operation;
with Gtkada.Printing;       use Gtkada.Printing;
 
procedure On_Print (Object : access Gtk_Menu_Item_Record'Class) is
   pragma Unreferenced (Object);
   Print_Op : Gtk_Print_Operation;
   Result   : Gtk_Print_Operation_Result;
begin
   Gtk_New(Print_Op);
   Set_N_Pages(Print_Op, 1);
   On_Draw_Page(Print_Op, Draw_Page);                                                                      Line 182
   Result := Connect_And_Run(Print_Op, Action_Print_Dialog, Main_Window);           Line 183
end On_Print;
 
procedure Draw_Page(Op : Gtk_Print_Operation_Record; Context : Gtk_Print_Context;
   Page_nr : Gint) is
   Print_CR : Cairo_Context;
begin
   Print_CR := Get_Cairo_Context (Context);
   Draw_Grid(Print_CR);
end Draw_Page;
 
Now I get the folowing messages:
 
182:30: no candidate interpretations match the actuals:
182:30: context requires function call, found procedure name
182:30:   ==> in call to "On_Draw_Page" at gtk-print_operation.ads:769
182:30:   ==> in call to "On_Draw_Page" at gtk-print_operation.ads:765
183:33: expected an access type with designated type "Gtkada_Print_Operation_Record'Class" defined at gtkada-printing.ads:102
183:33: found type "Gtk_Print_Operation" defined at gtk-print_operation.ads:99
183:33:   ==> in call to "Connect_And_Run" at gtkada-printing.ads:110
 
In the line181 The fact that Print_Op is not a Gtk_Print_Operation_Record does not create an error and Draw+Page is in the listings and the description not a function. I have no idea
 
L. Dries

_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Print question

bertus.dries
In the meantime I changed in On_Print
the declaration of Print_Op from Gtk_Print_Operation to Gtkada_Print_Operation and now yhe error inline 183 has disappeared.
have the errors in line 182. It looks like I cannot set the Callback routine correct.
 
L. Dries
 
Sent: Monday, August 1, 2016 7:53 PM
Subject: [gtkada] Print question
 
I am creating a program that makes some kind of drawing with cairo and pango on my screen.
Now I want to print that drawing I thought I could solve that by:
 
Drawing on the screen:
 
procedure Draw_Grid(CR : Cairo_Context) is
..
..
..
end Draw_ Grid;
 
The drawing on the screen works.
 
Till now I have used:
 
with Gtk.Print_Context;     use Gtk.Print_Context;
with Gtk.Print_Operation;   use Gtk.Print_Operation;
with Gtkada.Printing;       use Gtkada.Printing;
 
procedure On_Print (Object : access Gtk_Menu_Item_Record'Class) is
   pragma Unreferenced (Object);
   Print_Op : Gtk_Print_Operation;
   Result   : Gtk_Print_Operation_Result;
begin
   Gtk_New(Print_Op);
   Set_N_Pages(Print_Op, 1);
   On_Draw_Page(Print_Op, Draw_Page);                                                                      Line 182
   Result := Connect_And_Run(Print_Op, Action_Print_Dialog, Main_Window);           Line 183
end On_Print;
 
procedure Draw_Page(Op : Gtk_Print_Operation_Record; Context : Gtk_Print_Context;
   Page_nr : Gint) is
   Print_CR : Cairo_Context;
begin
   Print_CR := Get_Cairo_Context (Context);
   Draw_Grid(Print_CR);
end Draw_Page;
 
Now I get the folowing messages:
 
182:30: no candidate interpretations match the actuals:
182:30: context requires function call, found procedure name
182:30:   ==> in call to "On_Draw_Page" at gtk-print_operation.ads:769
182:30:   ==> in call to "On_Draw_Page" at gtk-print_operation.ads:765
183:33: expected an access type with designated type "Gtkada_Print_Operation_Record'Class" defined at gtkada-printing.ads:102
183:33: found type "Gtk_Print_Operation" defined at gtk-print_operation.ads:99
183:33:   ==> in call to "Connect_And_Run" at gtkada-printing.ads:110
 
In the line181 The fact that Print_Op is not a Gtk_Print_Operation_Record does not create an error and Draw+Page is in the listings and the description not a function. I have no idea
 
L. Dries


_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada


Geen virus gevonden in dit bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 2016.0.7690 / Virusdatabase: 4627/12722 - datum van uitgifte: 08/01/16


_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada
Loading...