View Issue Details

IDProjectCategoryView StatusLast Update
0014963PatchesIDEpublic2009-11-05 05:40
ReporterAlexander S. Klenin Assigned ToPaul Ishenin  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version0.9.29 (SVN) 
Target Version0.9.30Fixed in Version0.9.29 (SVN) 
Summary0014963: Source editor: Allow moving tabs with the mouse
DescriptionThis is a simple Delphi feature I always missed in Lazarus.
Tested under Win32, but should work on other widgetsets too.
The interface is a but rough compared to Delphi,
there is definitely still room for improvement :-)
Additional InformationChanges to status bar height were generated by simply opening the form in IDE --
I could do nothing to prevent them.
TagsNo tags attached.
Fixed in Revision22383
LazTarget0.9.30
Widgetset
Attached Files

Relationships

duplicate of 0009562 closedMartin Friebe Lazarus Suggedtion: allow oneto drag/drop the Source Editor tabs 
related to 0014975 closedAlexander S. Klenin Lazarus Selection of source editor tabs shows wrong mouse cursor (drag) / dragging not always possible 

Activities

2009-11-01 11:29

 

sourceeditor_tabs_dragdrop.patch (4,580 bytes)   
Index: sourceeditor.lfm
===================================================================
--- sourceeditor.lfm	(revision 22348)
+++ sourceeditor.lfm	(working copy)
@@ -7,10 +7,11 @@
   Caption = 'SourceNotebook'
   ClientHeight = 300
   ClientWidth = 400
+  OnMouseUp = FormMouseUp
   object StatusBar: TStatusBar[0]
     Left = 0
-    Height = 23
-    Top = 277
+    Height = 20
+    Top = 280
     Width = 400
     Panels = <    
       item
Index: sourceeditor.lrs
===================================================================
--- sourceeditor.lrs	(revision 22348)
+++ sourceeditor.lrs	(working copy)
@@ -3,9 +3,10 @@
 LazarusResources.Add('TSourceNotebook','FORMDATA',[
   'TPF0'#241#15'TSourceNotebook'#14'SourceNotebook'#4'Left'#3#21#2#6'Height'#3
   +','#1#3'Top'#3'v'#1#5'Width'#3#144#1#14'AllowDropFiles'#9#7'Caption'#6#14'So'
-  +'urceNotebook'#12'ClientHeight'#3','#1#11'ClientWidth'#3#144#1#0#242#2#0#10
-  +'TStatusBar'#9'StatusBar'#4'Left'#2#0#6'Height'#2#23#3'Top'#3#21#1#5'Width'#3
-  +#144#1#6'Panels'#14#1#5'Width'#2'd'#0#1#5'Width'#3#150#0#0#1#5'Width'#2'2'#0
-  +#1#4'Text'#6#3'INS'#5'Width'#2'2'#0#0#10'SimpleText'#6#14'This is a test'#11
-  +'SimplePanel'#8#10'OnDblClick'#7#17'StatusBarDblClick'#0#0#0
+  +'urceNotebook'#12'ClientHeight'#3','#1#11'ClientWidth'#3#144#1#9'OnMouseUp'#7
+  +#11'FormMouseUp'#0#242#2#0#10'TStatusBar'#9'StatusBar'#4'Left'#2#0#6'Height'
+  +#2#20#3'Top'#3#24#1#5'Width'#3#144#1#6'Panels'#14#1#5'Width'#2'd'#0#1#5'Widt'
+  +'h'#3#150#0#0#1#5'Width'#2'2'#0#1#4'Text'#6#3'INS'#5'Width'#2'2'#0#0#10'Simp'
+  +'leText'#6#14'This is a test'#11'SimplePanel'#8#10'OnDblClick'#7#17'StatusBa'
+  +'rDblClick'#0#0#0
 ]);
Index: sourceeditor.pp
===================================================================
--- sourceeditor.pp	(revision 22348)
+++ sourceeditor.pp	(working copy)
@@ -439,6 +439,8 @@
     SrcPopUpMenu: TPopupMenu;
     StatusBar: TStatusBar;
     procedure AddBreakpointClicked(Sender: TObject);
+    procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
+      Shift: TShiftState; X, Y: Integer);
     procedure StatusBarDblClick(Sender: TObject);
     procedure ToggleBreakpointClicked(Sender: TObject);
     procedure CompleteCodeMenuItemClick(Sender: TObject);
