WinInterface.h 28 KB

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