WinInterface.h 24 KB

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