{**************************
Shortcut icon script Ver1.0 by snowfox
**************************}
const
  RowHeight=27;
  RowSep=15;
  RowLeft=4;

var
  i: Integer;
  fIconBitmapName:string;
  
  ts1,ts2:TTabSheet; 
  
  lblTitle,lblTitleFont,lblLabelDays,lblTitleText,lblFormWidth,lblFormHeight,lblDaysText,lblDaysFont,lblHText,lblMText,lblSText,lblDefaultPNG:TLabel;
  edtTitle,edtTitleFont,edtTitleText,edtLabelDays,edtFormWidth,edtFormHeight,edtDaysText,edtDaysFont,edtHText,edtMText,edtSText:TEdit;
  
  
  pngImage:TPanel;
  ScrBImage:TScrollBox;
  img:TImage;
  dlgPic:TOpenPictureDialog;
  BtnTitleFontText:string;
  btnTitleFont,btnDaysFont,btnTitle:TSpeedButton;
  chkFormSize:TCheckBox;
  fontname,fontsize,fontcolor,fontbold:string;
  fontname1,fontsize1,fontcolor1,fontbold1:string;
  fontname11,fontsize11,fontcolor11,fontbold11:string;
  fontname2,fontsize2,fontcolor2,fontbold2:string;
  fontname3,fontsize3,fontcolor3,fontbold3:string;
  cbbDefaultPNG,cbbTitle,cbbTitleFont:TComboBox;
  Place_Title,Place_NoDays,Place_NoH,Place_NoM,Place_NoS,Place_TextDays,Place_TextH,Place_TextM,Place_TextS:string;
  Font_Title,Font_DownNo,Font_DownSS,Font_DayText,Font_SSText:string;
  Range_DayTime:string;
  
//Init Skin form setting
procedure InitSetting;
var
	s,s1,s2:string;
	inifn:TIniFile;
	lst:TStrings;
	i:integer;
  function GetFontText(AllFontText:string;Index:integer;var s1,s2,s3,s4:string):string;
  var
    i,j:Integer;
    tempstr,ResultStr:string; 
  begin
    tempstr:=AllFontText;
    ResultStr:='';
    for i:=1 to Index do
      begin
        j:=Pos('/',tempstr);
        if j>0 then
          begin
	  if i=1 then s1:=Copy(tempstr,1,j-1);
	  if i=2 then s2:=Copy(tempstr,1,j-1);
	  if i=3 then s3:=Copy(tempstr,1,j-1);
	  if i=4 then s4:=Copy(tempstr,1,j-1);
          ResultStr:=ResultStr+Copy(tempstr,1,j);
          Delete(tempstr,1,j);
          end
          else begin
	  if i=4 then s4:=tempstr;
          ResultStr:=ResultStr+tempstr;
	  end;
      end;
    if Copy(ResultStr,Length(ResultStr),1)='/' then
      Delete(ResultStr,Length(ResultStr),1); 
    Result:=ResultStr;
  end;

