Browse Source

The OnLastTerminalClosed and OnTerminalListChanged events are never used externally

Source commit: 6a3236f6091002a13946deaf6f90892333c8984b
Martin Prikryl 5 years ago
parent
commit
d86d9d205a

+ 8 - 13
source/forms/CustomScpExplorer.cpp

@@ -353,7 +353,7 @@ __fastcall TCustomScpExplorerForm::~TCustomScpExplorerForm()
   SAFE_DESTROY(FDocks);
 
   SessionsPageControl->Images = NULL;
-  // only after clearing Terminal (after DoTerminalListChanged => ... => AddSessionColor is called)
+  // only after clearing Terminal (after TerminalListChanged => ... => AddSessionColor is called)
   SAFE_DESTROY(FSessionColors);
   SAFE_DESTROY(FSessionsDragDropFilesEx);
 
@@ -574,7 +574,7 @@ void __fastcall TCustomScpExplorerForm::TerminalChanged(bool Replaced)
   {
     UpdateSessionColor((TColor)Terminal->StateData->Color);
   }
-  DoTerminalListChanged();
+  TerminalListChanged();
 
   DebugAssert(!IsLocalBrowserMode());
   if (Replaced)
@@ -4893,7 +4893,7 @@ void __fastcall TCustomScpExplorerForm::RenameSession()
 
     UpdateControls();
     // Add/Remove distinguishing paths from sessions of the same name.
-    DoTerminalListChanged();
+    TerminalListChanged();
   }
 }
 //---------------------------------------------------------------------------
