Authenticate.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include "Authenticate.h"
  6. #include <VCLCommon.h>
  7. #include <TextsWin.h>
  8. #include <Terminal.h>
  9. #include <CoreMain.h>
  10. #include <PasTools.hpp>
  11. #include <CustomWinConfiguration.h>
  12. //---------------------------------------------------------------------------
  13. #pragma package(smart_init)
  14. #pragma link "PasswordEdit"
  15. #pragma resource "*.dfm"
  16. //---------------------------------------------------------------------------
  17. __fastcall TAuthenticateForm::TAuthenticateForm(TComponent * Owner)
  18. : TForm(Owner), FSessionData(NULL), FTerminal(NULL)
  19. {
  20. }
  21. //---------------------------------------------------------------------------
  22. void __fastcall TAuthenticateForm::Init(TTerminal * Terminal)
  23. {
  24. FTerminal = Terminal;
  25. FSessionData = Terminal->SessionData;
  26. UseSystemSettings(this);
  27. FShowAsModalStorage = NULL;
  28. FFocusControl = NULL;
  29. UseDesktopFont(LogView);
  30. FAnimationPainted = false;
  31. FShowNoActivate = false;
  32. FPromptParent = InstructionsLabel->Parent;
  33. FPromptLeft = InstructionsLabel->Left;
  34. FPromptTop = InstructionsLabel->Top;
  35. FPromptRight = FPromptParent->ClientWidth - InstructionsLabel->Width - FPromptLeft;
  36. FPromptEditGap = PromptEdit1->Top - PromptLabel1->Top - PromptLabel1->Height;
  37. FPromptsGap = PromptLabel2->Top - PromptEdit1->Top - PromptEdit1->Height;
  38. ClientHeight = ScaleByTextHeight(this, 270);
  39. FHorizontalLogPadding = ScaleByTextHeight(this, 4);
  40. FVerticalLogPadding = ScaleByTextHeight(this, 3);
  41. FLogTextFormat << tfNoPrefix << tfWordBreak << tfVerticalCenter;
  42. }
  43. //---------------------------------------------------------------------------
  44. __fastcall TAuthenticateForm::~TAuthenticateForm()
  45. {
  46. if (ReleaseAsModal(this, FShowAsModalStorage))
  47. {
  48. UnhookFormActivation(this);
  49. }
  50. }
  51. //---------------------------------------------------------------------------
  52. void __fastcall TAuthenticateForm::ShowAsModal()
  53. {
  54. if (IsApplicationMinimized())
  55. {
  56. FShowNoActivate = true;
  57. }
  58. // Do not call BringToFront when minimized, so that we do not have to use the same hack as in TMessageForm::SetZOrder
  59. ::ShowAsModal(this, FShowAsModalStorage, !FShowNoActivate);
  60. HookFormActivation(this);
  61. }
  62. //---------------------------------------------------------------------------
  63. void __fastcall TAuthenticateForm::CMShowingChanged(TMessage & Message)
  64. {
  65. if (Showing && FShowNoActivate)
  66. {
  67. ShowFormNoActivate(this);
  68. }
  69. else
  70. {
  71. TForm::Dispatch(&Message);
  72. }
  73. }
  74. //---------------------------------------------------------------------------
  75. void __fastcall TAuthenticateForm::WMNCCreate(TWMNCCreate & Message)
  76. {
  77. // bypass TForm::WMNCCreate to prevent disabling "resize"
  78. // (which is done for bsDialog, see comments in CreateParams)
  79. DefaultHandler(&Message);
  80. }
  81. //---------------------------------------------------------------------------
  82. void __fastcall TAuthenticateForm::DoCancel()
  83. {
  84. if (FOnCancel != NULL)
  85. {
  86. FOnCancel(this);
  87. }
  88. }
  89. //---------------------------------------------------------------------------
  90. void __fastcall TAuthenticateForm::Dispatch(void * AMessage)
  91. {
  92. TMessage & Message = *reinterpret_cast<TMessage *>(AMessage);
  93. if (Message.Msg == WM_NCCREATE)
  94. {
  95. WMNCCreate(*reinterpret_cast<TWMNCCreate *>(AMessage));
  96. }
  97. else if (Message.Msg == WM_CLOSE)
  98. {
  99. DoCancel();
  100. TForm::Dispatch(AMessage);
  101. }
  102. else if (Message.Msg == WM_MANAGES_CAPTION)
  103. {
  104. // caption managed in TAuthenticateForm::AdjustControls()
  105. Message.Result = 1;
  106. }
  107. else if (Message.Msg == CM_SHOWINGCHANGED)
  108. {
  109. CMShowingChanged(Message);
  110. }
  111. else
  112. {
  113. TForm::Dispatch(AMessage);
  114. }
  115. }
  116. //---------------------------------------------------------------------------
  117. void __fastcall TAuthenticateForm::CreateParams(TCreateParams & Params)
  118. {
  119. TForm::CreateParams(Params);
  120. // Allow resizing of the window, even if this is bsDialog.
  121. // This makes it more close to bsSizeable, but bsSizeable cannot for some
  122. // reason receive focus, if window is shown atop non-main window
  123. // (like editor)
  124. Params.Style = Params.Style | WS_THICKFRAME;
  125. }
  126. //---------------------------------------------------------------------------
  127. void __fastcall TAuthenticateForm::FormShow(TObject * /*Sender*/)
  128. {
  129. AdjustControls();
  130. if (FFocusControl != NULL)
  131. {
  132. ActiveControl = FFocusControl;
  133. }
  134. UnicodeString AnimationName = FSessionData->IsSecure() ? L"ConnectingSecure" : L"ConnectingInsecure";
  135. FFrameAnimation.Init(AnimationPaintBox, AnimationName);
  136. FFrameAnimation.Start();
  137. }
  138. //---------------------------------------------------------------------------
  139. void __fastcall TAuthenticateForm::Log(const UnicodeString Message)
  140. {
  141. // HACK
  142. // The first call to Repaint from TFrameAnimation happens
  143. // even before the form is showing. After it is shown it takes sometime too long
  144. // before the animation is painted, so that the form is closed before the first frame even appers
  145. if (!FAnimationPainted && Showing)
  146. {
  147. AnimationPaintBox->Repaint();
  148. FAnimationPainted = true;
  149. }
  150. int Index = LogView->Items->Add(Message);
  151. MakeLogItemVisible(Index);
  152. LogView->Repaint();
  153. }
  154. //---------------------------------------------------------------------------
  155. void __fastcall TAuthenticateForm::MakeLogItemVisible(int Index)
  156. {
  157. if (Index < LogView->TopIndex)
  158. {
  159. LogView->TopIndex = Index;
  160. }
  161. else
  162. {
  163. int TotalHeight = 0;
  164. int Index2 = Index;
  165. while ((Index2 >= 0) && TotalHeight < LogView->ClientHeight)
  166. {
  167. TotalHeight += LogItemHeight(Index2);
  168. Index2--;
  169. }
  170. // Index2 is the last item above the first fully visible,
  171. // were the Index on the very bottom.
  172. if (LogView->TopIndex <= Index2 + 1)
  173. {
  174. LogView->TopIndex = Index2 + 2;
  175. }
  176. }
  177. }
  178. //---------------------------------------------------------------------------
  179. void __fastcall TAuthenticateForm::AdjustControls()
  180. {
  181. UnicodeString ACaption;
  182. if (FStatus.IsEmpty())
  183. {
  184. ACaption = FSessionData->SessionName;
  185. }
  186. else
  187. {
  188. ACaption = FORMAT(L"%s - %s", (FStatus, FSessionData->SessionName));
  189. }
  190. Caption = FormatFormCaption(this, ACaption);
  191. }
  192. //---------------------------------------------------------------------------
  193. TLabel * __fastcall TAuthenticateForm::GenerateLabel(int Current, UnicodeString Caption)
  194. {
  195. TLabel * Result = new TLabel(this);
  196. Result->Parent = FPromptParent;
  197. Result->Anchors = TAnchors() << akLeft << akTop << akRight;
  198. Result->WordWrap = true;
  199. Result->AutoSize = false;
  200. Result->Top = Current;
  201. Result->Left = FPromptLeft;
  202. Result->Caption = Caption;
  203. int Width = FPromptParent->ClientWidth - FPromptLeft - FPromptRight;
  204. Result->Width = Width;
  205. Result->AutoSize = true;
  206. Result->AutoSize = false;
  207. Result->Width = Width;
  208. return Result;
  209. }
  210. //---------------------------------------------------------------------------
  211. TCustomEdit * __fastcall TAuthenticateForm::GenerateEdit(int Current, bool Echo)
  212. {
  213. TCustomEdit * Result = (Echo ? static_cast<TCustomEdit *>(new TEdit(this)) :
  214. static_cast<TCustomEdit *>(new TPasswordEdit(this)));
  215. Result->Parent = FPromptParent;
  216. Result->Anchors = TAnchors() << akLeft << akTop << akRight;
  217. Result->Top = Current;
  218. Result->Left = FPromptLeft;
  219. Result->Width = FPromptParent->ClientWidth - FPromptLeft - FPromptRight;
  220. return Result;
  221. }
  222. //---------------------------------------------------------------------------
  223. TList * __fastcall TAuthenticateForm::GeneratePrompt(UnicodeString Instructions,
  224. TStrings * Prompts)
  225. {
  226. while (FPromptParent->ControlCount > 0)
  227. {
  228. delete FPromptParent->Controls[0];
  229. }
  230. TList * Result = new TList;
  231. int Current = FPromptTop;
  232. if (!Instructions.IsEmpty())
  233. {
  234. TLabel * Label = GenerateLabel(Current, Instructions);
  235. Current += Label->Height + FPromptsGap;
  236. }
  237. for (int Index = 0; Index < Prompts->Count; Index++)
  238. {
  239. if (Index > 0)
  240. {
  241. Current += FPromptEditGap;
  242. }
  243. TLabel * Label = GenerateLabel(Current, Prompts->Strings[Index]);
  244. Current += Label->Height + FPromptEditGap;
  245. bool Echo = FLAGSET(int(Prompts->Objects[Index]), pupEcho);
  246. TCustomEdit * Edit = GenerateEdit(Current, Echo);
  247. Result->Add(Edit);
  248. Label->FocusControl = Edit;
  249. Current += Edit->Height;
  250. }
  251. FPromptParent->ClientHeight = Current;
  252. return Result;
  253. }
  254. //---------------------------------------------------------------------------
  255. bool __fastcall TAuthenticateForm::PromptUser(TPromptKind Kind, UnicodeString Name,
  256. UnicodeString Instructions, TStrings * Prompts, TStrings * Results, bool ForceLog,
  257. bool StoredCredentialsTried)
  258. {
  259. bool Result;
  260. TList * Edits = GeneratePrompt(Instructions, Prompts);
  261. try
  262. {
  263. bool ShowSessionRememberPasswordPanel = false;
  264. bool ShowSavePasswordPanel = false;
  265. TSessionData * Data = NULL;
  266. if (IsPasswordPrompt(Kind, Prompts) && StoredCredentialsTried)
  267. {
  268. Data = StoredSessions->FindSame(FSessionData);
  269. ShowSavePasswordPanel = (Data != NULL) && !Data->Password.IsEmpty();
  270. }
  271. // do not offer to remember password,
  272. // if we are offering to save the password to stored site
  273. if (!ShowSavePasswordPanel &&
  274. (Prompts->Count == 1) &&
  275. FLAGSET(int(Prompts->Objects[0]), pupRemember) &&
  276. DebugAlwaysTrue(IsPasswordOrPassphrasePrompt(Kind, Prompts)))
  277. {
  278. ShowSessionRememberPasswordPanel = true;
  279. }
  280. SavePasswordCheck->Checked = false;
  281. SavePasswordPanel->Visible = ShowSavePasswordPanel;
  282. SessionRememberPasswordCheck->Checked = false;
  283. SessionRememberPasswordPanel->Visible = ShowSessionRememberPasswordPanel;
  284. if (PasswordPanel->AutoSize)
  285. {
  286. PasswordPanel->AutoSize = false;
  287. PasswordPanel->AutoSize = true;
  288. }
  289. PasswordPanel->Realign();
  290. DebugAssert(Results->Count == Edits->Count);
  291. for (int Index = 0; Index < Edits->Count; Index++)
  292. {
  293. TCustomEdit * Edit = reinterpret_cast<TCustomEdit *>(Edits->Items[Index]);
  294. Edit->Text = Results->Strings[Index];
  295. }
  296. Result = Execute(Name, PasswordPanel,
  297. ((Edits->Count > 0) ?
  298. reinterpret_cast<TWinControl *>(Edits->Items[0]) :
  299. static_cast<TWinControl *>(PasswordOKButton)),
  300. PasswordOKButton, PasswordCancelButton, true, false, ForceLog);
  301. if (Result)
  302. {
  303. for (int Index = 0; Index < Edits->Count; Index++)
  304. {
  305. TCustomEdit * Edit = reinterpret_cast<TCustomEdit *>(Edits->Items[Index]);
  306. Results->Strings[Index] = Edit->Text;
  307. Prompts->Objects[Index] = (TObject *)
  308. ((int(Prompts->Objects[Index]) & ~pupRemember) |
  309. FLAGMASK(((Index == 0) && SessionRememberPasswordCheck->Checked), pupRemember));
  310. }
  311. if (SavePasswordCheck->Checked)
  312. {
  313. DebugAssert(Data != NULL);
  314. DebugAssert(Results->Count >= 1);
  315. FSessionData->Password = Results->Strings[0];
  316. Data->Password = Results->Strings[0];
  317. // modified only, explicit
  318. StoredSessions->Save(false, true);
  319. }
  320. }
  321. }
  322. __finally
  323. {
  324. delete Edits;
  325. }
  326. return Result;
  327. }
  328. //---------------------------------------------------------------------------
  329. void __fastcall TAuthenticateForm::UpdateBannerFont()
  330. {
  331. if (BannerMonospacedFontAction->Checked)
  332. {
  333. BannerMemo->Font->Name = CustomWinConfiguration->DefaultFixedWidthFontName;
  334. BannerMemo->Font->Size = CustomWinConfiguration->DefaultFixedWidthFontSize;
  335. }
  336. else
  337. {
  338. BannerMemo->ParentFont = true;
  339. }
  340. }
  341. //---------------------------------------------------------------------------
  342. void __fastcall TAuthenticateForm::Banner(const UnicodeString & Banner,
  343. bool & NeverShowAgain, int Options, unsigned int & Params)
  344. {
  345. BannerMemo->Lines->Text = Banner;
  346. NeverShowAgainCheck->Visible = FLAGCLEAR(Options, boDisableNeverShowAgain);
  347. NeverShowAgainCheck->Checked = NeverShowAgain;
  348. BannerMonospacedFontAction->Checked = FLAGSET(Params, bpMonospacedFont);
  349. UpdateBannerFont();
  350. bool Result = Execute(LoadStr(AUTHENTICATION_BANNER), BannerPanel, BannerCloseButton,
  351. BannerCloseButton, BannerCloseButton, false, true, false);
  352. if (Result)
  353. {
  354. NeverShowAgain = NeverShowAgainCheck->Checked;
  355. Params =
  356. (Params & ~bpMonospacedFont) |
  357. FLAGMASK(BannerMonospacedFontAction->Checked, bpMonospacedFont);
  358. }
  359. }
  360. //---------------------------------------------------------------------------
  361. bool __fastcall TAuthenticateForm::Execute(UnicodeString Status, TPanel * Panel,
  362. TWinControl * FocusControl, TButton * DefaultButton, TButton * CancelButton,
  363. bool FixHeight, bool Zoom, bool ForceLog)
  364. {
  365. TModalResult DefaultButtonResult;
  366. TAlign Align = Panel->Align;
  367. try
  368. {
  369. // If not visible yet, the animation was not even initialized yet
  370. if (Visible)
  371. {
  372. FFrameAnimation.Stop();
  373. }
  374. DebugAssert(FStatus.IsEmpty());
  375. FStatus = Status;
  376. DefaultButton->Default = true;
  377. CancelButton->Cancel = true;
  378. DefaultButtonResult = DefaultResult(this);
  379. if (Zoom)
  380. {
  381. Panel->Align = alClient;
  382. }
  383. if (ForceLog || Visible)
  384. {
  385. if (ClientHeight < Panel->Height)
  386. {
  387. ClientHeight = Panel->Height;
  388. }
  389. // Panel being hidden gets not realigned automatically, even if it
  390. // has Align property set
  391. Panel->Top = ClientHeight - Panel->Height;
  392. Panel->Show();
  393. TCursor PrevCursor = Screen->Cursor;
  394. try
  395. {
  396. if (Zoom)
  397. {
  398. TopPanel->Hide();
  399. }
  400. else
  401. {
  402. if (LogView->Items->Count > 0)
  403. {
  404. // To avoid the scrolling effect when setting TopIndex
  405. LogView->Items->BeginUpdate();
  406. try
  407. {
  408. MakeLogItemVisible(LogView->Items->Count - 1);
  409. }
  410. __finally
  411. {
  412. LogView->Items->EndUpdate();
  413. RedrawLog();
  414. }
  415. }
  416. }
  417. Screen->Cursor = crDefault;
  418. if (!Visible)
  419. {
  420. DebugAssert(ForceLog);
  421. ShowAsModal();
  422. }
  423. ActiveControl = FocusControl;
  424. ModalResult = mrNone;
  425. AdjustControls();
  426. do
  427. {
  428. Application->HandleMessage();
  429. }
  430. while (!Application->Terminated && (ModalResult == mrNone));
  431. }
  432. __finally
  433. {
  434. Panel->Hide();
  435. Screen->Cursor = PrevCursor;
  436. if (Zoom)
  437. {
  438. TopPanel->Show();
  439. }
  440. Repaint();
  441. }
  442. }
  443. else
  444. {
  445. int PrevHeight = ClientHeight;
  446. int PrevMinHeight = Constraints->MinHeight;
  447. int PrevMaxHeight = Constraints->MaxHeight;
  448. try
  449. {
  450. Constraints->MinHeight = 0;
  451. ClientHeight = Panel->Height;
  452. if (FixHeight)
  453. {
  454. Constraints->MinHeight = Height;
  455. Constraints->MaxHeight = Height;
  456. }
  457. TopPanel->Hide();
  458. Panel->Show();
  459. FFocusControl = FocusControl;
  460. ShowModal();
  461. }
  462. __finally
  463. {
  464. FFocusControl = NULL;
  465. ClientHeight = PrevHeight;
  466. Constraints->MinHeight = PrevMinHeight;
  467. Constraints->MaxHeight = PrevMaxHeight;
  468. Panel->Hide();
  469. TopPanel->Show();
  470. }
  471. }
  472. }
  473. __finally
  474. {
  475. Panel->Align = Align;
  476. DefaultButton->Default = false;
  477. CancelButton->Cancel = false;
  478. FStatus = L"";
  479. AdjustControls();
  480. FFrameAnimation.Start();
  481. }
  482. bool Result = (ModalResult == DefaultButtonResult);
  483. if (!Result)
  484. {
  485. // This is not nice as it may ultimately route to
  486. // TTerminalThread::Cancel() and throw fatal exception,
  487. // what actually means that any PromptUser call during authentication never
  488. // return false and their fall back/alternative code never occurs.
  489. // It probably needs fixing.
  490. DoCancel();
  491. }
  492. return Result;
  493. }
  494. //---------------------------------------------------------------------------
  495. void __fastcall TAuthenticateForm::HelpButtonClick(TObject * /*Sender*/)
  496. {
  497. FormHelp(this);
  498. }
  499. //---------------------------------------------------------------------------
  500. int __fastcall TAuthenticateForm::LogItemHeight(int Index)
  501. {
  502. UnicodeString S = LogView->Items->Strings[Index];
  503. TRect TextRect(0, 0, LogView->ClientWidth - (2 * FHorizontalLogPadding), 0);
  504. LogView->Canvas->Font = LogView->Font;
  505. LogView->Canvas->TextRect(TextRect, S, FLogTextFormat + (TTextFormat() << tfCalcRect));
  506. int Result = TextRect.Height() + (2 * FVerticalLogPadding);
  507. return Result;
  508. }
  509. //---------------------------------------------------------------------------
  510. void __fastcall TAuthenticateForm::LogViewMeasureItem(TWinControl * /*Control*/, int Index,
  511. int & Height)
  512. {
  513. Height = LogItemHeight(Index);
  514. }
  515. //---------------------------------------------------------------------------
  516. void __fastcall TAuthenticateForm::LogViewDrawItem(TWinControl * /*Control*/, int Index,
  517. TRect & Rect, TOwnerDrawState /*State*/)
  518. {
  519. // Reset back to base colors. We do not want to render selection.
  520. // + At initial phases the canvas font will not yet reflect the desktop font.
  521. LogView->Canvas->Font = LogView->Font;
  522. LogView->Canvas->Brush->Color = LogView->Color;
  523. LogView->Canvas->FillRect(Rect);
  524. // tfVerticalCenter does not seem to center the text,
  525. // so we need to deflate the vertical size too
  526. Rect.Inflate(-FHorizontalLogPadding, -FVerticalLogPadding);
  527. UnicodeString S = LogView->Items->Strings[Index];
  528. LogView->Canvas->TextRect(Rect, S, FLogTextFormat);
  529. }
  530. //---------------------------------------------------------------------------
  531. void __fastcall TAuthenticateForm::RedrawLog()
  532. {
  533. // Redraw including the scrollbar (RDW_FRAME)
  534. RedrawWindow(LogView->Handle, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
  535. }
  536. //---------------------------------------------------------------------------
  537. void __fastcall TAuthenticateForm::FormResize(TObject * /*Sender*/)
  538. {
  539. if (LogView->Showing)
  540. {
  541. // Mainly to avoid the scrolling effect when setting TopIndex
  542. LogView->Items->BeginUpdate();
  543. try
  544. {
  545. // Rebuild the list view to force Windows to resend WM_MEASUREITEM
  546. int ItemIndex = LogView->ItemIndex;
  547. int TopIndex = LogView->TopIndex;
  548. std::unique_ptr<TStringList> Items(new TStringList);
  549. Items->Assign(LogView->Items);
  550. LogView->Items->Assign(Items.get());
  551. LogView->ItemIndex = ItemIndex;
  552. LogView->TopIndex = TopIndex;
  553. }
  554. __finally
  555. {
  556. LogView->Items->EndUpdate();
  557. RedrawLog();
  558. }
  559. }
  560. }
  561. //---------------------------------------------------------------------------
  562. void __fastcall TAuthenticateForm::ChangeScale(int M, int D)
  563. {
  564. TForm::ChangeScale(M, D);
  565. // Recreate the list to re-measure the items according to the new font
  566. if (DebugAlwaysTrue(LogView->HandleAllocated()) &&
  567. (LogView->Items->Count > 0))
  568. {
  569. std::unique_ptr<TStrings> Items(new TStringList());
  570. Items->AddStrings(LogView->Items);
  571. LogView->Items->Clear();
  572. LogView->Items->AddStrings(Items.get());
  573. MakeLogItemVisible(LogView->Items->Count - 1);
  574. }
  575. }
  576. //---------------------------------------------------------------------------
  577. void __fastcall TAuthenticateForm::BannerMemoContextPopup(TObject * Sender, TPoint & MousePos, bool & Handled)
  578. {
  579. MenuPopup(Sender, MousePos, Handled);
  580. }
  581. //---------------------------------------------------------------------------
  582. void __fastcall TAuthenticateForm::BannerMonospacedFontActionExecute(TObject * /*Sender*/)
  583. {
  584. BannerMonospacedFontAction->Checked = !BannerMonospacedFontAction->Checked;
  585. UpdateBannerFont();
  586. }
  587. //---------------------------------------------------------------------------