// --------------------------------------------------------------------------- // lang.ini loading void __fastcall LoadLang(TForm1* form, String inifile) { if (TFile::Exists(inifile)) { TStringList *sect = new TStringList(); TMemIniFile *ini = new TMemIniFile(inifile); ini->ReadSectionValues("Lang.TMenuItem.Caption", sect); for (int i = 0; i < sect->Count; ++i) { String key = sect->Names[i]; String val = sect->Values[key]; TMenuItem *item = static_cast<TMenuItem*>(form->FindComponent(key)); if (item != NULL) { item->Caption = val; } } ini->ReadSectionValues("Lang.TToolButton.Hint", sect); for (int i = 0; i < sect->Count; ++i) { String key = sect->Names[i]; String val = sect->Values[key]; TToolButton *item = static_cast<TToolButton*>(form->FindComponent(key)); if (item != NULL) { item->Hint = val; } } form->SlideShowStart = ini->ReadString("Lang.Etc", "SlideShowStart", "Slide Show Start"); form->SlideShowStop = ini->ReadString("Lang.Etc", "SlideShowStop", "Slide Show Stop"); form->mnuPlaySlideShow->Caption = SlideShowStart; delete ini; delete sect; } }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::LoadBtnClick(TObject *Sender) { // TOpenDialog *pBox = new TOpenDialog(this); pBox->Options >> ofCreatePrompt; pBox->Options << ofFileMustExist; if( sys.m_MsgEng ){ pBox->Title = "Open command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルを開く"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = ""; pBox->DefaultExt = "rcm"; pBox->InitialDir = sys.m_BgnDir; if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); CmdInit->Text = pIniFile->ReadString("RADIO", "CmdInit", CmdInit->Text); CmdRx->Text = pIniFile->ReadString("RADIO", "CmdRx", CmdRx->Text); CmdTx->Text = pIniFile->ReadString("RADIO", "CmdTx", CmdTx->Text); Cmdxx->Text = pIniFile->ReadString("RADIO", "Cmdxx", Cmdxx->Text); m_PollType = pIniFile->ReadInteger("RADIO", "PollType", 0); RGFS->ItemIndex = pIniFile->ReadInteger("RADIO", "Offset", 0); PollInt->Text = (pIniFile->ReadInteger("RADIO", "PollInterval", 0) + 2)/10.0; AddrScan->Checked = 0; delete pIniFile; SetMaker(); UpdateUI(); } delete pBox; }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::LoadBtnClick(TObject *Sender) { // TOpenDialog *pBox = MmttyWd->OpenDialog; pBox->Options >> ofCreatePrompt; pBox->Options << ofFileMustExist; if(Font->Charset != SHIFTJIS_CHARSET){ pBox->Title = "Open command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルを開く"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = ""; pBox->DefaultExt = "rcm"; pBox->InitialDir = BgnDir; NormalWindow(this); if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); CmdInit->Text = pIniFile->ReadString("RADIO", "CmdInit", CmdInit->Text); CmdRx->Text = pIniFile->ReadString("RADIO", "CmdRx", CmdRx->Text); CmdTx->Text = pIniFile->ReadString("RADIO", "CmdTx", CmdTx->Text); Cmdxx->Text = pIniFile->ReadString("RADIO", "Cmdxx", Cmdxx->Text); m_PollType = pIniFile->ReadInteger("RADIO", "PollType", 0); FreqOffset->ItemIndex = pIniFile->ReadInteger("RADIO", "PollOffset", 5); PollInt->Text = (pIniFile->ReadInteger("RADIO", "PollInterval", 0) + 5)/10.0; AddrScan->Checked = 0; delete pIniFile; SetMaker(); UpdateUI(); } TopWindow(this); }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::SaveBtnClick(TObject *Sender) { TSaveDialog *pBox = MmttyWd->SaveDialog; if( (Font->Charset != SHIFTJIS_CHARSET) ){ pBox->Title = "Save command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルの作成"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = "MyRIG.rcm"; pBox->DefaultExt = "rcm"; pBox->InitialDir = BgnDir; NormalWindow(this); if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); pIniFile->WriteString("RADIO", "CmdInit", CmdInit->Text); pIniFile->WriteString("RADIO", "CmdRx", CmdRx->Text); pIniFile->WriteString("RADIO", "CmdTx", CmdTx->Text); pIniFile->WriteString("RADIO", "Cmdxx", Cmdxx->Text); pIniFile->WriteInteger("RADIO", "PollType", m_PollType); pIniFile->WriteInteger("RADIO", "PollOffset", FreqOffset->ItemIndex); double d; int dd = 5; if( sscanf(AnsiString(PollInt->Text).c_str(), "%lf", &d) == 1 ){ //JA7UDE 0428 if( d >= 0.5 ){ dd = int((d * 10.0) - 5); if( dd < 0 ) dd = 0; } } pIniFile->WriteInteger("RADIO", "PollInterval", dd); pIniFile->UpdateFile(); delete pIniFile; } TopWindow(this); }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::SaveBtnClick(TObject *Sender) { TSaveDialog *pBox = new TSaveDialog(this); if( sys.m_MsgEng ){ pBox->Title = "Save command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルの作成"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = "MyRIG.rcm"; pBox->DefaultExt = "rcm"; pBox->InitialDir = sys.m_BgnDir; if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); pIniFile->WriteString("RADIO", "CmdInit", CmdInit->Text); pIniFile->WriteString("RADIO", "CmdRx", CmdRx->Text); pIniFile->WriteString("RADIO", "CmdTx", CmdTx->Text); pIniFile->WriteString("RADIO", "Cmdxx", Cmdxx->Text); pIniFile->WriteInteger("RADIO", "PollType", m_PollType); pIniFile->ReadInteger("RADIO", "Offset", RGFS->ItemIndex); double d; int dd = 5; if( sscanf(AnsiString(PollInt->Text).c_str(), "%lf", &d) == 1 ){ //JA7UDE 0428 if( d >= 0.2 ){ dd = int((d * 10.0) - 2); if( dd < 0 ) dd = 0; } } pIniFile->WriteInteger("RADIO", "PollInterval", dd); pIniFile->UpdateFile(); delete pIniFile; } delete pBox; }
void TTrdItf_DDABOSS::SetConfig(void) { if( FSetupFile== NULL ) return ; TMemIniFile *ini = new TMemIniFile( FSetupFile ); try { ini->WriteString(PLUGINNAME,"pUser",FSet.pUser); ini->WriteString(PLUGINNAME,"pWtfs",FSet.pWtfs); ini->WriteString(PLUGINNAME,"pYyb",FSet.pYyb); ini->WriteString(PLUGINNAME,"pRight",FSet.pRight); ini->WriteString(PLUGINNAME,"pDest",FSet.pDest); ini->WriteString(PLUGINNAME,"pemote",FSet.pRemote); ini->UpdateFile(); } __finally { delete ini; } }
bool TTrdItf_DDABOSS::GetConfig(void) { if( FSetupFile== NULL ) return false; TMemIniFile *ini = new TMemIniFile( FSetupFile ); try { // 判断是否存在插件的设置,没有的话返回false以便系统能够生成默认的设置 if( ini->SectionExists(PLUGINNAME) == false ) return false; lstrcpyn(FSet.pUser,ini->ReadString(PLUGINNAME,"pUser",FSet.pUser).c_str(),9); lstrcpyn(FSet.pWtfs,ini->ReadString(PLUGINNAME,"pWtfs",FSet.pWtfs).c_str(),2); lstrcpyn(FSet.pYyb,ini->ReadString(PLUGINNAME,"pYyb",FSet.pYyb).c_str(),9); lstrcpyn(FSet.pRight,ini->ReadString(PLUGINNAME,"pRight",FSet.pRight).c_str(),99); lstrcpyn(FSet.pDest,ini->ReadString(PLUGINNAME,"pDest",FSet.pDest).c_str(),49); lstrcpyn(FSet.pRemote,ini->ReadString(PLUGINNAME,"pRemote",FSet.pRemote).c_str(),99); } __finally { delete ini; } return true; }
bool RecvEventsTh::GetConfig(const char * setupfile) { TMemIniFile *ini = new TMemIniFile( setupfile ); try { // 判断是否存在插件的设置,没有的话返回false以便系统能够生成默认的设置 if( ini->SectionExists(PLUGINNAME) == false ) return false; SvrIp = ini->ReadString (PLUGINNAME,"SvrIP",SvrIp); PushPort = ini->ReadInteger(PLUGINNAME,"PushPort",PushPort); debug_mode = ini->ReadBool(PLUGINNAME,"debug_mode",debug_mode); JysID =ini->ReadString (PLUGINNAME,"jysID",JysID); } __finally { delete ini; } return true; }