NonVisual.cpp 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "NonVisual.h"
  5. #include <Common.h>
  6. #include <CoreMain.h>
  7. #include <TextsWin.h>
  8. #include <Tools.h>
  9. #include <Setup.h>
  10. #include <Log.h>
  11. #include <Interface.h>
  12. #include "WinConfiguration.h"
  13. #include "TerminalManager.h"
  14. #include "TBX.hpp"
  15. #include "VCLCommon.h"
  16. #include <HistoryComboBox.hpp>
  17. //---------------------------------------------------------------------------
  18. #pragma package(smart_init)
  19. #pragma link "TB2Item"
  20. #pragma link "TBX"
  21. #pragma link "TB2ExtItems"
  22. #pragma link "TBXExtItems"
  23. #pragma link "TBXToolPals"
  24. #ifndef NO_RESOURCES
  25. #pragma resource "*.dfm"
  26. #endif
  27. TNonVisualDataModule *NonVisualDataModule;
  28. //---------------------------------------------------------------------------
  29. #define SCPCOMMANDER ((TScpCommanderForm *)ScpExplorer)
  30. #define UPDEX(HandleAction, Condition, OtherEnabled, OtherDisabled) if (Action == HandleAction) { \
  31. ((TCustomAction *)Action)->Enabled = (Condition); \
  32. if (((TCustomAction *)Action)->Enabled) { OtherEnabled; } else { OtherDisabled; }; \
  33. Handled = true; } else
  34. #define UPDEX1(HandleAction, Condition, Other) UPDEX(HandleAction, Condition, Other, Other)
  35. #define UPD(HandleAction, Condition) if (Action == HandleAction) { \
  36. ((TCustomAction *)Action)->Enabled = (Condition); Handled = true; } else
  37. #define UPDFUNC(HandleAction, Function) if (Action == HandleAction) { Function; Handled = true; } else
  38. #define EXE(HandleAction, Command) if (Action == HandleAction) { \
  39. Command; Handled = true; } else
  40. #define UPDACT(HandleAction, Command) \
  41. EXE(HandleAction, ((TCustomAction *)Action)->Enabled = true; Command)
  42. #define UPDCOMP(COMP) if (Action == COMP ## Action) { COMP ## Action->Enabled = true; \
  43. COMP ## Action->Checked = ScpExplorer->ComponentVisible[fc ## COMP]; Handled = true; } else
  44. #define EXECOMP(COMP) EXE(COMP ## Action, \
  45. ScpExplorer->ComponentVisible[fc ## COMP] = !ScpExplorer->ComponentVisible[fc ## COMP] )
  46. #define COLPROPS(SIDE) \
  47. ((TCustomDirViewColProperties*)ScpExplorer->DirView(os ## SIDE)->ColProperties)
  48. #define UPDSORT(SIDE, PREFIX, COL) if (Action == SIDE ## SortBy ## COL ## Action) { \
  49. SIDE ## SortBy ## COL ## Action->Enabled = true; Handled = true; \
  50. SIDE ## SortBy ## COL ## Action->Checked = (COLPROPS(SIDE)->SortColumn == PREFIX ## COL); } else
  51. #define EXESORT(SIDE, PREFIX, COL) EXE(SIDE ## SortBy ## COL ## Action, \
  52. if (COLPROPS(SIDE)->SortColumn == PREFIX ## COL) \
  53. COLPROPS(SIDE)->SortAscending = !COLPROPS(SIDE)->SortAscending; \
  54. else COLPROPS(SIDE)->SortColumn = PREFIX ## COL )
  55. #define UPDSORTA(SIDE) if (Action == SIDE ## SortAscendingAction) { \
  56. SIDE ## SortAscendingAction->Enabled = true; Handled = true; \
  57. SIDE ## SortAscendingAction->Checked = COLPROPS(SIDE)->SortAscending; } else
  58. #define EXESORTA(SIDE) EXE(SIDE ## SortAscendingAction, \
  59. COLPROPS(SIDE)->SortAscending = !COLPROPS(SIDE)->SortAscending; )
  60. #define UPDSORTC(LPREFIX, LCOL, RPREFIX, RCOL) if (Action == CurrentSortBy ## RCOL ## Action) { \
  61. CurrentSortBy ## RCOL ## Action->Enabled = ScpExplorer->AllowedAction((TAction *)Action, aaShortCut); \
  62. if (CurrentSortBy ## RCOL ## Action->Enabled) { \
  63. if (ScpExplorer->DirView(osCurrent) == ScpExplorer->DirView(osRemote)) \
  64. CurrentSortBy ## RCOL ## Action->Checked = (COLPROPS(Current)->SortColumn == RPREFIX ## RCOL); \
  65. else CurrentSortBy ## RCOL ## Action->Checked = (COLPROPS(Current)->SortColumn == LPREFIX ## LCOL); \
  66. } else CurrentSortBy ## RCOL ## Action->Checked = false; Handled = true; } else
  67. #define EXESORTC(COL, LCOL, RCOL) \
  68. EXE(CurrentSortBy ## COL ## Action, \
  69. Integer NewSortCol = \
  70. ((ScpExplorer->DirView(osCurrent) == ScpExplorer->DirView(osRemote)) ? RCOL : LCOL); \
  71. if (COLPROPS(Current)->SortColumn == NewSortCol) \
  72. COLPROPS(Current)->SortAscending = !COLPROPS(Current)->SortAscending; \
  73. else COLPROPS(Current)->SortColumn = NewSortCol \
  74. )
  75. #define UPDSHCOL(SIDE, PREFIX, COL) \
  76. EXE(ShowHide ## SIDE ## COL ## ColumnAction, \
  77. ShowHide ## SIDE ## COL ## ColumnAction->Checked = COLPROPS(SIDE)->Visible[PREFIX ## COL])
  78. #define EXESHCOL(SIDE, PREFIX, COL) \
  79. EXE(ShowHide ## SIDE ## COL ## ColumnAction, \
  80. COLPROPS(SIDE)->Visible[PREFIX ## COL] = !COLPROPS(SIDE)->Visible[PREFIX ## COL])
  81. //---------------------------------------------------------------------------
  82. __fastcall TNonVisualDataModule::TNonVisualDataModule(TComponent* Owner)
  83. : TDataModule(Owner)
  84. {
  85. FListColumn = NULL;
  86. FSessionIdleTimerExecuting = false;
  87. FBusy = 0;
  88. QueueSpeedComboBoxItem(QueuePopupSpeedComboBoxItem);
  89. }
  90. //---------------------------------------------------------------------------
  91. __fastcall TNonVisualDataModule::~TNonVisualDataModule()
  92. {
  93. }
  94. //---------------------------------------------------------------------------
  95. void __fastcall TNonVisualDataModule::LogActionsUpdate(
  96. TBasicAction *Action, bool &Handled)
  97. {
  98. TLogMemo * LogMemo = TTerminalManager::Instance()->LogMemo;
  99. bool ValidLogMemo = LogMemo && LogMemo->Parent;
  100. UPD(LogClearAction, ValidLogMemo && LogMemo->Lines->Count)
  101. // removed potentially CPU intensive check for "all selected already"
  102. UPD(LogSelectAllAction, ValidLogMemo && LogMemo->Lines->Count)
  103. UPD(LogCopyAction, ValidLogMemo && LogMemo->SelLength)
  104. UPD(LogPreferencesAction, true)
  105. ;
  106. }
  107. //---------------------------------------------------------------------------
  108. void __fastcall TNonVisualDataModule::LogActionsExecute(
  109. TBasicAction *Action, bool &Handled)
  110. {
  111. {
  112. TAutoNestingCounter Counter(FBusy);
  113. TLogMemo * LogMemo = TTerminalManager::Instance()->LogMemo;
  114. assert(LogMemo && LogMemo->Parent);
  115. EXE(LogClearAction, LogMemo->SessionLog->Clear())
  116. EXE(LogSelectAllAction, LogMemo->SelectAll())
  117. EXE(LogCopyAction, LogMemo->CopyToClipboard())
  118. EXE(LogPreferencesAction, PreferencesDialog(pmLogging));
  119. ;
  120. }
  121. DoIdle();
  122. }
  123. //---------------------------------------------------------------------------
  124. void __fastcall TNonVisualDataModule::ExplorerActionsUpdate(
  125. TBasicAction *Action, bool &Handled)
  126. {
  127. if (!ScpExplorer || !ScpExplorer->AllowedAction((TAction *)Action, aaUpdate))
  128. {
  129. ((TAction *)Action)->Enabled = false;
  130. Handled = true;
  131. return;
  132. }
  133. void * Param;
  134. // CURRENT DIRVIEW
  135. #define EnabledSelectedOperation (ScpExplorer->EnableSelectedOperation[osCurrent])
  136. #define EnabledFocusedOperation (ScpExplorer->EnableFocusedOperation[osCurrent])
  137. #define EnabledSelectedFileOperation (ScpExplorer->EnableSelectedFileOperation[osCurrent])
  138. #define EnabledFocusedFileOperation (ScpExplorer->EnableFocusedFileOperation[osCurrent])
  139. #define EnabledLocalSelectedOperation (ScpExplorer->HasDirView[osLocal] && ScpExplorer->EnableSelectedOperation[osLocal])
  140. #define EnabledLocalFocusedOperation (ScpExplorer->HasDirView[osLocal] && ScpExplorer->EnableFocusedOperation[osLocal])
  141. #define EnabledLocalSelectedFileOperation (ScpExplorer->HasDirView[osLocal] && ScpExplorer->EnableSelectedFileOperation[osLocal])
  142. #define EnabledRemoteSelectedOperation (ScpExplorer->EnableSelectedOperation[osRemote])
  143. #define EnabledRemoteFocusedOperation (ScpExplorer->EnableFocusedOperation[osRemote])
  144. #define EnabledRemoteSelectedFileOperation (ScpExplorer->EnableSelectedFileOperation[osRemote])
  145. // focused operation
  146. UPD(CurrentDeleteFocusedAction, EnabledFocusedOperation)
  147. UPD(CurrentPropertiesFocusedAction, EnabledFocusedOperation)
  148. UPD(CurrentEditFocusedAction, EnabledFocusedFileOperation &&
  149. !WinConfiguration->DisableOpenEdit)
  150. UPD(CurrentSystemMenuFocusedAction, EnabledFocusedOperation)
  151. // file operation
  152. UPD(CurrentRenameAction, EnabledFocusedOperation &&
  153. ((ScpExplorer->HasDirView[osLocal] && DirView(osLocal) == DirView(osCurrent)) ||
  154. ScpExplorer->Terminal->IsCapable[fcRename]))
  155. UPD(CurrentEditAction, EnabledSelectedFileOperation &&
  156. !WinConfiguration->DisableOpenEdit)
  157. UPD(CurrentEditAlternativeAction, EnabledSelectedFileOperation &&
  158. !WinConfiguration->DisableOpenEdit)
  159. UPD(CurrentEditInternalAction, EnabledSelectedFileOperation &&
  160. !WinConfiguration->DisableOpenEdit)
  161. UPD(CurrentEditWithAction, EnabledSelectedFileOperation &&
  162. !WinConfiguration->DisableOpenEdit)
  163. UPD(CurrentOpenAction, EnabledFocusedOperation &&
  164. !WinConfiguration->DisableOpenEdit)
  165. UPDEX1(CurrentAddEditLinkContextAction, ScpExplorer->CanAddEditLink(osCurrent),
  166. ((TAction *)Action)->Visible = ScpExplorer->LinkFocused())
  167. UPD(NewLinkAction, ScpExplorer->CanAddEditLink(osCurrent))
  168. // selected operation
  169. UPD(CurrentDeleteAction, EnabledSelectedOperation)
  170. UPD(CurrentDeleteAlternativeAction, EnabledSelectedOperation)
  171. UPD(CurrentPropertiesAction, EnabledSelectedOperation)
  172. UPD(RemoteMoveToAction, EnabledSelectedOperation &&
  173. (DirView(osRemote) == DirView(osCurrent)) &&
  174. ScpExplorer->Terminal->IsCapable[fcRemoteMove])
  175. UPD(RemoteCopyToAction, EnabledSelectedOperation &&
  176. (DirView(osRemote) == DirView(osCurrent)))
  177. UPD(FileListToCommandLineAction, EnabledSelectedOperation)
  178. UPD(FileListToClipboardAction, EnabledSelectedOperation)
  179. UPD(FullFileListToClipboardAction, EnabledSelectedOperation)
  180. UPD(FileGenerateUrlAction, EnabledSelectedOperation && (DirView(osRemote) == DirView(osCurrent)))
  181. UPD(FileListFromClipboardAction, IsFormatInClipboard(CF_TEXT));
  182. UPD(CurrentAddEditLinkAction, ScpExplorer->CanAddEditLink(osCurrent))
  183. // local selected operation
  184. UPD(LocalCopyAction, EnabledLocalSelectedOperation)
  185. UPD(LocalRenameAction, EnabledLocalSelectedOperation)
  186. UPD(LocalEditAction, EnabledLocalSelectedFileOperation && !WinConfiguration->DisableOpenEdit)
  187. UPD(LocalMoveAction, EnabledLocalSelectedOperation)
  188. UPD(LocalCreateDirAction, true)
  189. UPD(LocalDeleteAction, EnabledLocalSelectedOperation)
  190. UPD(LocalPropertiesAction, EnabledLocalSelectedOperation)
  191. UPD(LocalAddEditLinkAction, ScpExplorer->CanAddEditLink(osLocal))
  192. // local focused operation
  193. UPD(LocalCopyFocusedAction, EnabledLocalFocusedOperation)
  194. UPD(LocalMoveFocusedAction, EnabledLocalFocusedOperation)
  195. // remote selected operation
  196. UPD(RemoteCopyAction, EnabledRemoteSelectedOperation)
  197. UPD(RemoteRenameAction, EnabledRemoteSelectedOperation &&
  198. ScpExplorer->Terminal->IsCapable[fcRename])
  199. UPD(RemoteEditAction, EnabledRemoteSelectedFileOperation && !WinConfiguration->DisableOpenEdit)
  200. UPD(RemoteMoveAction, EnabledRemoteSelectedOperation)
  201. UPD(RemoteCreateDirAction, true)
  202. UPD(RemoteDeleteAction, EnabledRemoteSelectedOperation)
  203. UPD(RemotePropertiesAction, EnabledRemoteSelectedOperation)
  204. UPD(RemoteAddEditLinkAction, ScpExplorer->CanAddEditLink(osRemote))
  205. // remote focused operation
  206. UPD(RemoteCopyFocusedAction, EnabledRemoteFocusedOperation)
  207. UPD(RemoteMoveFocusedAction, EnabledRemoteFocusedOperation)
  208. UPD(RemoteMoveToFocusedAction, EnabledFocusedOperation &&
  209. (DirView(osRemote) == DirView(osCurrent)) &&
  210. ScpExplorer->Terminal->IsCapable[fcRemoteMove])
  211. UPD(RemoteCopyToFocusedAction, EnabledFocusedOperation &&
  212. DirView(osRemote) == DirView(osCurrent))
  213. // directory
  214. UPD(CurrentCreateDirAction, true)
  215. UPD(NewDirAction, true)
  216. UPD(RemoteFindFilesAction, true)
  217. // selection
  218. UPD(SelectOneAction, DirView(osCurrent)->FilesCount)
  219. UPD(SelectAction, DirView(osCurrent)->FilesCount)
  220. UPD(UnselectAction, DirView(osCurrent)->SelCount)
  221. UPD(SelectAllAction, DirView(osCurrent)->FilesCount)
  222. UPD(InvertSelectionAction, DirView(osCurrent)->FilesCount)
  223. UPD(ClearSelectionAction, DirView(osCurrent)->SelCount)
  224. UPD(RestoreSelectionAction, DirView(osCurrent)->SelectedNamesSaved)
  225. UPD(PasteAction2, ScpExplorer->CanPasteFromClipBoard())
  226. UPD(LocalSelectAction, ScpExplorer->HasDirView[osLocal] && DirView(osLocal)->FilesCount)
  227. UPD(LocalUnselectAction, ScpExplorer->HasDirView[osLocal] && DirView(osLocal)->SelCount)
  228. UPD(LocalSelectAllAction, ScpExplorer->HasDirView[osLocal] && DirView(osLocal)->FilesCount)
  229. UPD(RemoteSelectAction, DirView(osRemote)->FilesCount)
  230. UPD(RemoteUnselectAction, DirView(osRemote)->SelCount)
  231. UPD(RemoteSelectAllAction, DirView(osRemote)->FilesCount)
  232. //style
  233. UPDACT(CurrentCycleStyleAction,
  234. CurrentCycleStyleAction->ImageIndex = 8 + (DirView(osCurrent)->ViewStyle + 1) % 4)
  235. #define STYLEACTION(Style) UPDACT(Current ## Style ## Action, \
  236. Current ## Style ## Action->Checked = (DirView(osCurrent)->ViewStyle == vs ## Style))
  237. STYLEACTION(Icon)
  238. STYLEACTION(SmallIcon)
  239. STYLEACTION(List)
  240. STYLEACTION(Report)
  241. #undef STYLEACTION
  242. // REMOTE+LOCAL
  243. // back/forward
  244. #define HISTORYACTION(SIDE, DIRECTION, HINTFMT, DELTA) \
  245. UPDEX(SIDE ## DIRECTION ## Action, (DirView(os ## SIDE)->DIRECTION ## Count > 0), \
  246. SIDE ## DIRECTION ## Action->Hint = FMTLOAD(HINTFMT, (DirView(os ## SIDE)->HistoryPath[DELTA])), \
  247. SIDE ## DIRECTION ## Action->Hint = L"")
  248. HISTORYACTION(Local, Back, EXPLORER_BACK_HINT, -1)
  249. HISTORYACTION(Local, Forward, EXPLORER_FORWARD_HINT, 1)
  250. HISTORYACTION(Remote, Back, EXPLORER_BACK_HINT, -1)
  251. HISTORYACTION(Remote, Forward, EXPLORER_FORWARD_HINT, 1)
  252. #undef HISTORYACTION
  253. #define PANEL_ACTIONS(SIDE) \
  254. UPD(SIDE ## ParentDirAction, !DirView(os ## SIDE)->IsRoot) \
  255. UPD(SIDE ## RootDirAction, !DirView(os ## SIDE)->IsRoot) \
  256. UPD(SIDE ## HomeDirAction, true) \
  257. UPD(SIDE ## RefreshAction, DirView(os ## SIDE)->DirOK) \
  258. UPD(SIDE ## OpenDirAction, true) \
  259. UPD(SIDE ## ChangePathAction, true) \
  260. UPD(SIDE ## AddBookmarkAction, true) \
  261. UPD(SIDE ## PathToClipboardAction, true) \
  262. UPDEX1(SIDE ## FilterAction, true, ((TAction *)Action)->Checked = !DirView(os ## SIDE)->Mask.IsEmpty())
  263. PANEL_ACTIONS(Local)
  264. PANEL_ACTIONS(Remote)
  265. #undef PANEL_ACTIONS
  266. UPD(LocalExploreDirectoryAction, true)
  267. // HELP
  268. UPD(AboutAction, true)
  269. UPD(HomepageAction, true)
  270. UPD(HistoryPageAction, true)
  271. UPD(TableOfContentsAction, true)
  272. UPD(ForumPageAction, true)
  273. UPDACT(CheckForUpdatesAction, ShowUpdatesUpdate())
  274. UPD(UpdatesPreferencesAction, true)
  275. UPD(DonatePageAction, true)
  276. UPD(DownloadPageAction, true)
  277. // VIEW
  278. UPDCOMP(SessionsTabs)
  279. UPDCOMP(StatusBar)
  280. UPDCOMP(ToolBar2)
  281. UPDCOMP(LocalStatusBar)
  282. UPDCOMP(RemoteStatusBar)
  283. UPDCOMP(CommandLinePanel)
  284. UPDCOMP(RemoteTree)
  285. UPDCOMP(LocalTree)
  286. UPDCOMP(ExplorerMenuBand)
  287. UPDCOMP(ExplorerAddressBand)
  288. UPDCOMP(ExplorerToolbarBand)
  289. UPDCOMP(ExplorerSelectionBand)
  290. UPDCOMP(ExplorerSessionBand)
  291. UPDCOMP(ExplorerPreferencesBand)
  292. UPDCOMP(ExplorerSortBand)
  293. UPDCOMP(ExplorerUpdatesBand)
  294. UPDCOMP(ExplorerTransferBand)
  295. UPDCOMP(ExplorerCustomCommandsBand)
  296. UPDCOMP(CommanderMenuBand)
  297. UPDCOMP(CommanderSessionBand)
  298. UPDCOMP(CommanderPreferencesBand)
  299. UPDCOMP(CommanderSortBand)
  300. UPDCOMP(CommanderCommandsBand)
  301. UPDCOMP(CommanderUpdatesBand)
  302. UPDCOMP(CommanderTransferBand)
  303. UPDCOMP(CommanderCustomCommandsBand)
  304. UPDCOMP(CommanderLocalHistoryBand)
  305. UPDCOMP(CommanderLocalNavigationBand)
  306. UPDCOMP(CommanderLocalFileBand)
  307. UPDCOMP(CommanderLocalSelectionBand)
  308. UPDCOMP(CommanderRemoteHistoryBand)
  309. UPDCOMP(CommanderRemoteNavigationBand)
  310. UPDCOMP(CommanderRemoteFileBand)
  311. UPDCOMP(CommanderRemoteSelectionBand)
  312. UPD(GoToCommandLineAction, true)
  313. UPD(GoToTreeAction, true)
  314. UPDEX(ViewLogAction, Configuration->Logging,
  315. ViewLogAction->Checked = (WinConfiguration->LogView == lvWindow),
  316. ViewLogAction->Checked = false )
  317. UPDEX(ShowHiddenFilesAction, true,
  318. ShowHiddenFilesAction->Checked = WinConfiguration->ShowHiddenFiles, )
  319. UPDEX(FormatSizeBytesNoneAction, true,
  320. FormatSizeBytesNoneAction->Checked = (WinConfiguration->FormatSizeBytes == fbNone), )
  321. UPDEX(FormatSizeBytesKilobytesAction, true,
  322. FormatSizeBytesKilobytesAction->Checked = (WinConfiguration->FormatSizeBytes == fbKilobytes), )
  323. UPDEX(FormatSizeBytesShortAction, true,
  324. FormatSizeBytesShortAction->Checked = (WinConfiguration->FormatSizeBytes == fbShort), )
  325. UPDEX(AutoReadDirectoryAfterOpAction, true,
  326. AutoReadDirectoryAfterOpAction->Checked = Configuration->AutoReadDirectoryAfterOp, )
  327. UPD(PreferencesAction, true)
  328. UPD(PresetsPreferencesAction, true)
  329. UPDEX(LockToolbarsAction, true,
  330. LockToolbarsAction->Checked = WinConfiguration->LockToolbars, )
  331. UPDEX(SelectiveToolbarTextAction, true,
  332. SelectiveToolbarTextAction->Checked = WinConfiguration->SelectiveToolbarText, )
  333. UPDCOMP(CustomCommandsBand)
  334. UPD(ColorMenuAction, true)
  335. // SORT
  336. UPDSORTA(Local)
  337. UPDSORT(Local, dv, Name)
  338. UPDSORT(Local, dv, Ext)
  339. UPDSORT(Local, dv, Size)
  340. UPDSORT(Local, dv, Type)
  341. UPDSORT(Local, dv, Changed)
  342. UPDSORT(Local, dv, Attr)
  343. UPDSORTA(Remote)
  344. UPDSORT(Remote, uv, Name)
  345. UPDSORT(Remote, uv, Ext)
  346. UPDSORT(Remote, uv, Size)
  347. UPDSORT(Remote, uv, Changed)
  348. UPDSORT(Remote, uv, Rights)
  349. UPDSORT(Remote, uv, Owner)
  350. UPDSORT(Remote, uv, Group)
  351. UPDSORT(Remote, uv, Type)
  352. UPDSORTA(Current)
  353. UPDSORTC(dv, Name, uv, Name)
  354. UPDSORTC(dv, Ext, uv, Ext)
  355. UPDSORTC(dv, Size, uv, Size)
  356. UPDSORTC(dv, Type, uv, Type)
  357. UPDSORTC(dv, Changed, uv, Changed)
  358. UPDSORTC(dv, Attr, uv, Rights)
  359. UPDSORTC(dv, Name, uv, Owner)
  360. UPDSORTC(dv, Name, uv, Group)
  361. #define COLVIEWPROPS ((TCustomDirViewColProperties*)(((TCustomDirView*)(((TListColumns*)(ListColumn->Collection))->Owner()))->ColProperties))
  362. UPDEX(SortColumnAscendingAction, (ListColumn != NULL), SortColumnAscendingAction->Checked =
  363. (COLVIEWPROPS->SortColumn == ListColumn->Index) && COLVIEWPROPS->SortAscending, /*assert(false)*/ )
  364. UPDEX(SortColumnDescendingAction, (ListColumn != NULL), SortColumnDescendingAction->Checked =
  365. (COLVIEWPROPS->SortColumn == ListColumn->Index) && !COLVIEWPROPS->SortAscending, /*assert(false)*/ )
  366. #undef COLVIEWPROPS
  367. // SHOW/HIDE COLUMN
  368. UPDSHCOL(Local, dv, Name)
  369. UPDSHCOL(Local, dv, Ext)
  370. UPDSHCOL(Local, dv, Size)
  371. UPDSHCOL(Local, dv, Type)
  372. UPDSHCOL(Local, dv, Changed)
  373. UPDSHCOL(Local, dv, Attr)
  374. UPDSHCOL(Remote, uv, Name)
  375. UPDSHCOL(Remote, uv, Ext)
  376. UPDSHCOL(Remote, uv, Size)
  377. UPDSHCOL(Remote, uv, Changed)
  378. UPDSHCOL(Remote, uv, Rights)
  379. UPDSHCOL(Remote, uv, Owner)
  380. UPDSHCOL(Remote, uv, Group)
  381. UPDSHCOL(Remote, uv, LinkTarget)
  382. UPDSHCOL(Remote, uv, Type)
  383. UPD(HideColumnAction, (ListColumn != NULL))
  384. UPD(BestFitColumnAction, (ListColumn != NULL))
  385. // SESSION
  386. UPD(NewSessionAction, true)
  387. UPD(SiteManagerAction, true)
  388. UPD(DuplicateSessionAction, true)
  389. UPD(CloseSessionAction, true)
  390. UPD(SavedSessionsAction2, true)
  391. UPD(WorkspacesAction, StoredSessions->HasAnyWorkspace())
  392. UPD(OpenedSessionsAction, true)
  393. UPD(SaveCurrentSessionAction2, true)
  394. UPD(SaveWorkspaceAction, true)
  395. // COMMAND
  396. UPD(CompareDirectoriesAction, true)
  397. UPD(SynchronizeAction, true)
  398. UPD(FullSynchronizeAction, true)
  399. UPD(ConsoleAction, true)
  400. UPD(PuttyAction, TTerminalManager::Instance()->CanOpenInPutty())
  401. UPD(SynchronizeBrowsingAction, true)
  402. UPD(CloseApplicationAction, true)
  403. UPD(FileSystemInfoAction, true)
  404. UPD(SessionGenerateUrlAction, true)
  405. UPD(ClearCachesAction, (ScpExplorer->Terminal != NULL) && !ScpExplorer->Terminal->AreCachesEmpty)
  406. UPD(NewFileAction, !WinConfiguration->DisableOpenEdit)
  407. UPD(EditorListCustomizeAction, true)
  408. // CUSTOM COMMANDS
  409. UPD(CustomCommandsAction, true)
  410. UPD(CustomCommandsEnterAction, true)
  411. UPD(CustomCommandsEnterFocusedAction, true)
  412. UPDFUNC(CustomCommandsLastAction, CustomCommandsLastUpdate(CustomCommandsLastAction))
  413. UPDFUNC(CustomCommandsLastFocusedAction, CustomCommandsLastUpdate(CustomCommandsLastFocusedAction))
  414. UPD(CustomCommandsCustomizeAction, true)
  415. // QUEUE
  416. UPDEX(QueueEnableAction, true, ((TAction *)Action)->Checked = ScpExplorer->GetQueueEnabled(), )
  417. #define UPDQUEUE(OPERATION) UPD(Queue ## OPERATION ## Action, \
  418. ScpExplorer->AllowQueueOperation(qo ## OPERATION))
  419. UPDQUEUE(GoTo)
  420. UPDQUEUE(Preferences)
  421. UPDEX(QueueItemQueryAction, ScpExplorer->AllowQueueOperation(qoItemQuery),
  422. ((TAction *)Action)->Visible = true, ((TAction *)Action)->Visible = false)
  423. UPDEX(QueueItemErrorAction, ScpExplorer->AllowQueueOperation(qoItemError),
  424. ((TAction *)Action)->Visible = true, ((TAction *)Action)->Visible = false)
  425. UPDEX(QueueItemPromptAction, ScpExplorer->AllowQueueOperation(qoItemPrompt),
  426. ((TAction *)Action)->Visible = true, ((TAction *)Action)->Visible = false)
  427. UPDQUEUE(ItemDelete)
  428. UPDEX(QueueItemExecuteAction, ScpExplorer->AllowQueueOperation(qoItemExecute),
  429. ((TAction *)Action)->Visible = true, ((TAction *)Action)->Visible =
  430. !ScpExplorer->AllowQueueOperation(qoItemPause) &&
  431. !ScpExplorer->AllowQueueOperation(qoItemResume))
  432. UPDEX(QueueItemPauseAction, ScpExplorer->AllowQueueOperation(qoItemPause),
  433. ((TAction *)Action)->Visible = true, ((TAction *)Action)->Visible = false)
  434. UPDEX(QueueItemResumeAction, ScpExplorer->AllowQueueOperation(qoItemResume),
  435. ((TAction *)Action)->Visible = true, ((TAction *)Action)->Visible = false)
  436. UPDQUEUE(ItemUp)
  437. UPDQUEUE(ItemDown)
  438. UPDQUEUE(PauseAll)
  439. UPDQUEUE(ResumeAll)
  440. UPDQUEUE(DeleteAllDone)
  441. #undef UPDQUEUE
  442. UPDEX(QueueItemSpeedAction, ScpExplorer->AllowQueueOperation(qoItemSpeed, &Param),
  443. QueueItemSpeedAction->Text = SetSpeedLimit(reinterpret_cast<unsigned long>(Param)),
  444. QueueItemSpeedAction->Text = L"")
  445. UPDACT(QueueToggleShowAction,
  446. ((TAction *)Action)->Checked = ScpExplorer->ComponentVisible[fcQueueView])
  447. #define QUEUEACTION(SHOW) UPDACT(Queue ## SHOW ## Action, \
  448. ((TAction *)Action)->Checked = WinConfiguration->QueueView.Show == qv ## SHOW)
  449. QUEUEACTION(Show)
  450. QUEUEACTION(HideWhenEmpty)
  451. QUEUEACTION(Hide)
  452. #undef QUEUEACTION
  453. UPDEX1(QueueCycleOnceEmptyAction, ScpExplorer->AllowQueueOperation(qoOnceEmpty),
  454. QueueCycleOnceEmptyAction->ImageIndex = CurrentQueueOnceEmptyAction()->ImageIndex;
  455. QueueCycleOnceEmptyAction->Checked = !QueueIdleOnceEmptyAction->Checked)
  456. UPD(QueueIdleOnceEmptyAction, ScpExplorer->AllowQueueOperation(qoOnceEmpty))
  457. UPD(QueueDisconnectOnceEmptyAction, ScpExplorer->AllowQueueOperation(qoOnceEmpty))
  458. UPD(QueueShutDownOnceEmptyAction, ScpExplorer->AllowQueueOperation(qoOnceEmpty))
  459. UPDCOMP(CommanderPreferencesBand)
  460. UPDACT(QueueToolbarAction,
  461. ((TAction *)Action)->Enabled = ScpExplorer->ComponentVisible[fcQueueView];
  462. ((TAction *)Action)->Checked = ScpExplorer->ComponentVisible[fcQueueToolbar])
  463. ;
  464. }
  465. //---------------------------------------------------------------------------
  466. void __fastcall TNonVisualDataModule::ExplorerActionsExecute(
  467. TBasicAction *Action, bool &Handled)
  468. {
  469. assert(ScpExplorer);
  470. if (!ScpExplorer->AllowedAction((TAction *)Action, aaExecute))
  471. {
  472. Handled = true;
  473. return;
  474. }
  475. ScpExplorer->BeforeAction();
  476. {
  477. TAutoNestingCounter Counter(FBusy);
  478. // focused operation
  479. EXE(CurrentDeleteFocusedAction, ScpExplorer->ExecuteFileOperationCommand(foDelete, osCurrent, true))
  480. EXE(CurrentPropertiesFocusedAction, ScpExplorer->ExecuteFileOperationCommand(foSetProperties, osCurrent, true))
  481. EXE(CurrentEditFocusedAction, ScpExplorer->ExecuteFile(osCurrent, efDefaultEditor, NULL, true, true))
  482. EXE(CurrentSystemMenuFocusedAction, ScpExplorer->DisplaySystemContextMenu())
  483. // operation
  484. EXE(CurrentEditAction, ScpExplorer->ExecuteFile(osCurrent, efDefaultEditor, NULL, true, false))
  485. EXE(CurrentEditAlternativeAction, CreateEditorListMenu(CurrentEditAlternativeAction))
  486. EXE(CurrentEditInternalAction, ScpExplorer->ExecuteFile(osCurrent, efInternalEditor, NULL, true, false))
  487. EXE(CurrentEditWithAction, ScpExplorer->ExecuteCurrentFileWith())
  488. EXE(CurrentOpenAction, ScpExplorer->ExecuteCurrentFile())
  489. EXE(CurrentAddEditLinkAction, ScpExplorer->AddEditLink(osCurrent, false))
  490. EXE(CurrentAddEditLinkContextAction, ScpExplorer->AddEditLink(osCurrent, false))
  491. EXE(NewLinkAction, ScpExplorer->AddEditLink(osCurrent, true))
  492. EXE(CurrentRenameAction, ScpExplorer->ExecuteFileOperationCommand(foRename, osCurrent, false))
  493. EXE(CurrentDeleteAction, ScpExplorer->ExecuteFileOperationCommand(foDelete, osCurrent, false))
  494. EXE(CurrentDeleteAlternativeAction, ScpExplorer->ExecuteFileOperationCommand(foDelete, osCurrent, false, false, (void*)true))
  495. EXE(CurrentPropertiesAction, ScpExplorer->ExecuteFileOperationCommand(foSetProperties, osCurrent, false))
  496. EXE(FileListToCommandLineAction, ScpExplorer->PanelExport(osCurrent, peFileList, pedCommandLine))
  497. EXE(FileListToClipboardAction, ScpExplorer->PanelExport(osCurrent, peFileList, pedClipboard))
  498. EXE(FullFileListToClipboardAction, ScpExplorer->PanelExport(osCurrent, peFullFileList, pedClipboard))
  499. EXE(FileGenerateUrlAction, ScpExplorer->FileGenerateUrl())
  500. EXE(FileListFromClipboardAction, ScpExplorer->FileListFromClipboard())
  501. // local selected operation
  502. EXE(LocalCopyAction, ScpExplorer->ExecuteFileOperationCommand(foCopy, osLocal, false))
  503. EXE(LocalRenameAction, ScpExplorer->ExecuteFileOperationCommand(foRename, osLocal, false))
  504. EXE(LocalEditAction, ScpExplorer->ExecuteFile(osLocal, efDefaultEditor, NULL, true, false))
  505. EXE(LocalMoveAction, ScpExplorer->ExecuteFileOperationCommand(foMove, osLocal, false))
  506. EXE(LocalCreateDirAction, ScpExplorer->CreateDirectory(osLocal))
  507. EXE(LocalDeleteAction, ScpExplorer->ExecuteFileOperationCommand(foDelete, osLocal, false))
  508. EXE(LocalPropertiesAction, ScpExplorer->ExecuteFileOperationCommand(foSetProperties, osLocal, false))
  509. EXE(LocalAddEditLinkAction, ScpExplorer->AddEditLink(osLocal, false))
  510. // local focused operation
  511. EXE(LocalCopyFocusedAction, ScpExplorer->ExecuteFileOperationCommand(foCopy, osLocal, true))
  512. EXE(LocalMoveFocusedAction, ScpExplorer->ExecuteFileOperationCommand(foMove, osLocal, true))
  513. // remote selected operation
  514. EXE(RemoteCopyAction, ScpExplorer->ExecuteFileOperationCommand(foCopy, osRemote, false))
  515. EXE(RemoteRenameAction, ScpExplorer->ExecuteFileOperationCommand(foRename, osRemote, false))
  516. EXE(RemoteEditAction, ScpExplorer->ExecuteFile(osRemote, efDefaultEditor, NULL, true, false))
  517. EXE(RemoteMoveAction, ScpExplorer->ExecuteFileOperationCommand(foMove, osRemote, false))
  518. EXE(RemoteCreateDirAction, ScpExplorer->CreateDirectory(osRemote))
  519. EXE(RemoteDeleteAction, ScpExplorer->ExecuteFileOperationCommand(foDelete, osRemote, false))
  520. EXE(RemotePropertiesAction, ScpExplorer->ExecuteFileOperationCommand(foSetProperties, osRemote, false))
  521. EXE(RemoteMoveToAction, ScpExplorer->ExecuteFileOperationCommand(foRemoteMove, osCurrent, false))
  522. EXE(RemoteCopyToAction, ScpExplorer->ExecuteFileOperationCommand(foRemoteCopy, osCurrent, false))
  523. EXE(RemoteAddEditLinkAction, ScpExplorer->AddEditLink(osRemote, false))
  524. // remote focused operation
  525. EXE(RemoteCopyFocusedAction, ScpExplorer->ExecuteFileOperationCommand(foCopy, osRemote, true))
  526. EXE(RemoteMoveFocusedAction, ScpExplorer->ExecuteFileOperationCommand(foMove, osRemote, true))
  527. EXE(RemoteMoveToFocusedAction, ScpExplorer->ExecuteFileOperationCommand(foRemoteMove, osCurrent, true))
  528. EXE(RemoteCopyToFocusedAction, ScpExplorer->ExecuteFileOperationCommand(foRemoteCopy, osCurrent, true))
  529. // directory
  530. EXE(CurrentCreateDirAction, ScpExplorer->CreateDirectory(osCurrent))
  531. EXE(NewDirAction, ScpExplorer->CreateDirectory(osCurrent))
  532. EXE(RemoteFindFilesAction, ScpExplorer->RemoteFindFiles())
  533. //selection
  534. EXE(SelectOneAction, DirView(osCurrent)->SelectCurrentItem(DirView(osCurrent)->NortonLike))
  535. EXE(SelectAction, DirView(osCurrent)->DoSelectByMask(true))
  536. EXE(UnselectAction, DirView(osCurrent)->DoSelectByMask(false))
  537. EXE(SelectAllAction, DirView(osCurrent)->SelectAll(smAll))
  538. EXE(InvertSelectionAction, DirView(osCurrent)->SelectAll(smInvert))
  539. EXE(ClearSelectionAction, DirView(osCurrent)->SelectAll(smNone))
  540. EXE(RestoreSelectionAction, DirView(osCurrent)->RestoreSelectedNames())
  541. EXE(LocalSelectAction, DirView(osLocal)->DoSelectByMask(true))
  542. EXE(LocalUnselectAction, DirView(osLocal)->DoSelectByMask(false))
  543. EXE(LocalSelectAllAction, DirView(osLocal)->SelectAll(smAll))
  544. EXE(RemoteSelectAction, DirView(osRemote)->DoSelectByMask(true))
  545. EXE(RemoteUnselectAction, DirView(osRemote)->DoSelectByMask(false))
  546. EXE(RemoteSelectAllAction, DirView(osRemote)->SelectAll(smAll))
  547. EXE(PasteAction2, ScpExplorer->PasteFromClipBoard())
  548. // style
  549. EXE(CurrentCycleStyleAction,
  550. if (DirView(osCurrent)->ViewStyle == vsReport) DirView(osCurrent)->ViewStyle = vsIcon;
  551. else DirView(osCurrent)->ViewStyle = (TViewStyle)(DirView(osCurrent)->ViewStyle + 1);
  552. )
  553. #define STYLEACTION(Style) EXE(Current ## Style ## Action, \
  554. DirView(osCurrent)->ViewStyle = vs ## Style)
  555. STYLEACTION(Icon)
  556. STYLEACTION(SmallIcon)
  557. STYLEACTION(List)
  558. STYLEACTION(Report)
  559. #undef STYLEACTION
  560. #define PANEL_ACTIONS(SIDE) \
  561. EXE(SIDE ## BackAction, ScpExplorer->HistoryGo(os ## SIDE, -1)) \
  562. EXE(SIDE ## ForwardAction, ScpExplorer->HistoryGo(os ## SIDE, 1)) \
  563. EXE(SIDE ## ParentDirAction, DirView(os ## SIDE)->ExecuteParentDirectory()) \
  564. EXE(SIDE ## RootDirAction, DirView(os ## SIDE)->ExecuteRootDirectory()) \
  565. EXE(SIDE ## HomeDirAction, ScpExplorer->HomeDirectory(os ## SIDE)) \
  566. EXE(SIDE ## RefreshAction, DirView(os ## SIDE)->ReloadDirectory()) \
  567. EXE(SIDE ## OpenDirAction, ScpExplorer->OpenDirectory(os ## SIDE)) \
  568. EXE(SIDE ## ChangePathAction, ScpExplorer->ChangePath(os ## SIDE)) \
  569. EXE(SIDE ## AddBookmarkAction, ScpExplorer->AddBookmark(os ## SIDE)) \
  570. EXE(SIDE ## PathToClipboardAction, ScpExplorer->PanelExport(os ## SIDE, pePath, pedClipboard)) \
  571. EXE(SIDE ## FilterAction, ScpExplorer->Filter(os ## SIDE))
  572. PANEL_ACTIONS(Local)
  573. PANEL_ACTIONS(Remote)
  574. #undef PANEL_ACTIONS
  575. EXE(LocalExploreDirectoryAction, ScpExplorer->ExploreLocalDirectory())
  576. //HELP
  577. EXE(AboutAction, DoAboutDialog(Configuration))
  578. EXE(HomepageAction, OpenBrowser(LoadStr(HOMEPAGE_URL)))
  579. EXE(HistoryPageAction, OpenBrowser(LoadStr(HISTORY_URL)))
  580. EXE(TableOfContentsAction, Application->HelpSystem->ShowTableOfContents())
  581. EXE(ForumPageAction, OpenBrowser(LoadStr(FORUM_URL)))
  582. EXE(CheckForUpdatesAction, CheckForUpdates(false))
  583. EXE(UpdatesPreferencesAction, PreferencesDialog(pmUpdates))
  584. EXE(DonatePageAction, OpenBrowser(LoadStr(DONATE_URL)))
  585. EXE(DownloadPageAction, OpenBrowser(LoadStr(DOWNLOAD_URL)))
  586. // VIEW
  587. EXECOMP(SessionsTabs)
  588. EXECOMP(StatusBar)
  589. EXECOMP(ToolBar2)
  590. EXECOMP(LocalStatusBar)
  591. EXECOMP(RemoteStatusBar)
  592. EXECOMP(ExplorerMenuBand)
  593. EXECOMP(ExplorerAddressBand)
  594. EXECOMP(ExplorerToolbarBand)
  595. EXECOMP(ExplorerSelectionBand)
  596. EXECOMP(ExplorerSessionBand)
  597. EXECOMP(ExplorerPreferencesBand)
  598. EXECOMP(ExplorerSortBand)
  599. EXECOMP(ExplorerUpdatesBand)
  600. EXECOMP(ExplorerTransferBand)
  601. EXECOMP(ExplorerCustomCommandsBand)
  602. EXECOMP(CommanderMenuBand)
  603. EXECOMP(CommanderSessionBand)
  604. EXECOMP(CommanderPreferencesBand)
  605. EXECOMP(CommanderSortBand)
  606. EXECOMP(CommanderCommandsBand)
  607. EXECOMP(CommanderUpdatesBand)
  608. EXECOMP(CommanderTransferBand)
  609. EXECOMP(CommanderCustomCommandsBand)
  610. EXECOMP(CommanderLocalHistoryBand)
  611. EXECOMP(CommanderLocalNavigationBand)
  612. EXECOMP(CommanderLocalFileBand)
  613. EXECOMP(CommanderLocalSelectionBand)
  614. EXECOMP(CommanderRemoteHistoryBand)
  615. EXECOMP(CommanderRemoteNavigationBand)
  616. EXECOMP(CommanderRemoteFileBand)
  617. EXECOMP(CommanderRemoteSelectionBand)
  618. EXECOMP(CommandLinePanel)
  619. EXECOMP(RemoteTree)
  620. EXECOMP(LocalTree)
  621. EXE(GoToCommandLineAction, ScpExplorer->GoToCommandLine())
  622. EXE(GoToTreeAction, ScpExplorer->GoToTree())
  623. EXE(ViewLogAction, WinConfiguration->LogView =
  624. (WinConfiguration->LogView == lvNone ? lvWindow : lvNone) )
  625. EXE(ShowHiddenFilesAction, ScpExplorer->ToggleShowHiddenFiles())
  626. EXE(FormatSizeBytesNoneAction, ScpExplorer->SetFormatSizeBytes(fbNone))
  627. EXE(FormatSizeBytesKilobytesAction, ScpExplorer->SetFormatSizeBytes(fbKilobytes))
  628. EXE(FormatSizeBytesShortAction, ScpExplorer->SetFormatSizeBytes(fbShort))
  629. EXE(AutoReadDirectoryAfterOpAction, ScpExplorer->ToggleAutoReadDirectoryAfterOp())
  630. EXE(PreferencesAction, PreferencesDialog(::pmDefault) )
  631. EXE(PresetsPreferencesAction, PreferencesDialog(pmPresets) )
  632. EXE(LockToolbarsAction, WinConfiguration->LockToolbars = !WinConfiguration->LockToolbars)
  633. EXE(SelectiveToolbarTextAction, WinConfiguration->SelectiveToolbarText = !WinConfiguration->SelectiveToolbarText)
  634. EXECOMP(CustomCommandsBand)
  635. EXE(ColorMenuAction, CreateSessionColorMenu(ColorMenuAction));
  636. #define COLVIEWPROPS ((TCustomDirViewColProperties*)(((TCustomDirView*)(((TListColumns*)(ListColumn->Collection))->Owner()))->ColProperties))
  637. // SORT
  638. EXESORTA(Local)
  639. EXESORT(Local, dv, Name)
  640. EXESORT(Local, dv, Ext)
  641. EXESORT(Local, dv, Size)
  642. EXESORT(Local, dv, Type)
  643. EXESORT(Local, dv, Changed)
  644. EXESORT(Local, dv, Attr)
  645. EXESORTA(Remote)
  646. EXESORT(Remote, uv, Name)
  647. EXESORT(Remote, uv, Ext)
  648. EXESORT(Remote, uv, Size)
  649. EXESORT(Remote, uv, Changed)
  650. EXESORT(Remote, uv, Rights)
  651. EXESORT(Remote, uv, Owner)
  652. EXESORT(Remote, uv, Group)
  653. EXESORT(Remote, uv, Type)
  654. EXESORTA(Current)
  655. EXESORTC(Name, dvName, uvName)
  656. EXESORTC(Ext, dvExt, uvExt)
  657. EXESORTC(Size, dvSize, uvSize)
  658. EXESORTC(Type, dvType, uvType)
  659. EXESORTC(Changed, dvChanged, uvChanged)
  660. EXESORTC(Rights, dvAttr, uvRights)
  661. EXESORTC(Owner, dvName, uvOwner)
  662. EXESORTC(Group, dvName, uvGroup)
  663. EXE(SortColumnAscendingAction, assert(ListColumn);
  664. COLVIEWPROPS->SortColumn = ListColumn->Index; COLVIEWPROPS->SortAscending = true; ListColumn = NULL )
  665. EXE(SortColumnDescendingAction, assert(ListColumn);
  666. COLVIEWPROPS->SortColumn = ListColumn->Index; COLVIEWPROPS->SortAscending = false; ListColumn = NULL )
  667. // SHOW/HIDE COLUMN
  668. EXESHCOL(Local, dv, Name)
  669. EXESHCOL(Local, dv, Ext)
  670. EXESHCOL(Local, dv, Size)
  671. EXESHCOL(Local, dv, Type)
  672. EXESHCOL(Local, dv, Changed)
  673. EXESHCOL(Local, dv, Attr)
  674. EXESHCOL(Remote, uv, Name)
  675. EXESHCOL(Remote, uv, Ext)
  676. EXESHCOL(Remote, uv, Size)
  677. EXESHCOL(Remote, uv, Changed)
  678. EXESHCOL(Remote, uv, Rights)
  679. EXESHCOL(Remote, uv, Owner)
  680. EXESHCOL(Remote, uv, Group)
  681. EXESHCOL(Remote, uv, LinkTarget)
  682. EXESHCOL(Remote, uv, Type)
  683. EXE(HideColumnAction, assert(ListColumn);
  684. COLVIEWPROPS->Visible[ListColumn->Index] = false; ListColumn = NULL )
  685. EXE(BestFitColumnAction, assert(ListColumn); ListColumn = NULL ) // TODO
  686. #undef COLVIEWPROPS
  687. // SESSION
  688. EXE(NewSessionAction, ScpExplorer->NewSession(false))
  689. EXE(SiteManagerAction, ScpExplorer->NewSession(true))
  690. EXE(DuplicateSessionAction, ScpExplorer->DuplicateSession())
  691. EXE(CloseSessionAction, ScpExplorer->CloseSession())
  692. EXE(SavedSessionsAction2, CreateSessionListMenu(SavedSessionsAction2))
  693. EXE(WorkspacesAction, CreateWorkspacesMenu(WorkspacesAction))
  694. EXE(OpenedSessionsAction, CreateOpenedSessionListMenu(OpenedSessionsAction))
  695. EXE(SaveCurrentSessionAction2, ScpExplorer->SaveCurrentSession())
  696. EXE(SaveWorkspaceAction, ScpExplorer->SaveWorkspace(false))
  697. // COMMAND
  698. EXE(CompareDirectoriesAction, ScpExplorer->CompareDirectories())
  699. EXE(SynchronizeAction, ScpExplorer->SynchronizeDirectories())
  700. EXE(FullSynchronizeAction, ScpExplorer->FullSynchronizeDirectories())
  701. EXE(ConsoleAction, ScpExplorer->OpenConsole())
  702. EXE(PuttyAction, TTerminalManager::Instance()->OpenInPutty())
  703. EXE(SynchronizeBrowsingAction, ScpExplorer->SynchronizeBrowsingChanged())
  704. EXE(CloseApplicationAction, ScpExplorer->Close())
  705. EXE(FileSystemInfoAction, ScpExplorer->FileSystemInfo())
  706. EXE(SessionGenerateUrlAction, ScpExplorer->SessionGenerateUrl())
  707. EXE(ClearCachesAction, ScpExplorer->Terminal->ClearCaches())
  708. EXE(NewFileAction, ScpExplorer->EditNew(osCurrent))
  709. EXE(EditorListCustomizeAction, PreferencesDialog(pmEditor))
  710. // CUSTOM COMMANDS
  711. EXE(CustomCommandsAction, CreateCustomCommandsMenu(CustomCommandsAction))
  712. EXE(CustomCommandsEnterAction, ScpExplorer->AdHocCustomCommand(false))
  713. EXE(CustomCommandsEnterFocusedAction, ScpExplorer->AdHocCustomCommand(true))
  714. EXE(CustomCommandsLastAction, ScpExplorer->LastCustomCommand(false))
  715. EXE(CustomCommandsLastFocusedAction, ScpExplorer->LastCustomCommand(true))
  716. EXE(CustomCommandsCustomizeAction, PreferencesDialog(pmCustomCommands))
  717. // QUEUE
  718. EXE(QueueEnableAction, ScpExplorer->ToggleQueueEnabled())
  719. #define EXEQUEUE(OPERATION) EXE(Queue ## OPERATION ## Action, \
  720. ScpExplorer->ExecuteQueueOperation(qo ## OPERATION))
  721. EXEQUEUE(GoTo)
  722. EXEQUEUE(Preferences)
  723. EXEQUEUE(ItemQuery)
  724. EXEQUEUE(ItemError)
  725. EXEQUEUE(ItemPrompt)
  726. EXEQUEUE(ItemDelete)
  727. EXEQUEUE(ItemExecute)
  728. EXEQUEUE(ItemPause)
  729. EXEQUEUE(ItemResume)
  730. EXEQUEUE(ItemUp)
  731. EXEQUEUE(ItemDown)
  732. EXEQUEUE(PauseAll)
  733. EXEQUEUE(ResumeAll)
  734. EXEQUEUE(DeleteAllDone)
  735. #undef EXEQUEUE
  736. EXE(QueueToggleShowAction, ScpExplorer->ToggleQueueVisibility())
  737. #define QUEUEACTION(SHOW) EXE(Queue ## SHOW ## Action, \
  738. TQueueViewConfiguration Config = WinConfiguration->QueueView; \
  739. if (Config.Show != qvShow) Config.LastHideShow = Config.Show; \
  740. Config.Show = qv ## SHOW; \
  741. WinConfiguration->QueueView = Config)
  742. QUEUEACTION(Show)
  743. QUEUEACTION(HideWhenEmpty)
  744. QUEUEACTION(Hide)
  745. #undef QUEUEACTION
  746. EXE(QueueCycleOnceEmptyAction, CycleQueueOnceEmptyAction());
  747. EXE(QueueIdleOnceEmptyAction, SetQueueOnceEmptyAction(QueueIdleOnceEmptyAction))
  748. EXE(QueueDisconnectOnceEmptyAction, SetQueueOnceEmptyAction(QueueDisconnectOnceEmptyAction))
  749. EXE(QueueShutDownOnceEmptyAction, SetQueueOnceEmptyAction(QueueShutDownOnceEmptyAction))
  750. EXECOMP(QueueToolbar);
  751. EXE(QueueItemSpeedAction, )
  752. ;
  753. }
  754. DoIdle();
  755. }
  756. //---------------------------------------------------------------------------
  757. void __fastcall TNonVisualDataModule::UpdateNonVisibleActions()
  758. {
  759. // following actions needs to be updated even when all clients
  760. // are invisible, so the queue list toolbar button can be shown
  761. NonVisualDataModule->QueueItemQueryAction->Update();
  762. NonVisualDataModule->QueueItemErrorAction->Update();
  763. NonVisualDataModule->QueueItemPromptAction->Update();
  764. }
  765. //---------------------------------------------------------------------------
  766. #define CTRL TShiftState() << ssCtrl
  767. #define ALT TShiftState() << ssAlt
  768. #define SHIFT TShiftState() << ssShift
  769. #define CTRLSHIFT TShiftState() << ssCtrl << ssShift
  770. #define CTRLALT TShiftState() << ssCtrl << ssAlt
  771. #define NONE TShiftState()
  772. void __fastcall TNonVisualDataModule::ExplorerShortcuts()
  773. {
  774. // Directory
  775. CurrentCreateDirAction->ShortCut = ShortCut(L'D', CTRL);
  776. // File operation
  777. CurrentRenameAction->ShortCut = ShortCut(VK_F2, NONE);
  778. CurrentEditAction->ShortCut = ShortCut(L'E', CTRL);
  779. CurrentAddEditLinkAction->ShortCut = ShortCut(L'L', CTRLALT);
  780. CurrentEditInternalAction->ShortCut = 0;
  781. // Focused operation
  782. RemoteCopyAction->ShortCut = ShortCut(L'C', CTRL);
  783. RemoteMoveAction->ShortCut = ShortCut(L'M', CTRL);
  784. CurrentDeleteFocusedAction->ShortCut = ShortCut(VK_DELETE, NONE);
  785. CurrentPropertiesFocusedAction->ShortCut = ShortCut(VK_RETURN, ALT);
  786. RemoteMoveToFocusedAction->ShortCut = ShortCut(L'M', CTRLALT);
  787. // remote directory
  788. RemoteOpenDirAction->ShortCut = ShortCut(L'O', CTRL);
  789. RemoteRefreshAction->ShortCut = ShortCut(VK_F5, NONE);
  790. RemoteHomeDirAction->ShortCut = ShortCut(L'H', CTRL);
  791. RemotePathToClipboardAction->ShortCut = ShortCut(L'P', CTRLSHIFT);
  792. // selected operation
  793. CurrentDeleteAlternativeAction->ShortCut = ShortCut(VK_DELETE, SHIFT);
  794. RemoteMoveToAction->ShortCut = ShortCut(L'M', CTRLALT);
  795. // selection
  796. SelectAction->ShortCut = ShortCut(VK_ADD, NONE);
  797. UnselectAction->ShortCut = ShortCut(VK_SUBTRACT, NONE);
  798. SelectAllAction->ShortCut = ShortCut(L'A', CTRL);
  799. InvertSelectionAction->ShortCut = ShortCut(VK_MULTIPLY, NONE);
  800. ClearSelectionAction->ShortCut = ShortCut(L'L', CTRL);
  801. RestoreSelectionAction->ShortCut = ShortCut(L'R', CTRLSHIFT);
  802. // commands
  803. NewFileAction->ShortCut = ShortCut(L'E', CTRLSHIFT);
  804. RemoteFindFilesAction->ShortCut = ShortCut(VK_F3, NONE);
  805. CloseApplicationAction->ShortCut = ShortCut(VK_F4, ALT);
  806. CloneShortcuts();
  807. }
  808. //---------------------------------------------------------------------------
  809. void __fastcall TNonVisualDataModule::CommanderShortcuts()
  810. {
  811. bool ExplorerKeyboardShortcuts = WinConfiguration->ScpCommander.ExplorerKeyboardShortcuts;
  812. // Directory
  813. CurrentCreateDirAction->ShortCut = ShortCut(VK_F7, NONE);
  814. // File operation
  815. CurrentRenameAction->ShortCut = ShortCut(VK_F2, NONE);
  816. CurrentEditAction->ShortCut = ShortCut(VK_F4, NONE);
  817. CurrentAddEditLinkAction->ShortCut = ShortCut(VK_F6, ALT);
  818. CurrentEditInternalAction->ShortCut = ShortCut(VK_F4, CTRLALT);
  819. // Focused operation
  820. RemoteCopyAction->ShortCut =
  821. ExplorerKeyboardShortcuts ? ShortCut(L'K', CTRL) : ShortCut(VK_F5, NONE);
  822. RemoteMoveAction->ShortCut = ShortCut(VK_F6, NONE);
  823. CurrentDeleteFocusedAction->ShortCut = ShortCut(VK_F8, NONE);
  824. CurrentPropertiesFocusedAction->ShortCut = ShortCut(VK_F9, NONE);
  825. RemoteMoveToFocusedAction->ShortCut = ShortCut(VK_F6, SHIFT);
  826. RemoteCopyToFocusedAction->ShortCut = ShortCut(VK_F5, SHIFT);
  827. // remote directory
  828. RemoteOpenDirAction->ShortCut = ShortCut(L'O', CTRL);
  829. RemoteRefreshAction->ShortCut =
  830. ExplorerKeyboardShortcuts ? ShortCut(VK_F5, NONE) : ShortCut(L'R', CTRL);
  831. RemoteHomeDirAction->ShortCut = ShortCut(L'H', CTRL);
  832. RemotePathToClipboardAction->ShortCut = ShortCut(VK_OEM_6 /* ] */, CTRL);
  833. // local directory
  834. LocalPathToClipboardAction->ShortCut = ShortCut(VK_OEM_4 /* [ */, CTRL);
  835. // selected operation
  836. CurrentDeleteAction->SecondaryShortCuts->Clear();
  837. CurrentDeleteAction->SecondaryShortCuts->Add(ShortCutToText(ShortCut(VK_DELETE, NONE)));
  838. CurrentDeleteAlternativeAction->ShortCut = ShortCut(VK_F8, SHIFT);
  839. CurrentDeleteAlternativeAction->SecondaryShortCuts->Clear();
  840. CurrentDeleteAlternativeAction->SecondaryShortCuts->Add(ShortCutToText(ShortCut(VK_DELETE, SHIFT)));
  841. RemoteMoveToAction->ShortCut = ShortCut(VK_F6, SHIFT);
  842. RemoteCopyToAction->ShortCut = ShortCut(VK_F5, SHIFT);
  843. // selection
  844. SelectOneAction->ShortCut = VK_INSERT;
  845. SelectAction->ShortCut = ShortCut(VK_ADD, NONE);
  846. UnselectAction->ShortCut = ShortCut(VK_SUBTRACT, NONE);
  847. SelectAllAction->ShortCut = ShortCut(L'A', CTRL);
  848. InvertSelectionAction->ShortCut = ShortCut(VK_MULTIPLY, NONE);
  849. ClearSelectionAction->ShortCut = ShortCut(L'L', CTRL);
  850. RestoreSelectionAction->ShortCut = ShortCut(L'R', CTRLSHIFT);
  851. // commands
  852. NewFileAction->ShortCut = ShortCut(VK_F4, SHIFT);
  853. RemoteFindFilesAction->ShortCut =
  854. ExplorerKeyboardShortcuts ? ShortCut(VK_F3, NONE) : ShortCut(VK_F7, ALT);
  855. // legacy shortcut (can be removed when necessary)
  856. NewFileAction->SecondaryShortCuts->Add(ShortCutToText(ShortCut(VK_F4, CTRLSHIFT)));
  857. CloseApplicationAction->ShortCut = ShortCut(VK_F10, NONE);
  858. CloneShortcuts();
  859. }
  860. #undef CTRL
  861. #undef ALT
  862. #undef NONE
  863. //---------------------------------------------------------------------------
  864. void __fastcall TNonVisualDataModule::CloneShortcuts()
  865. {
  866. // Directory
  867. NewDirAction->ShortCut = CurrentCreateDirAction->ShortCut;
  868. // File operation
  869. CurrentAddEditLinkContextAction->ShortCut = CurrentAddEditLinkAction->ShortCut;
  870. LocalAddEditLinkAction->ShortCut = CurrentAddEditLinkAction->ShortCut;
  871. RemoteAddEditLinkAction->ShortCut = CurrentAddEditLinkAction->ShortCut;
  872. // local directory
  873. LocalOpenDirAction->ShortCut = RemoteOpenDirAction->ShortCut;
  874. LocalRefreshAction->ShortCut = RemoteRefreshAction->ShortCut;
  875. LocalHomeDirAction->ShortCut = RemoteHomeDirAction->ShortCut;
  876. // selected operation
  877. CurrentDeleteAction->ShortCut = CurrentDeleteFocusedAction->ShortCut;
  878. CurrentPropertiesAction->ShortCut = CurrentPropertiesFocusedAction->ShortCut;
  879. // local selected operation
  880. LocalCopyAction->ShortCut = RemoteCopyAction->ShortCut;
  881. LocalRenameAction->ShortCut = CurrentRenameAction->ShortCut;
  882. LocalEditAction->ShortCut = CurrentEditAction->ShortCut;
  883. LocalMoveAction->ShortCut = RemoteMoveAction->ShortCut;
  884. LocalCreateDirAction->ShortCut = CurrentCreateDirAction->ShortCut;
  885. LocalDeleteAction->ShortCut = CurrentDeleteAction->ShortCut;
  886. LocalPropertiesAction->ShortCut = CurrentPropertiesAction->ShortCut;
  887. // local focused operation
  888. LocalCopyFocusedAction->ShortCut = LocalCopyAction->ShortCut;
  889. LocalMoveFocusedAction->ShortCut = LocalMoveAction->ShortCut;
  890. // remote selected operation
  891. RemoteRenameAction->ShortCut = CurrentRenameAction->ShortCut;
  892. RemoteEditAction->ShortCut = CurrentEditAction->ShortCut;
  893. RemoteCreateDirAction->ShortCut = CurrentCreateDirAction->ShortCut;
  894. RemoteDeleteAction->ShortCut = CurrentDeleteAction->ShortCut;
  895. RemotePropertiesAction->ShortCut = CurrentPropertiesAction->ShortCut;
  896. // remote focused operation
  897. RemoteCopyFocusedAction->ShortCut = RemoteCopyAction->ShortCut;
  898. RemoteMoveFocusedAction->ShortCut = RemoteMoveAction->ShortCut;
  899. // selection
  900. LocalSelectAction->ShortCut = SelectAction->ShortCut;
  901. LocalUnselectAction->ShortCut = UnselectAction->ShortCut;
  902. LocalSelectAllAction->ShortCut = SelectAllAction->ShortCut;
  903. RemoteSelectAction->ShortCut = SelectAction->ShortCut;
  904. RemoteUnselectAction->ShortCut = UnselectAction->ShortCut;
  905. RemoteSelectAllAction->ShortCut = SelectAllAction->ShortCut;
  906. }
  907. //---------------------------------------------------------------------------
  908. void __fastcall TNonVisualDataModule::SetScpExplorer(TCustomScpExplorerForm * value)
  909. {
  910. FScpExplorer = value;
  911. SessionIdleTimer->Enabled = (FScpExplorer != NULL);
  912. }
  913. //---------------------------------------------------------------------------
  914. void __fastcall TNonVisualDataModule::SessionIdleTimerTimer(
  915. TObject */*Sender*/)
  916. {
  917. DoIdle();
  918. }
  919. //---------------------------------------------------------------------------
  920. void __fastcall TNonVisualDataModule::DoIdle()
  921. {
  922. if (!FSessionIdleTimerExecuting)
  923. {
  924. FSessionIdleTimerExecuting = true;
  925. try
  926. {
  927. assert(ScpExplorer);
  928. ScpExplorer->Idle();
  929. }
  930. __finally
  931. {
  932. FSessionIdleTimerExecuting = false;
  933. }
  934. }
  935. }
  936. //---------------------------------------------------------------------------
  937. void __fastcall TNonVisualDataModule::CreateCustomCommandsMenu(
  938. TTBCustomItem * Menu, bool OnFocused, bool Toolbar, bool Both)
  939. {
  940. for (int Index = 0; Index < WinConfiguration->CustomCommandList->Count; Index++)
  941. {
  942. const TCustomCommandType * Command = WinConfiguration->CustomCommandList->Commands[Index];
  943. int State;
  944. if (!Both)
  945. {
  946. State = ScpExplorer->CustomCommandState(*Command, OnFocused);
  947. }
  948. else
  949. {
  950. State = ScpExplorer->BothCustomCommandState(*Command);
  951. }
  952. if (State >= 0)
  953. {
  954. TTBCustomItem * Item = new TTBXItem(Owner);
  955. Item->Caption = Command->Name;
  956. if (Toolbar)
  957. {
  958. Item->Caption = EscapeHotkey(StripHotkey(Item->Caption));
  959. }
  960. Item->Tag = Index;
  961. Item->Enabled = (State > 0);
  962. if (OnFocused)
  963. {
  964. Item->Tag = Item->Tag | 0x0100;
  965. }
  966. if (Both)
  967. {
  968. Item->Tag = Item->Tag | 0x0200;
  969. }
  970. Item->Hint = FMTLOAD(CUSTOM_COMMAND_HINT, (StripHotkey(Command->Name)));
  971. if (!Both)
  972. {
  973. Item->ShortCut = Command->ShortCut;
  974. }
  975. Item->OnClick = CustomCommandClick;
  976. Menu->Add(Item);
  977. }
  978. }
  979. TTBCustomItem * Item;
  980. if (!Both)
  981. {
  982. Item = new TTBXItem(Menu);
  983. Item->Action = OnFocused ? CustomCommandsEnterFocusedAction : CustomCommandsEnterAction;
  984. Menu->Add(Item);
  985. Item = new TTBXItem(Menu);
  986. Item->Action = OnFocused ? CustomCommandsLastFocusedAction : CustomCommandsLastAction;
  987. if (Toolbar)
  988. {
  989. Item->Caption = EscapeHotkey(StripHotkey(LoadStr(CUSTOM_COMMAND_LAST_SHORT)));
  990. }
  991. Menu->Add(Item);
  992. }
  993. AddMenuSeparator(Menu);
  994. if (!Toolbar && !Both)
  995. {
  996. Item = new TTBXItem(Menu);
  997. Item->Action = CustomCommandsBandAction;
  998. Menu->Add(Item);
  999. }
  1000. Item = new TTBXItem(Menu);
  1001. Item->Action = CustomCommandsCustomizeAction;
  1002. Menu->Add(Item);
  1003. }
  1004. //---------------------------------------------------------------------------
  1005. void __fastcall TNonVisualDataModule::CreateCustomCommandsMenu(TAction * Action)
  1006. {
  1007. assert(Action);
  1008. TTBCustomItem * Menu = dynamic_cast<TTBCustomItem *>(Action->ActionComponent);
  1009. if (Menu)
  1010. {
  1011. int PrevCount = Menu->Count;
  1012. bool OnFocused = (Menu == RemoteDirViewCustomCommandsMenu);
  1013. CreateCustomCommandsMenu(Menu, OnFocused, false, false);
  1014. for (int Index = 0; Index < PrevCount; Index++)
  1015. {
  1016. Menu->Delete(0);
  1017. }
  1018. }
  1019. }
  1020. //---------------------------------------------------------------------------
  1021. void __fastcall TNonVisualDataModule::UpdateCustomCommandsToolbar(TTBXToolbar * Toolbar)
  1022. {
  1023. // can be called while explorer is being created
  1024. if (ScpExplorer == NULL)
  1025. {
  1026. return;
  1027. }
  1028. int AdditionalCommands = 4;
  1029. TCustomCommandList * CustomCommandList = WinConfiguration->CustomCommandList;
  1030. bool Changed = (CustomCommandList->Count != (Toolbar->Items->Count - AdditionalCommands));
  1031. if (!Changed)
  1032. {
  1033. int Index = 0;
  1034. while (!Changed && (Index < CustomCommandList->Count))
  1035. {
  1036. Changed =
  1037. (Toolbar->Items->Items[Index]->Caption !=
  1038. EscapeHotkey(StripHotkey(CustomCommandList->Commands[Index]->Name)));
  1039. Index++;
  1040. }
  1041. }
  1042. if (Changed)
  1043. {
  1044. Toolbar->BeginUpdate();
  1045. try
  1046. {
  1047. Toolbar->Items->Clear();
  1048. CreateCustomCommandsMenu(Toolbar->Items, false, true, false);
  1049. assert(CustomCommandList->Count == (Toolbar->Items->Count - AdditionalCommands));
  1050. }
  1051. __finally
  1052. {
  1053. Toolbar->EndUpdate();
  1054. }
  1055. }
  1056. else
  1057. {
  1058. for (int Index = 0; Index < Toolbar->Items->Count - AdditionalCommands; Index++)
  1059. {
  1060. TTBCustomItem * Item = Toolbar->Items->Items[Index];
  1061. int CommandIndex = (Item->Tag & 0x00FF);
  1062. assert(CommandIndex == Index);
  1063. int State = ScpExplorer->CustomCommandState(
  1064. *CustomCommandList->Commands[CommandIndex], false);
  1065. assert(State >= 0);
  1066. Item->Enabled = (State > 0);
  1067. }
  1068. }
  1069. }
  1070. //---------------------------------------------------------------------------
  1071. void __fastcall TNonVisualDataModule::CustomCommandClick(TObject * Sender)
  1072. {
  1073. TTBCustomItem * Item = dynamic_cast<TTBCustomItem *>(Sender);
  1074. assert(Item);
  1075. const TCustomCommandType * Command = WinConfiguration->CustomCommandList->Commands[Item->Tag & 0x00FF];
  1076. if (FLAGCLEAR(Item->Tag, 0x0200))
  1077. {
  1078. ScpExplorer->ExecuteFileOperationCommand(foCustomCommand, osRemote,
  1079. FLAGSET(Item->Tag, 0x0100), false, const_cast<TCustomCommandType *>(Command));
  1080. }
  1081. else
  1082. {
  1083. ScpExplorer->BothCustomCommand(*Command);
  1084. }
  1085. }
  1086. //---------------------------------------------------------------------------
  1087. void __fastcall TNonVisualDataModule::CreateSessionColorMenu(TAction * Action)
  1088. {
  1089. if (ALWAYS_TRUE(Action->ActionComponent != NULL))
  1090. {
  1091. ::CreateSessionColorMenu(Action->ActionComponent, ScpExplorer->SessionColor,
  1092. SessionColorChange);
  1093. }
  1094. }
  1095. //---------------------------------------------------------------------------
  1096. void __fastcall TNonVisualDataModule::SessionColorChange(TColor Color)
  1097. {
  1098. ScpExplorer->SessionColor = Color;
  1099. }
  1100. //---------------------------------------------------------------------------
  1101. void __fastcall TNonVisualDataModule::CreateSessionListMenu(TAction * Action)
  1102. {
  1103. StoredSessions->Load();
  1104. CreateSessionListMenuLevel(
  1105. dynamic_cast<TTBCustomItem *>(Action->ActionComponent), 0, 0);
  1106. }
  1107. //---------------------------------------------------------------------------
  1108. UnicodeString __fastcall TNonVisualDataModule::GetSessionFolderRoot(
  1109. TSessionData * Data, int Level)
  1110. {
  1111. UnicodeString Path = Data->Name;
  1112. UnicodeString Root;
  1113. for (int ALevel = 0; ALevel < Level; ALevel++)
  1114. {
  1115. Root.Insert(::CutToChar(Path, L'/', false) + L'/', Root.Length() + 1);
  1116. }
  1117. return Root;
  1118. }
  1119. //---------------------------------------------------------------------------
  1120. void __fastcall TNonVisualDataModule::CreateSessionListMenuLevel(
  1121. TTBCustomItem * Menu, int Index, int Level)
  1122. {
  1123. Menu->Clear();
  1124. TTBCustomItem * Item = new TTBXItem(Menu);
  1125. UnicodeString Root;
  1126. if (Level == 0)
  1127. {
  1128. Item->Action = SiteManagerAction;
  1129. Root = L"";
  1130. }
  1131. else
  1132. {
  1133. assert(Index < StoredSessions->Count);
  1134. TSessionData * Data = StoredSessions->Sessions[Index];
  1135. Root = GetSessionFolderRoot(Data, Level);
  1136. Item->Caption = LoadStr(SAVEDSESSIONFOLDER_THIS_OPEN);
  1137. Item->Tag = MAKELONG(Index, Level);
  1138. UnicodeString FolderName = Root;
  1139. if (ALWAYS_TRUE(!FolderName.IsEmpty() && FolderName[FolderName.Length()] == L'/'))
  1140. {
  1141. FolderName.Delete(FolderName.Length(), 1);
  1142. }
  1143. Item->Hint = FMTLOAD(SAVEDSESSIONFOLDER_THIS_HINT, (FolderName));
  1144. Item->OnClick = SessionFolderThisItemClick;
  1145. }
  1146. Menu->Insert(Menu->Count, Item);
  1147. AddMenuSeparator(Menu);
  1148. int FirstSession = Menu->Count;
  1149. UnicodeString PrevName;
  1150. while (Index < StoredSessions->Count)
  1151. {
  1152. TSessionData * Data = StoredSessions->Sessions[Index];
  1153. if (!AnsiSameText(Data->Name.SubString(1, Root.Length()), Root))
  1154. {
  1155. // Sessions are sorted, so no chance further sessions may match
  1156. break;
  1157. }
  1158. else if (!Data->IsWorkspace)
  1159. {
  1160. UnicodeString Name = Data->Name.SubString(Root.Length() + 1, Data->Name.Length() - Root.Length());
  1161. int P = Name.Pos(L'/');
  1162. if (P > 0)
  1163. {
  1164. Name.SetLength(P - 1);
  1165. }
  1166. if (Name != PrevName)
  1167. {
  1168. if (P > 0)
  1169. {
  1170. TTBCustomItem * Item = new TTBXSubmenuItem(Menu);
  1171. Item->Caption = Name;
  1172. Item->Tag = ((Level + 1) << 16) | Index; // MAKELONG
  1173. Item->Hint = FMTLOAD(SAVEDSESSIONFOLDER_HINT, (Root + Name));
  1174. Item->ImageIndex = SavedSessionsAction2->ImageIndex;
  1175. Item->OnClick = SessionFolderItemClick;
  1176. Menu->Insert(FirstSession, Item);
  1177. FirstSession++;
  1178. }
  1179. else
  1180. {
  1181. TTBCustomItem * Item = new TTBXItem(Menu);
  1182. Item->Caption = Name;
  1183. Item->Tag = Index;
  1184. Item->Hint = FMTLOAD(SAVEDSESSION_HINT, (Data->Name));
  1185. Item->OnClick = SessionItemClick;
  1186. Menu->Insert(Menu->Count, Item);
  1187. }
  1188. PrevName = Name;
  1189. }
  1190. }
  1191. Index++;
  1192. }
  1193. }
  1194. //---------------------------------------------------------------------------
  1195. void __fastcall TNonVisualDataModule::SessionFolderItemClick(TObject * Sender)
  1196. {
  1197. TTBCustomItem * Item = dynamic_cast<TTBCustomItem *>(Sender);
  1198. assert(Item != NULL);
  1199. CreateSessionListMenuLevel(Item, LOWORD(Item->Tag), HIWORD(Item->Tag));
  1200. }
  1201. //---------------------------------------------------------------------------
  1202. void __fastcall TNonVisualDataModule::SessionFolderThisItemClick(TObject * Sender)
  1203. {
  1204. TTBCustomItem * Item = NOT_NULL(dynamic_cast<TTBCustomItem *>(Sender));
  1205. int Index = LOWORD(Item->Tag);
  1206. int Level = HIWORD(Item->Tag);
  1207. UnicodeString Folder = GetSessionFolderRoot(StoredSessions->Sessions[Index], Level);
  1208. ScpExplorer->OpenFolderOrWorkspace(Folder);
  1209. }
  1210. //---------------------------------------------------------------------------
  1211. void __fastcall TNonVisualDataModule::SessionItemClick(TObject * Sender)
  1212. {
  1213. assert(StoredSessions && (((TTBCustomItem *)Sender)->Tag < StoredSessions->Count));
  1214. ScpExplorer->OpenStoredSession(StoredSessions->Sessions[((TTBCustomItem *)Sender)->Tag]);
  1215. }
  1216. //---------------------------------------------------------------------------
  1217. void __fastcall TNonVisualDataModule::CreateWorkspacesMenu(TAction * Action)
  1218. {
  1219. StoredSessions->Load();
  1220. if (!StoredSessions->HasAnyWorkspace())
  1221. {
  1222. Abort();
  1223. }
  1224. else
  1225. {
  1226. TTBCustomItem * Menu =
  1227. NOT_NULL(dynamic_cast<TTBCustomItem *>(Action->ActionComponent));
  1228. Menu->Clear();
  1229. std::unique_ptr<TStrings> Workspaces(StoredSessions->GetWorkspaces());
  1230. for (int Index = 0; Index < Workspaces->Count; Index++)
  1231. {
  1232. TTBCustomItem * Item = new TTBXItem(Menu);
  1233. Item->Caption = Workspaces->Strings[Index];
  1234. Item->Tag = Index;
  1235. Item->Hint = FMTLOAD(WORKSPACE_HINT, (Workspaces->Strings[Index]));
  1236. Item->OnClick = WorkspaceItemClick;
  1237. Menu->Insert(Menu->Count, Item);
  1238. }
  1239. }
  1240. }
  1241. //---------------------------------------------------------------------------
  1242. void __fastcall TNonVisualDataModule::WorkspaceItemClick(TObject * Sender)
  1243. {
  1244. std::unique_ptr<TStrings> Workspaces(StoredSessions->GetWorkspaces());
  1245. ScpExplorer->OpenFolderOrWorkspace(
  1246. Workspaces->Strings[NOT_NULL(dynamic_cast<TTBCustomItem *>(Sender))->Tag]);
  1247. }
  1248. //---------------------------------------------------------------------------
  1249. TShortCut __fastcall TNonVisualDataModule::OpenSessionShortCut(int Index)
  1250. {
  1251. if (Index >= 0 && Index < 10)
  1252. {
  1253. return ShortCut((Word)(Index < 9 ? L'0' + 1 + Index : L'0'),
  1254. TShiftState() << ssAlt);
  1255. }
  1256. else
  1257. {
  1258. return scNone;
  1259. }
  1260. }
  1261. //---------------------------------------------------------------------------
  1262. void __fastcall TNonVisualDataModule::CreateOpenedSessionListMenu(TAction * Action)
  1263. {
  1264. TTBCustomItem * OpenedSessionsMenu = dynamic_cast<TTBCustomItem *>(Action->ActionComponent);
  1265. assert(OpenedSessionsMenu != NULL);
  1266. TTerminalManager * Manager = TTerminalManager::Instance();
  1267. TStrings * TerminalList = Manager->TerminalList;
  1268. int PrevCount = OpenedSessionsMenu->Count;
  1269. for (int Index = 0; Index < TerminalList->Count; Index++)
  1270. {
  1271. TTerminal * Terminal = dynamic_cast<TTerminal *>(TerminalList->Objects[Index]);
  1272. assert(Terminal);
  1273. TTBCustomItem * Item = new TTBXItem(OpenedSessionsMenu);
  1274. Item->Caption = TerminalList->Strings[Index];
  1275. Item->Tag = int(Terminal);
  1276. Item->Hint = FMTLOAD(OPENEDSESSION_HINT, (Item->Caption));
  1277. Item->Checked = (Manager->ActiveTerminal == Terminal);
  1278. Item->ShortCut = OpenSessionShortCut(Index);
  1279. Item->OnClick = OpenedSessionItemClick;
  1280. Item->RadioItem = true;
  1281. OpenedSessionsMenu->Add(Item);
  1282. }
  1283. for (int Index = 0; Index < PrevCount; Index++)
  1284. {
  1285. OpenedSessionsMenu->Delete(0);
  1286. }
  1287. }
  1288. //---------------------------------------------------------------------------
  1289. void __fastcall TNonVisualDataModule::OpenedSessionItemClick(TObject * Sender)
  1290. {
  1291. TTerminalManager::Instance()->ActiveTerminal = (TTerminal*)(((TMenuItem *)Sender)->Tag);
  1292. }
  1293. //---------------------------------------------------------------------------
  1294. void __fastcall TNonVisualDataModule::CreateEditorListMenu(TAction * Action)
  1295. {
  1296. assert(Action != NULL);
  1297. TTBCustomItem * Menu = dynamic_cast<TTBCustomItem *>(Action->ActionComponent);
  1298. if (Menu != NULL)
  1299. {
  1300. int PrevCount = Menu->Count;
  1301. TTBCustomItem * Item = new TTBXItem(Menu);
  1302. Item->Action = CurrentEditInternalAction;
  1303. Menu->Add(Item);
  1304. AddMenuSeparator(Menu);
  1305. TStringList * UsedEditors = new TStringList();
  1306. try
  1307. {
  1308. UsedEditors->CaseSensitive = false;
  1309. UsedEditors->Sorted = true;
  1310. const TEditorList * EditorList = WinConfiguration->EditorList;
  1311. for (int Index = 0; Index < EditorList->Count; Index++)
  1312. {
  1313. const TEditorPreferences * Editor = EditorList->Editors[Index];
  1314. if ((Editor->Data->Editor == edExternal) &&
  1315. (UsedEditors->IndexOf(Editor->Data->ExternalEditor) < 0))
  1316. {
  1317. UsedEditors->Add(Editor->Data->ExternalEditor);
  1318. TTBCustomItem * Item = new TTBXItem(Menu);
  1319. Item->Caption = Editor->Name;
  1320. Item->Tag = Index;
  1321. Item->Hint = FMTLOAD(EXTERNAL_EDITOR_HINT, (Editor->Name));
  1322. Item->OnClick = EditorItemClick;
  1323. Menu->Add(Item);
  1324. }
  1325. }
  1326. Item = new TTBXItem(Menu);
  1327. Item->Action = CurrentEditWithAction;
  1328. Menu->Add(Item);
  1329. AddMenuSeparator(Menu);
  1330. Item = new TTBXItem(Menu);
  1331. Item->Action = EditorListCustomizeAction;
  1332. Menu->Add(Item);
  1333. for (int Index = 0; Index < PrevCount; Index++)
  1334. {
  1335. Menu->Delete(0);
  1336. }
  1337. }
  1338. __finally
  1339. {
  1340. delete UsedEditors;
  1341. }
  1342. }
  1343. }
  1344. //---------------------------------------------------------------------------
  1345. void __fastcall TNonVisualDataModule::EditorItemClick(TObject * Sender)
  1346. {
  1347. int Tag = dynamic_cast<TTBXItem*>(Sender)->Tag;
  1348. const TEditorList * EditorList = WinConfiguration->EditorList;
  1349. // sanity check
  1350. if (Tag < EditorList->Count)
  1351. {
  1352. ScpExplorer->ExecuteFile(osCurrent, efExternalEditor, EditorList->Editors[Tag]->Data,
  1353. true, false);
  1354. }
  1355. }
  1356. //---------------------------------------------------------------------------
  1357. void __fastcall TNonVisualDataModule::QueuePopupPopup(TObject * /*Sender*/)
  1358. {
  1359. TAction * Action = NULL;
  1360. switch (ScpExplorer->DefaultQueueOperation())
  1361. {
  1362. case qoItemQuery:
  1363. Action = QueueItemQueryAction;
  1364. break;
  1365. case qoItemError:
  1366. Action = QueueItemErrorAction;
  1367. break;
  1368. case qoItemPrompt:
  1369. Action = QueueItemPromptAction;
  1370. break;
  1371. case qoItemExecute:
  1372. Action = QueueItemExecuteAction;
  1373. break;
  1374. case qoItemPause:
  1375. Action = QueueItemPauseAction;
  1376. break;
  1377. case qoItemResume:
  1378. Action = QueueItemResumeAction;
  1379. break;
  1380. }
  1381. TTBCustomItem * Item;
  1382. for (int Index = 0; Index < QueuePopup->Items->Count; Index++)
  1383. {
  1384. Item = QueuePopup->Items->Items[Index];
  1385. TTBItemOptions O = Item->Options;
  1386. if ((Action != NULL) && (Item->Action == Action))
  1387. {
  1388. O << tboDefault;
  1389. }
  1390. else
  1391. {
  1392. O >> tboDefault;
  1393. }
  1394. Item->Options = O;
  1395. }
  1396. QueueSpeedComboBoxItemUpdate(QueuePopupSpeedComboBoxItem);
  1397. }
  1398. //---------------------------------------------------------------------------
  1399. void __fastcall TNonVisualDataModule::ShowUpdatesUpdate()
  1400. {
  1401. TUpdatesConfiguration Updates = WinConfiguration->Updates;
  1402. unsigned short H, M, S, MS;
  1403. DecodeTime(Now(), H, M, S, MS);
  1404. int CurrentCompoundVer = Configuration->CompoundVersion;
  1405. CheckForUpdatesAction->ImageIndex =
  1406. ((Updates.HaveResults && (Updates.Results.ForVersion == CurrentCompoundVer) &&
  1407. !Updates.Results.Disabled &&
  1408. ((Updates.Results.Critical && !Updates.ShownResults && (MS >= 500)) ||
  1409. ((!Updates.Results.Critical || Updates.ShownResults) &&
  1410. ((Updates.Results.Version > CurrentCompoundVer) ||
  1411. !Updates.Results.Message.IsEmpty())))) ? 80 :
  1412. ((int(Updates.Period) <= 0) ? 81 : 63));
  1413. }
  1414. //---------------------------------------------------------------------------
  1415. void __fastcall TNonVisualDataModule::PreferencesDialog(TPreferencesMode APreferencesMode)
  1416. {
  1417. if (ScpExplorer != NULL)
  1418. {
  1419. ScpExplorer->PreferencesDialog(APreferencesMode);
  1420. }
  1421. else
  1422. {
  1423. DoPreferencesDialog(APreferencesMode);
  1424. }
  1425. }
  1426. //---------------------------------------------------------------------------
  1427. void __fastcall TNonVisualDataModule::CustomCommandsLastUpdate(TAction * Action)
  1428. {
  1429. TCustomCommandType Command;
  1430. int State;
  1431. bool Defined = ScpExplorer->GetLastCustomCommand(
  1432. (Action == CustomCommandsLastFocusedAction), Command, State);
  1433. Action->Visible = Defined;
  1434. if (Defined)
  1435. {
  1436. UnicodeString TitleCommand = Command.Command;
  1437. int MaxTitleCommandLen = 20;
  1438. if (TitleCommand.Length() > MaxTitleCommandLen)
  1439. {
  1440. TitleCommand = TitleCommand.SubString(1, MaxTitleCommandLen - 3) + "...";
  1441. }
  1442. Action->Caption = FMTLOAD(CUSTOM_COMMAND_LAST, (TitleCommand));
  1443. Action->Hint = FMTLOAD(CUSTOM_COMMAND_HINT, (Command.Command));
  1444. Action->Enabled = (State > 0);
  1445. }
  1446. }
  1447. //---------------------------------------------------------------------------
  1448. UnicodeString __fastcall TNonVisualDataModule::QueueItemSpeed(const UnicodeString & Text,
  1449. TTBXComboBoxItem * Item)
  1450. {
  1451. unsigned long Speed = GetSpeedLimit(Text);
  1452. ScpExplorer->ExecuteQueueOperation(qoItemSpeed, reinterpret_cast<void*>(Speed));
  1453. UnicodeString Result = SetSpeedLimit(Speed);
  1454. SaveToHistory(Item->Strings, Result);
  1455. CustomWinConfiguration->History[L"SpeedLimit"] = Item->Strings;
  1456. return Result;
  1457. }
  1458. //---------------------------------------------------------------------------
  1459. void __fastcall TNonVisualDataModule::QueuePopupSpeedComboBoxItemItemClick(
  1460. TObject * Sender)
  1461. {
  1462. TTBXComboBoxItem * Item = dynamic_cast<TTBXComboBoxItem *>(Sender);
  1463. QueueItemSpeedAction->Text = QueueItemSpeed(Item->Text, Item);
  1464. }
  1465. //---------------------------------------------------------------------------
  1466. void __fastcall TNonVisualDataModule::QueueSpeedComboBoxItemAcceptText(
  1467. TObject * Sender, UnicodeString & NewText, bool & /*Accept*/)
  1468. {
  1469. TTBXComboBoxItem * Item = dynamic_cast<TTBXComboBoxItem *>(Sender);
  1470. NewText = QueueItemSpeed(NewText, Item);
  1471. QueueItemSpeedAction->Text = NewText;
  1472. }
  1473. //---------------------------------------------------------------------------
  1474. void __fastcall TNonVisualDataModule::QueueSpeedComboBoxItem(TTBXComboBoxItem * Item)
  1475. {
  1476. // IDE often looses this link
  1477. Item->OnAcceptText = QueueSpeedComboBoxItemAcceptText;
  1478. Item->OnItemClick = QueuePopupSpeedComboBoxItemItemClick;
  1479. }
  1480. //---------------------------------------------------------------------------
  1481. void __fastcall TNonVisualDataModule::QueueSpeedComboBoxItemUpdate(TTBXComboBoxItem * Item)
  1482. {
  1483. Item->Strings = CustomWinConfiguration->History[L"SpeedLimit"];
  1484. }
  1485. //---------------------------------------------------------------------------
  1486. void __fastcall TNonVisualDataModule::SetQueueOnceEmptyAction(TAction * Action)
  1487. {
  1488. TAction * Current = CurrentQueueOnceEmptyAction();
  1489. if (Current != Action)
  1490. {
  1491. Current->Checked = false;
  1492. Action->Checked = true;
  1493. }
  1494. }
  1495. //---------------------------------------------------------------------------
  1496. void __fastcall TNonVisualDataModule::CycleQueueOnceEmptyAction()
  1497. {
  1498. TAction * Current = CurrentQueueOnceEmptyAction();
  1499. Current->Checked = false;
  1500. if (Current == QueueIdleOnceEmptyAction)
  1501. {
  1502. QueueDisconnectOnceEmptyAction->Checked = true;
  1503. }
  1504. else if (Current == QueueDisconnectOnceEmptyAction)
  1505. {
  1506. QueueShutDownOnceEmptyAction->Checked = true;
  1507. }
  1508. else if (Current == QueueShutDownOnceEmptyAction)
  1509. {
  1510. QueueIdleOnceEmptyAction->Checked = true;
  1511. }
  1512. else
  1513. {
  1514. FAIL;
  1515. }
  1516. }
  1517. //---------------------------------------------------------------------------
  1518. TAction * __fastcall TNonVisualDataModule::CurrentQueueOnceEmptyAction()
  1519. {
  1520. TAction * Result;
  1521. if (QueueIdleOnceEmptyAction->Checked)
  1522. {
  1523. Result = QueueIdleOnceEmptyAction;
  1524. }
  1525. else if (QueueDisconnectOnceEmptyAction->Checked)
  1526. {
  1527. Result = QueueDisconnectOnceEmptyAction;
  1528. }
  1529. else if (QueueShutDownOnceEmptyAction->Checked)
  1530. {
  1531. Result = QueueShutDownOnceEmptyAction;
  1532. }
  1533. else
  1534. {
  1535. FAIL;
  1536. }
  1537. return Result;
  1538. }
  1539. //---------------------------------------------------------------------------
  1540. TOnceDoneOperation __fastcall TNonVisualDataModule::CurrentQueueOnceEmptyOperation()
  1541. {
  1542. TOnceDoneOperation Result;
  1543. TBasicAction * Current = CurrentQueueOnceEmptyAction();
  1544. if (Current == QueueIdleOnceEmptyAction)
  1545. {
  1546. Result = odoIdle;
  1547. }
  1548. else if (Current == QueueDisconnectOnceEmptyAction)
  1549. {
  1550. Result = odoDisconnect;
  1551. }
  1552. else if (Current == QueueShutDownOnceEmptyAction)
  1553. {
  1554. Result = odoShutDown;
  1555. }
  1556. else
  1557. {
  1558. FAIL;
  1559. }
  1560. return Result;
  1561. }
  1562. //---------------------------------------------------------------------------
  1563. void __fastcall TNonVisualDataModule::ResetQueueOnceEmptyOperation()
  1564. {
  1565. SetQueueOnceEmptyAction(QueueIdleOnceEmptyAction);
  1566. }
  1567. //---------------------------------------------------------------------------
  1568. void __fastcall TNonVisualDataModule::StartBusy()
  1569. {
  1570. FBusy++;
  1571. }
  1572. //---------------------------------------------------------------------------
  1573. void __fastcall TNonVisualDataModule::EndBusy()
  1574. {
  1575. FBusy--;
  1576. }