WinInterface.h 25 KB

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