Fp Window->Tile - enable, disable correctly.

This commit is contained in:
Margers 2025-02-17 08:53:17 +00:00 committed by Michael Van Canneyt
parent 2d7a8d4440
commit 3c7a114c0b
2 changed files with 11 additions and 33 deletions

View File

@ -263,13 +263,12 @@ begin
New(W,Init); New(W,Init);
ExecView(W); ExecView(W);
Dispose(W,Done); Dispose(W,Done);
Desktop^.Lock;
{ force correct commands to be enabled }
Desktop^.SetState(sfActive,true); { activate everything }
Desktop^.SetState(sfActive,false); { deactivate everything }
if assigned(Desktop^.Current) then if assigned(Desktop^.Current) then
begin Desktop^.Current^.SetState(sfActive,true); { set active only current }
Desktop^.Lock; Desktop^.UnLock;
{ force correct commands to be enabled }
Desktop^.Current^.SetState(sfActive,false);
Desktop^.Current^.SetState(sfActive,true);
Desktop^.UnLock;
end;
end; end;

View File

@ -204,9 +204,6 @@ type
function GetPalette: PPalette; virtual; function GetPalette: PPalette; virtual;
constructor Load(var S: TStream); constructor Load(var S: TStream);
procedure Store(var S: TStream); procedure Store(var S: TStream);
procedure Show; virtual;
procedure Hide; virtual;
procedure Close; virtual;
destructor Done; virtual; destructor Done; virtual;
end; end;
@ -2674,15 +2671,17 @@ begin
end; end;
procedure TSourceWindow.UpdateCommands; procedure TSourceWindow.UpdateCommands;
var Active: boolean; var Active, Visible: boolean;
begin begin
Active:=GetState(sfActive); Visible:=GetState(sfVisible);
Active:=GetState(sfActive) and Visible;
if Editor^.IsClipboard=false then if Editor^.IsClipboard=false then
begin begin
SetCmdState(SourceCmds+CompileCmds,Active); SetCmdState(SourceCmds+CompileCmds,Active);
SetCmdState(EditorCmds,Active); SetCmdState(EditorCmds,Active);
end; end;
SetCmdState(ToClipCmds+FromClipCmds+NulClipCmds+UndoCmd+RedoCmd+[cmHide],Active); SetCmdState(ToClipCmds+FromClipCmds+NulClipCmds+UndoCmd+RedoCmd+[cmHide],Active);
SetCmdState([cmTile,cmCascade],Visible or IsThereAnyVisibleEditorWindow);
Message(Application,evBroadcast,cmCommandSetChanged,nil); Message(Application,evBroadcast,cmCommandSetChanged,nil);
end; end;
@ -2723,23 +2722,6 @@ begin
PopStatus; PopStatus;
end; end;
procedure TSourceWindow.Show;
begin
inherited Show;
IDEApp.SetCmdState([cmTile,cmCascade],true);
end;
procedure TSourceWindow.Hide;
begin
inherited Hide;
IDEApp.SetCmdState([cmTile,cmCascade],IsThereAnyVisibleEditorWindow);
end;
procedure TSourceWindow.Close;
begin
inherited Close;
end;
destructor TSourceWindow.Done; destructor TSourceWindow.Done;
begin begin
PushStatus(FormatStrStr(msg_closingfile,GetStr(Title))); PushStatus(FormatStrStr(msg_closingfile,GetStr(Title)));
@ -4322,10 +4304,7 @@ begin
{ this makes loading a lot slower and is not needed as far as I can see (FK) { this makes loading a lot slower and is not needed as far as I can see (FK)
Message(Application,evBroadcast,cmUpdate,nil); Message(Application,evBroadcast,cmUpdate,nil);
} }
if ShowIt then W^.SetCmdState([cmSaveAll],true);
W^.SetCmdState([cmTile,cmCascade,cmSaveAll],true)
else
W^.SetCmdState([cmSaveAll],true);
end; end;
PopStatus; PopStatus;
IOpenEditorWindow:=W; IOpenEditorWindow:=W;