begin
  inifn:=TIniFile.create(SkinFileName);
  lst:=TStringList.create;
  with inifn do
  try
    //Tab2
     
     
    //取得文本内容
    edtTitleText.text:=ReadString('Item0','Item0','距北京2008奥运会还有');
    //取得位置
    Place_Title:=ReadString('Item0','Item0Rect','30/155/245/110');
    Place_NoDays:=ReadString('Item1','Item0Rect','134/216/85/50');
    Place_NoH:=ReadString('Item1','Item1Rect','55/257/85/50');
    Place_NoM:=ReadString('Item1','Item2Rect','55/257/85/50');
    Place_NoS:=ReadString('Item2','Item0Rect','55/257/85/50');
    Place_TextDays:=ReadString('Item3','Item0Rect','134/216/85/50');
    Place_TextH:=ReadString('Item3','Item1Rect','55/257/85/50');
    Place_TextM:=ReadString('Item3','Item2Rect','55/257/85/50');
    Place_TextS:=ReadString('Item3','Item3Rect','55/257/85/50');

    cbbTitle.ItemIndex:=0;
    edtTitle.Text:=Place_Title;

    //取得字体
    s1:=ReadString('Item0','Item0Font','隶书/22/#ffffff/1'); //标题
    Font_Title:=GetFontText(s1,4,fontname,fontsize,fontcolor,fontbold);
    s2:=ReadString('Item1','Item0Font','隶书/20/clred/1');//天
    Font_DownNo:=GetFontText(s2,4,fontname1,fontsize1,fontcolor1,fontbold1);
    s2:=ReadString('Item1','Item1Font','隶书/20/clred/1');//时、分、秒
    Font_DownSS:=GetFontText(s2,4,fontname11,fontsize11,fontcolor11,fontbold11);
    s2:=ReadString('Item3','Item0Font','隶书/20/clred/1'); // 文本 天
    Font_DayText:=GetFontText(s2,4,fontname2,fontsize2,fontcolor2,fontbold2);
    s2:=ReadString('Item3','Item1Font','隶书/20/clred/1'); //文本 时、分、秒
    Font_SSText:=GetFontText(s2,4,fontname3,fontsize3,fontcolor3,fontbold3); 
    cbbTitleFont.ItemIndex:=0;
    edtTitleFont.Text:=Font_Title;
     
 
    s:=ReadString('Item1','Item0','<#MemoryDayTime_2008-8-8 20:00:00>');
    Range_DayTime:=Copy(s,17,pos('>',s)-17);
    edtDaysText.text:=Range_DayTime;
     


    s:=ReadString('system','Width','');
    s1:=ReadString('system','Height','');
    if (s='') and (s1='') then
      begin
      edtFormWidth.text:=s;
      edtFormHeight.text:=s1; 
      edtFormWidth.ReadOnly:=True;
      edtFormHeight.ReadOnly:=True;
      chkFormSize.checked:=True;
      end
      else begin
      edtFormWidth.text:=s;
      edtFormHeight.text:=s1; 
      edtFormWidth.ReadOnly:=False;
      edtFormHeight.ReadOnly:=False;
      chkFormSize.checked:=False;
      end;
    
  finally
    inifn.free;
    lst.free;
  end;
end;

//save Skin form setting
function SaveSetting:boolean;
var
	s:string;
	inifn:TIniFile;
	i:integer;
begin
  result:=false;
  result:=true;
  inifn:=TIniFile.create(SkinFileName);
  with inifn do
  try
    //背景图片 

     //Tab2
        //标题
   	WriteString('Item0','Item0Rect', Place_Title);
   	WriteString('Item0','Item0Font', fontname+'/'+fontsize+'/'+fontcolor+'/'+fontbold +'/0/0/0/0/255/1/0/1/clBlack/191');
        WriteString('Item0','Item0', edtTitleText.text); 
        //数字 位置 
	WriteString('Item1','Item0Rect', Place_NoDays);
	WriteString('Item1','Item1Rect', Place_NoH);
	WriteString('Item1','Item2Rect', Place_NoM);
	WriteString('Item2','Item0Rect', Place_NoS);
	//文本 位置
	WriteString('Item3','Item0Rect', Place_TextDays);
	WriteString('Item3','Item1Rect', Place_TextH);
	WriteString('Item3','Item2Rect', Place_TextM);
	WriteString('Item3','Item3Rect', Place_TextS);

	//数字 字体
  WriteString('Item1','Item0Font', fontname1+'/'+fontsize1+'/'+fontcolor1+'/'+fontbold1 +'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item1','Item1Font', fontname11+'/'+fontsize11+'/'+fontcolor11+'/'+fontbold11 +'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item1','Item2Font', fontname11+'/'+fontsize11+'/'+fontcolor11+'/'+fontbold11 +'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item2','Item0Font', fontname11+'/'+fontsize11+'/'+fontcolor11+'/'+fontbold11 +'/0/0/0/0/255/1/0/1/clBlack/191');
	//文本 字体
  WriteString('Item3','Item0Font', fontname2+'/'+fontsize2+'/'+fontcolor2+'/'+fontbold2 +'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item3','Item1Font', fontname3+'/'+fontsize3+'/'+fontcolor3+'/'+fontbold3 +'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item3','Item2Font', fontname3+'/'+fontsize3+'/'+fontcolor3+'/'+fontbold3 +'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item3','Item3Font', fontname3+'/'+fontsize3+'/'+fontcolor3+'/'+fontbold3 +'/0/0/0/0/255/1/0/1/clBlack/191');
  //倒计时
  WriteString('Item1','Item0', '<#MemoryDayTime_'+edtDaysText.text+'><#CountdownDay>'); 
	WriteString('Item1','Item1', '<#MemoryDayTime_'+edtDaysText.text+'><#CountdownTimeH>');
	WriteString('Item1','Item2', '<#MemoryDayTime_'+edtDaysText.text+'><#CountdownTimeM>');
	WriteString('Item2','Item0', '<#MemoryDayTime_'+edtDaysText.text+'><#CountdownTimeS>');
   	
	if chkFormSize.checked then
	  begin
          WriteString('system','Width','');
  	  WriteString('system','Height','');
	  end
	  else begin
          WriteString('system','Width',edtFormWidth.text);
  	  WriteString('system','Height',edtFormHeight.text);
	  end;
  	
  finally
    inifn.free;
  end;