@@ -6704,7 +6704,7 @@ void __fastcall TCustomScpExplorerForm::FileTerminalRemoved(const UnicodeString
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::LastTerminalClosed(TObject * /*Sender*/)
+void __fastcall TCustomScpExplorerForm::LastTerminalClosed()
 {
   UpdateControls();
   SessionColor = TColor(0);
@@ -6747,7 +6747,7 @@ void __fastcall TCustomScpExplorerForm::NeedSession(bool Startup)
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::DoTerminalListChanged()
+void __fastcall TCustomScpExplorerForm::TerminalListChanged()
 {
   TStrings * TerminalList = TTerminalManager::Instance()->TerminalList;
   int ActiveTerminalIndex = TTerminalManager::Instance()->ActiveTerminalIndex;
@@ -6806,11 +6806,6 @@ void __fastcall TCustomScpExplorerForm::DoTerminalListChanged()
   SessionsPageControl->ActivePageIndex = ActiveTerminalIndex;
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::TerminalListChanged(TObject * /*Sender*/)
-{
-  DoTerminalListChanged();
-}
-//---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::UpdateNewSessionTab()
 {
   TTabSheet * TabSheet = SessionsPageControl->Pages[SessionsPageControl->PageCount - 1];
@@ -6867,7 +6862,7 @@ bool __fastcall TCustomScpExplorerForm::SessionTabSwitched()
     }
     __finally
     {
-      DoTerminalListChanged();
+      TerminalListChanged();
     }
 
     FSessionsPageControlNewSessionTime = Now();
@@ -7136,7 +7131,7 @@ void __fastcall TCustomScpExplorerForm::UpdatePixelsPerInchMainWindowCounter()
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::StartingDisconnected()
 {
-  DoTerminalListChanged();
+  TerminalListChanged();
   InitStatusBar();
   UpdateControls();
 }
@@ -9957,7 +9952,7 @@ void __fastcall TCustomScpExplorerForm::SessionsPageControlDragDrop(
       (SessionsPageControl->ActivePage->PageIndex != Index))
   {
     Configuration->Usage->Inc(L"SessionTabMoves");
-    // this is almost redundant as we would recreate tabs in DoTerminalListChanged,
+    // this is almost redundant as we would recreate tabs in TerminalListChanged,
     // but we want to actually prevent that to avoid flicker
     SessionsPageControl->ActivePage->PageIndex = Index;
     TTerminal * Terminal = GetSessionTabTerminal(SessionsPageControl->ActivePage);

+ 2 - 3
source/forms/CustomScpExplorer.h

@@ -659,7 +659,6 @@ protected:
     void * Arg);
   void __fastcall AnyInternalEditorModified(TObject * Sender, bool & Modified);
   virtual void __fastcall StartingDisconnected();
-  void __fastcall DoTerminalListChanged();
   void __fastcall NeedSession(bool Startup);
   bool __fastcall DraggingAllFilesFromDirView(TOperationSide Side, TStrings * FileList);
   bool __fastcall SelectedAllFilesInDirView(TCustomDirView * DView);
@@ -793,11 +792,11 @@ public:
   bool __fastcall GetQueueEnabled();
   void __fastcall ToggleQueueEnabled();
   UnicodeString __fastcall GetQueueProgressTitle();
-  void __fastcall LastTerminalClosed(TObject * Sender);
+  void __fastcall LastTerminalClosed();
   void __fastcall TerminalRemoved(TObject * Sender);
   void __fastcall TerminalDisconnected();
   void __fastcall TerminalConnecting();
-  void __fastcall TerminalListChanged(TObject * Sender);
+  void __fastcall TerminalListChanged();
   void __fastcall ApplicationTitleChanged();
   unsigned int __fastcall MoreMessageDialog(const UnicodeString Message,
     TStrings * MoreMessages, TQueryType Type, unsigned int Answers,

+ 4 - 13
source/windows/TerminalManager.cpp

@@ -92,8 +92,6 @@ __fastcall TTerminalManager::TTerminalManager() :
 
   DebugAssert(Configuration && !Configuration->OnChange);
   Configuration->OnChange = ConfigurationChange;
-  FOnLastTerminalClosed = NULL;
-  FOnTerminalListChanged = NULL;
 
   FTerminalList = new TStringList();
   FQueues = new TList();
@@ -642,15 +640,8 @@ void __fastcall TTerminalManager::SetScpExplorer(TCustomScpExplorerForm * value)
     {
       FScpExplorer->Terminal = ActiveTerminal;
       FScpExplorer->Queue = ActiveQueue;
-      FOnLastTerminalClosed = FScpExplorer->LastTerminalClosed;
-      FOnTerminalListChanged = FScpExplorer->TerminalListChanged;
       UpdateTaskbarList();
     }
-    else
-    {
-      FOnLastTerminalClosed = NULL;
-      FOnTerminalListChanged = NULL;
-    }
   }
 }
 //---------------------------------------------------------------------------
@@ -732,9 +723,9 @@ void __fastcall TTerminalManager::DoSetActiveTerminal(TManagedTerminal * value,
     }
     else
     {
-      if (OnLastTerminalClosed)
+      if (FScpExplorer != NULL)
       {
-        OnLastTerminalClosed(this);
+        FScpExplorer->LastTerminalClosed();
       }
     }
 
@@ -1720,9 +1711,9 @@ void __fastcall TTerminalManager::Move(TTerminal * Source, TTerminal * Target)
 //---------------------------------------------------------------------------
 void __fastcall TTerminalManager::DoTerminalListChanged()
 {
-  if (OnTerminalListChanged)
+  if (FScpExplorer != NULL)
   {
-    OnTerminalListChanged(this);
+    FScpExplorer->TerminalListChanged();
   }
 }
 //---------------------------------------------------------------------------

+ 0 - 4
source/windows/TerminalManager.h

@@ -80,8 +80,6 @@ public:
   __property TTerminalQueue * ActiveQueue = { read = GetActiveQueue };
   __property int ActiveTerminalIndex = { read = GetActiveTerminalIndex, write = SetActiveTerminalIndex };
   __property TStrings * TerminalList = { read = GetTerminalList };
-  __property TNotifyEvent OnLastTerminalClosed = { read = FOnLastTerminalClosed, write = FOnLastTerminalClosed };
-  __property TNotifyEvent OnTerminalListChanged = { read = FOnTerminalListChanged, write = FOnTerminalListChanged };
   __property TTerminal * LocalTerminal = { read = FLocalTerminal };
   __property TManagedTerminal * Terminals[int Index]  = { read=GetTerminal };
 
@@ -97,8 +95,6 @@ private:
   TTerminal * FLocalTerminal;
   bool FDestroying;
   TTerminalPendingAction FTerminalPendingAction;
-  TNotifyEvent FOnLastTerminalClosed;
-  TNotifyEvent FOnTerminalListChanged;
   TStrings * FTerminalList;
   TList * FQueues;
   TStrings * FTerminationMessages;