WinInterface.h 28 KB

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