end;

procedure CreateTab1;
begin
  //--- Tab 1 ---
  ts1:=TTabSheet.Create(pgc);
  ts1.PageControl:=pgc;
  ts1.Caption:='背景图片设置';
 //image preview
  {pngImage:=TImage.create(ts1);
  with pngImage do
  begin
    parent:=ts1;
    left:=16; top:=16;
    width:=350; height:=200;
    caption:='';
    BevelOuter:=bvLowered;
  end;
  }
  ScrBImage:=TScrollBox.create(ts1);
  with ScrBImage do
    begin
    parent:=ts1;
    left:=3; top:=3;
    width:=370; height:=220;
    end;
  img:=TImage.create(ScrBImage);
  with img do
  begin
    cursor:=crHandPoint;
    parent:= ScrBImage;
    Align:=alClient;
    //Align:=alNone;
    //Picture.LoadFromFile('C:\Documents and Settings\wang\My Documents\My Pictures\699084.jpg');
    AutoSize:=True;
    left:=0; top:=0;
    width:=ScrBImage.width; height:=ScrBImage.height;
    visible:=True;
    img.hint:='单击选择背景图片';
    ShowHint:=True;
     OnClick:=@imgClick;
  end;

  //默认背景图片
  lblDefaultPNG:=TLabel.create(self);
  with lblDefaultPNG do
  begin
    parent:=ts1;
    left:=RowLeft; top:= ScrBImage.top+ScrBImage.Height+RowHeight-20;
    //Font.Color:=clBlue;
    //Font.style:=fsUnderLine;
    caption:='默认背景图片';
    cursor:=crHandPoint;
    // OnClick:=@DefaultPNGClick;
  end;
  cbbDefaultPNG:=TComboBox.Create(ts1);
  with cbbDefaultPNG do
  begin
    Left:=RowLeft+lblDefaultPNG.width+2; Top:= ScrBImage.top+ ScrBImage.Height+RowHeight-25; width:=100;
    DropDownCount:=4;
    Parent:=ts1;
    Style:=csDropDownList;
    with Items do
    begin
      add('宝石蓝');
      add('火焰红');
      add('橄榄绿');
      add('香橙黄'); 
      add('');
    end;
    OnChange:=@DefaultPNGClick;
    ItemIndex:=0;
  end;

  //窗口宽度
  lblFormWidth:=TLabel.create(self);
  with lblFormWidth do
  begin
    parent:=ts1;
    left:=RowLeft; top:=ScrBImage.top+ ScrBImage.Height+RowHeight;
    caption:='背景长度：';
  end;
  edtFormWidth:=TEdit.create(self);
  with edtFormWidth do
  begin
    parent:=ts1;
    left:=lblFormWidth.left+60; top:=lblFormWidth.top-4; width:=50;
  end;
  lblFormHeight:=TLabel.create(self);
  with lblFormHeight do
  begin
    parent:=ts1;
    left:=edtFormWidth.left+60; top:=lblFormWidth.top;
    caption:='背景高度：';
  end;
  edtFormHeight:=TEdit.create(self);
  with edtFormHeight do
  begin
    parent:=ts1;
    left:=lblFormHeight.left+60; top:=lblFormWidth.top-4; width:=50;
  end;

  chkFormSize:=TCheckBox.create(self);
  with chkFormSize do
    begin
    parent:=ts1;
    left:=edtFormHeight.left+edtFormHeight.width+13;
    top:=edtFormHeight.top+1;
    //height:=17;
    //width:=100;
    caption:='实际图片大小';
    OnClick:=@ChkFormSizeClick;
    end;
   
