summaryrefslogtreecommitdiff
path: root/UMain.pas
diff options
context:
space:
mode:
Diffstat (limited to 'UMain.pas')
-rw-r--r--UMain.pas47
1 files changed, 26 insertions, 21 deletions
diff --git a/UMain.pas b/UMain.pas
index 252e557..d7c23a9 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -1049,6 +1049,31 @@ begin
PathBoxPopupMenu.Add(miPathBoxCopyPath);
end;
+procedure ListViewColumnResized(gobject: PGObject; pspec: PGParamSpec; user_data: gpointer); cdecl;
+var AListView: TGTKListView;
+ i, FirstColumn, LastColumn: integer;
+ LeftLV, b: boolean;
+begin
+ AListView := TGTKListView(user_data);
+ LeftLV := AListView = FMain.LeftListView;
+ GetFirstLastPanelColumn(FirstColumn, LastColumn);
+ b := True;
+ for i := 0 to AListView.Columns.Count - 1 do
+ if (AListView.Columns[i].Tag <> LastColumn) or (FirstColumn = LastColumn) then
+ b := b and (ConfColumnSizes[AListView.Columns[i].Tag] = AListView.Columns[i].Width);
+ if not b then begin
+ DebugMsg(['*** ListViewColumnResized']);
+ for i := 0 to AListView.Columns.Count - 1 do
+ ConfColumnSizes[AListView.Columns[i].Tag] := AListView.Columns[i].Width;
+ if LeftLV then AListView := FMain.RightListView
+ else AListView := FMain.LeftListView;
+ // Change target widths
+ for i := 0 to AListView.Columns.Count - 1 do
+ if ConfColumnSizes[AListView.Columns[i].Tag] <> AListView.Columns[i].Width then
+ AListView.Columns[i].FixedWidth := ConfColumnSizes[AListView.Columns[i].Tag];
+ end;
+end;
+
procedure TFMain.ConstructColumns(ListView: TGTKListView);
var i, FirstColumn, LastColumn: integer;
Column: TGTKTreeViewColumn;
@@ -1103,7 +1128,7 @@ begin
end;
if Application.GTKVersion_2_4_0_Up then Column.SetProperty('single-paragraph-mode', 1);
Column.OnClicked := ListViewColumnClicked;
-
+ g_signal_connect(Column.FColumn, 'notify::width', G_CALLBACK(@ListViewColumnResized), ListView);
end;
// Set the list font
@@ -4421,26 +4446,6 @@ var AListView: TGTKListView;
begin
PanelRightMouseInProgress := False;
RightMouseSelectPopupTimer.Enabled := False;
- if Button = mbLeft then begin
- AListView := Sender as TGTKListView;
- LeftLV := AListView = LeftListView;
- GetFirstLastPanelColumn(FirstColumn, LastColumn);
- b := True;
- for i := 0 to AListView.Columns.Count - 1 do
- if (AListView.Columns[i].Tag <> LastColumn) or (FirstColumn = LastColumn) then
- b := b and (ConfColumnSizes[AListView.Columns[i].Tag] = AListView.Columns[i].Width);
- if not b then begin
- DebugMsg(['*** ListView Mouse Up -> resizing columns']);
- for i := 0 to AListView.Columns.Count - 1 do
- ConfColumnSizes[AListView.Columns[i].Tag] := AListView.Columns[i].Width;
- if LeftLV then AListView := RightListView
- else AListView := LeftListView;
- // Change target widths
- for i := 0 to AListView.Columns.Count - 1 do
- if ConfColumnSizes[AListView.Columns[i].Tag] <> AListView.Columns[i].Width then
- AListView.Columns[i].FixedWidth := ConfColumnSizes[AListView.Columns[i].Tag];
- end;
- end;
if Button = mbRight then Accept := False;
end;