WinInterface.h 29 KB

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