Index: cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptionsNotes.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptionsNotes.pas	(revision 453)
+++ cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptionsNotes.pas	(revision 541)
@@ -4,6 +4,43 @@
 interface
 
+{ //kt 8/09  The following objects were addeded to the *FORM* of this unit
+
+  object lblHTMLViewSize: TLabel
+    Left = 8
+    Top = 144
+    Width = 159
+    Height = 13
+    Caption = 'Formatted Text (HTML) View Size'
+  end
+  object cboHTMLViewSize: TComboBox
+  Left = 8
+  Top = 162
+  Width = 153
+  Height = 21
+  ItemHeight = 13
+  TabOrder = 6
+  Text = '<View Size>'
+  OnClick = cboHTMLViewSizeClick
+  Items.Strings = (
+    'Smallest'
+    'Small'
+    'Medium'
+    'Large'
+    'Largest')
+  end
+  object cbDefaultHTMLMode: TCheckBox
+    Left = 8
+    Top = 112
+    Width = 225
+    Height = 17
+    Caption = 'Start notes in Formatted (HTML) Mode'
+    TabOrder = 7
+    OnClick = cbDefaultHTMLModeClick
+}
+
+
 uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
+  IniFiles,    //kt for IniFile
   StdCtrls, ExtCtrls, ORCtrls, ORFn, ComCtrls, DKLang;
 
@@ -22,5 +59,8 @@
     btnCancel: TButton;
     lblAutoSave2: TLabel;
-    DKLanguageController1: TDKLanguageController;
+    cboHTMLViewSize: TComboBox;   //kt 8/09
+    lblHTMLViewSize: TLabel;      //kt 8/09
+    cbDefaultHTMLMode: TCheckBox; //kt 8/09
+    DKLanguageController1: TDKLanguageController; //kt
     procedure FormShow(Sender: TObject);
     procedure btnOKClick(Sender: TObject);
@@ -32,4 +72,7 @@
       Direction, InsertAt: Integer);
     procedure cboCosignerExit(Sender: TObject);
+    procedure FormCreate(Sender: TObject);              //kt 8/09
+    procedure cbDefaultHTMLModeClick(Sender: TObject);  //kt 8/09
+    procedure cboHTMLViewSizeChange(Sender: TObject);   //kt 8/09
   private
     { Private declarations }
@@ -40,6 +83,11 @@
 var
   frmOptionsNotes: TfrmOptionsNotes;
+  OptionsNotesIniFile : TIniFile;  //kt 8/09
+  DefaultEditHTMLMode : boolean;   //kt 8/09
+  FHTMLEditTextSize   : integer;   //kt 8/09
 
 procedure DialogOptionsNotes(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
+procedure SetDefaultEditHTMLMode(Value : boolean);  //kt 8/09
+procedure Loaded;                                   //kt 8/09
 
 implementation
@@ -48,5 +96,13 @@
 
 uses
+  uCore,    //kt 8/09
+  Registry, //kt 8/09
   rOptions, uOptions, rCore, rTIU, rDCSumm;
+
+const
+  DEFAULT_HTML_EDIT_MODE = 'Edit-in-HTML default mode';       //kt 8/09
+  DEFAULT_HTML_TEXT_SIZE = 'Edit-in-HTML default text size';  //kt 8/09
+
+procedure SetRegHTMLViewSize(Size : integer); forward;        //kt 8/09
 
 procedure DialogOptionsNotes(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
@@ -102,4 +158,5 @@
   chkAskSubject.Checked := rpcGetSubject;
   if chkAskSubject.Checked then chkAskSubject.Tag := 1;
+  cbDefaultHTMLMode.Checked := DefaultEditHTMLMode; //kt
 end;
 
@@ -207,3 +264,78 @@
 end;
 
+
+procedure SetRegHTMLViewSize(Size : integer);
+//kt added entire function 8/09
+//NOTE: The only way to affect the view size of the HTML renderer (IE) is to
+//      change a system-wide setting in the registry.  Then CPRS has to be
+//      restarted for changes to take effect.
+var
+  FontSizeData : array[0..3] of byte;
+  ZoomReg      : TRegistry;
+begin
+  if (Size < 0) or (Size > 255) then exit;
+  ZoomReg := TRegistry.Create;
+  FontSizeData[0] := Lo(Size); FontSizeData[1] := 0; FontSizeData[2] := 0; FontSizeData[3] := 0;
+  try
+    ZoomReg.Rootkey := HKEY_CURRENT_USER;
+    if ZoomReg.OpenKey('\Software\Microsoft\Internet Explorer\International\Scripts\3', False) then begin
+      ZoomReg.WriteBinaryData('IEFontSize',FontSizeData,SizeOf(FontSizeData));
+    end;
+  finally
+    ZoomReg.Free;
+  end;
+end;
+
+procedure SetDefaultEditHTMLMode(Value : boolean);
+//kt added entire function 8/09
+begin
+  if Value <> DefaultEditHTMLMode then begin
+    OptionsNotesIniFile.WriteBool(User.Name,DEFAULT_HTML_EDIT_MODE,Value);
+    DefaultEditHTMLMode := Value;
+  end;
+end;
+
+procedure TfrmOptionsNotes.cbDefaultHTMLModeClick(Sender: TObject);
+//kt added entire function 8/09
+begin
+  SetDefaultEditHTMLMode(cbDefaultHTMLMode.Checked);
+end;
+
+procedure TfrmOptionsNotes.cboHTMLViewSizeChange(Sender: TObject);
+//kt added entire function 8/09
+begin
+  SetRegHTMLViewSize(cboHTMLViewSize.ItemIndex);
+  OptionsNotesIniFile.WriteInteger(User.Name,DEFAULT_HTML_TEXT_SIZE,cboHTMLViewSize.ItemIndex);
+  MessageDlg('Formated text size change will take '+#10+#13+
+             'effect next time CPRS is restarted.',mtInformation,[mbOK],0);
+end;
+
+procedure Loaded;
+//kt added entire function 8/09
+begin
+  //Code was put in global access space because object is not instantiated until
+  //after user shows options (which could be never)
+  OptionsNotesIniFile := TIniFile.Create(ChangeFileExt(Application.ExeName, '.INI'));  //kt
+  DefaultEditHTMLMode := OptionsNotesIniFile.ReadBool(User.Name,DEFAULT_HTML_EDIT_MODE,false);
+  FHTMLEditTextSize := OptionsNotesIniFile.ReadInteger(User.Name,DEFAULT_HTML_TEXT_SIZE,2);
+  SetRegHTMLViewSize(FHTMLEditTextSize);
+end;
+
+procedure TfrmOptionsNotes.FormCreate(Sender: TObject);
+//kt added entire function 8/09
+//NOTE: form is not created until first time needed.
+begin
+  //NOTE: FHTMLEditTextSize is set in Loaded function (has to be called after sign on (so User.Name is available)
+  if (FHTMLEditTextSize > -1) and (FHTMLEditTextSize < cboHTMLViewSize.Items.Count) then begin
+    cboHTMLViewSize.ItemIndex := FHTMLEditTextSize;
+    cboHTMLViewSize.Text := cboHTMLViewSize.Items[FHTMLEditTextSize];
+    SetRegHTMLViewSize(cboHTMLViewSize.ItemIndex);
+  end;
+end;
+
+initialization
+
+finalization
+  OptionsNotesIniFile.Free;  //kt 8/09
+
 end.
