WinInterface.h 29 KB

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