summaryrefslogtreecommitdiff
path: root/UMain.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2025-11-27 19:28:03 +0100
committerTomas Bzatek <tbzatek@redhat.com>2025-11-27 21:43:01 +0100
commit36a656e6188f227956dbdf12bf5fda8be1ea7985 (patch)
treee32bf7d43d4ea7d6466db72ba1d6f0d29f75f059 /UMain.pas
parent90db8b6652f73ddc335922d3a7c593878d83c45e (diff)
downloadtuxcmd-36a656e6188f227956dbdf12bf5fda8be1ea7985.tar.xz
Fix panel separator resizing
Diffstat (limited to 'UMain.pas')
-rw-r--r--UMain.pas90
1 files changed, 35 insertions, 55 deletions
diff --git a/UMain.pas b/UMain.pas
index 87df6c0..3714c63 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -91,10 +91,9 @@ type
miDiff, miSynchronizeDirs: TGTKMenuItem;
procedure FormCreate(Sender: TObject); override;
procedure FormDestroy(Sender: TObject);
- procedure FormResize(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure PanelSeparatorResize(Sender: TObject);
- procedure PanelSeparatorMouseUp(Sender: TObject; Button: TGDKMouseButton; Shift: TShiftState; X, Y: Integer; var Accept: boolean);
+ procedure PanelSeparatorPositionChanged(Sender: TObject);
+ procedure PanelSeparatorRealize(Sender: TObject);
procedure miExitClick(Sender: TObject);
procedure miAboutClick(Sender: TObject);
procedure miRefreshClick(Sender: TObject);
@@ -182,7 +181,7 @@ type
procedure miSynchronizeDirsClick(Sender: TObject);
private
LeftLastFocused, Editing, QuickFind, RedrawLeftInactive, RedrawRightInactive, StartUp, LeftTabPopup: boolean;
- LastWidth, RunningEscSensitive: integer;
+ RunningEscSensitive: integer;
InplaceEditTimer, RebuildListViewsTimer, RightMouseSelectPopupTimer: TGTKTimer;
InplaceEditItem: TGTKListItem;
SavedCmdLine: string;
@@ -300,7 +299,7 @@ begin
MainVBox := TGTKVBox.Create(Self);
AddControl(MainVBox);
MainMenu := TGTKMenuBar.Create(Self);
- MainVBox.AddControlEx(MainMenu, False, True, 0);
+ MainVBox.AddControlEx(MainMenu, False, False, 0);
ConstructMenu;
InplaceEditTimer := TGTKTimer.Create(Self);
InplaceEditTimer.Enabled := False;
@@ -312,14 +311,12 @@ begin
RightMouseSelectPopupTimer.Enabled := False;
RightMouseSelectPopupTimer.OnTimer := @RightMouseSelectPopupTimerTimer;
MounterBarBox := TGTKHBox.Create(Self);
- MainVBox.AddControlEx(MounterBarBox, False, True, 0);
+ MainVBox.AddControlEx(MounterBarBox, False, False, 0);
LeftPanelBox := TGTKVBox.Create(Self);
RightPanelBox := TGTKVBox.Create(Self);
PanelSeparator := TGTKHPaned.Create(Self);
- MainVBox.AddControlEx(PanelSeparator, True, True, 0);
- PanelSeparator.Child1 := LeftPanelBox;
- PanelSeparator.Child2 := RightPanelBox;
ConstructPanels;
+ MainVBox.AddControlEx(PanelSeparator, True, True, 0);
CommandLineHBox := TGTKHBox.Create(Self);
CommandLineHBox.Homogeneous := False;
CommandLineCombo := TGTKComboBoxEntry.Create(Self);
@@ -396,15 +393,15 @@ begin
F6Button.CanFocus := False;
F7Button.CanFocus := False;
F8Button.CanFocus := False;
- PanelSeparator.OnMouseUp := @PanelSeparatorMouseUp;
// Events
- OnResize := @FormResize;
OnDestroy := @FormDestroy;
OnKeyDown := @FormKeyDown;
OnClose := @FormClose;
g_signal_connect_data(PGObject(FWidget), 'event-after', TGCallback(@form_event_handler), nil, nil, [G_CONNECT_AFTER]);
- PanelSeparator.OnResize := @PanelSeparatorResize;
+ PanelSeparator.OnPositionChanged := @PanelSeparatorPositionChanged;
+ PanelSeparator.OnRealize := @PanelSeparatorRealize;
+ PanelSeparator.HandlePopupMenu := SplitterPopupMenu;
LeftListView.OnKeyDown := @ListViewKeyDown;
RightListView.OnKeyDown := @ListViewKeyDown;
LeftListView.OnEnter := @ListViewEnter;
@@ -431,8 +428,8 @@ begin
RightListView.OnMouseDown := @ListViewMouseDown;
LeftListView.OnMouseUp := @ListViewMouseUp;
RightListView.OnMouseUp := @ListViewMouseUp;
-{ LeftListView.OnDblClick := @ListViewDblClick;
- RightListView.OnDblClick := @ListViewDblClick;}
+ LeftListView.OnDblClick := @ListViewDblClick;
+ RightListView.OnDblClick := @ListViewDblClick;
LeftListView.OnSelectionChanged := @ListViewSelectionChanged;
RightListView.OnSelectionChanged := @ListViewSelectionChanged;
LeftListView.OnMouseMove := @ListViewMouseMove;
@@ -449,9 +446,9 @@ end;
procedure TFMain.ConstructPanels;
begin
LeftMounterBarBox := TGTKHBox.Create(Self);
- LeftMounterBarBox.SetSizeRequest(10, -1);
+// LeftMounterBarBox.SetSizeRequest(10, -1);
RightMounterBarBox := TGTKHBox.Create(Self);
- RightMounterBarBox.SetSizeRequest(10, -1);
+// RightMounterBarBox.SetSizeRequest(10, -1);
LeftMounterBarBox.BorderWidth := 2;
RightMounterBarBox.BorderWidth := 2;
LeftPanelBox.AddControlEx(LeftMounterBarBox, False, False, 0);
@@ -462,8 +459,8 @@ begin
RightStatusBox.Homogeneous := False;
LeftPathLabel := TGTKLabel.Create(Self);
RightPathLabel := TGTKLabel.Create(Self);
- LeftPathLabel.SetSizeRequest(10, -1);
- RightPathLabel.SetSizeRequest(10, -1);
+// LeftPathLabel.SetSizeRequest(10, -1);
+// RightPathLabel.SetSizeRequest(10, -1);
LeftPathLabelEventBox := TGTKEventBox.Create(Self);
RightPathLabelEventBox := TGTKEventBox.Create(Self);
LeftPathLabelHBox := TGTKHBox.Create(Self);
@@ -560,7 +557,7 @@ begin
RightPathLabelEventBox.AddControl(RightPathLabel);
LeftPanelNotebook := TEphyNotebook.Create(Self);
LeftPanelNotebook.Visible := False;
- LeftPanelNotebook.SetSizeRequest(10, -1);
+// LeftPanelNotebook.SetSizeRequest(10, -1);
LeftPanelNotebook.Scrollable := True;
LeftPanelNotebook.ShowBorder := False;
LeftPanelNotebook.CanFocus := False; // Notebook should be focusable to allow scrolling when many tabs -- temporarily disabled
@@ -575,7 +572,7 @@ begin
LeftPanelNotebook.OnTabFocusOnlyEvent := @NotebookTabFocusOnlyEvent;
RightPanelNotebook := TEphyNotebook.Create(Self);
RightPanelNotebook.Visible := False;
- RightPanelNotebook.SetSizeRequest(10, -1);
+// RightPanelNotebook.SetSizeRequest(10, -1);
RightPanelNotebook.Scrollable := True;
RightPanelNotebook.ShowBorder := False;
RightPanelNotebook.CanFocus := False;
@@ -677,13 +674,16 @@ begin
RightStatusLine.MarginEnd := 5;
RightStatusLine.YAlign := 0.5;
{ LeftStatusBox.SetSizeRequest(1, 18);
- RightStatusBox.SetSizeRequest(1, 18); }
+ RightStatusBox.SetSizeRequest(1, 18);
LeftStatusLine.SetSizeRequest(1, 18);
RightStatusLine.SetSizeRequest(1, 18);
LeftDiskInfoLabel.SetSizeRequest(1, -1);
RightDiskInfoLabel.SetSizeRequest(1, -1);
LeftQuickFindVBox.SetSizeRequest(1, -1);
- RightQuickFindVBox.SetSizeRequest(1, -1);
+ RightQuickFindVBox.SetSizeRequest(1, -1); }
+
+ PanelSeparator.Child1 := LeftPanelBox;
+ PanelSeparator.Child2 := RightPanelBox;
end;
procedure TFMain.ConstructMenu;
@@ -1075,10 +1075,9 @@ begin
if (ConfRowHeight > 0) and ConfUseFileTypeIcons then begin
Column.SetImageProperty('width', ConfRowHeight);
Column.SetImageProperty('height', ConfRowHeight);
- end;
+ end;
end else Column := ListView.Columns.Add;
-
Column.Caption := ConfColumnTitlesShort[ConfColumnIDs[i]];
g_object_set(PGObject(Column.FColumn), 'sizing', [2, 'fixed-width', ConfColumnSizes[i], nil]);
@@ -1313,9 +1312,7 @@ begin
end;
if not ConfWMCompatMode then Show;
- // Other things
StartUp := False; // Set the flag to process Splitter repositioning
- PanelSeparator.Position := Round(Width * (ConfPanelSep / 100));
Application.ProcessMessages; // Need to process all messages before unlocking
InternalLockInit(False);
@@ -1330,21 +1327,22 @@ end;
(********************************************************************************************************************************)
(********************************************************************************************************************************)
(********************************************************************************************************************************)
-procedure TFMain.PanelSeparatorResize(Sender: TObject);
+procedure TFMain.PanelSeparatorPositionChanged(Sender: TObject);
begin
- if not StartUp then ConfPanelSep := Round((PanelSeparator.Position / Width) * 100);
+ if (not StartUp) and (PanelSeparator.Position > 0) then
+ ConfPanelSep := Round((PanelSeparator.Position / PanelSeparator.Width) * 100);
end;
-procedure TFMain.PanelSeparatorMouseUp(Sender: TObject; Button: TGDKMouseButton; Shift: TShiftState; X, Y: Integer; var Accept: boolean);
-var XLeft, XRight: gint;
+procedure TFMain.PanelSeparatorRealize(Sender: TObject);
begin
- if Button = mbRight then begin
- Accept := False;
- // TODO
-// gtk_widget_get_pointer(LeftPanelBox.FWidget, @XLeft, nil);
-// gtk_widget_get_pointer(RightPanelBox.FWidget, @XRight, nil);
- if (XLeft >= LeftPanelBox.Width) and (XRight < 0) then SplitterPopupMenu.PopUp;
- end;
+ PanelSeparator.Position := Round(PanelSeparator.Width * (ConfPanelSep / 100));
+end;
+
+procedure TFMain.SplitterPopupMenuClick(Sender: TObject);
+begin
+ if not (Sender is TGTKMenuItem) then Exit;
+ ConfPanelSep := Integer((Sender as TGTKMenuItem).Data);
+ PanelSeparator.Position := Round(PanelSeparator.Width * (ConfPanelSep / 100));
end;
procedure TFMain.miExitClick(Sender: TObject);
@@ -1667,16 +1665,6 @@ begin
((not LeftLastFocused) and (RightPanelEngine is TVFSEngine) and (not TVFSEngine(RightPanelEngine).ArchiveMode));
end;
-procedure TFMain.FormResize(Sender: TObject);
-begin
- if Width <> LastWidth then begin
-// DebugMsg(['FormResize: ', Width, 'x', Height]);
- PanelSeparator.Position := Round(Width * (ConfPanelSep / 100));
- CommandLineLabel.SetSizeRequest(Round(Width / 2.5), -1);
- LastWidth := Width;
- end;
-end;
-
procedure TFMain.PathLabelMouseDown(Sender: TObject; Button: TGDKMouseButton; Shift: TShiftState; X, Y: Integer; var Accept: boolean);
begin
if Button in [mbLeft, mbRight] then begin
@@ -3769,14 +3757,6 @@ begin
end;
(********************************************************************************************************************************)
-procedure TFMain.SplitterPopupMenuClick(Sender: TObject);
-begin
- if not (Sender is TGTKMenuItem) then Exit;
- ConfPanelSep := Integer((Sender as TGTKMenuItem).Data);
- PanelSeparator.Position := Round(Width * (ConfPanelSep / 100));
-end;
-
-(********************************************************************************************************************************)
procedure TFMain.miChangePermissionsClick(Sender: TObject);
var LeftPanel: boolean;
AListView: TGTKListView;