From de5a891d0049a85e85e243979e5fc116a03e5c6d Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 10 Nov 2016 18:56:47 +1100 Subject: Renamed popups to dialogs --- src/adapad.adb | 4 +- src/fltk_binding/c_fl_dialog.cpp | 32 +++++++++++ src/fltk_binding/c_fl_dialog.h | 15 ++++++ src/fltk_binding/c_fl_popup.cpp | 32 ----------- src/fltk_binding/c_fl_popup.h | 15 ------ src/fltk_binding/fltk-dialogs.adb | 110 ++++++++++++++++++++++++++++++++++++++ src/fltk_binding/fltk-dialogs.ads | 32 +++++++++++ src/fltk_binding/fltk-popups.adb | 110 -------------------------------------- src/fltk_binding/fltk-popups.ads | 32 ----------- 9 files changed, 191 insertions(+), 191 deletions(-) create mode 100644 src/fltk_binding/c_fl_dialog.cpp create mode 100644 src/fltk_binding/c_fl_dialog.h delete mode 100644 src/fltk_binding/c_fl_popup.cpp delete mode 100644 src/fltk_binding/c_fl_popup.h create mode 100644 src/fltk_binding/fltk-dialogs.adb create mode 100644 src/fltk_binding/fltk-dialogs.ads delete mode 100644 src/fltk_binding/fltk-popups.adb delete mode 100644 src/fltk_binding/fltk-popups.ads (limited to 'src') diff --git a/src/adapad.adb b/src/adapad.adb index a28494b..0559b52 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -5,7 +5,7 @@ with FLTK.Widgets; with FLTK.Widgets.Menus; with FLTK.Widgets.Groups.Windows; with FLTK.Text_Buffers; -with FLTK.Popups; +with FLTK.Dialogs; with Windows.Editor; with Windows.About; with Windows.Find; @@ -18,7 +18,7 @@ package body Adapad is package W renames FLTK.Widgets; package WN renames FLTK.Widgets.Groups.Windows; - package D renames FLTK.Popups; + package D renames FLTK.Dialogs; diff --git a/src/fltk_binding/c_fl_dialog.cpp b/src/fltk_binding/c_fl_dialog.cpp new file mode 100644 index 0000000..cb6d305 --- /dev/null +++ b/src/fltk_binding/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/src/fltk_binding/c_fl_dialog.h b/src/fltk_binding/c_fl_dialog.h new file mode 100644 index 0000000..6804022 --- /dev/null +++ b/src/fltk_binding/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/src/fltk_binding/c_fl_popup.cpp b/src/fltk_binding/c_fl_popup.cpp deleted file mode 100644 index 913ec51..0000000 --- a/src/fltk_binding/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/src/fltk_binding/c_fl_popup.h b/src/fltk_binding/c_fl_popup.h deleted file mode 100644 index ff0f9ac..0000000 --- a/src/fltk_binding/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/src/fltk_binding/fltk-dialogs.adb b/src/fltk_binding/fltk-dialogs.adb new file mode 100644 index 0000000..fed4070 --- /dev/null +++ b/src/fltk_binding/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/src/fltk_binding/fltk-dialogs.ads b/src/fltk_binding/fltk-dialogs.ads new file mode 100644 index 0000000..cf8f80e --- /dev/null +++ b/src/fltk_binding/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/src/fltk_binding/fltk-popups.adb b/src/fltk_binding/fltk-popups.adb deleted file mode 100644 index d6ac8e9..0000000 --- a/src/fltk_binding/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/src/fltk_binding/fltk-popups.ads b/src/fltk_binding/fltk-popups.ads deleted file mode 100644 index 4b75c9b..0000000 --- a/src/fltk_binding/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