Authenticate.cpp 20 KB

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