Пример #1
0
void WizardDialogSetFunc::CloseGaussParams()
{
  bool a,c,b,d;


  if (XRCCTRL(*master, "STRENGTH_DISTRI", wxRadioBox)->GetSelection() == 2)
    {
      if (XRCCTRL(*this, "GAUSS_MEAN", wxTextCtrl)->GetValue().ToDouble(&userdat->gauss_strength[0]) && XRCCTRL(*this, "GAUSS_SIGMA", wxTextCtrl)->GetValue().ToDouble(&userdat->gauss_strength[1]))
        {
          EndModal(true);
        }
      else
        {
          wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
          msgDlg.ShowModal();
        }
    }
  else if (XRCCTRL(*master, "STRENGTH_DISTRI", wxRadioBox)->GetSelection() == 1)
    {
      a = XRCCTRL(*this, "ID_TEXTCTRL_LINEAR_MEAN1", wxTextCtrl)->GetValue().ToDouble(&userdat->linear_strength[0]);
      b = XRCCTRL(*this, "ID_TEXTCTRL_LINEAR_SIZE1", wxTextCtrl)->GetValue().ToDouble(&userdat->linear_strength[1]);
      c = XRCCTRL(*this, "ID_TEXTCTRL_LINEAR_MEAN2", wxTextCtrl)->GetValue().ToDouble(&userdat->linear_strength[2]);
      d = XRCCTRL(*this, "ID_TEXTCTRL_LINEAR_SIZE2", wxTextCtrl)->GetValue().ToDouble(&userdat->linear_strength[3]);
      if (a && b && c && d)
        {
          EndModal(true);
        }
      else
        {
          wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
          msgDlg.ShowModal();
        }
    }
}
void AppVirtualWorld::NewWorldFile( string worldFullPath )
{
  // Verifica se ja existe um arquivo no caminho especificado
  // Se houver um arquivo, pede confirmacao para sobreescrever
  if ( wxFileExists( wxString( worldFullPath.c_str() ) ) )
  {
    wxMessageDialog msgDlg(NULL," Ja existe um arquivo no caminho especificado. Deseja sobreescreve-lo ? ","Aviso",wxYES_NO);
    if ( msgDlg.ShowModal() == wxNO )
    {
      return;
    }
  }

  // Se houver um mundo virtual não salvo pede confirmação da operação
  if ( ! this->project->GetVirtualWorld()->HasSavedWorldFile() )
  {
    wxMessageDialog msgDlg(NULL," O projeto IRCE atual possui um mundo virtual não salvo. Prosseguir ? ","Aviso",wxYES_NO);
    if ( msgDlg.ShowModal() == wxNO )
    {
      return;
    }
  }
  // Transforma o path absoluto informado em path relativo  
  worldFullPath = FileName::GetRelativeFilename( this->project->GetProjectDirectory(), worldFullPath );
  // Cria um novo arquivo de mundo virtual
  this->project->GetVirtualWorld()->SetWorldFile( worldFullPath );
}
Пример #3
0
void ManagerFrame::OnExportClicked(wxCommandEvent& event)
{
	size_t sel = (size_t)m_replayDV->GetSelection().GetID() - 1;
	ReplayProvider* provider = static_cast<ReplayDataModel*>(m_replayDV->GetModel())->GetProvider();
	Replay::Ptr replay = provider->replay[sel];

	wxFileDialog fdlg(
		this, 
		_("Export replay"),
		wxStandardPaths::Get().GetDocumentsDir(),
		replay->GetExportFileName(),
		"*.zip",
		wxFD_SAVE | wxFD_OVERWRITE_PROMPT
		);

	if (fdlg.ShowModal() == wxID_OK)
	{
		replay->Export(fdlg.GetPath());

		wxMessageDialog msgDlg(this, _("Export has finished"), _("Information"), wxICON_INFORMATION | wxOK | wxCANCEL | wxCENTER);
		msgDlg.SetOKCancelLabels(_("Open Folder"), _("Close"));
		if (msgDlg.ShowModal() == wxID_OK)
		{
			wxFileName fn(fdlg.GetPath());
			wxLaunchDefaultApplication(fn.GetPath());
		}
	}
}
Пример #4
0
bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg)
{
    // under MSW we prefer to use the base class version using ::MessageBox()
    // even if wxMessageBox() is available because it has less chances to
    // double fault our app than our wxMessageBox()
#if defined(__WXMSW__) || !wxUSE_MSGDLG
    return wxAppTraitsBase::ShowAssertDialog(msg);
#else // wxUSE_MSGDLG
    // this message is intentionally not translated -- it is for
    // developpers only
    wxString msgDlg(msg);
    msgDlg += wxT("\nDo you want to stop the program?\n")
              wxT("You can also choose [Cancel] to suppress ")
              wxT("further warnings.");

    switch ( wxMessageBox(msgDlg, wxT("wxWidgets Debug Alert"),
                          wxYES_NO | wxCANCEL | wxICON_STOP ) )
    {
        case wxYES:
            wxTrap();
            break;

        case wxCANCEL:
            // no more asserts
            return true;

        //case wxNO: nothing to do
    }

    return false;
#endif // !wxUSE_MSGDLG/wxUSE_MSGDLG
}
Пример #5
0
void WizardDialogRunFunc::CloseExtraDeform()
{
  if (XRCCTRL(*this, "ID_TEXTCTRL_EXTRASTEPSIZE", wxTextCtrl)->GetValue().ToDouble(&userdat->extra_deformation[0]))
    {
      userdat->extra_deformation[1] = XRCCTRL(*this, "ID_SPINCTRL_EXTRATIMESTEP", wxSpinCtrl)->GetValue();

      userdat->extra_deform = XRCCTRL(*this, "ID_CHECKBOX_EXTRADEFORM", wxCheckBox)->GetValue();
      
      switch (XRCCTRL(*this, "ID_RADIOBOX_EXTRA_DEFORM", wxRadioBox)->GetSelection())
        {
        case 0:
          userdat->extra_def_unilateral_proc = true;
          userdat->extra_def_bilateral_proc = false;
          userdat->extra_def_pureshear_proc = false;
          break;
        case 1:
          userdat->extra_def_unilateral_proc = false;
          userdat->extra_def_bilateral_proc = true;
          userdat->extra_def_pureshear_proc = false;
          break;
        case 2:
          userdat->extra_def_unilateral_proc = false;
          userdat->extra_def_bilateral_proc = false;
          userdat->extra_def_pureshear_proc = true;
          break;
        }
      
      EndModal(true);
    }
  else
    {
      wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
      msgDlg.ShowModal();
    }
}
void ExploreFrame::OnWindowClose( wxCloseEvent& event )
{
	if (m_archive && m_archive->IsModified())
	{
		wxMessageDialog msgDlg(this, _("Do you wan't to save unsaved changes?"), _("Warning"), wxICON_WARNING | wxYES_NO | wxCANCEL);
		msgDlg.SetYesNoLabels(_("Save"), _("Don't Save"));

		switch (msgDlg.ShowModal())
		{
			case wxID_YES:
			{
				wxCommandEvent evt(wxID_SAVE);
				OnSaveClicked(evt);
				event.Skip();
				break;
			}
			case wxID_NO:
				event.Skip();
				break;
			default:
				event.Veto();
				break;
		}
	} else
		event.Skip();
}
Пример #7
0
void PreferencesDialog::OnMyButtonClicked( wxCommandEvent &WXUNUSED(event) )
{
    // Construct a message dialog.
    wxMessageDialog msgDlg(this, _("You clicked on My Button"));

    // Show it modally.
    msgDlg.ShowModal();
}
Пример #8
0
void WizardDialogSetFunc::CloseGrainBoundaryEdit()
{
  if (XRCCTRL(*this, "GB_CONST", wxTextCtrl)->GetValue().ToDouble(&userdat->make_gb[0]) && XRCCTRL(*this, "GB_BREAKSTRENGTH", wxTextCtrl)->GetValue().ToDouble(&userdat->make_gb[1]))
    EndModal(true);
  else
    {
      wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
      msgDlg.ShowModal();
    }
}
Пример #9
0
void WizardDialogSetFunc::CloseYoungGauss()
{
  if (XRCCTRL(*this, "GAUSS_MEAN", wxTextCtrl)->GetValue().ToDouble(&userdat->gauss_young[0]) && XRCCTRL(*this, "GAUSS_SIGMA", wxTextCtrl)->GetValue().ToDouble(&userdat->gauss_young[1]))
    EndModal(true);
  else
    {
      wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
      msgDlg.ShowModal();
    }
}
bool ExploreFrame::OpenBaseFile(bool forceSelection)
{
	bool doSelect = forceSelection;

	wxString prevBasePath = wxConfigBase::Get()->Read("BaseFile");

	wxFileName baseFileName;
	if (prevBasePath.empty())
		baseFileName.Assign(GetGameBasePath(), "hlm2_data_desktop.wad");
	else
		baseFileName.Assign(prevBasePath);

	if (!baseFileName.Exists())
	{
		wxMessageDialog msgDlg(NULL, _("Could not find base game WAD. Please select main WAD to continue."),
			_("Warning"), wxICON_WARNING | wxOK | wxCANCEL | wxCENTER);
		msgDlg.SetOKLabel(_("Select"));
		if (msgDlg.ShowModal() != wxID_OK)
			return false;

		doSelect = true;
	}

	if (doSelect)
	{
		wxFileDialog fileDlg(this, _("Select base game WAD file"), "", baseFileName.GetFullPath(), "*.wad", wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST);
		if (fileDlg.ShowModal() != wxID_OK)
			return false;

		baseFileName.Assign(fileDlg.GetPath());
	}

	m_ignoreSearch = true;
	m_searchCtrl->SetValue("");
	m_searchCtrl->Enable();
	m_ignoreSearch = false;

	m_archive = new WADArchive(baseFileName.GetFullPath());
	wxObjectDataPtr<FileDataModel> model(new FileDataModel(m_archive.get()));
	m_fileListCtrl->UnselectAll();
	m_fileListCtrl->AssociateModel(model.get());
	m_fileListCtrl->Refresh();
	m_menubar->Enable(ID_EXTRACT, true);
	m_toolBar->EnableTool(ID_EXTRACT, true);
	m_menubar->Enable(wxID_ADD, !m_archive->GetReadOnly());
	if (m_archive->GetFilteredEntryCount() > 0)
	{
		SelectItem(0);
		m_fileListCtrl->SetFocus();
	}

	wxConfigBase::Get()->Write("BaseFile", baseFileName.GetFullPath());

	return true;
}
Пример #11
0
/**
 * Close dialog canceling changes
 */
