WinInterface.h 27 KB

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