diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2024-12-23 17:02:34 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2024-12-23 17:02:34 +1300 |
commit | b3f9e96403aa5cb9d7db2330aa579356d1d58b6f (patch) | |
tree | a2f6b68e3582b128e3a7e475757696f156084962 /src/fltk-devices-surface-paged-printers.adb | |
parent | db014c7a249b319e40052f2cff6305b0d09d7ca5 (diff) |
Tweaked the names of Surface_Device subhierarchy
Diffstat (limited to 'src/fltk-devices-surface-paged-printers.adb')
-rw-r--r-- | src/fltk-devices-surface-paged-printers.adb | 358 |
1 files changed, 358 insertions, 0 deletions
diff --git a/src/fltk-devices-surface-paged-printers.adb b/src/fltk-devices-surface-paged-printers.adb new file mode 100644 index 0000000..f5c964a --- /dev/null +++ b/src/fltk-devices-surface-paged-printers.adb @@ -0,0 +1,358 @@ + + +-- Programmed by Jedidiah Barber +-- Released into the public domain + + +with + + Interfaces.C; + +use type + + Interfaces.C.int; + + +package body FLTK.Devices.Surface.Paged.Printers is + + + function new_fl_printer + return Storage.Integer_Address; + pragma Import (C, new_fl_printer, "new_fl_printer"); + pragma Inline (new_fl_printer); + + procedure free_fl_printer + (D : in Storage.Integer_Address); + pragma Import (C, free_fl_printer, "free_fl_printer"); + pragma Inline (free_fl_printer); + + + + + function fl_printer_start_job + (D : in Storage.Integer_Address; + C : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_printer_start_job, "fl_printer_start_job"); + pragma Inline (fl_printer_start_job); + + function fl_printer_start_job2 + (D : in Storage.Integer_Address; + C, F, T : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_printer_start_job2, "fl_printer_start_job2"); + pragma Inline (fl_printer_start_job2); + + procedure fl_printer_end_job + (D : in Storage.Integer_Address); + pragma Import (C, fl_printer_end_job, "fl_printer_end_job"); + pragma Inline (fl_printer_end_job); + + function fl_printer_start_page + (D : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_printer_start_page, "fl_printer_start_page"); + pragma Inline (fl_printer_start_page); + + function fl_printer_end_page + (D : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_printer_end_page, "fl_printer_end_page"); + pragma Inline (fl_printer_end_page); + + + + + procedure fl_printer_margins + (D : in Storage.Integer_Address; + L, T, R, B : out Interfaces.C.int); + pragma Import (C, fl_printer_margins, "fl_printer_margins"); + pragma Inline (fl_printer_margins); + + function fl_printer_printable_rect + (D : in Storage.Integer_Address; + W, H : out Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_printer_printable_rect, "fl_printer_printable_rect"); + pragma Inline (fl_printer_printable_rect); + + procedure fl_printer_get_origin + (D : in Storage.Integer_Address; + X, Y : out Interfaces.C.int); + pragma Import (C, fl_printer_get_origin, "fl_printer_get_origin"); + pragma Inline (fl_printer_get_origin); + + procedure fl_printer_set_origin + (D : in Storage.Integer_Address; + X, Y : in Interfaces.C.int); + pragma Import (C, fl_printer_set_origin, "fl_printer_set_origin"); + pragma Inline (fl_printer_set_origin); + + procedure fl_printer_rotate + (D : in Storage.Integer_Address; + R : in Interfaces.C.C_float); + pragma Import (C, fl_printer_rotate, "fl_printer_rotate"); + pragma Inline (fl_printer_rotate); + + procedure fl_printer_scale + (D : in Storage.Integer_Address; + X, Y : in Interfaces.C.C_float); + pragma Import (C, fl_printer_scale, "fl_printer_scale"); + pragma Inline (fl_printer_scale); + + procedure fl_printer_translate + (D : in Storage.Integer_Address; + X, Y : in Interfaces.C.int); + pragma Import (C, fl_printer_translate, "fl_printer_translate"); + pragma Inline (fl_printer_translate); + + procedure fl_printer_untranslate + (D : in Storage.Integer_Address); + pragma Import (C, fl_printer_untranslate, "fl_printer_untranslate"); + pragma Inline (fl_printer_untranslate); + + + + + procedure fl_printer_print_widget + (D, I : in Storage.Integer_Address; + DX, DY : in Interfaces.C.int); + pragma Import (C, fl_printer_print_widget, "fl_printer_print_widget"); + pragma Inline (fl_printer_print_widget); + + procedure fl_printer_print_window_part + (D, I : in Storage.Integer_Address; + X, Y, W, H, DX, DY : in Interfaces.C.int); + pragma Import (C, fl_printer_print_window_part, "fl_printer_print_window_part"); + pragma Inline (fl_printer_print_window_part); + + + + + procedure fl_printer_set_current + (D : in Storage.Integer_Address); + pragma Import (C, fl_printer_set_current, "fl_printer_set_current"); + pragma Inline (fl_printer_set_current); + + + + + procedure Finalize + (This : in out Printer) is + begin + if This.Void_Ptr /= Null_Pointer and This.Needs_Dealloc then + free_fl_printer (This.Void_Ptr); + This.Void_Ptr := Null_Pointer; + end if; + end Finalize; + + + + + package body Forge is + + function Create + return Printer is + begin + return This : Printer do + This.Void_Ptr := new_fl_printer; + end return; + end Create; + + pragma Inline (Create); + + end Forge; + + + + + procedure Start_Job + (This : in out Printer; + Count : in Natural) is + begin + if fl_printer_start_job + (This.Void_Ptr, Interfaces.C.int (Count)) /= 0 + then + raise Page_Error; + end if; + end Start_Job; + + + procedure Start_Job + (This : in out Printer; + Count : in Natural; + From, To : in Positive) is + begin + if fl_printer_start_job2 + (This.Void_Ptr, + Interfaces.C.int (Count), + Interfaces.C.int (From), + Interfaces.C.int (To)) /= 0 + then + raise Page_Error; + end if; + end Start_Job; + + + procedure End_Job + (This : in out Printer) is + begin + fl_printer_end_job (This.Void_Ptr); + end End_Job; + + + procedure Start_Page + (This : in out Printer) is + begin + if fl_printer_start_page (This.Void_Ptr) /= 0 then + raise Page_Error; + end if; + end Start_Page; + + + procedure End_Page + (This : in out Printer) is + begin + if fl_printer_end_page (This.Void_Ptr) /= 0 then + raise Page_Error; + end if; + end End_Page; + + + + + procedure Get_Margins + (This : in Printer; + Left, Top, Right, Bottom : out Integer) is + begin + fl_printer_margins + (This.Void_Ptr, + Interfaces.C.int (Left), + Interfaces.C.int (Top), + Interfaces.C.int (Right), + Interfaces.C.int (Bottom)); + end Get_Margins; + + + procedure Get_Printable_Rect + (This : in Printer; + W, H : out Integer) is + begin + if fl_printer_printable_rect + (This.Void_Ptr, Interfaces.C.int (W), Interfaces.C.int (H)) /= 0 + then + raise Page_Error; + end if; + end Get_Printable_Rect; + + + procedure Get_Origin + (This : in Printer; + X, Y : out Integer) is + begin + fl_printer_get_origin (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y)); + end Get_Origin; + + + procedure Set_Origin + (This : in out Printer; + X, Y : in Integer) is + begin + fl_printer_set_origin + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y)); + end Set_Origin; + + + procedure Rotate + (This : in out Printer; + Degrees : in Float) is + begin + fl_printer_rotate (This.Void_Ptr, Interfaces.C.C_float (Degrees)); + end Rotate; + + + procedure Scale + (This : in out Printer; + Factor : in Float) is + begin + fl_printer_scale (This.Void_Ptr, Interfaces.C.C_float (Factor), 0.0); + end Scale; + + + procedure Scale + (This : in out Printer; + Factor_X, Factor_Y : in Float) is + begin + fl_printer_scale + (This.Void_Ptr, + Interfaces.C.C_float (Factor_X), + Interfaces.C.C_float (Factor_Y)); + end Scale; + + + procedure Translate + (This : in out Printer; + Delta_X, Delta_Y : in Integer) is + begin + fl_printer_translate + (This.Void_Ptr, + Interfaces.C.int (Delta_X), + Interfaces.C.int (Delta_Y)); + end Translate; + + + procedure Untranslate + (This : in out Printer) is + begin + fl_printer_untranslate (This.Void_Ptr); + end Untranslate; + + + + + procedure Print_Widget + (This : in out Printer; + Item : in FLTK.Widgets.Widget'Class; + Offset_X, Offset_Y : in Integer := 0) is + begin + fl_printer_print_widget + (This.Void_Ptr, + Wrapper (Item).Void_Ptr, + Interfaces.C.int (Offset_X), + Interfaces.C.int (Offset_Y)); + end Print_Widget; + + + procedure Print_Window_Part + (This : in out Printer; + Item : in FLTK.Widgets.Groups.Windows.Window'Class; + X, Y, W, H : in Integer; + Offset_X, Offset_Y : in Integer := 0) is + begin + fl_printer_print_window_part + (This.Void_Ptr, + Wrapper (Item).Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Offset_X), + Interfaces.C.int (Offset_Y)); + end Print_Window_Part; + + + + + procedure Set_Current + (This : in out Printer) is + begin + fl_printer_set_current (This.Void_Ptr); + Current_Ptr := This'Unchecked_Access; + end Set_Current; + + +end FLTK.Devices.Surface.Paged.Printers; + + |