Модуль "Настройки" (часть 2) - FormCreate

Рубрика: Исходники
Среда, 21 апреля 2010 г.
Просмотров: 141
последняя версия: 3.0.9 build 961 beta
от 07 декабря 2007 г.
procedure TfrmOptions.FormCreate(Sender: TObject);
var
  i: integer;
  SearchRec: TSearchRec;
  xIni: TIniFile;
  str: string;

begin
IsFirstRunning:= true;
frmOptions_General:= TfrmOptions_General.Create(nil);
//frmOptions_General.Width:= AdvPanel4.ClientWidth;
//frmOptions_General.Height:= AdvPanel4.ClientHeight;
frmOptions_P2K:= TfrmOptions_P2K.Create(nil);
//frmOptions_P2K.Width:= AdvPanel4.ClientWidth;
//frmOptions_P2K.Height:= AdvPanel4.ClientHeight;
frmOptions_AT:= TfrmOptions_AT.Create(nil);
//frmOptions_AT.Width:= AdvPanel4.ClientWidth;
//frmOptions_AT.Height:= AdvPanel4.ClientHeight;
frmOptions_OBEX:= TfrmOptions_OBEX.Create(nil);
//frmOptions_OBEX.Width:= AdvPanel4.ClientWidth;
//frmOptions_OBEX.Height:= AdvPanel4.ClientHeight;
if iFlashAvailable = 1 then
begin
frmOptions_Flash:= TfrmOptions_Flash.Create(nil);
//frmOptions_Flash.Width:= AdvPanel4.ClientWidth;
//frmOptions_Flash.Height:= AdvPanel4.ClientHeight;
end;
frmOptions_General.Visible:= false;
frmOptions_OBEX.Visible:= false;
frmOptions_AT.Visible:= false;
frmOptions_P2K.Visible:= false;
if iFlashAvailable = 1 then
begin
frmOptions_Flash.Visible:= false;
end;
frmOptions_General.AdvSpinEdit2.Value:= SwitchModeTimeOut;
frmOptions_General.aosSkin.ItemIndex:= frmOptions_General.aosSkin.Items.IndexOf(Skin);
frmOptions_General.cbUseSkin.Checked:= boolean(ThemeAdapt);
frmOptions_OBEX.RzCheckBox1.Checked:= boolean(bOBEXAutoUpdateFileList);
frmOptions_P2K.RzRadioGroup1.ItemIndex:= iReadDisks;
frmOptions_P2K.RzCheckBox1.Checked:= boolean(iCloseP2K);
frmOptions_General.RzCheckBox1.Checked:= AutoPlatform;
frmOptions_General.cbMinToTray.Checked:= MinToTray;
frmOptions_General.cbRollUp.Checked:= RollUp;
frmOptions_General.cbMultiLine.Checked:= boolean(curToolBar);
frmOptions_General.rgPanelButtonType.ItemIndex:= curTypeMenu;
frmOptions_P2K.RzCheckBox2.Checked:= boolean(iDynamicRefreshFolder);
frmOptions_P2K.rgP2KCF.ItemIndex:= iP2KCF;
frmOptions_P2K.AdvSpinEdit2.Value:= IFNUM;
frmOptions_P2K.cbUseMelodyFromCard.Checked:= UseMelodyFromCard;
frmOptions_P2K.cbUseWavAsRing.Checked:= WavByRing;
frmOptions_P2K.cbUseAmrAsRing.Checked:= AmrByRing;
frmOptions_P2K.cgMMAReadKJava.ItemChecked[0]:= MMA_ReadJava_A;
frmOptions_P2K.cgMMAReadKJava.ItemChecked[1]:= MMA_ReadJava_B;
//frmOptions_P2K.spSkinEdit1.Text:= OtherFeaturesFile;
  frmOptions_P2K.aosOtherFeatureFiles.Items.Clear;
  if FindFirst(ExePath + 'OtherFeatures\*.pof', faAnyFile, SearchRec) = 0 then
  begin
    repeat
     if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') and
        (ansilowercase(ExtractFileExt(SearchRec.Name)) = '.pof')
       then frmOptions_P2K.aosOtherFeatureFiles.Items.Add(ExtractFileName(SearchRec.Name));
    until FindNext(SearchRec) <> 0;
    FindClose(SearchRec);
    frmOptions_P2K.aosOtherFeatureFiles.ItemIndex:= frmOptions_P2K.aosOtherFeatureFiles.Items.IndexOf(OtherFeaturesFile);
  end;