end;
 
procedure CreateTab2;
var
	i:integer;
begin
  //--- Tab 2 ---
  ts2:=TTabSheet.Create(pgc);
  ts2.PageControl:=pgc;
  ts2.Caption:='自定义倒计时设置';
 
  //标题位置
  cbbTitle:=TComboBox.Create(ts2);
  with cbbTitle do
  begin
    Left:=RowLeft; Top:=5; width:=130;
    //DropDownCount:=4;
    Parent:=ts2;
    Style:=csDropDownList;
    with Items do
    begin
      add('标题位置');
      add('数字(天位置)');
      add('数字(时位置)');
      add('数字(分位置)');
      add('数字(秒位置)');
      add('文本(天位置)');
      add('文本(时位置)');
      add('文本(分位置)');
      add('文本(秒位置)');
    end;
    OnChange:=@cbbTitleClick;
    ItemIndex:=0;
  end;
  lblTitle:=TLabel.create(self);
  with lblTitle do
  begin
    parent:=ts2;
    left:=RowLeft+cbbTitle.width+1; top:=10;
    caption:='(距左/距顶/长/高)';
  end;
  edtTitle:=TEdit.create(self);
  with edtTitle do
  begin
    parent:=ts2;
    left:=RowLeft; top:=lblTitle.top+RowSep+3; width:=130;
  end;
   //位置-确定按钮
  btnTitle:=TSpeedButton.create(self);
  with btnTitle do
    begin
    parent:=ts2;
    left:=edtTitle.left+edtTitle.width+2; 
    top:=edtTitle.top;
    caption:='保存位置';
    width:=66; height:=22;
    OnClick:=@BtnTitleClick;
    end;

//标题字体
  cbbTitleFont:=TComboBox.Create(ts2);
  with cbbTitleFont do
  begin
    Left:=RowLeft; Top:=edtTitle.top+RowSep+20; width:=130;
    //DropDownCount:=4;
    Parent:=ts2;
    Style:=csDropDownList;
    with Items do
    begin
      add('标题字体');
      add('数字(天)');
      add('数字(时分秒)');
      add('文本(天)');
      add('文本(时分秒)');
    end;
    OnChange:=@cbbTitleFontClick;
    ItemIndex:=0;
  end;
  lblTitleFont:=TLabel.create(self);
  with lblTitleFont do
  begin
    parent:=ts2;
    left:=RowLeft+cbbTitleFont.left+cbbTitleFont.width; top:=cbbTitleFont.top+2;
    caption:='(字体/大小/颜色/粗体)';
  end;
  edtTitleFont:=TEdit.create(self);
  with edtTitleFont do
  begin
    parent:=ts2;
    ReadOnly:=true;
    color:=clBtnFace;
    left:=cbbTitleFont.left; top:= lblTitleFont.top+RowSep+8; width:=130;
  end;
  //选择字体-按钮
  btnTitleFont:=TSpeedButton.create(self);
  with btnTitleFont do
    begin
    parent:=ts2;
    left:=edtTitleFont.left+edtTitleFont.width+2; 
    top:=edtTitleFont.top;
    caption:='...';
    width:=23; height:=22;
    OnClick:=@BtnTitleFontClick;
    end;
 //显示-截止日期
  lblDaysText:=TLabel.create(self);
  with lblDaysText do
  begin
    parent:=ts2;
    left:=RowLeft; top:=edtTitleFont.top+RowHeight;
    caption:='截止日期+时间(YYYY-MM-DD HH:MM:SS)';
  end;
  edtDaysText:=TEdit.create(self);
  with edtDaysText do
  begin
    parent:=ts2;
    left:=lblDaysText.left; top:=lblDaysText.top+RowSep; width:=130;
  end;
  //文本内容
  lblTitleText:=TLabel.create(self);
  with lblTitleText do
  begin
    parent:=ts2;
    left:=RowLeft; top:=edtDaysText.top+RowHeight;
    caption:='标题内容';
  end;
  edtTitleText:=TEdit.create(self);
  with edtTitleText do
  begin
    parent:=ts2;
    left:=lblTitleText.left; top:=lblTitleText.top+RowSep; width:=250;
  end;

 
