WinInterface.h 25 KB

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