WinInterface.h 29 KB

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