@@ -22,6 +22,7 @@ with Ada.Strings.Fixed;
2222
2323with Glib ; use Glib;
2424with Glib.Values ;
25+ with Gtk.Menu ;
2526with Pango.Layout ; use Pango.Layout;
2627
2728with Gtk.Cell_Renderer_Text ; use Gtk.Cell_Renderer_Text;
@@ -93,6 +94,10 @@ package body Log_File_Views is
9394 -- Map of preferences which control filtration
9495 end record ;
9596
97+ overriding procedure Create_Menu
98+ (View : not null access Log_View_Record;
99+ Menu : not null access Gtk.Menu.Gtk_Menu_Record'Class);
100+
96101 function Initialize (View : access Log_View_Record'Class) return Gtk_Widget;
97102 -- Create a new log view
98103
@@ -122,6 +127,7 @@ package body Log_File_Views is
122127 Formal_View_Record => Log_View_Record,
123128 Reuse_If_Exist => True,
124129 Local_Toolbar => True,
130+ Local_Config => True,
125131 Areas => Gtkada.MDI.Sides_Only,
126132 Group => Group_Consoles);
127133 subtype Log_View_Access is Log_Views.View_Access;
@@ -229,6 +235,8 @@ package body Log_File_Views is
229235
230236 Log_View_Preference : Log_View_Kind_Preferences.Preference;
231237
238+ Auto_Scroll_Preference : Boolean_Preference;
239+
232240 -- -----------------
233241 -- After_Message --
234242 -- -----------------
@@ -508,6 +516,17 @@ package body Log_File_Views is
508516 E.Filter.Refilter;
509517 end On_Filter_Changed ;
510518
519+ -- ---------------
520+ -- Create_Menu --
521+ -- ---------------
522+
523+ overriding procedure Create_Menu
524+ (View : not null access Log_View_Record;
525+ Menu : not null access Gtk.Menu.Gtk_Menu_Record'Class) is
526+ begin
527+ Append_Menu (Menu, View.Kernel, Auto_Scroll_Preference);
528+ end Create_Menu ;
529+
511530 -- --------------
512531 -- Initialize --
513532 -- --------------
@@ -546,6 +565,8 @@ package body Log_File_Views is
546565 Refresh (View);
547566 end if ;
548567
568+ View.Set_Automatic_Scroll (Auto_Scroll_Preference.Get_Pref);
569+
549570 return Gtk_Widget (View.Get_View);
550571 end Initialize ;
551572
@@ -881,6 +902,11 @@ package body Log_File_Views is
881902 (GPS.Kernel.Preferences.Comments_Style)
882903 then
883904 View.On_Preferences_Changed;
905+ return ;
906+ end if ;
907+
908+ if Pref = Default_Preferences.Preference (Auto_Scroll_Preference) then
909+ View.Set_Automatic_Scroll (Auto_Scroll_Preference.Get_Pref);
884910 end if ;
885911 end Execute ;
886912
@@ -962,6 +988,12 @@ package body Log_File_Views is
962988 Doc => " When the Log view collects messages" ,
963989 Default => Only_When_Opened);
964990
991+ Auto_Scroll_Preference := Get_Preferences (Kernel).Create_Invisible_Pref
992+ (Name => " Log-View-Auto-Scroll" ,
993+ Default => False,
994+ Label => " Log view auto-scrolling" ,
995+ Doc => " Automatically scroll to new logs." );
996+
965997 Register_Action
966998 (Kernel, " log save" ,
967999 new Save_Command,
0 commit comments