//--------------------------------------------------------------------------- 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); }
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; }
//--------------------------------------------------------------------------- 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; }