@@ -532,6 +534,7 @@
     FProcessingCommand: boolean;
     FSourceEditorList: TList; // list of TSourceEditor
     FOnPopupMenu: TSrcEditPopupMenuEvent;
+    FMouseDownTabIndex: Integer;
   private
     // colors for the completion form (popup form, e.g. word completion)
     FActiveEditDefaultFGColor: TColor;
@@ -621,6 +624,8 @@
 
     procedure NotebookMouseDown(Sender: TObject; Button: TMouseButton;
           Shift: TShiftState; X,Y: Integer);
+    procedure NotebookMouseUp(Sender: TObject; Button: TMouseButton;
+          Shift: TShiftState; X,Y: Integer);
 
     // hintwindow stuff
     procedure HintTimer(Sender: TObject);
@@ -4231,6 +4236,7 @@
           OnPageChanged := @NotebookPageChanged;
           OnCloseTabClicked:=@CloseTabClicked;
           OnMouseDown:=@NotebookMouseDown;
+          OnMouseUp:=@NotebookMouseUp;
           ShowHint:=true;
           OnShowHint:=@NotebookShowTabHint;
           {$IFDEF IDE_DEBUG}
@@ -6216,6 +6222,12 @@
   SrcEdit.FocusEditor;
 end;
 
+procedure TSourceNotebook.FormMouseUp(Sender: TObject; Button: TMouseButton;
+  Shift: TShiftState; X, Y: Integer);
+begin
+  Cursor:=crDefault;
+end;
+
 Function TSourceNotebook.ActiveFileName: AnsiString;
 Begin
   Result := GetActiveSE.FileName;
@@ -6442,13 +6454,35 @@
 var
   TabIndex: Integer;
 begin
-  if Button=mbMiddle then begin
-    TabIndex := Notebook.TabIndexAtClientPos(point(X,Y));
-    if TabIndex>=0 then
-      CloseClicked(Notebook.Page[TabIndex]);
+  TabIndex:=Notebook.TabIndexAtClientPos(Point(X,Y));
+  FMouseDownTabIndex:=-1;
+  case Button of
+    mbLeft: begin
+      FMouseDownTabIndex:=TabIndex;
+      Cursor:=crDrag;
+    end;
+    mbMiddle: begin
+      if TabIndex>=0 then
+        CloseClicked(Notebook.Page[TabIndex])
+    end;
   end;
 end;
 
+procedure TSourceNotebook.NotebookMouseUp(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+var
+  TabIndex,i: Integer;
+begin
+  TabIndex:=Notebook.TabIndexAtClientPos(Point(X,Y));
+  if
+    (Button=mbLeft) and (FMouseDownTabIndex>=0) and (TabIndex>=0) and
+    (TabIndex<>FMouseDownTabIndex)
+  then
+    MoveEditor(FMouseDownTabIndex,TabIndex);
+  FMouseDownTabIndex:=-1;
+  Cursor:=crDefault;
+end;
+
 Procedure TSourceNotebook.NotebookPageChanged(Sender: TObject);
 var TempEditor:TSourceEditor;
 Begin

Paul Ishenin

2009-11-02 13:41

manager   ~0031851

Thanks, applied. Finally this long awaited feature is implemented :)

Issue History

Date Modified Username Field Change
2009-11-01 11:29 Alexander S. Klenin New Issue
2009-11-01 11:29 Alexander S. Klenin File Added: sourceeditor_tabs_dragdrop.patch
2009-11-01 11:29 Alexander S. Klenin LazTarget => -
2009-11-02 13:41 Paul Ishenin Fixed in Revision => 22383
2009-11-02 13:41 Paul Ishenin LazTarget - => 0.9.30
2009-11-02 13:41 Paul Ishenin Status new => resolved
2009-11-02 13:41 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2009-11-02 13:41 Paul Ishenin Resolution open => fixed
2009-11-02 13:41 Paul Ishenin Assigned To => Paul Ishenin
2009-11-02 13:41 Paul Ishenin Note Added: 0031851
2009-11-02 13:41 Paul Ishenin Target Version => 0.9.30
2009-11-02 15:16 Martin Friebe Relationship added related to 0014975
2009-11-02 15:18 Martin Friebe Relationship added duplicate of 0009562
2009-11-05 05:40 Alexander S. Klenin Status resolved => closed