From faabff73b74307cdec73264116291857d679aef7 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 10 Nov 2016 18:56:47 +1100 Subject: Renamed popups to dialogs --- c_fl_dialog.cpp | 32 ++++++++++++++++ c_fl_dialog.h | 15 ++++++++ c_fl_popup.cpp | 32 ---------------- c_fl_popup.h | 15 -------- fltk-dialogs.adb | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ fltk-dialogs.ads | 32 ++++++++++++++++ fltk-popups.adb | 110 ------------------------------------------------------- fltk-popups.ads | 32 ---------------- 8 files changed, 189 insertions(+), 189 deletions(-) create mode 100644 c_fl_dialog.cpp create mode 100644 c_fl_dialog.h delete mode 100644 c_fl_popup.cpp delete mode 100644 c_fl_popup.h create mode 100644 fltk-dialogs.adb create mode 100644 fltk-dialogs.ads delete mode 100644 fltk-popups.adb delete mode 100644 fltk-popups.ads diff --git a/c_fl_dialog.cpp b/c_fl_dialog.cpp new file mode 100644 index 0000000..cb6d305 --- /dev/null +++ b/c_fl_dialog.cpp @@ -0,0 +1,32 @@ + + +#include +#include +#include +#include "c_fl_dialog.h" + + +void dialog_fl_alert(const char * m) { + fl_alert(m); +} + + +int dialog_fl_choice(const char * m, const char * a, const char * b, const char * c) { + return fl_choice(m, a, b, c); +} + + +char * dialog_fl_file_chooser(const char * m, const char * p, const char * d, int r) { + return fl_file_chooser(m, p, d, r); +} + + +const char * dialog_fl_input(const char * m, const char * d) { + return fl_input(m, d); +} + + +void dialog_fl_message(const char * m) { + fl_message(m); +} + diff --git a/c_fl_dialog.h b/c_fl_dialog.h new file mode 100644 index 0000000..6804022 --- /dev/null +++ b/c_fl_dialog.h @@ -0,0 +1,15 @@ + + +#ifndef FL_DIALOG_GUARD +#define FL_DIALOG_GUARD + + +extern "C" void dialog_fl_alert(const char * m); +extern "C" int dialog_fl_choice(const char * m, const char * a, const char * b, const char * c); +extern "C" char * dialog_fl_file_chooser(const char * m, const char * p, const char * d, int r); +extern "C" const char * dialog_fl_input(const char * m, const char * d); +extern "C" void dialog_fl_message(const char * m); + + +#endif + diff --git a/c_fl_popup.cpp b/c_fl_popup.cpp deleted file mode 100644 index 913ec51..0000000 --- a/c_fl_popup.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -#include -#include -#include -#include "c_fl_popup.h" - - -void popup_fl_alert(const char * m) { - fl_alert(m); -} - - -int popup_fl_choice(const char * m, const char * a, const char * b, const char * c) { - return fl_choice(m, a, b, c); -} - - -char * popup_fl_file_chooser(const char * m, const char * p, const char * d, int r) { - return fl_file_chooser(m, p, d, r); -} - - -const char * popup_fl_input(const char * m, const char * d) { - return fl_input(m, d); -} - - -void popup_fl_message(const char * m) { - fl_message(m); -} - diff --git a/c_fl_popup.h b/c_fl_popup.h deleted file mode 100644 index ff0f9ac..0000000 --- a/c_fl_popup.h +++ /dev/null @@ -1,15 +0,0 @@ - - -#ifndef FL_POPUP_GUARD -#define FL_POPUP_GUARD - - -extern "C" void popup_fl_alert(const char * m); -extern "C" int popup_fl_choice(const char * m, const char * a, const char * b, const char * c); -extern "C" char * popup_fl_file_chooser(const char * m, const char * p, const char * d, int r); -extern "C" const char * popup_fl_input(const char * m, const char * d); -extern "C" void popup_fl_message(const char * m); - - -#endif - diff --git a/fltk-dialogs.adb b/fltk-dialogs.adb new file mode 100644 index 0000000..fed4070 --- /dev/null +++ b/fltk-dialogs.adb @@ -0,0 +1,110 @@ + + +with Interfaces.C; +with Interfaces.C.Strings; +use type Interfaces.C.Strings.chars_ptr; + + +package body FLTK.Dialogs is + + + procedure dialog_fl_alert + (M : in Interfaces.C.char_array); + pragma Import (C, dialog_fl_alert, "dialog_fl_alert"); + + function dialog_fl_choice + (M, A, B, C : in Interfaces.C.char_array) + return Interfaces.C.int; + pragma Import (C, dialog_fl_choice, "dialog_fl_choice"); + + function dialog_fl_file_chooser + (M, P, D : in Interfaces.C.char_array; + R : in Interfaces.C.int) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, dialog_fl_file_chooser, "dialog_fl_file_chooser"); + + function dialog_fl_input + (M, D : in Interfaces.C.char_array) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, dialog_fl_input, "dialog_fl_input"); + + procedure dialog_fl_message + (M : in Interfaces.C.char_array); + pragma Import (C, dialog_fl_message, "dialog_fl_message"); + + + + + procedure Alert + (Message : String) is + begin + dialog_fl_alert (Interfaces.C.To_C (Message)); + end Alert; + + + + + function Three_Way_Choice + (Message, Button1, Button2, Button3 : in String) + return Choice + is + Result : Interfaces.C.int := dialog_fl_choice + (Interfaces.C.To_C (Message), + Interfaces.C.To_C (Button1), + Interfaces.C.To_C (Button2), + Interfaces.C.To_C (Button3)); + begin + return Choice'Val (Result); + end Three_Way_Choice; + + + + + function File_Chooser + (Message, Filter_Pattern, Default : in String; + Relative : in Boolean := False) + return String + is + Result : Interfaces.C.Strings.chars_ptr := dialog_fl_file_chooser + (Interfaces.C.To_C (Message), + Interfaces.C.To_C (Filter_Pattern), + Interfaces.C.To_C (Default), + Boolean'Pos (Relative)); + begin + if Result = Interfaces.C.Strings.Null_Ptr then + return ""; + else + return Interfaces.C.Strings.Value (Result); + end if; + end File_Chooser; + + + + + function Text_Input + (Message, Default : in String) + return String + is + Result : Interfaces.C.Strings.chars_ptr := dialog_fl_input + (Interfaces.C.To_C (Message), + Interfaces.C.To_C (Default)); + begin + if Result = Interfaces.C.Strings.Null_Ptr then + return ""; + else + return Interfaces.C.Strings.Value (Result); + end if; + end Text_Input; + + + + + procedure Message_Box + (Message : in String) is + begin + dialog_fl_message (Interfaces.C.To_C (Message)); + end Message_Box; + + +end FLTK.Dialogs; + diff --git a/fltk-dialogs.ads b/fltk-dialogs.ads new file mode 100644 index 0000000..cf8f80e --- /dev/null +++ b/fltk-dialogs.ads @@ -0,0 +1,32 @@ + + +package FLTK.Dialogs is + + + procedure Alert + (Message : String); + + + type Choice is (First, Second, Third); + function Three_Way_Choice + (Message, Button1, Button2, Button3 : in String) + return Choice; + + + function File_Chooser + (Message, Filter_Pattern, Default : in String; + Relative : in Boolean := False) + return String; + + + function Text_Input + (Message, Default : in String) + return String; + + + procedure Message_Box + (Message : in String); + + +end FLTK.Dialogs; + diff --git a/fltk-popups.adb b/fltk-popups.adb deleted file mode 100644 index d6ac8e9..0000000 --- a/fltk-popups.adb +++ /dev/null @@ -1,110 +0,0 @@ - - -with Interfaces.C; -with Interfaces.C.Strings; -use type Interfaces.C.Strings.chars_ptr; - - -package body FLTK.Popups is - - - procedure popup_fl_alert - (M : in Interfaces.C.char_array); - pragma Import (C, popup_fl_alert, "popup_fl_alert"); - - function popup_fl_choice - (M, A, B, C : in Interfaces.C.char_array) - return Interfaces.C.int; - pragma Import (C, popup_fl_choice, "popup_fl_choice"); - - function popup_fl_file_chooser - (M, P, D : in Interfaces.C.char_array; - R : in Interfaces.C.int) - return Interfaces.C.Strings.chars_ptr; - pragma Import (C, popup_fl_file_chooser, "popup_fl_file_chooser"); - - function popup_fl_input - (M, D : in Interfaces.C.char_array) - return Interfaces.C.Strings.chars_ptr; - pragma Import (C, popup_fl_input, "popup_fl_input"); - - procedure popup_fl_message - (M : in Interfaces.C.char_array); - pragma Import (C, popup_fl_message, "popup_fl_message"); - - - - - procedure Alert - (Message : String) is - begin - popup_fl_alert (Interfaces.C.To_C (Message)); - end Alert; - - - - - function Three_Way_Choice - (Message, Button1, Button2, Button3 : in String) - return Choice - is - Result : Interfaces.C.int := popup_fl_choice - (Interfaces.C.To_C (Message), - Interfaces.C.To_C (Button1), - Interfaces.C.To_C (Button2), - Interfaces.C.To_C (Button3)); - begin - return Choice'Val (Result); - end Three_Way_Choice; - - - - - function File_Chooser - (Message, Filter_Pattern, Default : in String; - Relative : in Boolean := False) - return String - is - Result : Interfaces.C.Strings.chars_ptr := popup_fl_file_chooser - (Interfaces.C.To_C (Message), - Interfaces.C.To_C (Filter_Pattern), - Interfaces.C.To_C (Default), - Boolean'Pos (Relative)); - begin - if Result = Interfaces.C.Strings.Null_Ptr then - return ""; - else - return Interfaces.C.Strings.Value (Result); - end if; - end File_Chooser; - - - - - function Text_Input - (Message, Default : in String) - return String - is - Result : Interfaces.C.Strings.chars_ptr := popup_fl_input - (Interfaces.C.To_C (Message), - Interfaces.C.To_C (Default)); - begin - if Result = Interfaces.C.Strings.Null_Ptr then - return ""; - else - return Interfaces.C.Strings.Value (Result); - end if; - end Text_Input; - - - - - procedure Message_Box - (Message : in String) is - begin - popup_fl_message (Interfaces.C.To_C (Message)); - end Message_Box; - - -end FLTK.Popups; - diff --git a/fltk-popups.ads b/fltk-popups.ads deleted file mode 100644 index 4b75c9b..0000000 --- a/fltk-popups.ads +++ /dev/null @@ -1,32 +0,0 @@ - - -package FLTK.Popups is - - - procedure Alert - (Message : String); - - - type Choice is (First, Second, Third); - function Three_Way_Choice - (Message, Button1, Button2, Button3 : in String) - return Choice; - - - function File_Chooser - (Message, Filter_Pattern, Default : in String; - Relative : in Boolean := False) - return String; - - - function Text_Input - (Message, Default : in String) - return String; - - - procedure Message_Box - (Message : in String); - - -end FLTK.Popups; - -- cgit