summaryrefslogtreecommitdiff
path: root/src/editor_windows.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/editor_windows.adb')
-rw-r--r--src/editor_windows.adb136
1 files changed, 80 insertions, 56 deletions
diff --git a/src/editor_windows.adb b/src/editor_windows.adb
index 0f013bc..d70ee71 100644
--- a/src/editor_windows.adb
+++ b/src/editor_windows.adb
@@ -1,21 +1,43 @@
-with FLTK.Enums;
-use FLTK.Enums;
+with FLTK.Enums; use FLTK.Enums;
with FLTK.Widgets;
-use FLTK.Widgets;
with FLTK.Widgets.Groups;
-use FLTK.Widgets.Groups;
with FLTK.Widgets.Groups.Windows;
-use FLTK.Widgets.Groups.Windows;
+with FLTK.Widgets.Groups.Windows.Double;
+with FLTK.Widgets.Groups.Text_Displays.Text_Editors;
+with FLTK.Widgets.Menus;
+with FLTK.Widgets.Menus.Menu_Bars;
+with FLTK.Widgets.Boxes;
+with FLTK.Widgets.Inputs;
+with FLTK.Widgets.Buttons;
+with FLTK.Widgets.Buttons.Enter;
+with FLTK.Widgets.Buttons.Light.Check;
with FLTK.Images.RGB.PNG;
-use FLTK.Images.RGB.PNG;
+with FLTK.Text_Buffers;
+use type FLTK.Widgets.Buttons.State;
package body Editor_Windows is
- Logo : PNG_Image := Create ("logo.png");
+ package W renames FLTK.Widgets;
+ package G renames FLTK.Widgets.Groups;
+ package WN renames FLTK.Widgets.Groups.Windows;
+ package WD renames FLTK.Widgets.Groups.Windows.Double;
+ package TE renames FLTK.Widgets.Groups.Text_Displays.Text_Editors;
+ package MB renames FLTK.Widgets.Menus.Menu_Bars;
+ package BX renames FLTK.Widgets.Boxes;
+ package IP renames FLTK.Widgets.Inputs;
+ package BU renames FLTK.Widgets.Buttons;
+ package EN renames FLTK.Widgets.Buttons.Enter;
+ package LC renames FLTK.Widgets.Buttons.Light.Check;
+ package PN renames FLTK.Images.RGB.PNG;
+
+
+
+
+ Logo : PN.PNG_Image := PN.Create ("logo.png");
@@ -25,12 +47,11 @@ package body Editor_Windows is
function Create
(X, Y, W, H : in Integer;
Label_Text : in String)
- return Editor_Window is
-
+ return Editor_Window
+ is
Width : Integer := Min_Editor_Width;
Height : Integer := Min_Editor_Height;
Menu_Height : Integer := 22;
-
begin
if Width < W then
Width := W;
@@ -41,11 +62,11 @@ package body Editor_Windows is
end if;
return This : Editor_Window :=
- (Double_Window'(Create (X, Y, Width, Height, Label_Text)) with
+ (WD.Double_Window'(WD.Create (X, Y, Width, Height, Label_Text)) with
- Editor => Text_Editor'(Create
+ Editor => TE.Text_Editor'(TE.Create
(0, Menu_Height, Width, Height - Menu_Height, "")),
- Bar => Menu_Bar'(Create
+ Bar => MB.Menu_Bar'(MB.Create
(0, 0, Width, Menu_Height, ""))) do
This.Add (This.Editor);
@@ -73,7 +94,7 @@ package body Editor_Windows is
function Get_Buffer
(This : in Editor_Window)
- return Text_Buffer_Cursor is
+ return FLTK.Text_Buffers.Text_Buffer_Cursor is
begin
return This.Editor.Get_Buffer;
end Get_Buffer;
@@ -83,7 +104,7 @@ package body Editor_Windows is
procedure Set_Buffer
(This : in out Editor_Window;
- Buff : in out Text_Buffer) is
+ Buff : in out FLTK.Text_Buffers.Text_Buffer) is
begin
This.Editor.Set_Buffer (Buff);
end Set_Buffer;
@@ -93,9 +114,9 @@ package body Editor_Windows is
function Get_Menu
(This : in out Editor_Window)
- return Menu_Cursor is
+ return FLTK.Widgets.Menus.Menu_Cursor is
begin
- return Ref : Menu_Cursor (This.Bar'Access);
+ return Ref : FLTK.Widgets.Menus.Menu_Cursor (This.Bar'Access);
end Get_Menu;
@@ -182,23 +203,22 @@ package body Editor_Windows is
overriding procedure Call
(This : in Hide_Callback;
- Item : in out Widget'Class) is
-
- P : access Group'Class;
-
+ Item : in out W.Widget'Class)
+ is
+ P : access G.Group'Class;
begin
- if Item in Window'Class then
- Window (Item).Hide;
+ if Item in WN.Window'Class then
+ WN.Window (Item).Hide;
else
P := Item.Parent;
loop
if P = null then
return;
end if;
- exit when P.all in Window'Class;
+ exit when P.all in WN.Window'Class;
P := P.Parent;
end loop;
- Window (P.all).Hide;
+ WN.Window (P.all).Hide;
end if;
end Call;
@@ -207,7 +227,9 @@ package body Editor_Windows is
-- About_Window functions and procedures
- function Create return About_Window is
+ function Create
+ return About_Window
+ is
My_Width : Integer := 350;
My_Height : Integer := 250;
@@ -231,25 +253,25 @@ package body Editor_Windows is
Author_Text : String := "Programmed by Jed Barber";
begin
return This : About_Window :=
- (Double_Window'(Create (0, 0, My_Width, My_Height, "About Adapad")) with
+ (WD.Double_Window'(WD.Create (0, 0, My_Width, My_Height, "About Adapad")) with
- Picture => Box'(Create
+ Picture => BX.Box'(BX.Create
((My_Width - Logo_Width) / 2,
Logo_Line, Logo_Width, Logo_Height, "")),
- Heading => Box'(Create
+ Heading => BX.Box'(BX.Create
(0, Heading_Line, My_Width, Heading_Size, Heading_Text)),
- Blurb => Box'(Create
+ Blurb => BX.Box'(BX.Create
(0, Blurb_Line, My_Width, Text_Size, Blurb_Text)),
- Author => Box'(Create
+ Author => BX.Box'(BX.Create
(0, Author_Line, My_Width, Text_Size, Author_Text)),
- Dismiss => Enter_Button'(Create
+ Dismiss => EN.Enter_Button'(EN.Create
((My_Width - Button_Width) / 2,
Button_Line, Button_Width, Button_Height, "Close"))) do
This.Add (This.Picture);
This.Picture.Set_Image (Logo);
This.Add (This.Heading);
- This.Heading.Set_Label_Size (Font_Size (Heading_Size));
+ This.Heading.Set_Label_Size (W.Font_Size (Heading_Size));
This.Add (This.Blurb);
This.Add (This.Author);
This.Add (This.Dismiss);
@@ -291,23 +313,24 @@ package body Editor_Windows is
overriding procedure Call
(This : in Find_Marshaller;
- Item : in out Widget'Class) is
-
+ Item : in out W.Widget'Class)
+ is
type Find_Window_Access is access all Find_Window;
Dialog : access Find_Window := Find_Window_Access (Item.Parent);
-
begin
if Dialog.Callback /= null then
Dialog.Callback.Call
(Dialog.Find_What.Get_Value,
- Dialog.Match_Case.Get_State = On);
+ Dialog.Match_Case.Get_State = BU.On);
end if;
end Call;
- function Create return Find_Window is
+ function Create
+ return Find_Window
+ is
My_Width : Integer := 350;
My_Height : Integer := 130;
@@ -329,17 +352,17 @@ package body Editor_Windows is
Text_Size : Integer := 12;
begin
return This : Find_Window :=
- (Double_Window'(Create (0, 0, My_Width, My_Height, "Find")) with
+ (WD.Double_Window'(WD.Create (0, 0, My_Width, My_Height, "Find")) with
- Find_What => Input'(Create
+ Find_What => IP.Input'(IP.Create
(My_Width - Input_Width - Input_Margin_Right,
Input_Line, Input_Width, Input_Height, "Find what:")),
- Match_Case => Check_Button'(Create
+ Match_Case => LC.Check_Button'(LC.Create
(Case_Margin_Left, Case_Line, Check_Width, Check_Height, "Match case")),
- Cancel => Button'(Create
+ Cancel => BU.Button'(BU.Create
((My_Width - 2 * Button_Width) / 3,
Button_Line, Button_Width, Button_Height, "Cancel")),
- Start => Enter_Button'(Create
+ Start => EN.Enter_Button'(EN.Create
((My_Width - 2 * Button_Width) * 2 / 3 + Button_Width,
Button_Line, Button_Width, Button_Height, "Find")),
@@ -398,25 +421,26 @@ package body Editor_Windows is
overriding procedure Call
(This : in Replace_Marshaller;
- Item : in out Widget'Class) is
-
+ Item : in out W.Widget'Class)
+ is
type Replace_Window_Access is access all Replace_Window;
Dialog : access Replace_Window := Replace_Window_Access (Item.Parent);
-
begin
if Dialog.Callback /= null then
Dialog.Callback.Call
(Dialog.Find_What.Get_Value,
Dialog.Replace_With.Get_Value,
- Dialog.Match_Case.Get_State = On,
- Dialog.Replace_All.Get_State = On);
+ Dialog.Match_Case.Get_State = BU.On,
+ Dialog.Replace_All.Get_State = BU.On);
end if;
end Call;
- function Create return Replace_Window is
+ function Create
+ return Replace_Window
+ is
My_Width : Integer := 350;
My_Height : Integer := 180;
@@ -440,24 +464,24 @@ package body Editor_Windows is
Text_Size : Integer := 12;
begin
return This : Replace_Window :=
- (Double_Window'(Create (0, 0, My_Width, My_Height, "Replace")) with
+ (WD.Double_Window'(WD.Create (0, 0, My_Width, My_Height, "Replace")) with
- Find_What => Input'(Create
+ Find_What => IP.Input'(IP.Create
(My_Width - Input_Width - Input_Margin_Right,
Find_Line, Input_Width, Input_Height, "Find what:")),
- Replace_With => Input'(Create
+ Replace_With => IP.Input'(IP.Create
(My_Width - Input_Width - Input_Margin_Right,
Replace_Line, Input_Width, Input_Height, "Replace with:")),
- Match_Case => Check_Button'(Create
+ Match_Case => LC.Check_Button'(LC.Create
(Check_Margin_Left, Match_Line,
Check_Width, Check_Height, "Match case")),
- Replace_All => Check_Button'(Create
+ Replace_All => LC.Check_Button'(LC.Create
(Check_Margin_Left, Rep_All_Line,
Check_Width, Check_Height, "Replace all")),
- Cancel => Button'(Create
+ Cancel => BU.Button'(BU.Create
((My_Width - 2 * Button_Width) / 3,
Button_Line, Button_Width, Button_Height, "Cancel")),
- Start => Enter_Button'(Create
+ Start => EN.Enter_Button'(EN.Create
((My_Width - 2 * Button_Width) * 2 / 3 + Button_Width,
Button_Line, Button_Width, Button_Height, "Replace")),