end;
 

procedure imgClick(Sender: TObject);
var
  i:integer;
begin
  dlgPic:=TOpenPictureDialog.create(self);
  try
    dlgPic.Filter:='Portable Network Graphics (*.png)|*.png';
    dlgPic.FileName:= SkinFileName;
    if dlgPic.Execute then
    begin
      fIconBitmapName:=dlgPic.FileName;
      LoadPngImage(img,fIconBitmapName,i,i);
      cbbDefaultPNG.ItemIndex:=4;
      if Pos('SecondDown.png',fIconBitmapName)>0 then 
        cbbDefaultPNG.ItemIndex:=0;
      if Pos('SecondDown1.png',fIconBitmapName)>0 then 
        cbbDefaultPNG.ItemIndex:=1;
      if Pos('SecondDown2.png',fIconBitmapName)>0 then 
        cbbDefaultPNG.ItemIndex:=2;
      if Pos('SecondDown3.png',fIconBitmapName)>0 then 
        cbbDefaultPNG.ItemIndex:=3;
    end;
  finally
    dlgPic.free;
  end;
  
end;

procedure BtnTitleFontClick(Sender: TObject);
var
  i:integer;
  dlgFont1:TFontDialog;
  fontnameX,fontsizeX,fontcolorX,fontboldX:string;
  inifn:TIniFile;
