[476] | 1 | unit SkinFormU;
|
---|
| 2 | (*
|
---|
| 3 | WorldVistA Configuration Utility
|
---|
| 4 | (c) 8/2008 Kevin Toppenberg
|
---|
| 5 | Programmed by Kevin Toppenberg, Eddie Hagood
|
---|
| 6 |
|
---|
| 7 | Family Physicians of Greeneville, PC
|
---|
| 8 | 1410 Tusculum Blvd, Suite 2600
|
---|
| 9 | Greeneville, TN 37745
|
---|
| 10 | kdtop@yahoo.com
|
---|
| 11 |
|
---|
| 12 | This library is free software; you can redistribute it and/or
|
---|
| 13 | modify it under the terms of the GNU Lesser General Public
|
---|
| 14 | License as published by the Free Software Foundation; either
|
---|
| 15 | version 2.1 of the License, or (at your option) any later version.
|
---|
| 16 |
|
---|
| 17 | This library is distributed in the hope that it will be useful,
|
---|
| 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | Lesser General Public License for more details.
|
---|
| 21 |
|
---|
| 22 | You should have received a copy of the GNU Lesser General Public
|
---|
| 23 | License along with this library; if not, write to the Free Software
|
---|
| 24 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
| 25 | *)
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | //==========================================================================
|
---|
| 29 | //==========================================================================
|
---|
| 30 | // NOTICE BELOW...
|
---|
| 31 | //==========================================================================
|
---|
| 32 | //==========================================================================
|
---|
| 33 | (*
|
---|
| 34 | NOTICE:
|
---|
| 35 | This unit makes use of propriatary, commercial, binary files
|
---|
| 36 | (.DCU files) that are bound by a *separate* license. Please see that
|
---|
| 37 | license which is in the \GUI-Config\SkinStuff\ folder
|
---|
| 38 | *)
|
---|
| 39 |
|
---|
| 40 | interface
|
---|
| 41 |
|
---|
| 42 | uses
|
---|
| 43 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 44 | ipSkinManager, StdCtrls, ExtCtrls, ComCtrls, Buttons, DBCtrls, Mask;
|
---|
| 45 |
|
---|
| 46 | type
|
---|
| 47 | TSkinForm = class(TForm)
|
---|
| 48 | Panel3: TPanel;
|
---|
| 49 | SkinsListBox: TListBox;
|
---|
| 50 | ApplySkinButton: TButton;
|
---|
| 51 | btnDisable: TButton;
|
---|
| 52 | Label12: TLabel;
|
---|
| 53 | Button6: TButton;
|
---|
| 54 | Button1: TButton;
|
---|
| 55 | cbSkinAtStartup: TCheckBox;
|
---|
| 56 | procedure FormCreate(Sender: TObject);
|
---|
| 57 | procedure ApplySkinButtonClick(Sender: TObject);
|
---|
| 58 | procedure SkinsListBoxDblClick(Sender: TObject);
|
---|
| 59 | procedure SkinsListBoxKeyPress(Sender: TObject; var Key: Char);
|
---|
| 60 | procedure Button6Click(Sender: TObject);
|
---|
| 61 | procedure FormDestroy(Sender: TObject);
|
---|
| 62 | procedure FormShow(Sender: TObject);
|
---|
| 63 | private
|
---|
| 64 | { Private declarations }
|
---|
| 65 | SkinManager : TipSkinManager;
|
---|
| 66 | FINIFileName : string;
|
---|
| 67 | procedure FillSkinList;
|
---|
| 68 | public
|
---|
| 69 | { Public declarations }
|
---|
| 70 | CurrentSkinFile : string;
|
---|
| 71 | procedure ActivateCurrentSkin;
|
---|
| 72 | procedure InactivateSkin;
|
---|
| 73 | end;
|
---|
| 74 |
|
---|
| 75 | var
|
---|
| 76 | SkinForm: TSkinForm;
|
---|
| 77 |
|
---|
| 78 | CONST
|
---|
| 79 | SKIN_NONE = '<TURN OFF SKINS>' ;
|
---|
| 80 |
|
---|
| 81 | implementation
|
---|
| 82 |
|
---|
| 83 | {$R *.DFM}
|
---|
| 84 |
|
---|
| 85 | uses ShellAPI, inifiles;
|
---|
| 86 |
|
---|
| 87 | procedure TSkinForm.FillSkinList;
|
---|
| 88 | var
|
---|
| 89 | SRec : TSearchRec;
|
---|
| 90 | R : Integer;
|
---|
| 91 | begin
|
---|
| 92 | SkinsListBox.Items.Clear;
|
---|
| 93 | SkinsListBox.Items.Add (SKIN_NONE);
|
---|
| 94 | R := FindFirst (ExtractFilePath (Application.ExeName) + '\SkinStuff\Skins\*.ipz', faAnyFile, SRec);
|
---|
| 95 | while R = 0 do
|
---|
| 96 | begin
|
---|
| 97 | SkinsListBox.Items.Add (SRec.Name);
|
---|
| 98 | R := FindNext (SRec);
|
---|
| 99 | end;
|
---|
| 100 | SkinsListBox.Sorted := true;
|
---|
| 101 | SkinsListBox.ItemIndex := 0;
|
---|
| 102 | end;
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 | procedure TSkinForm.FormCreate(Sender: TObject);
|
---|
| 106 | var iniFile : TIniFile;
|
---|
| 107 | begin
|
---|
| 108 | SkinManager := TipSkinManager.Create(self);
|
---|
| 109 | FINIFileName := ExtractFilePath(ParamStr(0)) + 'GUI_Config.ini';
|
---|
| 110 | iniFile := TIniFile.Create(FINIFileName);
|
---|
| 111 | cbSkinAtStartup.Checked := iniFile.ReadBool('Skin','Load At Startup',false);
|
---|
| 112 | CurrentSkinFile := iniFile.ReadString('Skin','Default Skin','.\SkinStuff\Skins\ICQ_Longhorn_v.1.2.ipz');
|
---|
| 113 | iniFile.Free;
|
---|
| 114 | end;
|
---|
| 115 |
|
---|
| 116 | procedure TSkinForm.FormDestroy(Sender: TObject);
|
---|
| 117 | var iniFile : TIniFile;
|
---|
| 118 | begin
|
---|
| 119 | iniFile := TIniFile.Create(FINIFileName);
|
---|
| 120 | iniFile.WriteString('Skin','Default Skin',CurrentSkinFile);
|
---|
| 121 | iniFile.WriteBool('Skin','Load At Startup',cbSkinAtStartup.Checked);
|
---|
| 122 | iniFile.Free;
|
---|
| 123 | SkinManager.Free;
|
---|
| 124 | end;
|
---|
| 125 |
|
---|
| 126 | procedure TSkinForm.ApplySkinButtonClick(Sender: TObject);
|
---|
| 127 | var fileS : String;
|
---|
| 128 | begin
|
---|
| 129 | fileS := '';
|
---|
| 130 | if SkinsListBox.ItemIndex > -1 then begin
|
---|
| 131 | fileS := SkinsListBox.Items [SkinsListBox.ItemIndex];
|
---|
| 132 | end;
|
---|
| 133 | if fileS = SKIN_NONE then fileS := '';
|
---|
| 134 | CurrentSkinFile := ExtractFilePath (Application.ExeName) +'\SkinStuff\Skins\' +fileS;
|
---|
| 135 | ModalResult := mrOK;
|
---|
| 136 | end;
|
---|
| 137 |
|
---|
| 138 | procedure TSkinForm.SkinsListBoxDblClick(Sender: TObject);
|
---|
| 139 | begin
|
---|
| 140 | ApplySkinButtonClick (Self);
|
---|
| 141 | end;
|
---|
| 142 |
|
---|
| 143 | procedure TSkinForm.SkinsListBoxKeyPress(Sender: TObject; var Key: Char);
|
---|
| 144 | begin
|
---|
| 145 | if Key = #13 then ApplySkinButtonClick (Self);
|
---|
| 146 | end;
|
---|
| 147 |
|
---|
| 148 | procedure TSkinForm.Button6Click(Sender: TObject);
|
---|
| 149 | begin
|
---|
| 150 | ShellExecute (Handle, 'open', 'http://www2.wincustomize.com/Skins.aspx?LibID=12&view=1&sortby=9&sortdir=DESC&p=1&advanced=0&mode=1&u=0', nil, nil, SW_SHOWNORMAL);
|
---|
| 151 | end;
|
---|
| 152 |
|
---|
| 153 | procedure TSkinForm.ActivateCurrentSkin;
|
---|
| 154 | begin
|
---|
| 155 | SkinManager.SkinFile := CurrentSkinFile;
|
---|
| 156 | if CurrentSkinFile <>'' then begin
|
---|
| 157 | try
|
---|
| 158 | SkinManager.Active := true;
|
---|
| 159 | except
|
---|
| 160 | on EInvalidOperation do begin
|
---|
| 161 | MessageDlg('Error Applying Skin. Please try another.',mtInformation,[mbOK],0);
|
---|
| 162 | end;
|
---|
| 163 | else begin
|
---|
| 164 | MessageDlg('Error Applying Skin. Please try another.',mtInformation,[mbOK],0);
|
---|
| 165 | end;
|
---|
| 166 | end;
|
---|
| 167 | end else begin
|
---|
| 168 | SkinManager.Active := false;
|
---|
| 169 | end;
|
---|
| 170 | end;
|
---|
| 171 |
|
---|
| 172 |
|
---|
| 173 | procedure TSkinForm.InactivateSkin;
|
---|
| 174 | begin
|
---|
| 175 | SkinManager.Active := false;
|
---|
| 176 | end;
|
---|
| 177 |
|
---|
| 178 | procedure TSkinForm.FormShow(Sender: TObject);
|
---|
| 179 | begin
|
---|
| 180 | FillSkinList;
|
---|
| 181 | end;
|
---|
| 182 |
|
---|
| 183 | end.
|
---|