WinInterface.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. //---------------------------------------------------------------------------
  2. #ifndef WinInterfaceH
  3. #define WinInterfaceH
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Buttons.hpp>
  7. #include <Interface.h>
  8. #include <WinConfiguration.h>
  9. #include <SynchronizeController.h>
  10. #ifdef LOCALINTERFACE
  11. #include <LocalInterface.h>
  12. #endif
  13. #define SITE_ICON 1
  14. #define SITE_FOLDER_ICON 2
  15. #define WORKSPACE_ICON 3
  16. class TStoredSessionList;
  17. class TConfiguration;
  18. class TTerminal;
  19. const int mpNeverAskAgainCheck = 0x01;
  20. const int mpAllowContinueOnError = 0x02;
  21. #define UPLOAD_IF_ANY_SWITCH L"UploadIfAny"
  22. #define UPLOAD_SWITCH L"Upload"
  23. #define KEEP_UP_TO_DATE_SWITCH L"KeepUpToDate"
  24. #define JUMPLIST_SWITCH L"JumpList"
  25. #define DESKTOP_SWITCH L"Desktop"
  26. #define SEND_TO_HOOK_SWITCH L"SendToHook"
  27. #define UNSAFE_SWITCH L"Unsafe"
  28. #define DEFAULTS_SWITCH L"Defaults"
  29. #define NEWINSTANCE_SWICH L"NewInstance"
  30. #define KEYGEN_SWITCH L"KeyGen"
  31. #define KEYGEN_OUTPUT_SWITCH L"Output"
  32. #define KEYGEN_COMMENT_SWITCH L"Comment"
  33. #define KEYGEN_CHANGE_PASSPHRASE_SWITCH L"ChangePassphrase"
  34. #define LOG_SWITCH L"Log"
  35. #define LOGSIZE_SWITCH L"LogSize"
  36. #define LOGSIZE_SEPARATOR L"*"
  37. #define INI_SWITCH L"Ini"
  38. #define RAW_CONFIG_SWITCH L"RawConfig"
  39. #define FINGERPRINTSCAN_SWITCH L"FingerprintScan"
  40. struct TMessageParams
  41. {
  42. TMessageParams(unsigned int AParams = 0);
  43. TMessageParams(const TQueryParams * AParams);
  44. const TQueryButtonAlias * Aliases;
  45. unsigned int AliasesCount;
  46. unsigned int Params;
  47. unsigned int Timer;
  48. TQueryParamsTimerEvent TimerEvent;
  49. UnicodeString TimerMessage;
  50. unsigned int TimerAnswers;
  51. TQueryType TimerQueryType;
  52. unsigned int Timeout;
  53. unsigned int TimeoutAnswer;
  54. UnicodeString NeverAskAgainTitle;
  55. unsigned int NeverAskAgainAnswer;
  56. bool NeverAskAgainCheckedInitially;
  57. bool AllowHelp;
  58. UnicodeString ImageName;
  59. UnicodeString MoreMessagesUrl;
  60. TSize MoreMessagesSize;
  61. UnicodeString CustomCaption;
  62. private:
  63. inline void Reset();
  64. };
  65. class TCustomScpExplorerForm;
  66. TCustomScpExplorerForm * __fastcall CreateScpExplorer();
  67. void __fastcall ConfigureInterface();
  68. void __fastcall DoProductLicense();
  69. extern const UnicodeString AppName;
  70. void __fastcall SetOnForeground(bool OnForeground);
  71. void __fastcall FlashOnBackground();
  72. void __fastcall TerminateApplication();
  73. void __fastcall ShowExtendedExceptionEx(TTerminal * Terminal, Exception * E);
  74. void __fastcall FormHelp(TCustomForm * Form);
  75. void __fastcall SearchHelp(const UnicodeString & Message);
  76. void __fastcall MessageWithNoHelp(const UnicodeString & Message);
  77. class TProgramParams;
  78. bool __fastcall CheckSafe(TProgramParams * Params);
  79. void __fastcall CheckLogParam(TProgramParams * Params);
  80. bool __fastcall CheckXmlLogParam(TProgramParams * Params);
  81. UnicodeString __fastcall GetToolbarKey(const UnicodeString & ToolbarName);
  82. UnicodeString __fastcall GetToolbarsLayoutStr(TControl * OwnerControl);
  83. void __fastcall LoadToolbarsLayoutStr(TControl * OwnerControl, UnicodeString LayoutStr);
  84. namespace Tb2item { class TTBCustomItem; }
  85. namespace Tbx { class TTBXSeparatorItem; }
  86. Tbx::TTBXSeparatorItem * __fastcall AddMenuSeparator(Tb2item::TTBCustomItem * Menu);
  87. void __fastcall AddMenuLabel(Tb2item::TTBCustomItem * Menu, const UnicodeString & Label);
  88. void __fastcall ClickToolbarItem(Tb2item::TTBCustomItem * Item, bool PositionCursor);
  89. // windows\WinHelp.cpp
  90. void __fastcall InitializeWinHelp();
  91. void __fastcall FinalizeWinHelp();
  92. // windows\WinInterface.cpp
  93. unsigned int __fastcall MessageDialog(const UnicodeString Msg, TQueryType Type,
  94. unsigned int Answers, UnicodeString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  95. unsigned int __fastcall MessageDialog(int Ident, TQueryType Type,
  96. unsigned int Answers, UnicodeString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  97. unsigned int __fastcall SimpleErrorDialog(const UnicodeString Msg, const UnicodeString MoreMessages = L"");
  98. unsigned int __fastcall MoreMessageDialog(const UnicodeString Message,
  99. TStrings * MoreMessages, TQueryType Type, unsigned int Answers,
  100. UnicodeString HelpKeyword, const TMessageParams * Params = NULL);
  101. unsigned int __fastcall ExceptionMessageDialog(Exception * E, TQueryType Type,
  102. const UnicodeString MessageFormat = L"", unsigned int Answers = qaOK,
  103. UnicodeString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  104. unsigned int __fastcall FatalExceptionMessageDialog(Exception * E, TQueryType Type,
  105. int SessionReopenTimeout, const UnicodeString MessageFormat = L"", unsigned int Answers = qaOK,
  106. UnicodeString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  107. // forms\Custom.cpp
  108. TSessionData * __fastcall DoSaveSession(TSessionData * SessionData,
  109. TSessionData * OriginalSession, bool ForceDialog,
  110. TStrings * AdditionalFolders);
  111. void __fastcall SessionNameValidate(const UnicodeString & Text,
  112. const UnicodeString & OriginalName);
  113. bool __fastcall DoSaveWorkspaceDialog(UnicodeString & WorkspaceName,
  114. bool * SavePasswords, bool NotRecommendedSavingPasswords,
  115. bool & CreateShortcut, bool & EnableAutoSave);
  116. class TShortCuts;
  117. bool __fastcall DoShortCutDialog(TShortCut & ShortCut,
  118. const TShortCuts & ShortCuts, UnicodeString HelpKeyword);
  119. bool __fastcall DoCustomCommandOptionsDialog(
  120. const TCustomCommandType * Command, TStrings * CustomCommandOptions, TShortCut * ShortCut, unsigned int Flags,
  121. TCustomCommand * CustomCommandForOptions, const UnicodeString & Site, const TShortCuts * ShortCuts);
  122. void __fastcall DoUsageStatisticsDialog();
  123. // windows\UserInterface.cpp
  124. bool __fastcall DoMasterPasswordDialog();
  125. bool __fastcall DoChangeMasterPasswordDialog(UnicodeString & NewPassword);
  126. // windows\WinMain.cpp
  127. int __fastcall Execute();
  128. void __fastcall GetLoginData(UnicodeString SessionName, TOptions * Options,
  129. TObjectList * DataList, UnicodeString & DownloadFile, bool NeedSession, TForm * LinkedForm, int Flags = 0);
  130. // forms\InputDlg.cpp
  131. struct TInputDialogData
  132. {
  133. TCustomEdit * Edit;
  134. };
  135. typedef void __fastcall (__closure *TInputDialogInitialize)
  136. (TObject * Sender, TInputDialogData * Data);
  137. bool __fastcall InputDialog(const UnicodeString ACaption,
  138. const UnicodeString APrompt, UnicodeString & Value, UnicodeString HelpKeyword = HELP_NONE,
  139. TStrings * History = NULL, bool PathInput = false,
  140. TInputDialogInitialize OnInitialize = NULL, bool Echo = true);
  141. // forms\About.cpp
  142. struct TRegistration
  143. {
  144. bool Registered;
  145. UnicodeString Subject;
  146. int Licenses;
  147. UnicodeString ProductId;
  148. bool NeverExpires;
  149. TDateTime Expiration;
  150. bool EduLicense;
  151. TNotifyEvent OnRegistrationLink;
  152. };
  153. void __fastcall DoAboutDialog(TConfiguration * Configuration,
  154. bool AllowLicense, TRegistration * Registration);
  155. void __fastcall DoAboutDialog(TConfiguration *Configuration);
  156. // forms\Cleanup.cpp
  157. bool __fastcall DoCleanupDialog(TStoredSessionList *SessionList,
  158. TConfiguration *Configuration);
  159. // forms\Console.cpp
  160. void __fastcall DoConsoleDialog(TTerminal * Terminal,
  161. const UnicodeString Command = L"", const TStrings * Log = NULL);
  162. // forms\Copy.cpp
  163. const coTemp = 0x001;
  164. const coDisableQueue = 0x002;
  165. const coDisableDirectory = 0x008; // not used anymore
  166. const coDoNotShowAgain = 0x020;
  167. const coDisableSaveSettings = 0x040; // not used anymore
  168. const coDoNotUsePresets = 0x080;
  169. const coAllowRemoteTransfer = 0x100;
  170. const coNoQueue = 0x200;
  171. const coShortCutHint = 0x800;
  172. const coAllFiles = 0x1000;
  173. const cooDoNotShowAgain = 0x01;
  174. const cooRemoteTransfer = 0x02;
  175. const cooSaveSettings = 0x04;
  176. bool __fastcall DoCopyDialog(bool ToRemote,
  177. bool Move, TStrings * FileList, UnicodeString & TargetDirectory,
  178. TGUICopyParamType * Params, int Options, int CopyParamAttrs,
  179. TSessionData * SessionData, int * OutputOptions);
  180. // forms\CreateDirectory.cpp
  181. bool __fastcall DoCreateDirectoryDialog(UnicodeString & Directory,
  182. TRemoteProperties * Properties, int AllowedChanges, bool & SaveSettings);
  183. // forms\ImportSessions.cpp
  184. bool __fastcall DoImportSessionsDialog(TList * Imported);
  185. // forms\License.cpp
  186. enum TLicense { lcNoLicense = -1, lcWinScp, lcExpat };
  187. void __fastcall DoLicenseDialog(TLicense License);
  188. bool __fastcall DoLoginDialog(TStoredSessionList * SessionList, TList * DataList, TForm * LinkedForm);
  189. // forms\SiteAdvanced.cpp
  190. bool __fastcall DoSiteAdvancedDialog(TSessionData * SessionData);
  191. // forms\OpenDirectory.cpp
  192. enum TOpenDirectoryMode { odBrowse, odAddBookmark };
  193. bool __fastcall DoOpenDirectoryDialog(TOpenDirectoryMode Mode, TOperationSide Side,
  194. UnicodeString & Directory, TStrings * Directories, TTerminal * Terminal,
  195. bool AllowSwitch);
  196. // forms\LocatinoProfiles.cpp
  197. bool __fastcall LocationProfilesDialog(TOpenDirectoryMode Mode,
  198. TOperationSide Side, UnicodeString & LocalDirectory, UnicodeString & RemoteDirectory,
  199. TStrings * LocalDirectories, TStrings * RemoteDirectories, TTerminal * Terminal);
  200. // forms\Preferences.cpp
  201. enum TPreferencesMode { pmDefault, pmEditor, pmCustomCommands,
  202. pmQueue, pmLogging, pmUpdates, pmPresets, pmEditors, pmCommander,
  203. pmEditorInternal };
  204. class TCopyParamRuleData;
  205. struct TPreferencesDialogData
  206. {
  207. TCopyParamRuleData * CopyParamRuleData;
  208. };
  209. bool __fastcall DoPreferencesDialog(TPreferencesMode APreferencesMode,
  210. TPreferencesDialogData * DialogData = NULL);
  211. // forms\CustomCommand.cpp
  212. class TCustomCommandList;
  213. class TCustomCommandType;
  214. class TShortCuts;
  215. enum TCustomCommandsMode { ccmAdd, ccmEdit, ccmAdHoc };
  216. const ccoDisableRemote = 0x01;
  217. const ccoDisableRemoteFiles = 0x02;
  218. typedef void __fastcall (__closure *TCustomCommandValidate)
  219. (const TCustomCommandType & Command);
  220. bool __fastcall DoCustomCommandDialog(TCustomCommandType & Command,
  221. const TCustomCommandList * CustomCommandList,
  222. TCustomCommandsMode Mode, int Options, TCustomCommandValidate OnValidate,
  223. const TShortCuts * ShortCuts);
  224. // forms\CopyParamPreset.cpp
  225. class TCopyParamList;
  226. enum TCopyParamPresetMode { cpmAdd, cpmAddCurrent, cpmEdit, cpmDuplicate };
  227. bool __fastcall DoCopyParamPresetDialog(TCopyParamList * CopyParamList,
  228. int & Index, TCopyParamPresetMode Mode, TCopyParamRuleData * CurrentRuleData,
  229. const TCopyParamType & DefaultCopyParams);
  230. // forms\CopyParamCsutom.cpp
  231. bool __fastcall DoCopyParamCustomDialog(TCopyParamType & CopyParam,
  232. int CopyParamAttrs);
  233. // forms\Properties.cpp
  234. class TRemoteProperties;
  235. class TRemoteTokenList;
  236. struct TCalculateSizeStats;
  237. const cpMode = 0x01;
  238. const cpOwner = 0x02;
  239. const cpGroup = 0x04;
  240. typedef void __fastcall (__closure *TCalculateSizeEvent)
  241. (TStrings * FileList, __int64 & Size, TCalculateSizeStats & Stats,
  242. bool & Close);
  243. typedef void __fastcall (__closure *TCalculatedChecksumCallbackEvent)(
  244. const UnicodeString & FileName, const UnicodeString & Alg, const UnicodeString & Hash);
  245. typedef void __fastcall (__closure *TCalculateChecksumEvent)
  246. (const UnicodeString & Alg, TStrings * FileList,
  247. TCalculatedChecksumCallbackEvent OnCalculatedChecksum, bool & Close);
  248. bool __fastcall DoPropertiesDialog(TStrings * FileList,
  249. const UnicodeString Directory, const TRemoteTokenList * GroupList,
  250. const TRemoteTokenList * UserList, TStrings * ChecksumAlgs,
  251. TRemoteProperties * Properties,
  252. int AllowedChanges, bool UserGroupByID, TCalculateSizeEvent OnCalculateSize,
  253. TCalculateChecksumEvent OnCalculateChecksum);
  254. bool __fastcall DoRemoteMoveDialog(bool Multi, UnicodeString & Target, UnicodeString & FileMask);
  255. enum TDirectRemoteCopy { drcDisallow, drcAllow, drcConfirmCommandSession };
  256. bool __fastcall DoRemoteCopyDialog(TStrings * Sessions, TStrings * Directories,
  257. TDirectRemoteCopy AllowDirectCopy, bool Multi, void *& Session,
  258. UnicodeString & Target, UnicodeString & FileMask, bool & DirectCopy, void * CurrentSession);
  259. // forms\SelectMask.cpp
  260. #ifdef CustomdirviewHPP
  261. bool __fastcall DoSelectMaskDialog(TCustomDirView * Parent, bool Select,
  262. TFileFilter * Filter, TConfiguration * Configuration);
  263. bool __fastcall DoFilterMaskDialog(TCustomDirView * Parent,
  264. TFileFilter * Filter);
  265. #endif
  266. // forms\EditMask.cpp
  267. bool __fastcall DoEditMaskDialog(TFileMasks & Mask);
  268. // forms\Synchronize.cpp
  269. const soDoNotUsePresets = 0x01;
  270. const soNoMinimize = 0x02;
  271. const soAllowSelectedOnly = 0x04;
  272. typedef void __fastcall (__closure *TGetSynchronizeOptionsEvent)
  273. (int Params, TSynchronizeOptions & Options);
  274. typedef void __fastcall (__closure *TSynchronizeSessionLog)
  275. (const UnicodeString & Message);
  276. typedef void __fastcall (__closure *TFeedSynchronizeError)
  277. (const UnicodeString & Message, TStrings * MoreMessages, TQueryType Type,
  278. const UnicodeString & HelpKeyword);
  279. typedef void __fastcall (__closure *TSynchronizeInNewWindow)
  280. (const TSynchronizeParamType & Params, const TCopyParamType * CopyParams);
  281. bool __fastcall DoSynchronizeDialog(TSynchronizeParamType & Params,
  282. const TCopyParamType * CopyParams, TSynchronizeStartStopEvent OnStartStop,
  283. bool & SaveSettings, int Options, int CopyParamAttrs,
  284. TGetSynchronizeOptionsEvent OnGetOptions,
  285. TSynchronizeSessionLog OnSynchronizeSessionLog,
  286. TFeedSynchronizeError & OnFeedSynchronizeError,
  287. TSynchronizeInNewWindow OnSynchronizeInNewWindow,
  288. bool Start);
  289. // forms\FullSynchronize.cpp
  290. struct TUsableCopyParamAttrs;
  291. enum TSynchronizeMode { smRemote, smLocal, smBoth };
  292. const fsoDisableTimestamp = 0x01;
  293. const fsoDoNotUsePresets = 0x02;
  294. const fsoAllowSelectedOnly = 0x04;
  295. bool __fastcall DoFullSynchronizeDialog(TSynchronizeMode & Mode, int & Params,
  296. UnicodeString & LocalDirectory, UnicodeString & RemoteDirectory,
  297. TCopyParamType * CopyParams, bool & SaveSettings, bool & SaveMode,
  298. int Options, const TUsableCopyParamAttrs & CopyParamAttrs);
  299. // forms\SynchronizeChecklist.cpp
  300. class TSynchronizeChecklist;
  301. typedef void __fastcall (__closure *TCustomCommandMenuEvent)
  302. (TAction * Action, TStrings * LocalFileList, TStrings * RemoteFileList);
  303. bool __fastcall DoSynchronizeChecklistDialog(TSynchronizeChecklist * Checklist,
  304. TSynchronizeMode Mode, int Params,
  305. const UnicodeString LocalDirectory, const UnicodeString RemoteDirectory,
  306. TCustomCommandMenuEvent OnCustomCommandMenu);
  307. // forms\Editor.cpp
  308. typedef void __fastcall (__closure *TFileClosedEvent)
  309. (TObject * Sender, bool Forced);
  310. typedef void __fastcall (__closure *TAnyModifiedEvent)
  311. (TObject * Sender, bool & Modified);
  312. TForm * __fastcall ShowEditorForm(const UnicodeString FileName, TForm * ParentForm,
  313. TNotifyEvent OnFileChanged, TNotifyEvent OnFileReload, TFileClosedEvent OnClose,
  314. TNotifyEvent OnSaveAll, TAnyModifiedEvent OnAnyModified,
  315. const UnicodeString Caption, bool StandaloneEditor, TColor Color, int InternalEditorEncodingOverride);
  316. void __fastcall ReconfigureEditorForm(TForm * Form);
  317. void __fastcall EditorFormFileUploadComplete(TForm * Form);
  318. void __fastcall EditorFormFileSave(TForm * Form);
  319. bool __fastcall IsEditorFormModified(TForm * Form);
  320. bool __fastcall DoSymlinkDialog(UnicodeString & FileName, UnicodeString & PointTo,
  321. TOperationSide Side, bool & SymbolicLink, bool Edit, bool AllowSymbolic);
  322. // forms\FileSystemInfo.cpp
  323. struct TSpaceAvailable;
  324. struct TFileSystemInfo;
  325. struct TSessionInfo;
  326. typedef void __fastcall (__closure *TGetSpaceAvailable)
  327. (const UnicodeString Path, TSpaceAvailable & ASpaceAvailable, bool & Close);
  328. void __fastcall DoFileSystemInfoDialog(
  329. const TSessionInfo & SessionInfo, const TFileSystemInfo & FileSystemInfo,
  330. UnicodeString SpaceAvailablePath, TGetSpaceAvailable OnGetSpaceAvailable);
  331. // forms\MessageDlg.cpp
  332. void __fastcall AnswerNameAndCaption(
  333. unsigned int Answer, UnicodeString & Name, UnicodeString & Caption);
  334. TForm * __fastcall CreateMoreMessageDialog(const UnicodeString & Msg,
  335. TStrings * MoreMessages, TMsgDlgType DlgType, unsigned int Answers,
  336. const TQueryButtonAlias * Aliases, unsigned int AliasesCount,
  337. unsigned int TimeoutAnswer, TButton ** TimeoutButton,
  338. const UnicodeString & ImageName, const UnicodeString & NeverAskAgainCaption,
  339. const UnicodeString & MoreMessagesUrl, TSize MoreMessagesSize,
  340. const UnicodeString & CustomCaption);
  341. TForm * __fastcall CreateMoreMessageDialogEx(const UnicodeString Message, TStrings * MoreMessages,
  342. TQueryType Type, unsigned int Answers, UnicodeString HelpKeyword, const TMessageParams * Params);
  343. unsigned int __fastcall ExecuteMessageDialog(TForm * Dialog, unsigned int Answers, const TMessageParams * Params);
  344. void __fastcall InsertPanelToMessageDialog(TCustomForm * Form, TPanel * Panel);
  345. void __fastcall NavigateMessageDialogToUrl(TCustomForm * Form, const UnicodeString & Url);
  346. extern const UnicodeString MessagePanelName;
  347. extern const UnicodeString MainMessageLabelName;
  348. extern const UnicodeString MessageLabelName;
  349. extern const UnicodeString YesButtonName;
  350. extern const UnicodeString OKButtonName;
  351. // windows\Console.cpp
  352. enum TConsoleMode { cmNone, cmScripting, cmHelp, cmBatchSettings, cmKeyGen, cmFingerprintScan };
  353. int __fastcall Console(TConsoleMode Mode);
  354. // forms\EditorPreferences.cpp
  355. enum TEditorPreferencesMode { epmAdd, epmEdit, epmAdHoc };
  356. class TEditorData;
  357. bool __fastcall DoEditorPreferencesDialog(TEditorData * Editor,
  358. bool & Remember, TEditorPreferencesMode Mode, bool MayRemote);
  359. // forms\Find.cpp
  360. typedef void __fastcall (__closure *TFindEvent)
  361. (TTerminal * Terminal, UnicodeString Directory, const TFileMasks & FileMask,
  362. TFileFoundEvent OnFileFound, TFindingFileEvent OnFindingFile);
  363. typedef void __fastcall (__closure *TFocusFileEvent)
  364. (TTerminal * Terminal, const UnicodeString & Path);
  365. typedef void __fastcall (__closure *TFileOperationFinishedEvent)
  366. (const UnicodeString & FileName, bool Success);
  367. typedef void __fastcall (__closure *TFileListOperationEvent)
  368. (TTerminal * Terminal, TStrings * FileList, TFileOperationFinishedEvent OnFileOperationFinished);
  369. void __fastcall ShowFileFindDialog(
  370. TTerminal * Terminal, UnicodeString Directory, TFindEvent OnFind, TFocusFileEvent OnFocusFile,
  371. TFileListOperationEvent OnDeleteFiles, TFileListOperationEvent OnDownloadFiles,
  372. TFileListOperationEvent OnEditFiles);
  373. void __fastcall HideFileFindDialog();
  374. // forms\GenerateUrl.cpp
  375. void __fastcall DoGenerateUrlDialog(TSessionData * Data, TStrings * Paths);
  376. enum TFilesSelected { fsList, fsAll };
  377. void __fastcall DoGenerateTransferCodeDialog(
  378. bool ToRemote, bool Move, int CopyParamAttrs, TSessionData * Data, TFilesSelected FilesSelected,
  379. TStrings * FileList, const UnicodeString & Path, const TCopyParamType & CopyParam);
  380. void __fastcall CopyParamListButton(TButton * Button);
  381. const int cplNone = 0x00;
  382. const int cplCustomize = 0x01;
  383. const int cplCustomizeDefault = 0x02;
  384. const int cplSaveSettings = 0x04;
  385. const int cplGenerateCode = 0x08;
  386. void __fastcall CopyParamListPopup(TRect R, TPopupMenu * Menu,
  387. const TCopyParamType & Param, UnicodeString Preset, TNotifyEvent OnClick,
  388. int Options, int CopyParamAttrs, bool SaveSettings = false);
  389. int __fastcall CopyParamListPopupClick(TObject * Sender,
  390. TCopyParamType & Param, UnicodeString & Preset, int CopyParamAttrs,
  391. bool * SaveSettings = NULL);
  392. void __fastcall MenuPopup(TPopupMenu * Menu, TRect Rect, TComponent * PopupComponent);
  393. void __fastcall MenuPopup(TPopupMenu * Menu, TButton * Button);
  394. void __fastcall MenuPopup(TObject * Sender, const TPoint & MousePos, bool & Handled);
  395. void __fastcall MenuButton(TButton * Button);
  396. TComponent * __fastcall GetPopupComponent(TObject * Sender);
  397. TRect __fastcall CalculatePopupRect(TButton * Button);
  398. TRect __fastcall CalculatePopupRect(TControl * Control, TPoint MousePos);
  399. typedef void __fastcall (__closure *TColorChangeEvent)
  400. (TColor Color);
  401. TPopupMenu * __fastcall CreateSessionColorPopupMenu(TColor Color,
  402. TColorChangeEvent OnColorChange);
  403. void __fastcall CreateSessionColorMenu(TComponent * AOwner, TColor Color,
  404. TColorChangeEvent OnColorChange);
  405. void __fastcall CreateEditorBackgroundColorMenu(TComponent * AOwner, TColor Color,
  406. TColorChangeEvent OnColorChange);
  407. TPopupMenu * __fastcall CreateColorPopupMenu(TColor Color,
  408. TColorChangeEvent OnColorChange);
  409. void __fastcall FixButtonImage(TButton * Button);
  410. void __fastcall CenterButtonImage(TButton * Button);
  411. void __fastcall UpgradeSpeedButton(TSpeedButton * Button);
  412. int __fastcall AdjustLocaleFlag(const UnicodeString & S, TLocaleFlagOverride LocaleFlagOverride, bool Recommended, int On, int Off);
  413. void __fastcall SetGlobalMinimizeHandler(TCustomForm * Form, TNotifyEvent OnMinimize);
  414. void __fastcall ClearGlobalMinimizeHandler(TNotifyEvent OnMinimize);
  415. void __fastcall CallGlobalMinimizeHandler(TObject * Sender);
  416. bool __fastcall IsApplicationMinimized();
  417. void __fastcall ApplicationMinimize();
  418. void __fastcall ApplicationRestore();
  419. bool __fastcall HandleMinimizeSysCommand(TMessage & Message);
  420. void __fastcall WinInitialize();
  421. void __fastcall WinFinalize();
  422. void __fastcall ShowNotification(TTerminal * Terminal, const UnicodeString & Str,
  423. TQueryType Type);
  424. void __fastcall InitializeShortCutCombo(TComboBox * ComboBox,
  425. const TShortCuts & ShortCuts);
  426. void __fastcall SetShortCutCombo(TComboBox * ComboBox, TShortCut Value);
  427. TShortCut __fastcall GetShortCutCombo(TComboBox * ComboBox);
  428. bool __fastcall IsCustomShortCut(TShortCut ShortCut);
  429. TShortCut __fastcall NormalizeCustomShortCut(TShortCut ShortCut);
  430. #ifdef _DEBUG
  431. void __fastcall ForceTracing();
  432. #endif
  433. //---------------------------------------------------------------------------
  434. #define HIDDEN_WINDOW_NAME L"WinSCPHiddenWindow3"
  435. //---------------------------------------------------------------------------
  436. struct TCopyDataMessage
  437. {
  438. enum { CommandCanCommandLine, CommandCommandLine, MainWindowCheck, RefreshPanel };
  439. static const unsigned int Version1 = 1;
  440. unsigned int Version;
  441. unsigned int Command;
  442. union
  443. {
  444. wchar_t CommandLine[10240];
  445. struct
  446. {
  447. wchar_t Session[1024];
  448. wchar_t Path[1024];
  449. } Refresh;
  450. };
  451. TCopyDataMessage()
  452. {
  453. Version = TCopyDataMessage::Version1;
  454. Command = static_cast<unsigned int>(-1);
  455. }
  456. };
  457. //---------------------------------------------------------------------------
  458. class TWinInteractiveCustomCommand : public TInteractiveCustomCommand
  459. {
  460. public:
  461. TWinInteractiveCustomCommand(
  462. TCustomCommand * ChildCustomCommand, const UnicodeString CustomCommandName, const UnicodeString HelpKeyword);
  463. protected:
  464. virtual void __fastcall Prompt(int Index, const UnicodeString & Prompt,
  465. UnicodeString & Value);
  466. virtual void __fastcall Execute(const UnicodeString & Command,
  467. UnicodeString & Value);
  468. virtual void __fastcall PatternHint(int Index, const UnicodeString & Pattern);
  469. private:
  470. UnicodeString FCustomCommandName;
  471. std::map<int, size_t> FIndexes;
  472. TUnicodeStringVector FPrompts;
  473. TUnicodeStringVector FDefaults;
  474. TUnicodeStringVector FValues;
  475. UnicodeString FHelpKeyword;
  476. };
  477. //---------------------------------------------------------------------------
  478. class TTrayIcon
  479. {
  480. public:
  481. __fastcall TTrayIcon(unsigned int Id);
  482. __fastcall ~TTrayIcon();
  483. void __fastcall PopupBalloon(UnicodeString Title, const UnicodeString & Str,
  484. TQueryType QueryType, unsigned int Timeout, TNotifyEvent OnBalloonClick,
  485. TObject * BalloonUserData);
  486. void __fastcall CancelBalloon();
  487. __property bool Visible = { read = FVisible, write = SetVisible };
  488. __property TNotifyEvent OnClick = { read = FOnClick, write = FOnClick };
  489. __property UnicodeString Hint = { read = GetHint, write = SetHint };
  490. protected:
  491. void __fastcall Update();
  492. bool __fastcall Notify(unsigned int Message);
  493. private:
  494. bool FVisible;
  495. NOTIFYICONDATA * FTrayIcon;
  496. TNotifyEvent FOnClick;
  497. TNotifyEvent FOnBalloonClick;
  498. TObject * FBalloonUserData;
  499. UINT FTaskbarCreatedMsg;
  500. void __fastcall WndProc(TMessage & Message);
  501. void __fastcall SetVisible(bool value);
  502. UnicodeString __fastcall GetHint();
  503. void __fastcall SetHint(UnicodeString value);
  504. void __fastcall BalloonCancelled();
  505. };
  506. //---------------------------------------------------------------------------
  507. #endif // WinInterfaceH