WinInterface.h 29 KB

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