Ignore:
Timestamp:
Aug 12, 2009, 7:14:16 PM (15 years ago)
Author:
Kevin Toppenberg
Message:

TMG Ver 1.1 Added HTML Support, better demographics editing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/branches/tmg-cprs/CPRS-Chart/fFrame.pas

    r490 r541  
    375375    SkinChanged : boolean;  //kt 9/8/08
    376376    CurrentSkinFile : string; //kt 9/8/08
     377    TMGAbort : boolean;  //kt 3/25/09
    377378    procedure ActivateCurrentSkin; //kt 9/8/08
    378379    procedure InactivateSkin; //kt 9/8/08
     
    407408  uTabList: TStringList;
    408409  uTabColorsList : TStringList;  //kt added 8/8/08
     410  uTabColorsEnabled : Boolean;   //kt 8/09
    409411  uRemoteType : string;
    410412  FlaggedPTList: TStringList;
     
    803805{$ENDIF}
    804806
     807  TMGAbort := False;  //kt 3/25/09
    805808  if not ConnectToServer(TX_OPTION) then
    806809  begin
     
    809812      InfoBox(RPCBrokerV.RPCBError, DKLangConstW('fFrame_Error'), MB_OK or MB_ICONERROR); //kt added 7/17/2007
    810813    Close;
     814    TMGAbort := True;   //kt 3/25/09
    811815    Exit;
    812816  end;
     
    37553759                    frmNotes := TfrmNotes.Create(Self);
    37563760                    frmNotes.Parent := pnlPage;
     3761                    //kt Note: The following two lines must be done **AFTER**
     3762                    //         the assigment of Parent to pnlPage.  Otherwise
     3763                    //         the ActiveX object looses its attachement point
     3764                    //         or something and the document objects turns nil.
     3765                    frmNotes.HtmlViewer.Loaded;  //kt 8/09
     3766                    frmNotes.HtmlEditor.Loaded;  //kt 8/09
    37573767                  end;
    37583768    CT_CONSULTS : begin
     
    38073817      tabPage.Tabs.Add(ALabel);
    38083818    end;
    3809   if uTabColorsList.IndexOf(ALabel) < 0 then                    //kt added 8/8/08
    3810     uTabColorsList.Add(ALabel);  //will put colors in later...  //kt
     3819  uTabColorsList.Add(IntToStr(ATabID));  //will put colors in later...  //kt
     3820  {if uTabColorsList.IndexOf(ALabel) < 0 then                    //kt added 8/8/08
     3821    uTabColorsList.Add(ALabel);  //will put colors in later...  //kt  }
    38113822end;
    38123823
     
    38183829begin
    38193830  value :=0;
     3831  uTabColorsEnabled := INIFile.ReadBool('TAB_COLORS','ENABLE',true);
    38203832  for i := 0 to ColorsList.Count-1 do begin
    3821     sValue := INIFile.ReadString('TAB_COLORS',ColorsList.Strings[i],IntToStr($00FFFF));
     3833    //sValue := INIFile.ReadString('TAB_COLORS',ColorsList.Strings[i],IntToStr($00FFFF));
     3834    sValue := INIFile.ReadString('TAB_COLORS','Tab '+IntToStr(i),IntToStr($00FFFF));
    38223835    try
    38233836      value := StrToInt(sValue)
     
    38343847begin
    38353848  for i := 0 to ColorsList.Count-1 do begin
    3836     INIFile.WriteInteger('TAB_COLORS',ColorsList.Strings[i],longword(ColorsList.Objects[i]));
    3837   end;
     3849    //INIFile.WriteInteger('TAB_COLORS',ColorsList.Strings[i],longword(ColorsList.Objects[i]));
     3850    INIFile.WriteInteger('TAB_COLORS','Tab '+IntToStr(i),longword(ColorsList.Objects[i]));
     3851  end;
     3852  INIFile.WriteBool('TAB_COLORS','ENABLE',uTabColorsEnabled); //kt 8/09
    38383853end;
    38393854
     
    49574972procedure TfrmFrame.tabPageDrawTab(Control: TCustomTabControl; TabIndex: Integer;
    49584973                                   const Rect: TRect; Active: Boolean);
     4974//kt added
    49594975var ALabel : string;
    49604976    colorIndex : Integer;
    49614977    color : TColor;
    49624978begin
    4963   ALabel := TTabControl(Control).Tabs[TabIndex];
    4964   colorIndex := uTabColorsList.IndexOf(ALabel);
    4965   if colorIndex < 0 then color := clYellow
    4966   else color := TColor(uTabColorsList.Objects[colorIndex]);
    4967   DrawTab(Control,TabIndex,Rect,color,Active);
     4979  if uTabColorsEnabled then begin
     4980    ALabel := TTabControl(Control).Tabs[TabIndex];
     4981    {
     4982    colorIndex := uTabColorsList.IndexOf(ALabel);
     4983    if colorIndex < 0 then color := clYellow
     4984    else color := TColor(uTabColorsList.Objects[colorIndex]);
     4985    }
     4986    color := TColor(uTabColorsList.Objects[TabIndex]);
     4987    DrawTab(Control,TabIndex,Rect,color,Active);
     4988  end else begin
     4989    //this isn't working... This is not what I want.  Fix later...
     4990    //For now, uTabColorsEnabled should always be TRUE.
     4991    Control.Canvas.FillRect(Rect);
     4992  end;
    49684993end;
    49694994
     
    49805005    tf            : TFont;
    49815006    Degrees       : integer;
    4982     inactiveColor     : TColor;
    4983 
    4984     (*
    4985     function DecRed(Color : TColor; Amount : byte) : TColor;
     5007    inactiveColor : TColor;
     5008
     5009    function DarkenRed(Color : TColor; Percent : byte) : TColor;
    49865010    var red : longWord;
    49875011    begin
    49885012      red := (Color and $0000FF);
    4989       if red > Amount then red := red - Amount
    4990       else red := 0;
     5013      red := Round (red * (Percent/100));
    49915014      Result := (Color and $FFFF00) or red;
    49925015    end;
    49935016
    4994     function DecGreen(Color : TColor; Amount : byte) : TColor;
     5017    function DarkenGreen(Color : TColor; Percent : byte) : TColor;
    49955018    var green : longWord;
    49965019    begin
    49975020      green := (Color and $00FF00);
    49985021      green := green shr 8;
    4999       if green > Amount then green := green - Amount
    5000       else green := 0;
     5022      green := Round(green * (Percent/100));
    50015023      green := green shl 8;
    50025024      Result := (Color and $FF00FF) or green;
    50035025    end;
    50045026
    5005     function DecBlue(Color : TColor; Amount : byte) : TColor;
     5027    function DarkenBlue(Color : TColor; Percent : byte) : TColor;
    50065028    var blue : longWord;
    50075029    begin
    50085030      blue := (Color and $FF0000);
    50095031      blue := blue shr 16;
    5010       if blue > Amount then blue := blue - Amount
    5011       else blue := 0;
     5032      Blue := Round (blue * (Percent/100));
    50125033      blue := blue shl 16;
    50135034      Result := (Color and $00FFFF) or blue;
    50145035    end;
    50155036
    5016    function Darken(Color : TColor; Amount : byte) : TColor;
     5037   function Darken(Color : TColor; Percent : byte) : TColor;
    50175038   begin
    5018      result:= DecRed(Color, Amount);
    5019      result := DecBlue(result,Amount);
    5020      result := DecGreen(result,Amount);
     5039     if Percent=0 then begin result := Color; exit; end;
     5040     result:= DarkenRed(Color, Percent);
     5041     result := DarkenBlue(result,Percent);
     5042     result := DarkenGreen(result,Percent);
    50215043   end;
    5022    *)
    5023 
    5024   var
    5025     DecAmount : Byte;
    50265044
    50275045  begin
    50285046    oRect    := Rect;
    5029     //DecAmount := 50;
    5030     //inactiveColor := Darken(Color,DecAmount);
    5031     inactiveColor := Color;
     5047    inactiveColor := Darken(Color,75);  //75%
    50325048
    50335049    TabControl := TTabControl(Control);
     
    50395055
    50405056    Control.Canvas.Font.Name := 'Tahoma';
    5041     if Active then Control.Canvas.Font.Style := Control.Canvas.Font.Style + [fsBold];
    5042     if Active then Control.Canvas.Font.Color := clBlack
    5043     else Control.Canvas.Font.Color := clWhite;
     5057    if Active then begin
     5058      Control.Canvas.Font.Style := Control.Canvas.Font.Style + [fsBold];
     5059      Control.Canvas.Font.Color := clBlack
     5060    end else begin
     5061      Control.Canvas.Font.Style := Control.Canvas.Font.Style - [fsBold];
     5062      //Control.Canvas.Font.Color := clBlack
     5063      Control.Canvas.Font.Color := clWhite;
     5064    end;
    50445065
    50455066    if (TabControl.TabPosition = tpLeft) or (TabControl.TabPosition = tpRight) then begin
     
    50735094    end;
    50745095
     5096    if (TabControl.TabPosition = tpBottom) and (not Active) then begin
     5097      iTop := iTop - 2;
     5098    end;
     5099
    50755100    if Active then begin
    5076       //Control.Canvas.Brush.Color := TColor($0000FFFF);  //Bright yellow
    50775101      Control.Canvas.Brush.Color := Color;
    5078       Control.Canvas.FillRect(Rect);
    50795102    end else begin
    5080       //Control.Canvas.Brush.Color := TColor($000079EFE8);  //dull yellow
    50815103      Control.Canvas.Brush.Color := inactiveColor;
    5082       Control.Canvas.FillRect(Rect);
    5083     end;
     5104    end;
     5105    Control.Canvas.FillRect(Rect);
    50845106    Control.Canvas.TextOut(iLeft,iTop,sCaption);
    50855107  end;
Note: See TracChangeset for help on using the changeset viewer.