WinInterface.h 28 KB

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