summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2016-11-13 20:06:05 +1100
committerJed Barber <jjbarber@y7mail.com>2016-11-13 20:06:05 +1100
commit42904bb6f3b48b27961bbec807cb514661ebb675 (patch)
treec286b74246da46768ad1fff665c1c39712a8c628 /src
parent4aea3718c6de90471d0f63d930a874c87edb3fcd (diff)
Added optional line numbers
Diffstat (limited to 'src')
-rw-r--r--src/adapad.adb17
-rw-r--r--src/fltk_binding/c_fl_text_display.cpp5
-rw-r--r--src/fltk_binding/c_fl_text_display.h1
-rw-r--r--src/fltk_binding/fltk-widgets-groups-text_displays.adb17
-rw-r--r--src/fltk_binding/fltk-widgets-groups-text_displays.ads5
-rw-r--r--src/windows-editor.adb10
-rw-r--r--src/windows-editor.ads5
7 files changed, 59 insertions, 1 deletions
diff --git a/src/adapad.adb b/src/adapad.adb
index a045cfe..e72d4d6 100644
--- a/src/adapad.adb
+++ b/src/adapad.adb
@@ -252,6 +252,20 @@ 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
+ -- 50 pixels should be enough for 5 digit line numbers
+ Editor.Set_Linenumber_Width (50);
+ else
+ Editor.Set_Linenumber_Width (0);
+ end if;
+ end Lines_CB;
+
+
+
+
procedure About_CB
(Item : in out FLTK.Widgets.Widget'Class) is
begin
@@ -479,7 +493,8 @@ begin
Bar.Add ("Search/Word Count", Count_CB'Access);
Bar.Add (Text => "&Options", Flags => Flag_Submenu);
- Bar.Add ("Options/&Word Wrap", Wrap_CB'Access, No_Key, Flag_Toggle);
+ Bar.Add ("Options/&Word Wrap", Wrap_CB'Access, No_Key, Flag_Toggle);
+ Bar.Add ("Options/&Line Numbers", Lines_CB'Access, No_Key, Flag_Toggle);
Bar.Add (Text => "&Help", Flags => Flag_Submenu);
Bar.Add ("Help/&About", About_CB'Access);
diff --git a/src/fltk_binding/c_fl_text_display.cpp b/src/fltk_binding/c_fl_text_display.cpp
index 85ad733..b9e59c6 100644
--- a/src/fltk_binding/c_fl_text_display.cpp
+++ b/src/fltk_binding/c_fl_text_display.cpp
@@ -98,3 +98,8 @@ int fl_text_display_rewind_lines(TEXTDISPLAY td, int s, int l) {
return reinterpret_cast<Fl_Text_Display*>(td)->rewind_lines(s, l);
}
+
+void fl_text_display_linenumber_width(TEXTDISPLAY td, int w) {
+ reinterpret_cast<Fl_Text_Display*>(td)->linenumber_width(w);
+}
+
diff --git a/src/fltk_binding/c_fl_text_display.h b/src/fltk_binding/c_fl_text_display.h
index 3202397..dbd683f 100644
--- a/src/fltk_binding/c_fl_text_display.h
+++ b/src/fltk_binding/c_fl_text_display.h
@@ -28,6 +28,7 @@ extern "C" void fl_text_display_previous_word(TEXTDISPLAY td);
extern "C" void fl_text_display_wrap_mode(TEXTDISPLAY td, int w, int m);
extern "C" int fl_text_display_skip_lines(TEXTDISPLAY td, int s, int l, int p);
extern "C" int fl_text_display_rewind_lines(TEXTDISPLAY td, int s, int l);
+extern "C" void fl_text_display_linenumber_width(TEXTDISPLAY td, int w);
#endif
diff --git a/src/fltk_binding/fltk-widgets-groups-text_displays.adb b/src/fltk_binding/fltk-widgets-groups-text_displays.adb
index c6a1589..1aa5962 100644
--- a/src/fltk_binding/fltk-widgets-groups-text_displays.adb
+++ b/src/fltk_binding/fltk-widgets-groups-text_displays.adb
@@ -97,6 +97,11 @@ package body FLTK.Widgets.Groups.Text_Displays is
return Interfaces.C.int;
pragma Import (C, fl_text_display_rewind_lines, "fl_text_display_rewind_lines");
+ procedure fl_text_display_linenumber_width
+ (TD : in System.Address;
+ W : in Interfaces.C.int);
+ pragma Import (C, fl_text_display_linenumber_width, "fl_text_display_linenumber_width");
+
@@ -306,5 +311,17 @@ package body FLTK.Widgets.Groups.Text_Displays is
end Rewind_Lines;
+
+
+ procedure Set_Linenumber_Width
+ (This : in out Text_Display;
+ Width : in Natural) is
+ begin
+ fl_text_display_linenumber_width
+ (This.Void_Ptr,
+ Interfaces.C.int (Width));
+ end Set_Linenumber_Width;
+
+
end FLTK.Widgets.Groups.Text_Displays;
diff --git a/src/fltk_binding/fltk-widgets-groups-text_displays.ads b/src/fltk_binding/fltk-widgets-groups-text_displays.ads
index 6362160..0e136ff 100644
--- a/src/fltk_binding/fltk-widgets-groups-text_displays.ads
+++ b/src/fltk_binding/fltk-widgets-groups-text_displays.ads
@@ -102,6 +102,11 @@ package FLTK.Widgets.Groups.Text_Displays is
return Natural;
+ procedure Set_Linenumber_Width
+ (This : in out Text_Display;
+ Width : in Natural);
+
+
private
diff --git a/src/windows-editor.adb b/src/windows-editor.adb
index e9195dd..d995f7a 100644
--- a/src/windows-editor.adb
+++ b/src/windows-editor.adb
@@ -197,5 +197,15 @@ package body Windows.Editor is
end Set_Wrap_Mode;
+
+
+ procedure Set_Linenumber_Width
+ (This : in out Editor_Window;
+ Width : in Natural) is
+ begin
+ This.Editor.Set_Linenumber_Width (Width);
+ end Set_Linenumber_Width;
+
+
end Windows.Editor;
diff --git a/src/windows-editor.ads b/src/windows-editor.ads
index d2874ed..8012e09 100644
--- a/src/windows-editor.ads
+++ b/src/windows-editor.ads
@@ -95,6 +95,11 @@ package Windows.Editor is
Margin : in Natural := 0);
+ procedure Set_Linenumber_Width
+ (This : in out Editor_Window;
+ Width : in Natural);
+
+
private