Hi Lazarus team,

Lazarus IDE is IMO so superior to Delphi's that any comparison would be unfair. However there's a Delphi IDE small feature which I miss when using Lazarus: a quick mouse access to the Jump Back/Jump Forward function, to navigate history. I find keyboard shortcuts (CTRL-H and Shift-CTRL-H) more cumbersome.

There's no easy way to add Icons to the NoteBook pages or tabs of the Source Editor window, so it came to my mind to add a source editor dedicated tool bar, to host those functions. It steals just 18 pixels in height, and one could take advantage of it to insert more editor related commands, which are now available in drop down menu's.

I attach a small patch to SourceEditor, just to show the idea. If accepted, it can be fully implemented, making it perhaps the umptieth option to the user configuration, extended, made fully configurable, etc.

If not, I'll just keep it for my personalized IDE.

(Double clicking on the added tool bar, it can be moved from top to right or to bottom. Quick and dirty just for testing the best position.)

Best,

Giuliano



Index: sourceeditor.pp
===================================================================
--- sourceeditor.pp	(revision 45619)
+++ sourceeditor.pp	(working copy)
@@ -45,8 +45,8 @@
   SynEditMouseCmds, Classes, SysUtils, Math, Controls, ExtendedNotebook,
   LCLProc, LCLType, LResources, LCLIntf, FileUtil, Forms, ComCtrls, Dialogs,
   StdCtrls, Graphics, Translations, ClipBrd, types, Extctrls, Menus, HelpIntfs,
-  LConvEncoding, Messages, LazLoggerBase, lazutf8classes, LazLogger, AvgLvlTree,
-  LazFileCache,
+  Buttons, LConvEncoding, Messages, LazLoggerBase, lazutf8classes, LazLogger,
+  AvgLvlTree, LazFileCache,
   // codetools
   BasicCodeTools, CodeBeautifier, CodeToolManager, CodeCache, SourceLog,
   LinkScanner,
@@ -609,6 +609,9 @@
   { TSourceNotebook }
 
   TSourceNotebook = class(TSourceEditorWindowInterface)
+    pTools: TPanel;
+    sbJback: TSpeedButton;
+    sbJforward: TSpeedButton;
     StatusBar: TStatusBar;
     procedure CompleteCodeMenuItemClick(Sender: TObject);
     procedure DbgPopUpMenuPopup(Sender: TObject);
@@ -629,12 +632,15 @@
     procedure OnPopupOpenPackageFile(Sender: TObject);
     procedure OnPopupOpenProjectInsp(Sender: TObject);
     procedure OpenAtCursorClicked(Sender: TObject);
+    procedure pToolsMove(Sender: TObject);
     procedure RenameIdentifierMenuItemClick(Sender: TObject);
     procedure ShowAbstractMethodsMenuItemClick(Sender: TObject);
     procedure ShowEmptyMethodsMenuItemClick(Sender: TObject);
     procedure ShowUnusedUnitsMenuItemClick(Sender: TObject);
     procedure SourceNotebookDropFiles(Sender: TObject;
       const FileNames: array of String);
+    procedure sbJbackClick(Sender: TObject);
+    procedure sbJforwardClick(Sender: TObject);
     procedure SrcEditMenuCopyToExistingWindowClicked(Sender: TObject);
     procedure SrcEditMenuFindInWindowClicked(Sender: TObject);
     procedure SrcEditMenuMoveToExistingWindowClicked(Sender: TObject);
@@ -676,6 +682,8 @@
     FWindowID: Integer;
     // PopupMenu
     procedure BuildPopupMenu;
+    // Toolbar
+    procedure BuildToolBar;
     //forwarders to FNoteBook
     function GetNoteBookPage(Index: Integer): TTabSheet;
     function GetNotebookPages: TStrings;
@@ -5819,7 +5827,8 @@
 
   // popup menu
   BuildPopupMenu;
-
+  // Toolbar
+  BuildToolBar;
   // HintTimer
   FMouseHintTimer := TIdleTimer.Create(Self);
   with FMouseHintTimer do begin
@@ -6503,6 +6512,23 @@
   {$ENDIF}
 end;
 
+procedure TSourceNotebook.BuildToolBar;
+var
+  jbackIdx: Integer;
+  jforwIdx: Integer;
+begin
+
+  jbackIdx:= IDEImages.GetImageIndex(16,'menu_search_jumpback');
+  if jbackIdx >=0 then
+    IDEImages.Images_16.GetBitmap(jbackIdx,sbJback.Glyph);
+  sbJback.Hint:= lisMenuJumpBack;
+
+  jforwIdx:= IDEImages.GetImageIndex(16,'menu_search_jumpforward');
+  if jforwIdx >=0 then
+    IDEImages.Images_16.GetBitmap(jforwIdx,sbJforward.Glyph);
+  sbJforward.Hint:= lisMenuJumpForward;
+end;
+
 function TSourceNotebook.GetNoteBookPage(Index: Integer): TTabSheet;
 begin
   if FNotebook.Visible then
@@ -7548,6 +7574,19 @@
     Manager.OnOpenFileAtCursorClicked(Sender);
 end;
 
+procedure TSourceNotebook.pToolsMove(Sender: TObject);
+begin
+  if pTools.Align = alTop then begin
+    pTools.Width:= 50;
+    pTools.Align:= alRight;
+  end
+  else if pTools.Align = alRight then begin
+    pTools.Height:= 18;
+    pTools.Align:= alBottom;
+  end
+  else pTools.Align:= alTop;
+end;
+
 procedure TSourceNotebook.CutClicked(Sender: TObject);
 var ActSE: TSourceEditor;
 begin
