From 7ec40156bf80af71ebf3f51129af42a01221f250 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 15 May 2018 16:38:23 +1000 Subject: Updated to bring into line with FLTK binding --- src/adapad.adb | 23 +++++++++++------------ src/windows-about.adb | 3 ++- src/windows-editor.adb | 10 +++++----- src/windows-editor.ads | 6 +++--- src/windows-find.adb | 3 ++- src/windows-jump.adb | 3 ++- src/windows-replace.adb | 3 ++- 7 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/adapad.adb b/src/adapad.adb index abb63cb..c24bb6e 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -80,8 +80,7 @@ package body Adapad is begin if not Safe_To_Discard then return; end if; Filename := To_Unbounded_String (0); - Buffer.Set_Selection (0, Buffer.Length); - Buffer.Remove_Selected_Text; + Buffer.Remove_Text (0, Buffer.Length); Changed := False; Buffer.Call_Modify_Callbacks; end New_CB; @@ -138,7 +137,7 @@ package body Adapad is (Item : in out FLTK.Widgets.Widget'Class) is use type FLTK.Text_Buffers.Modification; - Bar : FLTK.Widgets.Menus.Menu_Cursor := Editor.Get_Menu_Bar; + Bar : FLTK.Widgets.Menus.Menu_Reference := Editor.Get_Menu_Bar; Ch : Change_Vectors.Change; begin Buffer.Disable_Callbacks; @@ -171,7 +170,7 @@ package body Adapad is (Item : in out FLTK.Widgets.Widget'Class) is use type FLTK.Text_Buffers.Modification; - Bar : FLTK.Widgets.Menus.Menu_Cursor := Editor.Get_Menu_Bar; + Bar : FLTK.Widgets.Menus.Menu_Reference := Editor.Get_Menu_Bar; Ch : Change_Vectors.Change; begin Buffer.Disable_Callbacks; @@ -320,7 +319,7 @@ package body Adapad is procedure Wrap_CB (Item : in out FLTK.Widgets.Widget'Class) is begin - if FLTK.Widgets.Menus.Menu (Item).Chosen.Value then + if FLTK.Widgets.Menus.Menu (Item).Chosen.Get_State then Editor.Set_Wrap_Mode (Windows.Editor.Bounds); else Editor.Set_Wrap_Mode (Windows.Editor.None); @@ -333,7 +332,7 @@ package body Adapad is procedure Lines_CB (Item : in out FLTK.Widgets.Widget'Class) is begin - if FLTK.Widgets.Menus.Menu (Item).Chosen.Value then + if FLTK.Widgets.Menus.Menu (Item).Chosen.Get_State then -- 50 pixels should be enough for 5 digit line numbers. Editor.Set_Linenumber_Width (50); else @@ -363,8 +362,8 @@ package body Adapad is Deleted_Text : in String) is use type FLTK.Text_Buffers.Modification; - Bar : FLTK.Widgets.Menus.Menu_Cursor := Editor.Get_Menu_Bar; - Pop : FLTK.Widgets.Menus.Menu_Cursor := Editor.Get_Rightclick_Menu; + Bar : FLTK.Widgets.Menus.Menu_Reference := Editor.Get_Menu_Bar; + Pop : FLTK.Widgets.Menus.Menu_Reference := Editor.Get_Rightclick_Menu; begin if Action = FLTK.Text_Buffers.Insert or Action = FLTK.Text_Buffers.Delete then Changed := True; @@ -417,7 +416,7 @@ package body Adapad is Facing : in Windows.Find.Direction) is use type Windows.Find.Direction; - Bar : FLTK.Widgets.Menus.Menu_Cursor := Editor.Get_Menu_Bar; + Bar : FLTK.Widgets.Menus.Menu_Reference := Editor.Get_Menu_Bar; Current_Position, Select_Start, Select_End, Found_At : Natural; Was_Found : Boolean; begin @@ -485,7 +484,7 @@ package body Adapad is end if; exit when User_Response = FLTK.Dialogs.Third; if User_Response = FLTK.Dialogs.Second then - Buffer.Remove_Selected_Text; + Buffer.Remove_Selection; Buffer.Insert_Text (Found_At, Replace_With); Current_Position := Found_At + Replace_With'Length; Times_Replaced := Times_Replaced + 1; @@ -636,7 +635,7 @@ begin declare use FLTK; use FLTK.Widgets.Menus; - Bar : Menu_Cursor := Editor.Get_Menu_Bar; + Bar : Menu_Reference := Editor.Get_Menu_Bar; begin Bar.Add (Text => "&File", Flags => Flag_Submenu); Bar.Add ("File/&New", New_CB'Access, Mod_Ctrl + 'n'); @@ -674,7 +673,7 @@ begin declare use FLTK; use FLTK.Widgets.Menus; - Pop : Menu_Cursor := Editor.Get_Rightclick_Menu; + Pop : Menu_Reference := Editor.Get_Rightclick_Menu; begin Pop.Add ("Cu&t", Cut_CB'Access, No_Key, Flag_Inactive); Pop.Add ("&Copy", Copy_CB'Access, No_Key, Flag_Inactive); diff --git a/src/windows-about.adb b/src/windows-about.adb index 13b8337..8248065 100644 --- a/src/windows-about.adb +++ b/src/windows-about.adb @@ -3,6 +3,7 @@ package body Windows.About is + package W renames FLTK.Widgets.Groups.Windows; package WD renames FLTK.Widgets.Groups.Windows.Double; package BX renames FLTK.Widgets.Boxes; package EN renames FLTK.Widgets.Buttons.Enter; @@ -63,7 +64,7 @@ package body Windows.About is This.Picture.Set_Image (Logo); This.Set_Callback (Hide_CB'Access); - This.Set_Modal; + This.Set_Modal_State (W.Modal); end return; end Create; diff --git a/src/windows-editor.adb b/src/windows-editor.adb index 29b1c6e..b0c2d02 100644 --- a/src/windows-editor.adb +++ b/src/windows-editor.adb @@ -76,7 +76,7 @@ package body Windows.Editor is function Get_Buffer (This : in Editor_Window) - return FLTK.Text_Buffers.Text_Buffer_Cursor is + return FLTK.Text_Buffers.Text_Buffer_Reference is begin return This.Editor.Get_Buffer; end Get_Buffer; @@ -96,9 +96,9 @@ package body Windows.Editor is function Get_Menu_Bar (This : in out Editor_Window) - return FLTK.Widgets.Menus.Menu_Cursor is + return FLTK.Widgets.Menus.Menu_Reference is begin - return Ref : FLTK.Widgets.Menus.Menu_Cursor (This.Bar'Access); + return Ref : FLTK.Widgets.Menus.Menu_Reference (This.Bar'Access); end Get_Menu_Bar; @@ -106,9 +106,9 @@ package body Windows.Editor is function Get_Rightclick_Menu (This : in out Editor_Window) - return FLTK.Widgets.Menus.Menu_Cursor is + return FLTK.Widgets.Menus.Menu_Reference is begin - return Ref : FLTK.Widgets.Menus.Menu_Cursor (This.Popup'Access); + return Ref : FLTK.Widgets.Menus.Menu_Reference (This.Popup'Access); end Get_Rightclick_Menu; diff --git a/src/windows-editor.ads b/src/windows-editor.ads index 890242a..a9d0041 100644 --- a/src/windows-editor.ads +++ b/src/windows-editor.ads @@ -39,7 +39,7 @@ package Windows.Editor is function Get_Buffer (This : in Editor_Window) - return FLTK.Text_Buffers.Text_Buffer_Cursor; + return FLTK.Text_Buffers.Text_Buffer_Reference; procedure Set_Buffer @@ -49,12 +49,12 @@ package Windows.Editor is function Get_Menu_Bar (This : in out Editor_Window) - return FLTK.Widgets.Menus.Menu_Cursor; + return FLTK.Widgets.Menus.Menu_Reference; function Get_Rightclick_Menu (This : in out Editor_Window) - return FLTK.Widgets.Menus.Menu_Cursor; + return FLTK.Widgets.Menus.Menu_Reference; procedure Undo diff --git a/src/windows-find.adb b/src/windows-find.adb index 02698da..0336ce0 100644 --- a/src/windows-find.adb +++ b/src/windows-find.adb @@ -3,6 +3,7 @@ package body Windows.Find is + package W renames FLTK.Widgets.Groups.Windows; package WD renames FLTK.Widgets.Groups.Windows.Double; package IP renames FLTK.Widgets.Inputs; package BU renames FLTK.Widgets.Buttons; @@ -80,7 +81,7 @@ package body Windows.Find is This.Set_Icon (Logo); This.Set_Callback (Hide_CB'Access); - This.Set_Modal; + This.Set_Modal_State (W.Modal); end return; end Create; diff --git a/src/windows-jump.adb b/src/windows-jump.adb index 898ce04..f19315e 100644 --- a/src/windows-jump.adb +++ b/src/windows-jump.adb @@ -3,6 +3,7 @@ package body Windows.Jump is + package W renames FLTK.Widgets.Groups.Windows; package WD renames FLTK.Widgets.Groups.Windows.Double; package BU renames FLTK.Widgets.Buttons; package EN renames FLTK.Widgets.Buttons.Enter; @@ -67,7 +68,7 @@ package body Windows.Jump is This.Set_Icon (Logo); This.Set_Callback (Hide_CB'Access); - This.Set_Modal; + This.Set_Modal_State (W.Modal); end return; end Create; diff --git a/src/windows-replace.adb b/src/windows-replace.adb index 1393711..4b9345e 100644 --- a/src/windows-replace.adb +++ b/src/windows-replace.adb @@ -3,6 +3,7 @@ package body Windows.Replace is + package W renames FLTK.Widgets.Groups.Windows; package WD renames FLTK.Widgets.Groups.Windows.Double; package IP renames FLTK.Widgets.Inputs; package BU renames FLTK.Widgets.Buttons; @@ -92,7 +93,7 @@ package body Windows.Replace is This.Set_Icon (Logo); This.Set_Callback (Hide_CB'Access); - This.Set_Modal; + This.Set_Modal_State (W.Modal); end return; end Create; -- cgit