void ChooseVariableDialog::OncancelBtClick(wxCommandEvent& event)
{
    if ( modificationCount > 4 )
    {
        wxMessageDialog msgDlg(this, _("You made ")+gd::String::From(modificationCount)+_(" changes. Are you sure you want to cancel all changes\?"), _("Lot's of changes made."), wxYES_NO | wxICON_QUESTION);
        if ( msgDlg.ShowModal() == wxID_NO )
            return;
    }

    EndModal(0);
}
void ExploreFrame::OnReplaceClicked( wxCommandEvent& event )
{
	const WADArchiveEntry& entry = GetSelectedEntry();
	wxFileName entryFN(entry.GetFileName());
	
	wxFileDialog fileDlg(this, wxString::Format(_("Select file to replace %s"), entry.GetFileName()), wxString(),
						 entryFN.GetFullName(), "*." + entryFN.GetExt(), wxFD_DEFAULT_STYLE  | wxFD_FILE_MUST_EXIST);
	if (fileDlg.ShowModal() == wxID_OK)
	{
		if (entryFN.GetExt().IsSameAs("png", false))
		{
			wxString imgErrors;

			// Do some sanity checks on the replacement image
			wxImage replaceImage(fileDlg.GetPath());
			if (replaceImage.IsOk())
			{
				if (replaceImage.HasAlpha())
					imgErrors += _("- Image may not have an alpha mask\n");

				wxMemoryOutputStream oStr;
				m_archive->Extract(entry, oStr);
				wxStreamBuffer* buffer = oStr.GetOutputStreamBuffer();
				wxMemoryInputStream iStr(buffer->GetBufferStart(), buffer->GetBufferSize());
				wxImage orgImage(iStr);
				if (orgImage.GetSize() != replaceImage.GetSize())
					imgErrors += wxString::Format(_("- Image has to be %dx%d in size\n"), orgImage.GetSize().x, orgImage.GetSize().y);

				if (orgImage.HasMask() != replaceImage.HasMask())
					imgErrors += _("- Image must have transparency\n");
			}
			else
				imgErrors = _("Image could not be loaded");

			if (!imgErrors.empty())
			{
				wxMessageDialog msgDlg(this, wxString::Format(
					_("Image Errors\n\nThe replacement image contains erros which might crash the game\n\n%s\n\nDo you want't to replace anyway?"), imgErrors),
					_("Warning"), wxICON_WARNING | wxYES_NO | wxNO_DEFAULT);
				msgDlg.SetYesNoLabels(_("Replace"), _("Don't Replace"));
				if (msgDlg.ShowModal() != wxID_YES)
					return;
			}
		}

		size_t index = (size_t) m_fileListCtrl->GetSelection().GetID() - 1;
		m_archive->ReplaceFiltered(index, fileDlg.GetPath());
		static_cast<FileDataModel*>(m_fileListCtrl->GetModel())->RowChanged(index);
		wxDataViewEvent evt(wxEVT_DATAVIEW_SELECTION_CHANGED);
		OnFileListSelectionChanged(evt);

		UpdateTitle();
	}
}
Пример #13
0
void WizardDialogSetFunc::CloseWallEdit()
{
  userdat->walls[0] = XRCCTRL(*this, "ID_RADIOBOX_SW_BOTH_EDIT", wxRadioBox)->GetSelection();

  if (XRCCTRL(*this, "SW_CONST_EDIT", wxTextCtrl)->GetValue().ToDouble(&userdat->walls[1]))
    EndModal(true);
  else
    {
      wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
      msgDlg.ShowModal();
    }
}
Пример #14
0
bool ConfirmationDlg(const wxString &Msg, wxWindow* parent)
{
	wxMessageDialog msgDlg(parent, Msg, wxT("Confirmation"),
	  wxYES | wxNO | wxICON_QUESTION);
	if (msgDlg.ShowModal() == wxID_YES)
	{
		return true;
	}
	else
	{
		return false;
	}
}
Пример #15
0
void StocksListCtrl::OnDeleteStocks(wxCommandEvent& /*event*/)
{
    if (m_selected_row == -1) return;

    wxMessageDialog msgDlg(this, _("Do you really want to delete the stock investment?")
        , _("Confirm Stock Investment Deletion")
        , wxYES_NO | wxNO_DEFAULT | wxICON_ERROR);
    if (msgDlg.ShowModal() == wxID_YES)
    {
        Model_Stock::instance().remove(m_stocks[m_selected_row].STOCKID);
        mmAttachmentManage::DeleteAllAttachments(Model_Attachment::reftype_desc(Model_Attachment::STOCK), m_stocks[m_selected_row].STOCKID);
        DeleteItem(m_selected_row);
        doRefreshItems(-1);
    }
}
Пример #16
0
void WizardDialogSetFunc::CloseWeakenGrain()
{
  bool a,b,c;

  a = XRCCTRL(*this, "WA_CONST", wxTextCtrl)->GetValue().ToDouble(&userdat->weaken_grain[0]);
  b = XRCCTRL(*this, "WA_VISC", wxTextCtrl)->GetValue().ToDouble(&userdat->weaken_grain[1]);
  c = XRCCTRL(*this, "WA_BREAKSTRENGTH", wxTextCtrl)->GetValue().ToDouble(&userdat->weaken_grain[2]);

  if (a && b && c)
    EndModal(true);
  else
    {
      wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
      msgDlg.ShowModal();
    }
}
Пример #17
0
void CDlgCfgSetUptTime::OnBnClickedOk()
{
	wnddateStart_.GetTime(tmStart);
	wnddateEnd_.GetTime(tmEnd);

	tmStart = CTime(2009, 1, 1, tmStart.GetHour(), tmStart.GetMinute(), 0);
	tmEnd   = CTime(2009, 1, 1, tmEnd.GetHour(),   tmEnd.GetMinute(),   0);
	if (tmStart >= tmEnd)
	{
		CMessageBox msgDlg(_T("提示"),_T("请保证结束时间大于开始时间。"));
		msgDlg.DoModal();

		return ;
	}

	OnOK();
}
void billsDepositsListCtrl::OnDeleteBDSeries(wxCommandEvent& /*event*/)
{
    if (m_selected_row < 0) return;
    if (m_bdp->bills_.size() == 0) return;

    wxMessageDialog msgDlg(this, _("Do you really want to delete the series?")
        , _("Confirm Series Deletion")
        , wxYES_NO | wxNO_DEFAULT | wxICON_ERROR);
    if (msgDlg.ShowModal() == wxID_YES)
    {
        int BdId = m_bdp->bills_[m_selected_row].BDID;
        Model_Billsdeposits::instance().remove(BdId);
        mmAttachmentManage::DeleteAllAttachments(Model_Attachment::reftype_desc(Model_Attachment::BILLSDEPOSIT), BdId);
        m_bdp->initVirtualListControl();
        refreshVisualList(m_selected_row);
    }
}
Пример #19
0
void WizardDialogSetFunc::CloseAddLayer()
{
  bool a,b,c,d,e;

  a = XRCCTRL(*this, "ID_TEXTCTRL_2ND_LAY_Y_MIN", wxTextCtrl)->GetValue().ToDouble(&userdat->extra_hor_layer[0]);
  b = XRCCTRL(*this, "ID_TEXTCTRL_2ND_LAY_Y_MAX", wxTextCtrl)->GetValue().ToDouble(&userdat->extra_hor_layer[1]);
  c = XRCCTRL(*this, "ID_TEXTCTRL_2ND_LAY_CONSTANT", wxTextCtrl)->GetValue().ToDouble(&userdat->extra_hor_layer[2]);
  d = XRCCTRL(*this, "ID_TEXTCTRL_2ND_LAY_VISCOSITY", wxTextCtrl)->GetValue().ToDouble(&userdat->extra_hor_layer[3]);
  e = XRCCTRL(*this, "ID_TEXTCTRL_2ND_LAY_BREAK_STRENGTH", wxTextCtrl)->GetValue().ToDouble(&userdat->extra_hor_layer[4]);

  if (a && b && c && d && e)
    EndModal(true);
  else
    {
      wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
      msgDlg.ShowModal();
    }
}
Пример #20
0
void mmStocksPanel::OnRefreshQuotes(wxCommandEvent& WXUNUSED(event))
{
    wxString sError = "";
    if (onlineQuoteRefresh(sError))
    {
        const wxString header = _("Stock prices successfully updated");
        stock_details_->SetLabelText(header);
        stock_details_short_->SetLabelText(wxString::Format(_("Last updated %s"), strLastUpdate_));
        wxMessageDialog msgDlg(this, sError, header);
        msgDlg.ShowModal();
    }
    else
    {
        refresh_button_->SetBitmapLabel(wxBitmap(wxImage(led_red_xpm).Scale(16,16)));
        stock_details_->SetLabelText(sError);
        stock_details_short_->SetLabelText(_("Error"));
        mmShowErrorMessage(this, sError, _("Error"));
    }
}
Пример #21
0
void WizardDialogSetFunc::CloseWeakenEdit()
{
  bool a,b,c,d,e;

  a = XRCCTRL(*this, "WH_Y_MIN", wxTextCtrl)->GetValue().ToDouble(&userdat->weaken_hor[0]);
  b = XRCCTRL(*this, "WH_Y_MAX", wxTextCtrl)->GetValue().ToDouble(&userdat->weaken_hor[1]);
  c = XRCCTRL(*this, "WH_CONST", wxTextCtrl)->GetValue().ToDouble(&userdat->weaken_hor[2]);
  d = XRCCTRL(*this, "WH_VISC", wxTextCtrl)->GetValue().ToDouble(&userdat->weaken_hor[3]);
  e = XRCCTRL(*this, "WH_BREAKSTRENGTH", wxTextCtrl)->GetValue().ToDouble(&userdat->weaken_hor[4]);

  userdat->extra_hor_layer_proc = XRCCTRL(*this, "ID_CHECKBOX_2ND_LAYER", wxCheckBox)->IsChecked();

  if (a && b && c && d && e)
    EndModal(true);
  else
    {
      wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
      msgDlg.ShowModal();
    }
}
Пример #22
0
void mmAssetsListCtrl::OnDeleteAsset(wxCommandEvent& /*event*/)
{
    if (m_selected_row < 0)    return;

    wxMessageDialog msgDlg(this
        , _("Do you really want to delete the Asset?")
        , _("Confirm Asset Deletion")
        , wxYES_NO | wxNO_DEFAULT | wxICON_ERROR);

    if (msgDlg.ShowModal() == wxID_YES)
    {
        const Model_Asset::Data& asset = m_panel->m_assets[m_selected_row];
        Model_Asset::instance().remove(asset.ASSETID);
        mmAttachmentManage::DeleteAllAttachments(Model_Attachment::reftype_desc(Model_Attachment::ASSET), asset.ASSETID);

        m_panel->initVirtualListControl(m_selected_row, m_selected_col, m_asc);
        m_selected_row = -1;
        m_panel->updateExtraAssetData(m_selected_row);
    }
}
Пример #23
0
void CDlgCfgSafeCenter::SafeCenterConfig()
{
	if (!i8desk::IsRunOnServer())
	{
		CMessageBox msgDlg(_T("提示"),_T("无法远程配置和启动安全中心服务端\n"));
		msgDlg.DoModal();
		return ;
	}

	stdex::tString szExe;
	if ( iWhichSC_ == i8desk::DISKLESS)
	{
		szExe = utility::GetAppPath() + _T("SafeSvr\\Server\\UndiskSafe.exe");
		win32::system::KillProcess(_T("KHPrtSvr.exe"));
	}
	else 
	{
		szExe = utility::GetAppPath() + _T("SafeSvr\\KHPrtSvr.exe");
		win32::system::KillProcess(_T("UndiskSafe.exe"));
	}

	win32::system::StartProcess(szExe.c_str());
}
Пример #24
0
	void ShowCrashReport(wxDebugReport::Context context)
	{
		wxDebugReportCompress report;
		wxDebugReportPreviewStd preview;

		report.AddAll(context);

		if (preview.Show(report))
		{
			if (report.Process())
			{
				wxMessageDialog msgDlg(NULL, wxString::Format(
					_("A debug report has been saved to:\n%s"),
					report.GetCompressedFileName()), 
					_("Information"), wxOK | wxCANCEL | wxICON_INFORMATION |wxCENTER);
				msgDlg.SetOKCancelLabels(_("Open Folder"), wxID_CLOSE);
				if (msgDlg.ShowModal() == wxID_OK)
				{
					wxFileName fn(report.GetCompressedFileName());
					wxLaunchDefaultApplication(fn.GetPath());
				}
			}
		}
	}
