WinInterface.h 27 KB

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