//frmOptions_P2K.aosOtherFeatureFiles.ItemIndex:= frmOptions_P2K.aosOtherFeatureFiles.Items.IndexOf(OtherFeaturesFile2);
frmOptions_AT.aosMode.ItemIndex:= iPhoneBookType;
frmOptions_AT.AdvSpinEdit1.Value:= UseFirstNRecords;
frmOptions_AT.AdvSpinEdit2.Value:= ATTimeOut;
frmOptions_AT.AdvSpinEdit3.Value:= iREAD_PHONEBOOK_BLOCK;
frmOptions_AT.spSkinComboBox1.ItemIndex:= frmOptions_AT.spSkinComboBox1.Items.IndexOf(IntTostr(BaudRate)); 
frmOptions_OBEX.AdvSpinEdit2.Value:= OBEXTimeOut;
frmOptions_OBEX.AdvSpinEdit1.Value:= iOBEXType+1;
frmOptions_OBEX.RzCheckBox2.Checked:= boolean(OBEXShowProgress);
  frmOptions_General.aosSkin.Items.BeginUpdate;
  frmOptions_General.aosSkin.Items.Clear;
  if FindFirst(ExePath + 'Skins\*.skn', faAnyFile, SearchRec) = 0 then
  begin
    repeat
     if (SearchRec.Name <> '..') and (SearchRec.Name <> '.')
       then frmOptions_General.aosSkin.Items.Add(SearchRec.Name);
    until FindNext(SearchRec) <> 0;
    FindClose(SearchRec);
    frmOptions_General.aosSkin.ItemIndex:= frmOptions_General.aosSkin.Items.IndexOf(SKin);
  end;
  frmOptions_General.aosSkin.Items.EndUpdate;
  //xIni:= TIniFile.Create(ExePath+'config.ini');
  //LoadLang(ExePath + '\Lng\' + xLang);
  xIni:= TIniFile.Create(ExePath+'\Lng\' + xLang);
  try
    frmOptions_General.aosMode.Items.Clear;
    Caption:= xIni.ReadString('Main', 'mnu07', 'Настройка программы');
    InspectorBar1.Sections[0].Items[0].Text:= opt_text01;
    str:= xIni.ReadString('Main', 'mnu01', 'P2K режим');
    InspectorBar1.Sections[0].Items[1].Text:= str;
    frmOptions_General.aosMode.Items.Add(str);
    str:= xIni.ReadString('Main', 'mnu02', 'AT режим');
    InspectorBar1.Sections[0].Items[2].Text:= str;
    frmOptions_General.aosMode.Items.Add(str);
    str:= xIni.ReadString('Main', 'mnu04', 'Flash режим');
    frmOptions_General.aosMode.Items.Add(str);
    if iFlashAvailable = 1
    then begin
           //InspectorBar1.Sections[0].Items[4].Text:= str;
         end
    else begin
           //InspectorBar1.Sections[0].Items[4].Text:= '';
         end;
    str:= xIni.ReadString('Main', 'mnu03', 'OBEX режим');
    InspectorBar1.Sections[0].Items[3].Text:= str;
    frmOptions_General.aosMode.Items.Add(str);
  finally
    xIni.Free;
  end;
  frmOptions_General.aosMode.ItemIndex:= iCurrentMode;
  AdvGlowButton1.Caption:= btnApply;
  AdvGlowButton2.Caption:= btnCancel;
  AdvGlowButton3.Caption:= btnOk;
frmOptions_General.Label1.Caption:= opt_01_text01;
frmOptions_General.Label6.Caption:= opt_01_text02;
frmOptions_General.Label2.Caption:= txt_lang;
frmOptions_General.Label3.Caption:= opt_01_text03;
frmOptions_General.cbUseSkin.Caption:= opt_01_text04;
frmOptions_General.RzCheckBox1.Caption:= opt_01_text06;
frmOptions_General.spSkinGroupBox1.Caption:= opt_01_text07;
frmOptions_General.cbMinToTray.Caption:= opt_01_text08;
frmOptions_General.cbRollUp.Caption:= opt_01_text09;
frmOptions_General.spSkinStdLabel1.Caption:= opt_01_text10;
frmOptions_General.rgPanelButtonType.Caption:= opt_01_text11;
frmOptions_General.rgPanelButtonType.Items[0]:= opt_01_text12;
frmOptions_General.rgPanelButtonType.Items[1]:= opt_01_text13;
frmOptions_General.cbMultiLine.Caption:= opt_01_text14;
frmOptions_General.spSkinCheckRadioBox1.Caption:= opt_01_text15;
  frmOptions_General.AdvOfficeSelector1.Items.Clear;
  if FindFirst(ExePath + 'Lng\*.lng', faAnyFile, SearchRec) = 0 then
  begin
    repeat
     if (SearchRec.Name <> '..') and (SearchRec.Name <> '.')
       then frmOptions_General.AdvOfficeSelector1.Items.Add(ExtractFileName(SearchRec.Name));
    until FindNext(SearchRec) <> 0;
    FindClose(SearchRec);
    frmOptions_General.AdvOfficeSelector1.ItemIndex:= frmOptions_General.AdvOfficeSelector1.Items.IndexOf(xLang);
  end;
frmOptions_P2K.RzRadioGroup1.Caption:= opt_02_text01;
frmOptions_P2K.RzRadioGroup1.Items[0]:= opt_02_text02;
frmOptions_P2K.RzRadioGroup1.Items[1]:= opt_02_text03;
frmOptions_P2K.RzRadioGroup1.Items[2]:= opt_02_text04;
frmOptions_P2K.RzRadioGroup1.Items[3]:= opt_02_text05;
frmOptions_P2K.RzRadioGroup1.Items[4]:= opt_02_text06;
frmOptions_P2K.rgP2KCF.Caption:= opt_02_text07;
frmOptions_P2K.RzCheckBox1.Caption:= opt_02_text08;
frmOptions_P2K.RzCheckBox2.Caption:= opt_02_text09;
frmOptions_P2K.cbUseMelodyFromCard.Caption:= opt_02_text10;
frmOptions_P2K.cbUseWavAsRing.Caption:= opt_02_text11;
frmOptions_P2K.cbUseAmrAsRing.Caption:= opt_02_text12;
frmOptions_P2K.spSkinStdLabel2.Caption:= opt_02_text13;
frmOptions_P2K.cgMMAReadKJava.Caption:= opt_02_text14;
frmOptions_P2K.cgMMAReadKJava.Items[0]:= opt_02_text15;
frmOptions_P2K.cgMMAReadKJava.Items[1]:= opt_02_text16;
frmOptions_AT.Label1.Caption:= opt_03_text01;
frmOptions_AT.Label2.Caption:= opt_03_text02;
frmOptions_AT.Label3.Caption:= Format(opt_03_text03,['                        ']);
frmOptions_AT.Label5.Caption:= opt_03_text04;
frmOptions_AT.Label7.Caption:= opt_03_text05;
frmOptions_AT.Label8.Caption:= opt_03_text06;
frmOptions_AT.Label9.Caption:= opt_03_text07;
frmOptions_OBEX.RzCheckBox1.Caption:= opt_04_text01;
frmOptions_OBEX.Label7.Caption:= opt_04_text02;
frmOptions_OBEX.Label1.Caption:= opt_04_text03;
frmOptions_OBEX.Label2.Caption:= opt_04_text04;
frmOptions_OBEX.RzCheckBox2.Caption:= opt_04_text05;
if AutoPlatform
  then begin
         frmOptions_OBEX.AdvSpinEdit1.Enabled:= false;
         frmOptions_AT.aosMode.Enabled:= false;
       end
  else begin
        frmOptions_OBEX.AdvSpinEdit1.Enabled:= true;
        frmOptions_AT.aosMode.Enabled:= true;
       end;
spSkinButtonsBar1Sections0Items0Click(nil);
IsFirstRunning:= false;
end;
Rambler's Top100