Changeset 473 for cprs/branches/tmg-cprs/CPRS-Chart/fFrame.pas
- Timestamp:
- Aug 8, 2008, 8:34:55 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/tmg-cprs/CPRS-Chart/fFrame.pas
r472 r473 250 250 procedure mnuViewInformationClick(Sender: TObject); 251 251 procedure EditDemographicsClick(Sender: TObject); 252 procedure tabPageDrawTab(Control: TCustomTabControl; TabIndex: Integer; 253 const Rect: TRect; Active: Boolean); 252 254 private 253 255 //kt Begin Mod (change Consts to Vars) 7/17/2007 … … 319 321 procedure ClearPatient; 320 322 procedure ChangeFont(NewFontSize: Integer); 323 procedure LoadTabColors(INIFile : TIniFile; ColorsList : TStringList); //kt added 8/8/08 324 procedure SaveTabColors(INIFile : TIniFile; ColorsList : TStringList); 321 325 //procedure CreateTab(var AnInstance: TObject; AClass: TClass; ATabID: integer; ALabel: string); 322 326 procedure CreateTab(ATabID: integer; ALabel: string); … … 361 365 procedure HandleCCOWError(AMessage: string); 362 366 procedure SetupVars; 367 procedure DrawTab(Control: TCustomTabControl; TabIndex: Integer; 368 const Rect: TRect; Color : TColor; Active: Boolean); //kt added 8/8/08 363 369 public 364 370 EnduringPtSelSplitterPos: integer; … … 393 399 frmFrame: TfrmFrame; 394 400 uTabList: TStringList; 401 uTabColorsList : TStringList; //kt added 8/8/08 395 402 uRemoteType : string; 396 403 FlaggedPTList: TStringList; … … 424 431 , CCOW_const 425 432 {$ENDIF} 426 , fPtDemoEdit; 433 , fPtDemoEdit 434 , fOptionsOther; 427 435 428 436 var // RV 05/11/04 … … 720 728 i : integer; //kt added 6/29/07 721 729 CPRSChartINI: TINIFile; //elh 6/23/08 730 tempPosition : TTabPosition; //kt 722 731 begin 723 732 //kt 6/29/07 Begin modification ------------------- … … 800 809 Application.OnDeActivate := AppDeActivated; 801 810 802 // load language ini settings 811 // load language ini settings //elh added 803 812 CPRSChartINI := TINIFile.Create(ExtractFilePath(ParamStr(0)) + 'CPRSChart.ini'); // Read from INI elh 6/23/08 804 813 LangManager.LanguageID := CPRSChartINI.ReadInteger('Options','Language',1033); 805 CPRSChartINI.Free; 814 tempPosition := TTabPosition(CPRSChartINI.ReadInteger('TAB_POSITION','Tab Location',0)); 815 if tempPosition > tpRight then tempPosition := tpBottom; 816 fOptionsOther.SetTabPosition(tempPosition); 817 //kt -- end mod -- 806 818 807 819 //frmFrame.Caption := TX_IN_USE + MixedCase(User.Name) + ' (' + RPCBrokerV.Server + ')'; //kt added 808 820 //frmFrame.RenameTabs; //Resets names of tabs to correct translation //kt 809 810 821 811 822 // create initial core objects … … 897 908 RemoteReports := TRemoteReportList.Create; 898 909 uTabList := TStringList.Create; 910 uTabColorsList := TStringList.Create; //kt added 8/8/08 899 911 FlaggedPTList := TStringList.Create; 900 912 HasFlag := False; … … 934 946 end; 935 947 //kt replace later... CreateTab(CT_IMAGES, 'Images'); //kt 8/19/05 948 LoadTabColors(CPRSChartINI,uTabColorsList); //kt added 8/8/08 936 949 937 950 ShowHideChartTabMenus(mnuViewChart); … … 971 984 // if WindowState = wsMinimized then WindowState := wsNormal; 972 985 SetFormMonitoring(true); 986 CPRSChartINI.Free; //kt added 8/8/08 973 987 end; 974 988 … … 1066 1080 if URL='<!HIDE!>' then begin 1067 1081 SetATabVisibility(ATabID, false); 1068 end else begin1082 end else if URL<>'<!NOCHANGE!>' then begin 1069 1083 SetATabVisibility(ATabID, true, TabLabel); 1070 1084 tempFrmWebTab := TfrmWebTab(frmWebTabs[WebTabNum-1]); … … 1145 1159 procedure TfrmFrame.FormDestroy(Sender: TObject); 1146 1160 { free core objects used by CPRS } 1161 var 1162 CPRSChartINI: TINIFile; //kt 8/8/08 1163 1147 1164 begin 1148 1165 Application.OnActivate := FOldActivate; … … 1150 1167 FNextButtonBitmap.Free; 1151 1168 uTabList.Free; 1169 //kt --- 8/8/08 start mod --- 1170 CPRSChartINI := TINIFile.Create(ExtractFilePath(ParamStr(0)) + 'CPRSChart.ini'); 1171 CPRSChartINI.WriteInteger('Options','Language',LangManager.LanguageID); 1172 SaveTabColors(CPRSChartINI,uTabColorsList); 1173 uTabColorsList.Free; 1174 CPRSChartINI.WriteInteger('TAB_POSITION','Tab Location',integer(tabPage.TabPosition)); 1175 //kt --- end mod --- 1176 1152 1177 FlaggedPTList.Free; 1153 1178 RemoteSites.Free; … … 3718 3743 tabPage.Tabs.Add(ALabel); 3719 3744 end; 3745 if uTabColorsList.IndexOf(ALabel) < 0 then //kt added 8/8/08 3746 uTabColorsList.Add(ALabel); //will put colors in later... //kt 3747 end; 3748 3749 procedure TfrmFrame.LoadTabColors(INIFile : TIniFile; ColorsList : TStringList); 3750 //kt added 8/8/08 Entire function 3751 var i : integer; 3752 sValue : string; 3753 value : longword; 3754 begin 3755 value :=0; 3756 for i := 0 to ColorsList.Count-1 do begin 3757 sValue := INIFile.ReadString('TAB_COLORS',ColorsList.Strings[i],IntToStr($00FFFF)); 3758 try 3759 value := StrToInt(sValue) 3760 except 3761 on EConvertError do value := $00FFFF; 3762 end; 3763 ColorsList.Objects[i] := pointer(value); 3764 end; 3765 end; 3766 3767 procedure TfrmFrame.SaveTabColors(INIFile : TIniFile; ColorsList : TStringList); 3768 //kt added 8/8/08 Entire function 3769 var i : integer; 3770 begin 3771 for i := 0 to ColorsList.Count-1 do begin 3772 INIFile.WriteInteger('TAB_COLORS',ColorsList.Strings[i],longword(ColorsList.Objects[i])); 3773 end; 3720 3774 end; 3721 3775 … … 4830 4884 4831 4885 procedure TfrmFrame.EditDemographicsClick(Sender: TObject); 4832 //kt added Function 12/15/07, 6/6/08 4886 //kt added Function 12/15/07, 6/6/08 4833 4887 var EditResult: integer; 4834 4888 begin … … 4837 4891 end; 4838 4892 4893 procedure TfrmFrame.tabPageDrawTab(Control: TCustomTabControl; TabIndex: Integer; 4894 const Rect: TRect; Active: Boolean); 4895 var ALabel : string; 4896 colorIndex : Integer; 4897 color : TColor; 4898 begin 4899 ALabel := TTabControl(Control).Tabs[TabIndex]; 4900 colorIndex := uTabColorsList.IndexOf(ALabel); 4901 if colorIndex < 0 then color := clYellow 4902 else color := TColor(uTabColorsList.Objects[colorIndex]); 4903 DrawTab(Control,TabIndex,Rect,color,Active); 4904 end; 4905 4906 procedure TfrmFrame.DrawTab(Control: TCustomTabControl; TabIndex: Integer; 4907 const Rect: TRect; Color : TColor; Active: Boolean); 4908 var 4909 oRect : TRect; 4910 sCaption,temp : String; 4911 iTop : Integer; 4912 iLeft : Integer; 4913 i : integer; 4914 TabControl : TTabControl; 4915 lf : TLogFont; //Windows native font structure 4916 tf : TFont; 4917 Degrees : integer; 4918 inactiveColor : TColor; 4919 4920 (* 4921 function DecRed(Color : TColor; Amount : byte) : TColor; 4922 var red : longWord; 4923 begin 4924 red := (Color and $0000FF); 4925 if red > Amount then red := red - Amount 4926 else red := 0; 4927 Result := (Color and $FFFF00) or red; 4928 end; 4929 4930 function DecGreen(Color : TColor; Amount : byte) : TColor; 4931 var green : longWord; 4932 begin 4933 green := (Color and $00FF00); 4934 green := green shr 8; 4935 if green > Amount then green := green - Amount 4936 else green := 0; 4937 green := green shl 8; 4938 Result := (Color and $FF00FF) or green; 4939 end; 4940 4941 function DecBlue(Color : TColor; Amount : byte) : TColor; 4942 var blue : longWord; 4943 begin 4944 blue := (Color and $FF0000); 4945 blue := blue shr 16; 4946 if blue > Amount then blue := blue - Amount 4947 else blue := 0; 4948 blue := blue shl 16; 4949 Result := (Color and $00FFFF) or blue; 4950 end; 4951 4952 function Darken(Color : TColor; Amount : byte) : TColor; 4953 begin 4954 result:= DecRed(Color, Amount); 4955 result := DecBlue(result,Amount); 4956 result := DecGreen(result,Amount); 4957 end; 4958 *) 4959 4960 var 4961 DecAmount : Byte; 4962 4963 begin 4964 oRect := Rect; 4965 //DecAmount := 50; 4966 //inactiveColor := Darken(Color,DecAmount); 4967 inactiveColor := Color; 4968 4969 TabControl := TTabControl(Control); 4970 if TabControl.Tabs.Count=0 then exit; 4971 sCaption := TabControl.Tabs.Strings[TabIndex]; 4972 for i := 1 to length(temp) do begin 4973 if temp[i] <> '&' then sCaption := sCaption + temp[i]; 4974 end; 4975 4976 Control.Canvas.Font.Name := 'Tahoma'; 4977 if Active then Control.Canvas.Font.Style := Control.Canvas.Font.Style + [fsBold]; 4978 if Active then Control.Canvas.Font.Color := clBlack 4979 else Control.Canvas.Font.Color := clWhite; 4980 4981 if (TabControl.TabPosition = tpLeft) or (TabControl.TabPosition = tpRight) then begin 4982 4983 if (TabControl.TabPosition = tpLeft) then begin 4984 iTop := Rect.Bottom-4; 4985 if Active then iTop := iTop - 2; 4986 iLeft := Rect.Left + 1; 4987 Degrees := 90; 4988 end else begin 4989 iTop := Rect.Top + 4; 4990 if Active then iTop := iTop + 2; 4991 iLeft := Rect.Right - 2; 4992 Degrees := 270; 4993 end; 4994 tf := TFont.Create; 4995 try 4996 tf.Assign(Control.Canvas.Font); 4997 GetObject(tf.Handle, sizeof(lf), @lf); 4998 lf.lfEscapement := 10 * Degrees; //degrees of desired rotation 4999 lf.lfHeight := Control.Canvas.Font.Height - 2; 5000 tf.Handle := CreateFontIndirect(lf); 5001 Control.Canvas.Font.Assign(tf); 5002 finally 5003 tf.Free; 5004 end; 5005 5006 end else begin 5007 iTop := Rect.Top + ((Rect.Bottom - Rect.Top - Control.Canvas.TextHeight(sCaption)) div 2) + 1; 5008 iLeft := Rect.Left + ((Rect.Right - Rect.Left - Control.Canvas.TextWidth (sCaption)) div 2) + 1; 5009 end; 5010 5011 if Active then begin 5012 //Control.Canvas.Brush.Color := TColor($0000FFFF); //Bright yellow 5013 Control.Canvas.Brush.Color := Color; 5014 Control.Canvas.FillRect(Rect); 5015 end else begin 5016 //Control.Canvas.Brush.Color := TColor($000079EFE8); //dull yellow 5017 Control.Canvas.Brush.Color := inactiveColor; 5018 Control.Canvas.FillRect(Rect); 5019 end; 5020 Control.Canvas.TextOut(iLeft,iTop,sCaption); 5021 end; 5022 5023 5024 5025 4839 5026 initialization 4840 5027
Note:
See TracChangeset
for help on using the changeset viewer.