Пример #25
0
bool DoShowAssertDialog(const wxString& msg)
{
    // under MSW we can show the dialog even in the console mode
#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
    wxString msgDlg(msg);

    // this message is intentionally not translated -- it is for
    // developpers only
    msgDlg += wxT("\nDo you want to stop the program?\n")
              wxT("You can also choose [Cancel] to suppress ")
              wxT("further warnings.");

    switch ( ::MessageBox(NULL, msgDlg, _T("wxWidgets Debug Alert"),
                          MB_YESNOCANCEL | MB_ICONSTOP ) )
    {
        case IDYES:
            wxTrap();
            break;

        case IDCANCEL:
            // stop the asserts
            return true;

        //case IDNO: nothing to do
    }
#else // !__WXMSW__
    wxFprintf(stderr, wxT("%s\n"), msg.c_str());
    fflush(stderr);

    // TODO: ask the user to enter "Y" or "N" on the console?
    wxTrap();
#endif // __WXMSW__/!__WXMSW__

    // continue with the asserts
    return false;
}
bool ExploreFrame::CreatePatch()
{
	bool patchCreated;
	{
		wxBusyInfo busyInfo(_("Writing file..."));
		wxBusyCursor busyCursor;
		patchCreated = m_archive->CreatePatch(m_patchFileName);
	}

	if (patchCreated)
	{
		UpdateTitle();
		wxMessageDialog msgDlg(this, _("The patch WAD has been saved\n\nDo you want to open the folder it was saved to?"), _("Information"), wxICON_INFORMATION | wxOK | wxCANCEL);
		msgDlg.SetOKCancelLabels(_("Open Folder"), wxID_CLOSE);
		if (msgDlg.ShowModal() == wxID_OK)
		{
			wxFileName patchFN(m_patchFileName);
			patchFN.SetFullName("");
			wxLaunchDefaultApplication(patchFN.GetFullPath());
		}
	}

	return patchCreated;
}
Пример #27
0
void WizardDialogSetFunc::CloseEditMikeSettings()
{
	bool a = true,b = true,c = true,d = true,e = true,f = true,g = true,h = true,i = true,k = true;

  // both written to transition[]:::
  // start reactions at ... GPa (convert to pascal on save!)
  k = XRCCTRL(*this, "ID_TEXTCTRL_START_GPA", wxTextCtrl)->GetValue().ToDouble(&userdat->transition[1]);
  userdat->transition[1] *= 1e9;
  //activation energy
  i = XRCCTRL(*this, "ID_TEXTCTRL_ACTIVATION_ENERGY", wxTextCtrl)->GetValue().ToDouble(&userdat->transition[0]);
			  
  //the distribution-type for strength
  switch (XRCCTRL(*this, "STRENGTH_DISTRI", wxRadioBox)->GetSelection())
    {
    case 0:
      userdat->gauss_strength_proc = false;
      userdat->linear_strength_proc = false;
      break;
    case 1:
      userdat->gauss_strength_proc = false;
      userdat->linear_strength_proc = true;
      break;
    case 2:
      userdat->gauss_strength_proc = true;
      userdat->linear_strength_proc = false;
      break;
    }

  //rate distrib
  userdat->gauss_rate_proc = XRCCTRL(*this, "RATE_DISTRI", wxCheckBox)->IsChecked();
  //spring distrib
  userdat->gauss_spring_proc = XRCCTRL(*this, "SPRING_DISTRI", wxCheckBox)->IsChecked();
  //young distrib
  userdat->gauss_young_proc = XRCCTRL(*this, "YOUNG_DISTRI", wxCheckBox)->IsChecked();

  //Relaxthreshold
  a = XRCCTRL(*this, "MULT_RELAX", wxTextCtrl)->GetValue().ToDouble(&userdat->multiply_relax[0]);
	//cout << userdat->multiply_relax[0] << endl;
  userdat->multiply_relax_proc = XRCCTRL(*this, "CHECK_MULT_RELAX", wxCheckBox)->IsChecked();

  //timestep
  b = XRCCTRL(*this, "TIMESTEP", wxTextCtrl)->GetValue().ToDouble(&userdat->timestep[0]);
  userdat->timestep_proc = XRCCTRL(*this, "CHECK_TIMESTEP", wxCheckBox)->IsChecked();

  //set walls
  userdat->walls_proc = XRCCTRL(*this, "CHECK_SET_WALLS", wxCheckBox)->IsChecked();

  //wweaken horizontal
  userdat->weaken_hor_proc = XRCCTRL(*this, "CHECK_WEAKEN_HORIZ", wxCheckBox)->IsChecked();

  //weaken all
  userdat->weaken_all_proc = XRCCTRL(*this, "CHECK_WEAKEN_ALL", wxCheckBox)->IsChecked();

  //weaken grain
  userdat->weaken_grain_proc = XRCCTRL(*this, "ID_CHECKBOX_WEAKEN_GRAIN", wxCheckBox)->IsChecked();
  userdat->weaken_grain[3] = XRCCTRL(*this, "ID_SPINCTRL_WEAKEN_GRAIN", wxSpinCtrl)->GetValue();

  //make gb
  userdat->make_gb_proc = XRCCTRL(*this, "CHECK_MAKE_GB", wxCheckBox)->IsChecked();

  //mineral
  switch (XRCCTRL(*this, "ID_MINERAL", wxRadioBox)->GetSelection())
    {
    case 3:
      userdat->set_min = true;
      userdat->mineral[0] = 3;
      break;
    case 1:
      userdat->set_min = true;
      userdat->mineral[0] = 1;
      break;
    case 2:
      userdat->set_min = true;
      userdat->mineral[0] = 2;
      break;
    default:
      userdat->set_min = false;
      userdat->mineral[0] = 0;
      break;
    }

  // x-row
  userdat->dissolve_x_proc = XRCCTRL(*this, "CHECK_X_ROW", wxCheckBox)->IsChecked();
  c = XRCCTRL(*this, "DIS_UPPER", wxTextCtrl)->GetValue().ToDouble(&userdat->dissolve_x[0]);
  d = XRCCTRL(*this, "DIS_LOWER", wxTextCtrl)->GetValue().ToDouble(&userdat->dissolve_x[1]);

  // y-row
  userdat->dissolve_y_proc = XRCCTRL(*this, "CHECK_Y_ROW", wxCheckBox)->IsChecked();
  e = XRCCTRL(*this, "DIS_LEFT", wxTextCtrl)->GetValue().ToDouble(&userdat->dissolve_y[0]);
  f = XRCCTRL(*this, "DIS_RIGHT", wxTextCtrl)->GetValue().ToDouble(&userdat->dissolve_y[1]);

  // box size
  userdat->set_box_size_proc = XRCCTRL(*this, "CHECK_BOX_SIZE", wxCheckBox)->IsChecked();
  g = XRCCTRL(*this, "BOX_SIZE", wxTextCtrl)->GetValue().ToDouble(&userdat->set_box_size[0]);

  // plot frac
  userdat->plot_frac_proc = XRCCTRL(*this, "CHECK_PLOT", wxCheckBox)->IsChecked();
  userdat->plot_frac[0] = XRCCTRL(*this, "PLOT_NB", wxSpinCtrl)->GetValue();

  userdat->transition_proc = XRCCTRL(*this, "ID_CHECKBOX_TRANSITION", wxCheckBox)->GetValue();
  userdat->transition_heat_proc = XRCCTRL(*this, "ID_CHECKBOX_TRANSITION_HEAT", wxCheckBox)->GetValue();
  
  userdat->heat_conduction_proc = XRCCTRL(*this, "ID_CHECKBOX_HEAT_CONDUCTION", wxCheckBox)->GetValue();
  userdat->heat_conduction[0] = XRCCTRL(*this, "ID_SPINCTRL_HEAT_CONDUCTION_NB", wxSpinCtrl)->GetValue();
  userdat->heat_conduction[1] = XRCCTRL(*this, "ID_SPINCTRL_HEAT_CONDUCTION_T", wxSpinCtrl)->GetValue();
	
	//cout << a << b << c << d << e << f << g << h << i << k << endl;
  
  if (a && b && c && e && f && g && h && i && k)
    EndModal(true);
  else
    {
      wxMessageDialog msgDlg(this, _("Numbers only!"), _("Error!"), wxOK );
      msgDlg.ShowModal();
    }
}
Пример #28
0
void InstConsoleWindow::OnGenReportClicked(wxCommandEvent& event)
{
	wxString crashReportString = GetCrashReport();

	const int id_pastebin = 1;
	const int id_file = 2;
	const int id_clipboard = 3;

	AdvancedMsgDialog::ButtonDefList btns;
	btns.push_back(AdvancedMsgDialog::ButtonDef(_("Send to Pastebin"), id_pastebin));
	btns.push_back(AdvancedMsgDialog::ButtonDef(_("Save to File"), id_file));
	btns.push_back(AdvancedMsgDialog::ButtonDef(_("Copy to Clipboard"), id_clipboard));
	btns.push_back(AdvancedMsgDialog::ButtonDef(_("&Cancel"), wxID_CANCEL));

	AdvancedMsgDialog msgDlg(this, _("A crash report has been generated. "
		"What would you like to do with it?"), btns, _("Crash Report"));


	crashReportIsOpen = true;
	msgDlg.CenterOnParent();
	int response = msgDlg.ShowModal();
	if (response == id_pastebin) // Pastebin
	{
		PastebinTask *task = new PastebinTask(crashReportString);
		TaskProgressDialog tDlg(this);
		if (tDlg.ShowModal(task))
		{
			wxTextEntryDialog urlDialog(this, _("Your error report has been"
				" sent to the URL listed below."), _("Success"), task->GetPasteURL(),
				wxOK | wxCENTER);
			urlDialog.ShowModal();
		}
		else
		{
			wxMessageBox(_("Failed to send the crash report to pastebin. "
				"Please check your internet connection."), _("Error"));
		}
		delete task;
	}
	else if (response == id_file) // Save to file
	{
		wxFileDialog saveReportDlg(this, _("Save Crash Report"), wxGetCwd(), 
			wxDateTime::Now().Format("MultiMC_Report_%m-%d-%Y_%H-%M-%S.txt"), 
			"*.txt", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
		if (saveReportDlg.ShowModal() != wxID_CANCEL)
		{
			wxFFileOutputStream outStream(saveReportDlg.GetFilename());
			wxStringInputStream inStream(crashReportString);
			outStream.Write(inStream);
		}
	}
	else if (response == id_clipboard)
	{
		if (wxTheClipboard->Open())
		{
			wxTheClipboard->SetData(new wxTextDataObject(crashReportString));
			wxTheClipboard->Close();
		}
	}
	crashReportIsOpen = false;
}
Пример #29
0
void mmErrorDialogs::MessageWarning(wxWindow *parent
    , const wxString &message, const wxString &title)
{
    wxMessageDialog msgDlg(parent, message, title, wxOK | wxICON_WARNING);
    msgDlg.ShowModal();
}
Пример #30
0
bool mmTransDialog::validateData()
{
    if (!textAmount_->checkValue(m_trx_data.TRANSAMOUNT))
        return false;

    Model_Account::Data* account = Model_Account::instance().get(cbAccount_->GetValue());
    if (!account || Model_Account::type(account) == Model_Account::INVESTMENT)
    {
        mmErrorDialogs::InvalidAccount((wxWindow*)cbAccount_);
        return false;
    }
    m_trx_data.ACCOUNTID = account->ACCOUNTID;

    if (!m_transfer)
    {
        wxString payee_name = cbPayee_->GetValue();
        if (payee_name.IsEmpty())
        {
            mmErrorDialogs::InvalidPayee((wxWindow*)cbPayee_);
            return false;
        }

        // Get payee string from populated list to address issues with case compare differences between autocomplete and payee list
        int payee_loc = cbPayee_->FindString(payee_name);
        if (payee_loc != wxNOT_FOUND)
            payee_name = cbPayee_->GetString(payee_loc);

        Model_Payee::Data* payee = Model_Payee::instance().get(payee_name);
        if (!payee)
        {
            wxMessageDialog msgDlg( this
                , wxString::Format(_("Do you want to add new payee: \n%s?"), payee_name)
                , _("Confirm to add new payee")
                , wxYES_NO | wxYES_DEFAULT | wxICON_WARNING);
            if (msgDlg.ShowModal() == wxID_YES)
            {
                payee = Model_Payee::instance().create();
                payee->PAYEENAME = payee_name;
                Model_Payee::instance().save(payee);
				mmWebApp::MMEX_WebApp_UpdatePayee();
            }
            else
                return false;
        }
        m_trx_data.TOTRANSAMOUNT = m_trx_data.TRANSAMOUNT;
        m_trx_data.PAYEEID = payee->PAYEEID;
        m_trx_data.TOACCOUNTID = -1;

        payee->CATEGID = m_trx_data.CATEGID;
        payee->SUBCATEGID = m_trx_data.SUBCATEGID;
        Model_Payee::instance().save(payee);
		mmWebApp::MMEX_WebApp_UpdatePayee();
    }
    else //transfer
    {
        Model_Account::Data *to_account = Model_Account::instance().get(cbPayee_->GetValue());
        if (!to_account || to_account->ACCOUNTID == m_trx_data.ACCOUNTID || Model_Account::type(to_account) == Model_Account::INVESTMENT)
        {
            mmErrorDialogs::InvalidAccount((wxWindow*)cbPayee_, true);
            return false;
        }
        m_trx_data.TOACCOUNTID = to_account->ACCOUNTID;
        
        if (m_advanced)
        {
            if (!toTextAmount_->checkValue(m_trx_data.TOTRANSAMOUNT))
                return false;
        }
        m_trx_data.PAYEEID = -1;
    }

    if ((cSplit_->IsChecked() && local_splits.empty())
        || (!cSplit_->IsChecked() && Model_Category::full_name(m_trx_data.CATEGID, m_trx_data.SUBCATEGID).empty()))
    {
        mmErrorDialogs::InvalidCategory((wxWindow*)bCategory_, false);
        return false;
    }

    return true;
}