Browse Source

Fp Window->Tile - enable, disable correctly.

Margers 5 months ago
parent
commit
3c7a114c0b
2 changed files with 11 additions and 33 deletions
  1. 6 7
      packages/ide/fpmwnd.inc
  2. 5 26
      packages/ide/fpviews.pas

+ 6 - 7
packages/ide/fpmwnd.inc

@@ -263,13 +263,12 @@ begin
   New(W,Init);
   ExecView(W);
   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
-    begin
-      Desktop^.Lock;
-      { force correct commands to be enabled }
-      Desktop^.Current^.SetState(sfActive,false);
-      Desktop^.Current^.SetState(sfActive,true);
-      Desktop^.UnLock;
-    end;
+    Desktop^.Current^.SetState(sfActive,true); { set active only current }
+  Desktop^.UnLock;
 end;
 

+ 5 - 26
packages/ide/fpviews.pas

@@ -204,9 +204,6 @@ type
       function    GetPalette: PPalette; virtual;
       constructor Load(var S: TStream);
       procedure   Store(var S: TStream);
-      procedure   Show; virtual;
-      procedure   Hide; virtual;
-      procedure   Close; virtual;
       destructor  Done; virtual;
     end;
 
@@ -2674,15 +2671,17 @@ begin
 end;
 
 procedure TSourceWindow.UpdateCommands;
-var Active: boolean;
+var Active, Visible: boolean;
 begin
-  Active:=GetState(sfActive);
+  Visible:=GetState(sfVisible);
+  Active:=GetState(sfActive) and Visible;
   if Editor^.IsClipboard=false then
   begin
     SetCmdState(SourceCmds+CompileCmds,Active);
     SetCmdState(EditorCmds,Active);
   end;
   SetCmdState(ToClipCmds+FromClipCmds+NulClipCmds+UndoCmd+RedoCmd+[cmHide],Active);
+  SetCmdState([cmTile,cmCascade],Visible or IsThereAnyVisibleEditorWindow);
   Message(Application,evBroadcast,cmCommandSetChanged,nil);
 end;
 
@@ -2723,23 +2722,6 @@ begin
   PopStatus;
 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;
 begin
   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)
     Message(Application,evBroadcast,cmUpdate,nil);
     }
-    if ShowIt then
-      W^.SetCmdState([cmTile,cmCascade,cmSaveAll],true)
-    else
-      W^.SetCmdState([cmSaveAll],true);
+    W^.SetCmdState([cmSaveAll],true);
   end;
   PopStatus;
   IOpenEditorWindow:=W;