begin
try
  case cbbTitleFont.ItemIndex of
    0:begin
    fontnameX:=fontname;
    fontsizeX:=fontsize;
    fontcolorX:=fontcolor;
    fontboldX:=fontbold;
    end;
    1:begin
    fontnameX:=fontname1;
    fontsizeX:=fontsize1;
    fontcolorX:=fontcolor1;
    fontboldX:=fontbold1;
    end;
    2:begin
    fontnameX:=fontname11;
    fontsizeX:=fontsize11;
    fontcolorX:=fontcolor11;
    fontboldX:=fontbold11;
    end;
    3:begin
    fontnameX:=fontname2;
    fontsizeX:=fontsize2;
    fontcolorX:=fontcolor2;
    fontboldX:=fontbold2;
    end;
    4:begin
    fontnameX:=fontname3;
    fontsizeX:=fontsize3;
    fontcolorX:=fontcolor3;
    fontboldX:=fontbold3;
    end;
  end;
  dlgFont1:=TFontDialog.create(self);
  dlgFont1.Font.Name:=fontnameX;
  dlgFont1.Font.Size:=StrToInt(fontsizeX);
  dlgFont1.Font.Color:=StrToColor(fontcolorX);
  if fontboldX='1' then
    dlgFont1.Font.Style:=fsBold
    else
    dlgFont1.Font.Style:=nil;
  if dlgFont1.Execute then
    begin
    fontnameX:=dlgFont1.Font.Name;
    fontsizeX:=IntToStr( dlgFont1.Font.Size);
    fontcolorX:=ColorToHtmlStr(dlgFont1.Font.Color);
    if dlgFont1.Font.Style=fsBold Then
      fontboldX:='1'
      else
      fontboldX:='0';
    end ;
  case cbbTitleFont.ItemIndex of
    0:begin
    fontname:=fontnameX;
    fontsize:=fontsizeX;
    fontcolor:=fontcolorX;
    fontbold:=fontboldX;
    end;
    1:begin
    fontname1:=fontnameX;
    fontsize1:=fontsizeX;
    fontcolor1:=fontcolorX;
    fontbold1:=fontboldX;
    end;
    2:begin
    fontname11:=fontnameX;
    fontsize11:=fontsizeX;
    fontcolor11:=fontcolorX;
    fontbold11:=fontboldX;
    end;
    3:begin
    fontname2:=fontnameX;
    fontsize2:=fontsizeX;
    fontcolor2:=fontcolorX;
    fontbold2:=fontboldX;
    end;
    4:begin
    fontname3:=fontnameX;
    fontsize3:=fontsizeX;
    fontcolor3:=fontcolorX;
    fontbold3:=fontboldX;
    end;
  end;
  BtnTitleFontText:=fontnameX+'/'+fontsizeX+'/'+fontcolorX+'/'+fontboldX;
  edtTitleFont.Text:=BtnTitleFontText;
  //改变ini值
  inifn:=TIniFile.create(SkinFileName);
  with inifn do
    begin
      case cbbTitleFont.ItemIndex of
        0:begin
        WriteString('Item0','Item0Font', BtnTitleFontText+'/0/0/0/0/255/1/0/1/clBlack/191');
	end;
	1:begin
        WriteString('Item1','Item0Font', BtnTitleFontText+'/0/0/0/0/255/1/0/1/clBlack/191');
	end;
	2:begin
	WriteString('Item1','Item1Font', BtnTitleFontText+'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item1','Item2Font', BtnTitleFontText+'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item2','Item0Font', BtnTitleFontText+'/0/0/0/0/255/1/0/1/clBlack/191');
	end;
	3:begin
  WriteString('Item3','Item0Font', BtnTitleFontText+'/0/0/0/0/255/1/0/1/clBlack/191');
	end;
	4:begin
  WriteString('Item3','Item1Font', BtnTitleFontText+'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item3','Item2Font', BtnTitleFontText+'/0/0/0/0/255/1/0/1/clBlack/191');
	WriteString('Item3','Item3Font', BtnTitleFontText+'/0/0/0/0/255/1/0/1/clBlack/191');
	end;
      end;
         
    end;
finally
  dlgFont1.free;
  inifn.free;
end;
  
end;

procedure BtnDaysFontClick(Sender: TObject);
var
  dlgFont1:TFontDialog;
 
begin
try
  dlgFont1:=TFontDialog.create(self);
  dlgFont1.Font.Name:=fontname1;
  dlgFont1.Font.Size:=StrToInt(fontsize1);
  dlgFont1.Font.Color:=StrToColor(fontcolor1);
  if fontbold1='1' then
    dlgFont1.Font.Style:=fsBold
    else
    dlgFont1.Font.Style:=nil;
  if dlgFont1.Execute then
    begin 
    fontname1:=dlgFont1.Font.Name;
    fontsize1:=IntToStr( dlgFont1.Font.Size);
    fontcolor1:=ColorToHtmlStr(dlgFont1.Font.Color);
    if dlgFont1.Font.Style=fsBold Then
      fontbold1:='1'
      else
      fontbold1:='0';
    end ;
  BtnTitleFontText:=fontname1+'/'+fontsize1+'/'+fontcolor1+'/'+fontbold1;
  //edtDaysFont.text:= BtnTitleFontText;


finally
  dlgFont1.free;
  
end;
  
end;


