WinInterface.h 28 KB

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