Changeset 541 for cprs/branches/tmg-cprs/CPRS-Chart/fFrame.pas
- Timestamp:
- Aug 12, 2009, 7:14:16 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/tmg-cprs/CPRS-Chart/fFrame.pas
r490 r541 375 375 SkinChanged : boolean; //kt 9/8/08 376 376 CurrentSkinFile : string; //kt 9/8/08 377 TMGAbort : boolean; //kt 3/25/09 377 378 procedure ActivateCurrentSkin; //kt 9/8/08 378 379 procedure InactivateSkin; //kt 9/8/08 … … 407 408 uTabList: TStringList; 408 409 uTabColorsList : TStringList; //kt added 8/8/08 410 uTabColorsEnabled : Boolean; //kt 8/09 409 411 uRemoteType : string; 410 412 FlaggedPTList: TStringList; … … 803 805 {$ENDIF} 804 806 807 TMGAbort := False; //kt 3/25/09 805 808 if not ConnectToServer(TX_OPTION) then 806 809 begin … … 809 812 InfoBox(RPCBrokerV.RPCBError, DKLangConstW('fFrame_Error'), MB_OK or MB_ICONERROR); //kt added 7/17/2007 810 813 Close; 814 TMGAbort := True; //kt 3/25/09 811 815 Exit; 812 816 end; … … 3755 3759 frmNotes := TfrmNotes.Create(Self); 3756 3760 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 3757 3767 end; 3758 3768 CT_CONSULTS : begin … … 3807 3817 tabPage.Tabs.Add(ALabel); 3808 3818 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 } 3811 3822 end; 3812 3823 … … 3818 3829 begin 3819 3830 value :=0; 3831 uTabColorsEnabled := INIFile.ReadBool('TAB_COLORS','ENABLE',true); 3820 3832 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)); 3822 3835 try 3823 3836 value := StrToInt(sValue) … … 3834 3847 begin 3835 3848 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 3838 3853 end; 3839 3854 … … 4957 4972 procedure TfrmFrame.tabPageDrawTab(Control: TCustomTabControl; TabIndex: Integer; 4958 4973 const Rect: TRect; Active: Boolean); 4974 //kt added 4959 4975 var ALabel : string; 4960 4976 colorIndex : Integer; 4961 4977 color : TColor; 4962 4978 begin 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; 4968 4993 end; 4969 4994 … … 4980 5005 tf : TFont; 4981 5006 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; 4986 5010 var red : longWord; 4987 5011 begin 4988 5012 red := (Color and $0000FF); 4989 if red > Amount then red := red - Amount 4990 else red := 0; 5013 red := Round (red * (Percent/100)); 4991 5014 Result := (Color and $FFFF00) or red; 4992 5015 end; 4993 5016 4994 function D ecGreen(Color : TColor; Amount : byte) : TColor;5017 function DarkenGreen(Color : TColor; Percent : byte) : TColor; 4995 5018 var green : longWord; 4996 5019 begin 4997 5020 green := (Color and $00FF00); 4998 5021 green := green shr 8; 4999 if green > Amount then green := green - Amount 5000 else green := 0; 5022 green := Round(green * (Percent/100)); 5001 5023 green := green shl 8; 5002 5024 Result := (Color and $FF00FF) or green; 5003 5025 end; 5004 5026 5005 function D ecBlue(Color : TColor; Amount : byte) : TColor;5027 function DarkenBlue(Color : TColor; Percent : byte) : TColor; 5006 5028 var blue : longWord; 5007 5029 begin 5008 5030 blue := (Color and $FF0000); 5009 5031 blue := blue shr 16; 5010 if blue > Amount then blue := blue - Amount 5011 else blue := 0; 5032 Blue := Round (blue * (Percent/100)); 5012 5033 blue := blue shl 16; 5013 5034 Result := (Color and $00FFFF) or blue; 5014 5035 end; 5015 5036 5016 function Darken(Color : TColor; Amount : byte) : TColor;5037 function Darken(Color : TColor; Percent : byte) : TColor; 5017 5038 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); 5021 5043 end; 5022 *)5023 5024 var5025 DecAmount : Byte;5026 5044 5027 5045 begin 5028 5046 oRect := Rect; 5029 //DecAmount := 50; 5030 //inactiveColor := Darken(Color,DecAmount); 5031 inactiveColor := Color; 5047 inactiveColor := Darken(Color,75); //75% 5032 5048 5033 5049 TabControl := TTabControl(Control); … … 5039 5055 5040 5056 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; 5044 5065 5045 5066 if (TabControl.TabPosition = tpLeft) or (TabControl.TabPosition = tpRight) then begin … … 5073 5094 end; 5074 5095 5096 if (TabControl.TabPosition = tpBottom) and (not Active) then begin 5097 iTop := iTop - 2; 5098 end; 5099 5075 5100 if Active then begin 5076 //Control.Canvas.Brush.Color := TColor($0000FFFF); //Bright yellow5077 5101 Control.Canvas.Brush.Color := Color; 5078 Control.Canvas.FillRect(Rect);5079 5102 end else begin 5080 //Control.Canvas.Brush.Color := TColor($000079EFE8); //dull yellow5081 5103 Control.Canvas.Brush.Color := inactiveColor; 5082 Control.Canvas.FillRect(Rect);5083 end;5104 end; 5105 Control.Canvas.FillRect(Rect); 5084 5106 Control.Canvas.TextOut(iLeft,iTop,sCaption); 5085 5107 end;
Note:
See TracChangeset
for help on using the changeset viewer.