void CHexExportDlg::OnButton(wxCommandEvent& event) { wxObject * object = event.GetEventObject(); if (object == m_btnBrowse) { int err; wxString CurrentDir = wxGetCwd(); wxFileDialog dialog(GetParent(), wxT("Export hexes to"), wxT(""), m_tcFName->GetValue(), wxT(SZ_ALL_FILES), wxFD_SAVE ); err = dialog.ShowModal(); wxSetWorkingDirectory(CurrentDir); if (wxID_OK == err) m_tcFName->SetValue( dialog.GetPath() ); } else if (object==m_btnOk) { StoreSize(); EndModal(wxID_OK); } else if (object==m_btnCancel) { StoreSize(); EndModal(wxID_CANCEL); } }
void CExportMagesCSVDlg::OnButton(wxCommandEvent& event) { wxString S; switch (event.GetId()) { case wxID_OK: S = m_pSeparator->GetValue(); gpApp->SetConfig(m_sConfigSection.GetData(), SZ_KEY_SEPARATOR, S.mb_str()); S = m_pOrientation->GetValue(); gpApp->SetConfig(m_sConfigSection.GetData(), SZ_KEY_ORIENTATION, S.mb_str()); m_nFormat = 0; if (m_pRadio1->GetValue()) m_nFormat = 0; else if (m_pRadio2->GetValue()) m_nFormat = 1; else if (m_pRadio3->GetValue()) m_nFormat = 2; S.Empty(); S << m_nFormat; gpApp->SetConfig(m_sConfigSection.GetData(), SZ_KEY_FORMAT, S.mb_str()); StoreSize(); EndModal(wxID_OK); break; case wxID_CANCEL: StoreSize(); EndModal(wxID_CANCEL); break; case wxID_SETUP: // browse button { int err; wxString CurrentDir = wxGetCwd(); wxFileDialog dialog(GetParent(), wxT("Save mages info"), wxT(""), m_pFileName->GetValue(), wxT(SZ_CSV_FILES), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); err = dialog.ShowModal(); wxSetWorkingDirectory(CurrentDir); if (wxID_OK == err) m_pFileName->SetValue( dialog.GetPath() ); } break; } }
void COptionsDialog::OnOk (wxCommandEvent& event) { BOOL DoApplyColors; int layout; if (m_IsValid && event.GetId()==wxID_OK) { m_IsValid = FALSE; DoApplyColors = ((m_pChkHatchUnvisited->GetValue()?1:0)!=atol(gpApp->GetConfig(SZ_SECT_COMMON, SZ_KEY_HATCH_UNVISITED))); if (m_pRadio1Win->GetValue()) layout = AH_LAYOUT_1_WIN; else if (m_pRadio2Win->GetValue()) layout = AH_LAYOUT_2_WIN; else layout = AH_LAYOUT_3_WIN; // if (m_pChk3WinLayout->GetValue() != (0!=atol(gpApp->GetConfig(SZ_SECT_COMMON, SZ_KEY_LAYOUT)))) if (layout != atol(gpApp->GetConfig(SZ_SECT_COMMON, SZ_KEY_LAYOUT))) wxMessageBox(wxT("Please restart application for the changes to take effect"), wxT("Warning"), wxOK | wxCENTRE | wxICON_EXCLAMATION); gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_LOAD_ORDER , m_pChkLoadOrd ->GetValue()?"1":"0"); gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_LOAD_REP , m_pChkLoadRep ->GetValue()?"1":"0"); gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_HATCH_UNVISITED , m_pChkHatchUnvisited ->GetValue()?"1":"0"); gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_RCLICK_CENTERS , m_pChkRClickCenters ->GetValue()?"1":"0"); // gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_LAYOUT , m_pChk3WinLayout ->GetValue()?"1":"0"); gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_LAYOUT , layout); gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_CHECK_TEACH_LVL , m_pChkTeach ->GetValue()?"1":"0"); gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_PWD_READ , m_pChkReadPwd ->GetValue()?"1":"0"); gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_CHK_PROD_REQ , m_pChkCheckProdReq ->GetValue()?"1":"0"); gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_CHECK_MOVE_MODE , m_pChkMoveMode ->GetValue()?"1":"0"); if (m_pChkUnixStyle->GetValue()) { gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_EOL, SZ_EOL_UNIX); EOL_FILE = EOL_UNIX; } else { gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_EOL, SZ_EOL_MS); EOL_FILE = EOL_MS; } gpApp->SetConfig(SZ_SECT_COMMON, SZ_KEY_ICONS, m_pRadioIconsAdvanced->GetValue() ? SZ_ICONS_ADVANCED : SZ_ICONS_SIMPLE); if (DoApplyColors) gpApp->ApplyColors(); gpApp->ApplyIcons(); gpApp->Redraw(); } StoreSize(); EndModal(wxID_OK); }
void CShowDescriptionListDlg::OnButton(wxCommandEvent& event) { if (event.GetId()==wxID_OK) OnLBDClick(event); else if (event.GetId()==wxID_CANCEL) { StoreSize(); EndModal(wxID_CANCEL); } else if (event.GetId()==wxID_SAVE) SaveAs(); }
void COptionsDialog::OnCancel(wxCommandEvent& event) { int i; CStrStr * pSS; if (m_IsValid && event.GetId()==wxID_CANCEL) { m_IsValid = FALSE; for(i=0; i<FONT_COUNT; i++) { if (m_bFontChanged[i]) { /* gpApp->m_Fonts[i]->SetPointSize(m_FontData[i].size ) ; gpApp->m_Fonts[i]->SetFamily (m_FontData[i].family ) ; gpApp->m_Fonts[i]->SetStyle (m_FontData[i].style ) ; gpApp->m_Fonts[i]->SetWeight (m_FontData[i].weight ) ; gpApp->m_Fonts[i]->SetEncoding (m_FontData[i].encoding) ; gpApp->m_Fonts[i]->SetFaceName (m_FontData[i].face ) ;*/ delete gpApp->m_Fonts[i]; gpApp->m_Fonts[i] = new wxFont(m_FontData[i].size, m_FontData[i].family, m_FontData[i].style, m_FontData[i].weight, FALSE, m_FontData[i].face, m_FontData[i].encoding ); // font = new wxFont(size, family, style, weight, FALSE, facename, (wxFontEncoding)encoding); } } for (i=0; i<m_ColorData.Count(); i++) { pSS = (CStrStr*)m_ColorData.At(i); gpApp->SetConfig(SZ_SECT_COLORS, pSS->m_key, pSS->m_value); } for (i=0; i<m_FactionData.Count(); i++) { pSS = (CStrStr*)m_FactionData.At(i); gpApp->SetConfig(SZ_SECT_PASSWORDS, pSS->m_key, pSS->m_value); } gpApp->ApplyFonts(); gpApp->ApplyColors(); } StoreSize(); EndModal(wxID_CANCEL); }
void CShowOneDescriptionDlg::OnButton(wxCommandEvent& event) { if (event.GetId()==wxID_OK) { int err; wxString CurrentDir = wxGetCwd(); if (!m_descr) return; wxFileDialog dialog(GetParent(), wxT("Save current text"), wxT(""), wxT(""), wxT(SZ_ALL_FILES), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); err = dialog.ShowModal(); wxSetWorkingDirectory(CurrentDir); if (wxID_OK == err) { CFileWriter F; if (F.Open(dialog.GetPath().mb_str())) { F.WriteBuf(m_descr, strlen(m_descr)); F.Close(); } else wxMessageBox(wxT("Can not open file")); } } else if (event.GetId()==wxID_CANCEL) { StoreSize(); EndModal(wxID_CANCEL); } }
void CGetTextDlg::OnButton(wxCommandEvent& event) { m_Text = m_tcText->GetValue().mb_str(); StoreSize(); event.Skip(); }