procedure ChkFormSizeClick(Sender: TObject);
begin
  if ChkFormSize.checked then
      begin
      edtFormWidth.text:='';
      edtFormHeight.text:=''; 
      edtFormWidth.ReadOnly:=True;
      edtFormHeight.ReadOnly:=True;
      end
      else begin
      edtFormWidth.text:='298';
      edtFormHeight.text:='403'; 
      edtFormWidth.ReadOnly:=False;
      edtFormHeight.ReadOnly:=False; 
      end;
end;

procedure cbbTitleClick(Sender: TObject);
begin   
  case cbbTitle.ItemIndex of
    0:begin
    edtTitle.text:= Place_Title;
    end;
    1:begin
    edtTitle.text:= Place_NoDays;
    end;
    2:begin
    edtTitle.text:= Place_NoH;
    end;
    3:begin
    edtTitle.text:= Place_NoM;
    end;
    4:begin
    edtTitle.text:= Place_NoS;
    end;
    5:begin
    edtTitle.text:= Place_TextDays;
    end;
    6:begin
    edtTitle.text:= Place_TextH;
    end;
    7:begin
    edtTitle.text:= Place_TextM;
    end;
    8:begin
    edtTitle.text:= Place_TextS;
    end;

  end;
end;

procedure BtnTitleClick(Sender:TObject);
var  inifn:TIniFile;
begin
try
  inifn:=TIniFile.create(SkinFileName);
  with inifn do
    begin
    case cbbTitle.ItemIndex of
      0:begin
      Place_Title:=edtTitle.text;
      WriteString('Item0','Item0Rect',Place_Title); 
      end;
      1:begin
      Place_NoDays:=edtTitle.text;
      WriteString('Item1','Item0Rect',Place_NoDays); 
      end;
      2:begin
      Place_NoH:=edtTitle.text;
      WriteString('Item1','Item1Rect',Place_NoH); 
      end;
      3:begin
      Place_NoM:=edtTitle.text;
      WriteString('Item1','Item2Rect',Place_NoM); 
      end;
      4:begin
      Place_NoS:=edtTitle.text;
      WriteString('Item2','Item0Rect',Place_NoS); 
      end;
      5:begin
      Place_TextDays:=edtTitle.text;
      WriteString('Item3','Item0Rect',Place_TextDays); 
      end;
      6:begin
      Place_TextH:=edtTitle.text;
      WriteString('Item3','Item1Rect',Place_TextH); 
      end;
      7:begin
      Place_TextM:=edtTitle.text;
      WriteString('Item3','Item2Rect',Place_TextM); 
      end;
      8:begin
      Place_TextS:=edtTitle.text;
      WriteString('Item3','Item3Rect',Place_TextS); 
      end;

      end;
    end;
finally
  inifn.free;
end;
end;

procedure cbbTitleFontClick(Sender: TObject);
begin   
  case cbbTitleFont.ItemIndex of 
    0:begin
    edtTitleFont.text:=Font_Title;
    end;
    1:begin
    edtTitleFont.text:= Font_DownNo;
    end;
    2:begin
    edtTitleFont.text:= Font_DownSS;
    end;
    3:begin
    edtTitleFont.text:= Font_DayText;
    end;
    4:begin
    edtTitleFont.text:= Font_SSText;
    end;
  end;
end;
 
procedure DefaultPNGClick(Sender: TObject);
var  inifn:TIniFile;
begin
try
  inifn:=TIniFile.create(SkinFileName);
  with inifn do
    begin
    fIconBitmapName:='SecondDown.png';
    case cbbDefaultPNG.ItemIndex of
      0:begin
      fIconBitmapName:='SecondDown.png'; 
      end;
      1:begin
      fIconBitmapName:='SecondDown1.png';  
      end;
      2:begin
      fIconBitmapName:='SecondDown2.png'; 
      end;
      3:begin
      fIconBitmapName:='SecondDown3.png';  
      end;
    end;
    //WriteString('system','BackgroundBitmapName',fIconBitmapName); 
 
    LoadPngImage(img,fIconBitmapName,i,i);
    end;
finally
  inifn.free;
end;
end;
  
begin 
 // CreateTab1;
  CreateTab2;
  InitSetting;  
 
end.