@@ -7669,6 +7708,16 @@
   LazarusIDE.DoDropFiles(Sender,Filenames,WindowID);
 end;
 
+procedure TSourceNotebook.sbJbackClick(Sender: TObject);
+begin
+  if FManager.ActiveSourceWindow <> nil then FManager.HistoryJump(Sender,jhaBack);
+end;
+
+procedure TSourceNotebook.sbJforwardClick(Sender: TObject);
+begin
+  if FManager.ActiveSourceWindow <> nil then FManager.HistoryJump(Sender,jhaForward);
+end;
+
 procedure TSourceNotebook.FindOverloadsMenuItemClick(Sender: TObject);
 begin
   MainIDEInterface.DoCommand(ecFindOverloads);
Index: sourceeditor.lfm
===================================================================
--- sourceeditor.lfm	(revision 45619)
+++ sourceeditor.lfm	(working copy)
@@ -8,7 +8,7 @@
   ClientHeight = 300
   ClientWidth = 400
   OnMouseUp = FormMouseUp
-  LCLVersion = '1.1'
+  LCLVersion = '1.3'
   object StatusBar: TStatusBar
     Left = 0
     Height = 21
@@ -38,4 +38,42 @@
     OnDblClick = StatusBarDblClick
     OnDrawPanel = StatusBarDrawPanel
   end
+  object pTools: TPanel
+    Left = 0
+    Height = 18
+    Hint = 'Double click to move'
+    Top = 0
+    Width = 400
+    Align = alTop
+    ClientHeight = 18
+    ClientWidth = 400
+    ParentShowHint = False
+    ShowHint = True
+    TabOrder = 1
+    OnDblClick = pToolsMove
+    object sbJback: TSpeedButton
+      Left = 352
+      Height = 18
+      Hint = 'Jump back'
+      Top = 0
+      Width = 18
+      Anchors = [akTop, akRight]
+      Flat = True
+      OnClick = sbJbackClick
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object sbJforward: TSpeedButton
+      Left = 376
+      Height = 18
+      Hint = 'Jump forward'
+      Top = 0
+      Width = 18
+      Anchors = [akTop, akRight]
+      Flat = True
+      OnClick = sbJforwardClick
+      ShowHint = True
+      ParentShowHint = False
+    end
+  end
 end
Index: lazarus.lpi
===================================================================
--- lazarus.lpi	(revision 45619)
+++ lazarus.lpi	(working copy)
@@ -264,6 +264,7 @@
         <ComponentName Value="SourceNotebook"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
+        <UnitName Value="SourceEditor"/>
       </Unit32>
       <Unit33>
         <Filename Value="componentlist.pas"/>
@@ -313,7 +314,6 @@
       <Unit40>
         <Filename Value="main.pp"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="Main"/>
       </Unit40>
       <Unit41>
         <Filename Value="../designer/designer.pp"/>
@@ -340,7 +340,6 @@
       <Unit45>
         <Filename Value="project.pp"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="Project"/>
       </Unit45>
       <Unit46>
         <Filename Value="customformeditor.pp"/>
@@ -423,7 +422,6 @@
         <ComponentName Value="CompilerPathOptionsFrame"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Frame"/>
-        <UnitName Value="compiler_path_options"/>
       </Unit58>
       <Unit59>
         <Filename Value="frames/compiler_parsing_options.pas"/>
@@ -613,7 +611,6 @@
       <Unit90>
         <Filename Value="sourcefilemanager.pas"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="SourceFileManager"/>
       </Unit90>
       <Unit91>
         <Filename Value="../packager/lpkcache.pas"/>
@@ -827,7 +824,6 @@
       <Unit132>
         <Filename Value="lazarusidestrconsts.pas"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="LazarusIDEStrConsts"/>
       </Unit132>
       <Unit133>
         <Filename Value="codetemplatesdlg.pas"/>
@@ -837,11 +833,11 @@
       <Unit134>
         <Filename Value="mainintf.pas"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="MainIntf"/>
       </Unit134>
       <Unit135>
         <Filename Value="mainbase.pas"/>
         <IsPartOfProject Value="True"/>
+        <UnitName Value="MainBase"/>
       </Unit135>
       <Unit136>
         <Filename Value="buildmanager.pas"/>
@@ -867,6 +863,7 @@
       <Unit141>
         <Filename Value="mainbar.pas"/>
         <IsPartOfProject Value="True"/>
+        <UnitName Value="MainBar"/>
       </Unit141>
       <Unit142>
         <Filename Value="procedurelist.pas"/>
@@ -1239,10 +1236,7 @@
       <Unit221>
         <Filename Value="ideoptionsdlg.pas"/>
         <IsPartOfProject Value="True"/>
-        <ComponentName Value="IDEOptionsDialog"/>
         <HasResources Value="True"/>
-        <ResourceBaseClass Value="Form"/>
-        <UnitName Value="IDEOptionsDlg"/>
       </Unit221>
       <Unit222>
         <Filename Value="findunitdlg.pas"/>
@@ -1373,10 +1367,7 @@
       <Unit250>
         <Filename Value="imexportcompileropts.pas"/>
         <IsPartOfProject Value="True"/>
-        <ComponentName Value="ImExportCompOptsDlg"/>
         <HasResources Value="True"/>
-        <ResourceBaseClass Value="Form"/>
-        <UnitName Value="ImExportCompilerOpts"/>
       </Unit250>
       <Unit251>
         <Filename Value="initialsetupproc.pas"/>
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to