WinInterface.h 27 KB

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