mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Correct size synchronization of disk panels
This commit is contained in:
parent
131e1147d4
commit
22a1bd5ba5
4 changed files with 88 additions and 72 deletions
|
|
@ -60,7 +60,8 @@ type
|
|||
FChangePath : String;
|
||||
FEnvVar : String;
|
||||
FOldWidth : Integer;
|
||||
FMustResize : Boolean;
|
||||
FMustResize,
|
||||
FLockResize : Boolean;
|
||||
function LoadBtnIcon(IconPath : String) : TBitMap;
|
||||
function GetButton(Index: Integer): TSpeedButton;
|
||||
function GetButtonCount: Integer;
|
||||
|
|
@ -163,9 +164,11 @@ begin
|
|||
if FOldWidth = 0 then
|
||||
FOldWidth := Width;
|
||||
|
||||
if ((FOldWidth <> Width) or FMustResize) and (FButtonsList.Count > 0) then
|
||||
if (((FOldWidth <> Width) and not FLockResize) or FMustResize) and (FButtonsList.Count > 0) then
|
||||
begin
|
||||
|
||||
// lock on resize handler
|
||||
FLockResize := True;
|
||||
|
||||
NewHeight := FButtonSize + FTotalBevelWidth * 2;
|
||||
|
||||
if (BevelInner <> bvNone) and (BevelOuter <> bvNone) then
|
||||
|
|
@ -215,6 +218,8 @@ begin
|
|||
|
||||
Self.SetBounds(Left, Top, Width, NewHeight);
|
||||
|
||||
// unlock on resize handler
|
||||
FLockResize := False;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
|
@ -332,6 +337,7 @@ begin
|
|||
FNeedMore := False;
|
||||
FOldWidth := Width;
|
||||
FMustResize := False;
|
||||
FLockResize := False;
|
||||
end;
|
||||
|
||||
destructor TKAStoolBar.Destroy;
|
||||
|
|
@ -393,6 +399,9 @@ function TKAStoolBar.AddButton(sCaption, Cmd, BtnHint, IconPath : String) : Inte
|
|||
var
|
||||
ToolButton: TSpeedButton;
|
||||
begin
|
||||
// lock on resize handler
|
||||
FLockResize := True;
|
||||
|
||||
ToolButton:= TSpeedButton.Create(Self);
|
||||
//Include(ToolButton.ComponentStyle, csSubComponent);
|
||||
ToolButton.Parent:=Self;
|
||||
|
|
@ -420,10 +429,11 @@ begin
|
|||
Height := Height + FButtonSize;
|
||||
end;
|
||||
|
||||
|
||||
ToolButton.Left:= FPositionX;
|
||||
ToolButton.Top := FPositionY;
|
||||
|
||||
//WriteLN('ToolButton.Left == ' + IntToStr(ToolButton.Left));
|
||||
|
||||
if Assigned(OnMouseDown) then
|
||||
ToolButton.OnMouseDown := OnMouseDown;
|
||||
|
||||
|
|
@ -445,6 +455,9 @@ begin
|
|||
FCmdList.Add(Cmd);
|
||||
FIconList.Add(IconPath);
|
||||
|
||||
// unlock on resize handler
|
||||
FLockResize := False;
|
||||
|
||||
Result := ToolButton.Tag;
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,3 +5,4 @@
|
|||
указана текущая директория
|
||||
17.07.2007 ADD: Добавил просмотр файлов в VFS, для внутреннего листера
|
||||
13.08.2007 ADD: Сохранение и загрузку табов
|
||||
15.08.2007 ADD: Сделал корректную синхронизацию размеров панелей дисков
|
||||
|
|
|
|||
105
fmain.lfm
105
fmain.lfm
|
|
@ -1,7 +1,7 @@
|
|||
inherited frmMain: TfrmMain
|
||||
Left = 273
|
||||
Left = 275
|
||||
Height = 336
|
||||
Top = 148
|
||||
Top = 363
|
||||
Width = 525
|
||||
HorzScrollBar.Page = 524
|
||||
VertScrollBar.Page = 316
|
||||
|
|
@ -26,54 +26,55 @@ inherited frmMain: TfrmMain
|
|||
OnShow = frmMainShow
|
||||
Position = poDesktopCenter
|
||||
ShowHint = True
|
||||
object pnlButton: TPanel
|
||||
Height = 22
|
||||
object pnlSyncSize: TPanel
|
||||
Height = 26
|
||||
Top = 23
|
||||
Width = 525
|
||||
Align = alTop
|
||||
FullRepaint = False
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
end
|
||||
object pnlDisk: TPanel
|
||||
Height = 24
|
||||
Top = 45
|
||||
Width = 525
|
||||
Align = alTop
|
||||
Caption = 'pnlDisk'
|
||||
ClientHeight = 24
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 26
|
||||
ClientWidth = 525
|
||||
FullRepaint = False
|
||||
ParentColor = False
|
||||
TabOrder = 1
|
||||
object dskLeft: TKAStoolBar
|
||||
Left = 1
|
||||
Height = 22
|
||||
Top = 1
|
||||
Width = 142
|
||||
Align = alLeft
|
||||
Alignment = taLeftJustify
|
||||
TabOrder = 0
|
||||
object pnlDisk: TPanel
|
||||
Height = 26
|
||||
Width = 525
|
||||
Align = alRight
|
||||
Caption = 'pnlDisk'
|
||||
ClientHeight = 26
|
||||
ClientWidth = 525
|
||||
FullRepaint = False
|
||||
ParentColor = False
|
||||
TabOrder = 0
|
||||
OnToolButtonClick = dskLeftToolButtonClick
|
||||
CheckToolButton = True
|
||||
FlatButtons = True
|
||||
IsDiskPanel = True
|
||||
end
|
||||
object dskRight: TKAStoolBar
|
||||
Left = 143
|
||||
Height = 22
|
||||
Top = 1
|
||||
Width = 381
|
||||
Align = alClient
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 1
|
||||
OnToolButtonClick = dskRightToolButtonClick
|
||||
OnChangeLineCount = dskRightChangeLineCount
|
||||
CheckToolButton = True
|
||||
FlatButtons = True
|
||||
IsDiskPanel = True
|
||||
object dskLeft: TKAStoolBar
|
||||
Left = 1
|
||||
Height = 24
|
||||
Top = 1
|
||||
Width = 142
|
||||
Align = alLeft
|
||||
Alignment = taLeftJustify
|
||||
ParentColor = False
|
||||
TabOrder = 0
|
||||
OnToolButtonClick = dskLeftToolButtonClick
|
||||
CheckToolButton = True
|
||||
FlatButtons = True
|
||||
IsDiskPanel = True
|
||||
end
|
||||
object dskRight: TKAStoolBar
|
||||
Left = 143
|
||||
Height = 24
|
||||
Top = 1
|
||||
Width = 381
|
||||
Align = alClient
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 1
|
||||
OnToolButtonClick = dskRightToolButtonClick
|
||||
OnChangeLineCount = dskRightChangeLineCount
|
||||
CheckToolButton = True
|
||||
FlatButtons = True
|
||||
IsDiskPanel = True
|
||||
end
|
||||
end
|
||||
end
|
||||
object pnlCommand: TPanel
|
||||
|
|
@ -87,7 +88,7 @@ inherited frmMain: TfrmMain
|
|||
ClientWidth = 525
|
||||
FullRepaint = False
|
||||
ParentColor = False
|
||||
TabOrder = 2
|
||||
TabOrder = 1
|
||||
object lblCommandPath: TLabel
|
||||
Left = 1
|
||||
Height = 14
|
||||
|
|
@ -208,18 +209,18 @@ inherited frmMain: TfrmMain
|
|||
end
|
||||
end
|
||||
object pnlNotebooks: TPanel
|
||||
Height = 186
|
||||
Top = 69
|
||||
Height = 206
|
||||
Top = 49
|
||||
Width = 525
|
||||
Align = alClient
|
||||
ClientHeight = 186
|
||||
ClientHeight = 206
|
||||
ClientWidth = 525
|
||||
FullRepaint = False
|
||||
TabOrder = 3
|
||||
TabOrder = 2
|
||||
TabStop = True
|
||||
object nbLeft: TNotebook
|
||||
Left = 1
|
||||
Height = 184
|
||||
Height = 204
|
||||
Top = 1
|
||||
Width = 391
|
||||
Align = alLeft
|
||||
|
|
@ -229,14 +230,14 @@ inherited frmMain: TfrmMain
|
|||
end
|
||||
object MainSplitter: TSplitter
|
||||
Left = 392
|
||||
Height = 184
|
||||
Height = 204
|
||||
Top = 1
|
||||
Width = 4
|
||||
ResizeStyle = rsLine
|
||||
end
|
||||
object nbRight: TNotebook
|
||||
Left = 396
|
||||
Height = 184
|
||||
Height = 204
|
||||
Top = 1
|
||||
Width = 128
|
||||
Align = alClient
|
||||
|
|
@ -249,7 +250,7 @@ inherited frmMain: TfrmMain
|
|||
Height = 23
|
||||
Width = 525
|
||||
Align = alTop
|
||||
TabOrder = 4
|
||||
TabOrder = 3
|
||||
OnMouseDown = MainToolBarMouseDown
|
||||
OnToolButtonClick = MainToolBarToolButtonClick
|
||||
FlatButtons = True
|
||||
|
|
|
|||
33
fmain.pas
33
fmain.pas
|
|
@ -61,6 +61,7 @@ type
|
|||
dskLeft: TKAStoolBar;
|
||||
dskRight: TKAStoolBar;
|
||||
MainToolBar: TKASToolBar;
|
||||
pnlDisk: TPanel;
|
||||
tbDelete: TMenuItem;
|
||||
tbEdit: TMenuItem;
|
||||
MenuItem3: TMenuItem;
|
||||
|
|
@ -69,8 +70,7 @@ type
|
|||
nbLeft: TNotebook;
|
||||
nbRight: TNotebook;
|
||||
pnlNotebooks: TPanel;
|
||||
pnlButton: TPanel;
|
||||
pnlDisk: TPanel;
|
||||
pnlSyncSize: TPanel;
|
||||
pnlCommand: TPanel;
|
||||
lblCommandPath: TLabel;
|
||||
mnuHelp: TMenuItem;
|
||||
|
|
@ -395,14 +395,12 @@ end;
|
|||
|
||||
procedure TfrmMain.dskRightChangeLineCount(AddSize: Integer);
|
||||
begin
|
||||
pnlDisk.Height := pnlDisk.Height + AddSize;
|
||||
//pnlLeftdskRes.Height := pnlLeftdskRes.Height + AddSize;
|
||||
|
||||
pnlSyncSize.Height := pnlSyncSize.Height + AddSize;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.dskLeftToolButtonClick(NumberOfButton: Integer);
|
||||
var
|
||||
Command : String;
|
||||
Command : String;
|
||||
begin
|
||||
if dskLeft.Buttons[NumberOfButton].GroupIndex = 0 then
|
||||
begin
|
||||
|
|
@ -544,8 +542,6 @@ begin
|
|||
end;
|
||||
|
||||
procedure TfrmMain.frmMainShow(Sender: TObject);
|
||||
var
|
||||
LastDir : String;
|
||||
begin
|
||||
DebugLn('frmMainShow');
|
||||
(* If panels already created then refresh their and exit *)
|
||||
|
|
@ -561,12 +557,6 @@ begin
|
|||
Top := gIni.ReadInteger('Configuration', 'Main.Top', Top);
|
||||
Width := gIni.ReadInteger('Configuration', 'Main.Width', Width);
|
||||
Height := gIni.ReadInteger('Configuration', 'Main.Height', Height);
|
||||
|
||||
{LastDir := gIni.ReadString('left', 'path', '');
|
||||
CreatePanel(AddPage(nbLeft), fpLeft, LastDir);
|
||||
|
||||
LastDir := gIni.ReadString('right', 'path', '');
|
||||
CreatePanel(AddPage(nbRight), fpRight, LastDir); }
|
||||
|
||||
LoadTabs(nbLeft);
|
||||
LoadTabs(nbRight);
|
||||
|
|
@ -581,7 +571,8 @@ begin
|
|||
|
||||
pnlNotebooks.Width:=Width div 2;
|
||||
|
||||
// dskLeft.Width := Width div 2;
|
||||
//DebugLN('dskLeft.Width == ' + IntToStr(dskLeft.Width));
|
||||
//DebugLN('dskRight.Width == ' + IntToStr(dskRight.Width));
|
||||
|
||||
(*Create Disk Panels*)
|
||||
CreateDiskPanel(dskLeft);
|
||||
|
|
@ -840,7 +831,17 @@ end;
|
|||
procedure TfrmMain.FormResize(Sender: TObject);
|
||||
begin
|
||||
nbLeft.Width:= (frmMain.Width div 2) - (MainSplitter.Width div 2);
|
||||
dskLeft.Width := pnlDisk.Width div 2;
|
||||
|
||||
//DebugLN('pnlDisk.Width == ' + IntToStr(pnlDisk.Width));
|
||||
|
||||
{ Synchronize width of left and right disk panels }
|
||||
|
||||
pnlDisk.Width := pnlSyncSize.Width - (pnlSyncSize.Width mod 2);
|
||||
|
||||
dskLeft.Width := (pnlDisk.Width div 2) - pnlDisk.BevelWidth;
|
||||
|
||||
//DebugLN('dskLeft.Width == ' + IntToStr(dskLeft.Width));
|
||||
//DebugLN('dskRight.Width == ' + IntToStr(dskRight.Width));
|
||||
|
||||
dskLeft.Repaint;
|
||||
dskRight.Repaint;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue