FIX: Bug [2747120] Клик по вкладкам.

This commit is contained in:
cobines 2009-07-06 18:20:13 +00:00
commit 0fa150548f
3 changed files with 73 additions and 33 deletions

View file

@ -502,6 +502,10 @@ type
procedure UpdateSelectedDrive(ANoteBook: TNoteBook);
procedure EnableHotkeys(Enable: Boolean);
procedure ExecuteCommandLine(bRunInTerm: Boolean);
{en
Shows or removes the '*' indicator of a locked tab.
}
procedure UpdateTabLockedState(Page: TPage);
published
property SelectedPanel:TFilePanelSelect read PanelSelected;
end;
@ -1313,6 +1317,7 @@ var
PopUpPoint: TPoint;
NoteBook: TNoteBook;
TabNr: Integer;
Index: Integer;
begin
NoteBook := (Sender as TNoteBook);
@ -1334,6 +1339,12 @@ begin
begin
PopUpPoint := NoteBook.ClientToScreen(Point(X, Y));
// Check lock option items.
Index := pmTabMenu.Items.IndexOf(miToggleLockTab);
pmTabMenu.Items.Items[Index].Checked := (NoteBook.Page[TabNr].Tag = 1);
Index := pmTabMenu.Items.IndexOf(miToggleLockDcaTab);
pmTabMenu.Items.Items[Index].Checked := (NoteBook.Page[TabNr].Tag = 2);
pmTabMenu.Parent := NoteBook;
pmTabMenu.Tag := TabNr;
pmTabMenu.PopUp(PopUpPoint.x, PopUpPoint.y);
@ -2582,15 +2593,28 @@ begin
end;
function TfrmMain.FramepnlFileBeforeChangeDirectory(Sender: TObject; const NewDir: String): Boolean;
var
NoteBook: TNoteBook;
Panel: TFilePanelSelect;
begin
Result:= True;
if Sender is TPage then
with Sender as TPage do
if Tag = 1 then
begin
CreatePanel(AddPage(TNoteBook((Sender as TPage).Parent)), ActiveFrame.PanelSelect, NewDir);
Result:= False; // do not change directory in this tab
NoteBook := ((Sender as TPage).Parent) as TNoteBook;
if NoteBook = nbLeft then
Panel := fpLeft
else if NoteBook = nbRight then
Panel := fpRight
else
Exit;
CreatePanel(AddPage(NoteBook), Panel, NewDir);
ActiveFrame.SetFocus;
Result:= False;
end;
end;
@ -3148,6 +3172,31 @@ begin
end;
procedure TfrmMain.UpdateWindowView;
procedure UpdateNoteBook(NoteBook: TNoteBook);
var
I: Integer;
begin
NoteBook.ShowTabs := ((NoteBook.PageCount > 1) or (tb_always_visible in gDirTabOptions)) and gDirectoryTabs;
if tb_show_close_button in gDirTabOptions then
begin
NoteBook.Options := NoteBook.Options + [nboShowCloseButtons];
end
else
begin
NoteBook.Options := NoteBook.Options - [nboShowCloseButtons];
end;
SetMultilineTabs(NoteBook, tb_multiple_lines in gDirTabOptions);
for I := 0 to NoteBook.PageCount - 1 do // change on all tabs
begin
(NoteBook.Page[I].Controls[0] as TFrameFilePanel).UpdateView;
UpdateTabLockedState(NoteBook.Page[I]);
end;
end;
var
I : Integer;
IniBarFile : TIniFileEx;
@ -3209,27 +3258,8 @@ begin
btnRightTargetEqualSource.Flat:= gInterfaceFlat;
// Tabs
nbLeft.ShowTabs := ((nbLeft.PageCount > 1) or (tb_always_visible in gDirTabOptions)) and gDirectoryTabs;
nbRight.ShowTabs := ((nbRight.PageCount > 1) or (tb_always_visible in gDirTabOptions)) and gDirectoryTabs;
if tb_show_close_button in gDirTabOptions then
begin
nbLeft.Options:= nbLeft.Options + [nboShowCloseButtons];
nbRight.Options:= nbRight.Options + [nboShowCloseButtons];
end
else
begin
nbLeft.Options:= nbLeft.Options - [nboShowCloseButtons];
nbRight.Options:= nbRight.Options - [nboShowCloseButtons];
end;
SetMultilineTabs(nbLeft, tb_multiple_lines in gDirTabOptions);
SetMultilineTabs(nbRight, tb_multiple_lines in gDirTabOptions);
for I := 0 to nbLeft.PageCount - 1 do // change on all tabs
(nbLeft.Page[I].Controls[0] as TFrameFilePanel).UpdateView;
for I := 0 to nbRight.PageCount - 1 do // change on all tabs
(nbRight.Page[I].Controls[0] as TFrameFilePanel).UpdateView;
UpdateNoteBook(nbLeft);
UpdateNoteBook(nbRight);
for I := 0 to pnlKeys.ControlCount - 1 do // function keys
if pnlKeys.Controls[I] is TSpeedButton then
@ -3759,6 +3789,21 @@ begin
{$ENDIF}
end;
procedure TfrmMain.UpdateTabLockedState(Page: TPage);
var
NewCaption: String;
begin
if Page.Caption[1] = '*' then
NewCaption := Copy(Page.Caption, 2, Length(Page.Caption) - 1)
else
NewCaption := Page.Caption;
if (Page.Tag <> 0) and (tb_show_asterisk_for_locked in gDirTabOptions) then
Page.Caption := '*' + NewCaption
else
Page.Caption := NewCaption;
end;
initialization
{$I fmain.lrs}
end.

View file

@ -488,16 +488,14 @@ begin
begin
if NoteBook.Page[PageIndex].Tag <> 1 then // lock
begin
if (NoteBook.Page[PageIndex].Tag = 0) and (tb_show_asterisk_for_locked in gDirTabOptions) then
NoteBook.Page[PageIndex].Caption:= '*'+NoteBook.Page[PageIndex].Caption;
NoteBook.Page[PageIndex].Tag:= 1;
end
else // unlock
begin
NoteBook.Page[PageIndex].Tag:= 0;
if (tb_show_asterisk_for_locked in gDirTabOptions) then
NoteBook.Page[PageIndex].Caption:= Copy(NoteBook.Page[PageIndex].Caption, 2, Length(NoteBook.Page[PageIndex].Caption)-1);
end;
UpdateTabLockedState(NoteBook.Page[PageIndex]);
ActiveFrame.SetFocus;
end;
end;
@ -509,17 +507,14 @@ begin
if NoteBook.Page[PageIndex].Tag <> 2 then // lock
begin
NoteBook.Page[PageIndex].Hint:= ActiveFrame.ActiveDir;
if (Notebook.Page[PageIndex].Tag = 0) and (tb_show_asterisk_for_locked in gDirTabOptions) then
Notebook.Page[PageIndex].Caption:= '*'+Notebook.Page[PageIndex].Caption;
Notebook.Page[PageIndex].Tag:= 2;
end
else // unlock
begin
Notebook.Page[PageIndex].Tag:= 0;
Notebook.Page[PageIndex].Hint:= '';
if (tb_show_asterisk_for_locked in gDirTabOptions) then
Notebook.Page[PageIndex].Caption:= Copy(Notebook.Page[PageIndex].Caption, 2, Length(Notebook.Page[PageIndex].Caption)-1);
Notebook.Page[PageIndex].Tag:= 0;
end;
UpdateTabLockedState(NoteBook.Page[PageIndex]);
ActiveFrame.SetFocus;
end;
end;

View file

@ -731,7 +731,7 @@ begin
if NewDirectory <> '' then
begin
if Assigned(FOnBeforeChangeDirectory) then
if not FOnBeforeChangeDirectory(fOwner, ActiveDir) then
if not FOnBeforeChangeDirectory(fOwner, NewDirectory) then
Exit;
case fPanelMode of