From 8528bd05cbf65593c0592055431f6c85c21d6967 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 10 Nov 2016 19:06:24 +1100 Subject: Removed some package renames --- src/adapad.adb | 63 +++++++++++++++++++++++++++------------------------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/src/adapad.adb b/src/adapad.adb index 0559b52..50fbe8d 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -16,13 +16,6 @@ with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; package body Adapad is - package W renames FLTK.Widgets; - package WN renames FLTK.Widgets.Groups.Windows; - package D renames FLTK.Dialogs; - - - - -- global state of the text editor Editor : Windows.Editor.Editor_Window := Windows.Editor.Create (800, 500); @@ -62,7 +55,7 @@ package body Adapad is overriding procedure Call (This : in New_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin if not Safe_To_Discard then return; end if; Filename := To_Unbounded_String (0); @@ -77,11 +70,12 @@ package body Adapad is overriding procedure Call (This : in Open_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin if not Safe_To_Discard then return; end if; declare - New_Filename : String := D.File_Chooser ("Open File?", "*", To_String (Filename)); + New_Filename : String := + FLTK.Dialogs.File_Chooser ("Open File?", "*", To_String (Filename)); begin if New_Filename /= "" then Load_File (New_Filename); @@ -94,7 +88,7 @@ package body Adapad is overriding procedure Call (This : in Save_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Do_Save; end Call; @@ -104,7 +98,7 @@ package body Adapad is overriding procedure Call (This : in Save_As_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Do_Save_As; end Call; @@ -114,7 +108,7 @@ package body Adapad is overriding procedure Call (This : in Quit_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin if not Safe_To_Discard then return; end if; Hide; @@ -125,7 +119,7 @@ package body Adapad is overriding procedure Call (This : in Undo_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Editor.Undo; end Call; @@ -135,7 +129,7 @@ package body Adapad is overriding procedure Call (This : in Cut_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Editor.Cut; end Call; @@ -145,7 +139,7 @@ package body Adapad is overriding procedure Call (This : in Copy_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Editor.Copy; end Call; @@ -155,7 +149,7 @@ package body Adapad is overriding procedure Call (This : in Paste_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Editor.Paste; end Call; @@ -165,7 +159,7 @@ package body Adapad is overriding procedure Call (This : in Delete_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Editor.Delete; end Call; @@ -175,7 +169,7 @@ package body Adapad is overriding procedure Call (This : in Select_All_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Buffer.Set_Selection (0, Buffer.Length); end Call; @@ -185,7 +179,7 @@ package body Adapad is overriding procedure Call (This : in Find_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Centre (Find); Find.Show; @@ -196,7 +190,7 @@ package body Adapad is overriding procedure Call (This : in Replace_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Centre (Replace); Replace.Show; @@ -207,7 +201,7 @@ package body Adapad is overriding procedure Call (This : in About_Callback; - Item : in out W.Widget'Class) is + Item : in out FLTK.Widgets.Widget'Class) is begin Centre (About); About.Show; @@ -252,7 +246,7 @@ package body Adapad is Editor.Set_Insert_Position (Found_At + Item'Length); Editor.Show_Insert_Position; else - D.Alert ("No occurrences of '" & Item & "' found!"); + FLTK.Dialogs.Alert ("No occurrences of '" & Item & "' found!"); end if; end Call; @@ -286,9 +280,10 @@ package body Adapad is end loop; if Times_Replaced > 0 then - D.Message_Box ("Replaced " & Integer'Image (Times_Replaced) & " occurrences."); + FLTK.Dialogs.Message_Box + ("Replaced " & Integer'Image (Times_Replaced) & " occurrences."); else - D.Alert ("No occurrences of '" & Item & "' found!"); + FLTK.Dialogs.Alert ("No occurrences of '" & Item & "' found!"); end if; end Call; @@ -317,20 +312,20 @@ package body Adapad is function Safe_To_Discard return Boolean is - User_Response : D.Choice; + User_Response : FLTK.Dialogs.Choice; begin if not Changed then return True; end if; - User_Response := D.Three_Way_Choice + User_Response := FLTK.Dialogs.Three_Way_Choice ("The current file has not been saved." & Character'Val (10) & "Would you like to save it now?", "Cancel", "Save", "Discard"); case User_Response is - when D.First => + when FLTK.Dialogs.First => return False; - when D.Second => + when FLTK.Dialogs.Second => Do_Save; return not Changed; - when D.Third => + when FLTK.Dialogs.Third => return True; end case; end Safe_To_Discard; @@ -351,7 +346,7 @@ package body Adapad is procedure Do_Save_As is - New_Filename : String := D.File_Chooser + New_Filename : String := FLTK.Dialogs.File_Chooser ("Save File As?", "*", To_String (Filename)); begin if New_Filename /= "" then @@ -371,7 +366,7 @@ package body Adapad is Buffer.Call_Modify_Callbacks; exception when Storage_Error => - D.Alert ("Error reading from file " & Name); + FLTK.Dialogs.Alert ("Error reading from file " & Name); end Load_File; @@ -386,14 +381,14 @@ package body Adapad is Buffer.Call_Modify_Callbacks; exception when Storage_Error => - D.Alert ("Error writing to file " & Name); + FLTK.Dialogs.Alert ("Error writing to file " & Name); end Save_File; procedure Centre - (Win : in out WN.Window'Class) + (Win : in out FLTK.Widgets.Groups.Windows.Window'Class) is Middle_X : Integer := Editor.Get_X + Editor.Get_W / 2; Middle_Y : Integer := Editor.Get_Y + Editor.Get_H / 2; -- cgit