From b73ad171a31807d92bc8da390fd3a13364a8868b Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Wed, 12 Oct 2005 08:25:03 +0000
Subject: [PATCH] Created a right-click popup menu on the File Preview window
 to change the current font (shared with the Spy Terminal window).

---
 src/sbbs3/ctrl/PreviewFormUnit.cpp | 46 ++++++++++++++++++++++++++++++
 src/sbbs3/ctrl/PreviewFormUnit.dfm | 26 +++++++++++------
 src/sbbs3/ctrl/PreviewFormUnit.h   | 39 ++++++++++++++++++++++++-
 3 files changed, 102 insertions(+), 9 deletions(-)

diff --git a/src/sbbs3/ctrl/PreviewFormUnit.cpp b/src/sbbs3/ctrl/PreviewFormUnit.cpp
index 5228d70ddd..60e6276c30 100644
--- a/src/sbbs3/ctrl/PreviewFormUnit.cpp
+++ b/src/sbbs3/ctrl/PreviewFormUnit.cpp
@@ -1,3 +1,36 @@
+/* $Id$ */
+
+/****************************************************************************
+ * @format.tab-size 4		(Plain Text/Source Code File Header)			*
+ * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
+ *																			*
+ * Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html		*
+ *																			*
+ * This program is free software; you can redistribute it and/or			*
+ * modify it under the terms of the GNU General Public License				*
+ * as published by the Free Software Foundation; either version 2			*
+ * of the License, or (at your option) any later version.					*
+ * See the GNU General Public License for more details: gpl.txt or			*
+ * http://www.fsf.org/copyleft/gpl.html										*
+ *																			*
+ * Anonymous FTP access to the most recent released source is available at	*
+ * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net	*
+ *																			*
+ * Anonymous CVS access to the development source and modification history	*
+ * is available at cvs.synchro.net:/cvsroot/sbbs, example:					*
+ * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login			*
+ *     (just hit return, no password is necessary)							*
+ * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src		*
+ *																			*
+ * For Synchronet coding style and modification guidelines, see				*
+ * http://www.synchro.net/source.html										*
+ *																			*
+ * You are encouraged to submit any modifications (preferably in Unix diff	*
+ * format) via e-mail to mods@synchro.net									*
+ *																			*
+ * Note: If this box doesn't appear square, then you need to fix your tabs.	*
+ ****************************************************************************/
+
 //---------------------------------------------------------------------------
 
 #include <vcl.h>
@@ -29,6 +62,7 @@ __fastcall TPreviewForm::~TPreviewForm()
 	delete Terminal;
 }
 
+
 #define ANSI_ESC "\x1b["
 
 //---------------------------------------------------------------------------
@@ -160,4 +194,16 @@ void __fastcall TPreviewForm::FormClose(TObject *Sender,
 
 }
 //---------------------------------------------------------------------------
+void __fastcall TPreviewForm::ChangeFontMenuItemClick(TObject *Sender)
+{
+	TFontDialog *FontDialog=new TFontDialog(this);
+
+    FontDialog->Font=MainForm->SpyTerminalFont;
+    FontDialog->Execute();
+    MainForm->SpyTerminalFont->Assign(FontDialog->Font);
+    Terminal->Font=MainForm->SpyTerminalFont;
+    delete FontDialog;
+    Terminal->UpdateScreen();
+}
+//---------------------------------------------------------------------------
 
diff --git a/src/sbbs3/ctrl/PreviewFormUnit.dfm b/src/sbbs3/ctrl/PreviewFormUnit.dfm
index 6bae1d29cf..4cba9c6b5d 100644
--- a/src/sbbs3/ctrl/PreviewFormUnit.dfm
+++ b/src/sbbs3/ctrl/PreviewFormUnit.dfm
@@ -1,19 +1,29 @@
 object PreviewForm: TPreviewForm
-  Left = 392
-  Top = 374
-  Width = 622
-  Height = 309
+  Left = 504
+  Top = 375
+  Width = 585
+  Height = 364
   Caption = 'Preview'
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
-  Font.Height = -11
+  Font.Height = -14
   Font.Name = 'MS Sans Serif'
   Font.Style = []
   OldCreateOrder = False
-  Position = poDefault
+  PopupMenu = PopupMenu
+  Position = poDefaultPosOnly
   OnClose = FormClose
   OnShow = FormShow
-  PixelsPerInch = 96
-  TextHeight = 13
+  PixelsPerInch = 120
+  TextHeight = 16
+  object PopupMenu: TPopupMenu
+    Left = 144
+    Top = 24
+    object ChangeFontMenuItem: TMenuItem
+      Caption = 'Change Font'
+      Hint = 'Change Font'
+      OnClick = ChangeFontMenuItemClick
+    end
+  end
 end
diff --git a/src/sbbs3/ctrl/PreviewFormUnit.h b/src/sbbs3/ctrl/PreviewFormUnit.h
index d5c1114bb9..cbf6a47b73 100644
--- a/src/sbbs3/ctrl/PreviewFormUnit.h
+++ b/src/sbbs3/ctrl/PreviewFormUnit.h
@@ -1,3 +1,36 @@
+/* $Id$ */
+
+/****************************************************************************
+ * @format.tab-size 4		(Plain Text/Source Code File Header)			*
+ * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
+ *																			*
+ * Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html		*
+ *																			*
+ * This program is free software; you can redistribute it and/or			*
+ * modify it under the terms of the GNU General Public License				*
+ * as published by the Free Software Foundation; either version 2			*
+ * of the License, or (at your option) any later version.					*
+ * See the GNU General Public License for more details: gpl.txt or			*
+ * http://www.fsf.org/copyleft/gpl.html										*
+ *																			*
+ * Anonymous FTP access to the most recent released source is available at	*
+ * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net	*
+ *																			*
+ * Anonymous CVS access to the development source and modification history	*
+ * is available at cvs.synchro.net:/cvsroot/sbbs, example:					*
+ * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login			*
+ *     (just hit return, no password is necessary)							*
+ * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src		*
+ *																			*
+ * For Synchronet coding style and modification guidelines, see				*
+ * http://www.synchro.net/source.html										*
+ *																			*
+ * You are encouraged to submit any modifications (preferably in Unix diff	*
+ * format) via e-mail to mods@synchro.net									*
+ *																			*
+ * Note: If this box doesn't appear square, then you need to fix your tabs.	*
+ ****************************************************************************/
+
 //---------------------------------------------------------------------------
 
 #ifndef PreviewFormUnitH
@@ -7,13 +40,17 @@
 #include <Controls.hpp>
 #include <StdCtrls.hpp>
 #include <Forms.hpp>
-#include "emulvt.hpp"	/* TEmulVT */
+#include "emulvt.hpp"   /* TEmulVT */
+#include <Menus.hpp>
 //---------------------------------------------------------------------------
 class TPreviewForm : public TForm
 {
 __published:	// IDE-managed Components
+    TPopupMenu *PopupMenu;
+    TMenuItem *ChangeFontMenuItem;
 	void __fastcall FormShow(TObject *Sender);
     void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
+    void __fastcall ChangeFontMenuItemClick(TObject *Sender);
 private:	// User declarations
 public:		// User declarations
 	__fastcall TPreviewForm(TComponent* Owner);
-- 
GitLab