Example #1
0
myFindReplaceDlg::myFindReplaceDlg (wxWindow *parent,
                                    const wxString &findstr,
                                    const wxString &replacestr,
                                    wxUint32 flags,
                                    long style)
               : wxScrollingDialog (parent, -1, _("Dialog"),
                           wxDefaultPosition, wxDefaultSize,
                           style | wxDEFAULT_DIALOG_STYLE) {

    m_style = 0;

    //accelerators (for help)
    const int nEntries = 1 ;
    wxAcceleratorEntry entries[nEntries];
    entries[0].Set (wxACCEL_NORMAL, WXK_F1, wxID_HELP);
    wxAcceleratorTable accel (nEntries, entries);
    SetAcceleratorTable (accel);

    // layout the dialog
    m_findpane = new wxBoxSizer (wxVERTICAL);

    // find, replace text and options, direction
    wxBoxSizer *findsizer = new wxBoxSizer (wxHORIZONTAL);
    findsizer->Add (new wxStaticText (this, -1, _("Search for:"),
                                      wxDefaultPosition, wxSize(80, -1)),
                    0, wxALIGN_CENTRE_VERTICAL | wxRIGHT, 6);
    m_findstr = new wxComboBox (this, myID_DLG_FIND_TEXT, findstr,
                                 wxDefaultPosition, wxSize(200, -1));
    findsizer->Add (m_findstr, 1, wxALIGN_CENTRE_VERTICAL);
    m_findpane->Add (findsizer, 0, wxEXPAND | wxBOTTOM, 6);

    m_fdirsizer = new wxBoxSizer (wxHORIZONTAL);
    m_fdirsizer->Add (new wxStaticText (this, -1, _("In directories:"),
                                        wxDefaultPosition, wxSize(80, -1)),
                      0, wxALIGN_CENTRE_VERTICAL | wxRIGHT, 6);
    wxString finddir;
    m_finddir = new wxComboBox (this, -1, finddir,
                                wxDefaultPosition, wxSize(200, -1),
                                //0, NULL); //AMD64 ambiguity betw int vs wxArray
                                (int)0, (const wxString*) NULL);
    m_fdirsizer->Add (m_finddir, 1, wxALIGN_CENTRE_VERTICAL);
    m_findpane->Show (m_fdirsizer, false);
    m_findpane->Add (m_fdirsizer, 0, wxEXPAND | wxBOTTOM, 6);

    m_specsizer = new wxBoxSizer (wxHORIZONTAL);
    m_specsizer->Add (new wxStaticText (this, -1, _("With filespec:"),
                                        wxDefaultPosition, wxSize(80, -1)),
                      0, wxALIGN_CENTRE_VERTICAL | wxRIGHT, 6);
    m_findspec = new wxTextCtrl (this, -1, wxEmptyString,
                                 wxDefaultPosition, wxSize(200, -1));
    m_specsizer->Add (m_findspec, 1, wxALIGN_CENTRE_VERTICAL);
    m_findpane->Show (m_specsizer, false);
    m_findpane->Add (m_specsizer, 0, wxEXPAND | wxBOTTOM, 6);

    m_replsizer = new wxBoxSizer (wxHORIZONTAL);
    m_replsizer->Add (new wxStaticText (this, -1, _("Replace with:"),
                                        wxDefaultPosition, wxSize(80, -1)),
                      0, wxALIGN_CENTRE_VERTICAL | wxRIGHT, 6);
    m_replacestr = new wxComboBox (this, -1, replacestr,
                                    wxDefaultPosition, wxSize(200, -1));
    m_replsizer->Add (m_replacestr, 1, wxALIGN_CENTRE_VERTICAL);
    m_findpane->Show (m_replsizer, false);
    m_findpane->Add (m_replsizer, 0, wxEXPAND | wxBOTTOM, 6);

    // options
    m_optionsizer = new wxBoxSizer (wxVERTICAL);
    m_matchcase = new wxCheckBox (this, -1, _("Match &case"));
    m_matchcase->SetValue ((flags & myFR_MATCHCASE) > 0);
    m_optionsizer->Add (m_matchcase, 0, wxBOTTOM, 6);
    m_wholeword = new wxCheckBox (this, -1, _("Whole &word"));
    m_wholeword->SetValue ((flags & myFR_WHOLEWORD) > 0);
    m_wholeword->Enable (false);
    m_optionsizer->Add (m_wholeword, 0, wxBOTTOM, 6);
    m_findregex = new wxCheckBox (this, -1, _("Regular &expression"));
    m_findregex->SetValue ((flags & myFR_FINDREGEX) > 0);
    m_optionsizer->Add (m_findregex, 0, wxBOTTOM, 6);
    m_subfolder = new wxCheckBox (this, -1, _("Sub &directories"));
    m_subfolder->SetValue ((flags & myFR_SUBFOLDER) > 0);
    m_optionsizer->Add (m_subfolder, 0);

    // directions
    m_dirssizer = new wxBoxSizer (wxVERTICAL);
    static const wxString directions[] = {_("&Upwards"), _("&Downwards")};
    m_direction = new wxRadioBox (this, -1, _("Direction"),
                                  wxDefaultPosition, wxDefaultSize,
                                  WXSIZEOF(directions), directions,
                                  1, wxRA_SPECIFY_COLS);
    m_direction->SetSelection(1);
    m_dirssizer->Add (m_direction, 0);

    // options and directions
    m_optionpane = new wxBoxSizer (wxHORIZONTAL);
    m_optionpane->Add (m_optionsizer, 1, wxALIGN_TOP|wxALIGN_LEFT);
    m_optionpane->Add (m_dirssizer, 0, wxALIGN_TOP|wxALIGN_RIGHT);
    m_findpane->Add (0, 6);
    m_findpane->Add (m_optionpane, 0, wxEXPAND);

    // buttons
    m_buttonpane = new wxBoxSizer (wxVERTICAL);
    m_findButton = new wxButton (this, wxID_OK, _("&Find"));
    m_findButton->SetDefault();
    m_buttonpane->Add (m_findButton, 0, wxEXPAND|wxALIGN_TOP|wxBOTTOM, 6);
    m_replaceButton = new wxButton (this, myID_REPLACE, _("&Replace"));
    m_buttonpane->Add (m_replaceButton, 0, wxEXPAND|wxALIGN_TOP|wxBOTTOM, 6);
    m_buttonpane->Show (m_replaceButton, false);
    m_replaceAllButton = new wxButton (this, myID_REPLACEALL, _("Replace &all"));
    m_buttonpane->Add (m_replaceAllButton, 0, wxEXPAND|wxALIGN_TOP|wxBOTTOM, 6);
    m_buttonpane->Show (m_replaceAllButton, false);
    m_cancelButton = new wxButton (this, wxID_CANCEL, _("Cancel"));
    m_buttonpane->Add (m_cancelButton, 0, wxEXPAND|wxALIGN_BOTTOM);

    m_totalpane = new wxBoxSizer (wxHORIZONTAL);
    m_totalpane->Add (m_findpane, 0, wxEXPAND | wxALL, 10);
    m_totalpane->Add (m_buttonpane, 0, wxEXPAND | wxALL, 10);

    m_findstr->SetFocus();
    m_findstr->SetSelection (-1, -1);
    SetSizerAndFit (m_totalpane);

    // load history
    LoadDirHistory ();
    LoadFindHistory ();
    LoadReplaceHistory ();
    UpdateDirHistory ();
    UpdateFindHistory ();
    UpdateReplaceHistory ();

}
AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id,
                           const wxString &title, const wxPoint &position,
                           const wxSize& size, long style)
    : wxDialog(parent, id, title, position, size, style)
{
    const unsigned char* dolphin_logo_bin = dolphin_logo_png;
    size_t dolphin_logo_size = sizeof dolphin_logo_png;
#ifdef __APPLE__
    double scaleFactor = 1.0;
    if (GetContentScaleFactor() >= 2)
    {
        dolphin_logo_bin = dolphin_logo_2x_png;
        dolphin_logo_size = sizeof dolphin_logo_2x_png;
        scaleFactor = 2.0;
    }
#endif
    wxMemoryInputStream istream(dolphin_logo_bin, dolphin_logo_size);
    wxImage iDolphinLogo(istream, wxBITMAP_TYPE_PNG);
#ifdef __APPLE__
    wxGenericStaticBitmap* const sbDolphinLogo = new wxGenericStaticBitmap(this, wxID_ANY,
            wxBitmap(iDolphinLogo, -1, scaleFactor));
#else
    wxGenericStaticBitmap* const sbDolphinLogo = new wxGenericStaticBitmap(this, wxID_ANY,
            wxBitmap(iDolphinLogo));
#endif

    const wxString DolphinText = _("Dolphin");
    const wxString RevisionText = scm_desc_str;
    const wxString CopyrightText = _("(c) 2003-2015+ Dolphin Team. \"GameCube\" and \"Wii\" are trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way.");
    const wxString BranchText = wxString::Format(_("Branch: %s"), scm_branch_str);
    const wxString BranchRevText = wxString::Format(_("Revision: %s"), scm_rev_git_str);
    const wxString CompiledText = wxString::Format(_("Compiled: %s @ %s"), __DATE__, __TIME__);
    const wxString CheckUpdateText = _("Check for updates: ");
    const wxString Text = _("\n"
                            "Dolphin is a free and open-source GameCube and Wii emulator.\n"
                            "\n"
                            "This software should not be used to play games you do not legally own.\n");
    const wxString LicenseText = _("License");
    const wxString AuthorsText = _("Authors");
    const wxString SupportText = _("Support");

    wxStaticText* const Dolphin = new wxStaticText(this, wxID_ANY, DolphinText);
    wxStaticText* const Revision = new wxStaticText(this, wxID_ANY, RevisionText);

    wxStaticText* const Copyright = new wxStaticText(this, wxID_ANY, CopyrightText);
    wxStaticText* const Branch = new wxStaticText(this, wxID_ANY, BranchText + "\n" + BranchRevText + "\n" + CompiledText+"\n");
    wxStaticText* const Message = new wxStaticText(this, wxID_ANY, Text);
    wxStaticText* const UpdateText = new wxStaticText(this, wxID_ANY, CheckUpdateText);
    wxStaticText* const FirstSpacer = new wxStaticText(this, wxID_ANY, "  |  ");
    wxStaticText* const SecondSpacer = new wxStaticText(this, wxID_ANY, "  |  ");
    wxHyperlinkCtrl* const Download = new wxHyperlinkCtrl(this, wxID_ANY, "dolphin-emu.org/download", "https://dolphin-emu.org/download/");
    wxHyperlinkCtrl* const License = new wxHyperlinkCtrl(this, wxID_ANY, LicenseText, "https://github.com/dolphin-emu/dolphin/blob/master/license.txt");
    wxHyperlinkCtrl* const Authors = new wxHyperlinkCtrl(this, wxID_ANY, AuthorsText, "https://github.com/dolphin-emu/dolphin/graphs/contributors");
    wxHyperlinkCtrl* const Support = new wxHyperlinkCtrl(this, wxID_ANY, SupportText, "https://forums.dolphin-emu.org/");

    wxFont DolphinFont = Dolphin->GetFont();
    wxFont RevisionFont = Revision->GetFont();
    wxFont CopyrightFont = Copyright->GetFont();
    wxFont BranchFont = Branch->GetFont();

    DolphinFont.SetPointSize(36);
    Dolphin->SetFont(DolphinFont);

    RevisionFont.SetWeight(wxFONTWEIGHT_BOLD);
    Revision->SetFont(RevisionFont);

    BranchFont.SetPointSize(7);
    Branch->SetFont(BranchFont);

    CopyrightFont.SetPointSize(7);
    Copyright->SetFont(CopyrightFont);
    Copyright->SetFocus();

    wxBoxSizer* const sCheckUpdates = new wxBoxSizer(wxHORIZONTAL);
    sCheckUpdates->Add(UpdateText);
    sCheckUpdates->Add(Download);

    wxBoxSizer* const sLinks = new wxBoxSizer(wxHORIZONTAL);
    sLinks->Add(License);
    sLinks->Add(FirstSpacer);
    sLinks->Add(Authors);
    sLinks->Add(SecondSpacer);
    sLinks->Add(Support);

    wxBoxSizer* const sInfo = new wxBoxSizer(wxVERTICAL);
    sInfo->Add(Dolphin);
    sInfo->AddSpacer(5);
    sInfo->Add(Revision);
    sInfo->AddSpacer(10);
    sInfo->Add(Branch);
    sInfo->Add(sCheckUpdates);
    sInfo->Add(Message);
    sInfo->Add(sLinks);

    wxBoxSizer* const sLogo = new wxBoxSizer(wxVERTICAL);
    sLogo->AddSpacer(75);
    sLogo->Add(sbDolphinLogo);
    sLogo->AddSpacer(40);

    wxBoxSizer* const sMainHor = new wxBoxSizer(wxHORIZONTAL);
    sMainHor->AddSpacer(30);
    sMainHor->Add(sLogo);
    sMainHor->AddSpacer(30);
    sMainHor->Add(sInfo);
    sMainHor->AddSpacer(30);

    wxBoxSizer* const sFooter = new wxBoxSizer(wxVERTICAL);
    sFooter->AddSpacer(15);
    sFooter->Add(Copyright, 0, wxALIGN_BOTTOM | wxALIGN_CENTER);
    sFooter->AddSpacer(5);

    wxBoxSizer* const sMain = new wxBoxSizer(wxVERTICAL);
    sMain->Add(sMainHor, 1, wxEXPAND);
    sMain->Add(sFooter, 0, wxEXPAND);

    SetSizerAndFit(sMain);
    Center();
    SetFocus();
}
Example #3
0
VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, const std::string& ininame)
	: wxDialog(parent, wxID_ANY,
		wxString::Format(_("Dolphin %s Graphics Configuration"), wxGetTranslation(StrToWxStr(title))))
	, vconfig(g_Config)
{
	if (File::Exists(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"))
		vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
	else
		vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini");

	Bind(wxEVT_UPDATE_UI, &VideoConfigDiag::OnUpdateUI, this);

	wxNotebook* const notebook = new wxNotebook(this, wxID_ANY);

	// -- GENERAL --
	{
	wxPanel* const page_general = new wxPanel(notebook);
	notebook->AddPage(page_general, _("General"));
	wxBoxSizer* const szr_general = new wxBoxSizer(wxVERTICAL);

	// - basic
	{
	wxFlexGridSizer* const szr_basic = new wxFlexGridSizer(2, 5, 5);

	// backend
	{
	label_backend = new wxStaticText(page_general, wxID_ANY, _("Backend:"));
	choice_backend = new wxChoice(page_general, wxID_ANY);
	RegisterControl(choice_backend, wxGetTranslation(backend_desc));

	for (const VideoBackendBase* backend : g_available_video_backends)
	{
		choice_backend->AppendString(wxGetTranslation(StrToWxStr(backend->GetDisplayName())));
	}

	choice_backend->SetStringSelection(wxGetTranslation(StrToWxStr(g_video_backend->GetDisplayName())));
	choice_backend->Bind(wxEVT_CHOICE, &VideoConfigDiag::Event_Backend, this);

	szr_basic->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5);
	szr_basic->Add(choice_backend, 1, 0, 0);
	}

	// adapter (D3D only)
	if (vconfig.backend_info.Adapters.size())
	{
		choice_adapter = CreateChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_desc));

		for (const std::string& adapter : vconfig.backend_info.Adapters)
		{
			choice_adapter->AppendString(StrToWxStr(adapter));
		}

		choice_adapter->Select(vconfig.iAdapter);

		label_adapter = new wxStaticText(page_general, wxID_ANY, _("Adapter:"));
		szr_basic->Add(label_adapter, 1, wxALIGN_CENTER_VERTICAL, 5);
		szr_basic->Add(choice_adapter, 1, 0, 0);
	}


	// - display
	wxFlexGridSizer* const szr_display = new wxFlexGridSizer(2, 5, 5);

	{

#if !defined(__APPLE__)
	// display resolution
	{
		wxArrayString res_list = GetListOfResolutions();
		if (res_list.empty())
			res_list.Add(_("<No resolutions found>"));
		label_display_resolution = new wxStaticText(page_general, wxID_ANY, _("Fullscreen Resolution:"));
		choice_display_resolution = new wxChoice(page_general, wxID_ANY, wxDefaultPosition, wxDefaultSize, res_list);
		RegisterControl(choice_display_resolution, wxGetTranslation(display_res_desc));
		choice_display_resolution->Bind(wxEVT_CHOICE, &VideoConfigDiag::Event_DisplayResolution, this);

		choice_display_resolution->SetStringSelection(StrToWxStr(SConfig::GetInstance().strFullscreenResolution));

		szr_display->Add(label_display_resolution, 1, wxALIGN_CENTER_VERTICAL, 0);
		szr_display->Add(choice_display_resolution);
	}
#endif

	// aspect-ratio
	{
	const wxString ar_choices[] = { _("Auto"), _("Force 16:9"), _("Force 4:3"), _("Stretch to Window") };

	szr_display->Add(new wxStaticText(page_general, wxID_ANY, _("Aspect Ratio:")), 1, wxALIGN_CENTER_VERTICAL, 0);
	wxChoice* const choice_aspect = CreateChoice(page_general, vconfig.iAspectRatio, wxGetTranslation(ar_desc),
	                                             sizeof(ar_choices)/sizeof(*ar_choices), ar_choices);
	szr_display->Add(choice_aspect, 1, 0, 0);
	}

	// various other display options
	{
	szr_display->Add(CreateCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_desc), vconfig.bVSync));
	szr_display->Add(CreateCheckBox(page_general, _("Use Fullscreen"), wxGetTranslation(use_fullscreen_desc), SConfig::GetInstance().bFullscreen));
	}
	}

	// - other
	wxFlexGridSizer* const szr_other = new wxFlexGridSizer(2, 5, 5);

	{
	szr_other->Add(CreateCheckBox(page_general, _("Show FPS"), wxGetTranslation(show_fps_desc), vconfig.bShowFPS));
	szr_other->Add(CreateCheckBox(page_general, _("Log Render Time to File"), wxGetTranslation(log_render_time_to_file_desc), vconfig.bLogRenderTimeToFile));
	szr_other->Add(CreateCheckBox(page_general, _("Auto adjust Window Size"), wxGetTranslation(auto_window_size_desc), SConfig::GetInstance().bRenderWindowAutoSize));
	szr_other->Add(CreateCheckBox(page_general, _("Keep Window on Top"), wxGetTranslation(keep_window_on_top_desc), SConfig::GetInstance().bKeepWindowOnTop));
	szr_other->Add(CreateCheckBox(page_general, _("Hide Mouse Cursor"), wxGetTranslation(hide_mouse_cursor_desc), SConfig::GetInstance().bHideCursor));
	szr_other->Add(render_to_main_checkbox = CreateCheckBox(page_general, _("Render to Main Window"), wxGetTranslation(render_to_main_win_desc), SConfig::GetInstance().bRenderToMain));
	}


	wxStaticBoxSizer* const group_basic = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Basic"));
	group_basic->Add(szr_basic, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_general->Add(group_basic, 0, wxEXPAND | wxALL, 5);

	wxStaticBoxSizer* const group_display = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Display"));
	group_display->Add(szr_display, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_general->Add(group_display, 0, wxEXPAND | wxALL, 5);

	wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Other"));
	group_other->Add(szr_other, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_general->Add(group_other, 0, wxEXPAND | wxALL, 5);
	}

	szr_general->AddStretchSpacer();
	CreateDescriptionArea(page_general, szr_general);
	page_general->SetSizerAndFit(szr_general);
	}

	// -- ENHANCEMENTS --
	{
	wxPanel* const page_enh = new wxPanel(notebook);
	notebook->AddPage(page_enh, _("Enhancements"));
	wxBoxSizer* const szr_enh_main = new wxBoxSizer(wxVERTICAL);

	// - enhancements
	wxFlexGridSizer* const szr_enh = new wxFlexGridSizer(2, 5, 5);

	// Internal resolution
	{
	const wxString efbscale_choices[] = { _("Auto (Window Size)"), _("Auto (Multiple of 640x528)"),
		_("Native (640x528)"), _("1.5x Native (960x792)"), _("2x Native (1280x1056) for 720p"), _("2.5x Native (1600x1320)"),
		_("3x Native (1920x1584) for 1080p"), _("4x Native (2560x2112) for 1440p"), _("5x Native (3200x2640)"),
		_("6x Native (3840x3168) for 4K"), _("7x Native (4480x3696)"), _("8x Native (5120x4224) for 5K"), _("Custom") };

	wxChoice *const choice_efbscale = CreateChoice(page_enh,
		vconfig.iEFBScale, wxGetTranslation(internal_res_desc), (vconfig.iEFBScale > 11) ?
		ArraySize(efbscale_choices) : ArraySize(efbscale_choices) - 1, efbscale_choices);


	if (vconfig.iEFBScale > 11)
		choice_efbscale->SetSelection(12);

	szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Internal Resolution:")), 1, wxALIGN_CENTER_VERTICAL, 0);
	szr_enh->Add(choice_efbscale);
	}

	// AA
	{

	text_aamode = new wxStaticText(page_enh, wxID_ANY, _("Anti-Aliasing:"));
	choice_aamode = new wxChoice(page_enh, wxID_ANY);
	RegisterControl(choice_aamode, wxGetTranslation(aa_desc));
	PopulateAAList();
	choice_aamode->Bind(wxEVT_CHOICE, &VideoConfigDiag::OnAAChanged, this);

	szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0);
	szr_enh->Add(choice_aamode);

	}

	// AF
	{
	const wxString af_choices[] = {"1x", "2x", "4x", "8x", "16x"};
	szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Anisotropic Filtering:")), 1, wxALIGN_CENTER_VERTICAL, 0);
	szr_enh->Add(CreateChoice(page_enh, vconfig.iMaxAnisotropy, wxGetTranslation(af_desc), 5, af_choices));
	}

	// postproc shader
	if (vconfig.backend_info.bSupportsPostProcessing)
	{
		wxFlexGridSizer* const szr_pp = new wxFlexGridSizer(3, 5, 5);
		choice_ppshader = new wxChoice(page_enh, wxID_ANY);
		RegisterControl(choice_ppshader, wxGetTranslation(ppshader_desc));
		button_config_pp = new wxButton(page_enh, wxID_ANY, _("Config"));

		PopulatePostProcessingShaders();

		choice_ppshader->Bind(wxEVT_CHOICE, &VideoConfigDiag::Event_PPShader, this);
		button_config_pp->Bind(wxEVT_BUTTON, &VideoConfigDiag::Event_ConfigurePPShader, this);

		szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Post-Processing Effect:")), 1, wxALIGN_CENTER_VERTICAL, 0);
		szr_pp->Add(choice_ppshader);
		szr_pp->Add(button_config_pp);
		szr_enh->Add(szr_pp);
	}
	else
	{
		choice_ppshader = nullptr;
		button_config_pp = nullptr;
	}

	// Scaled copy, PL, Bilinear filter
	szr_enh->Add(CreateCheckBox(page_enh, _("Scaled EFB Copy"), wxGetTranslation(scaled_efb_copy_desc), vconfig.bCopyEFBScaled));
	szr_enh->Add(CreateCheckBox(page_enh, _("Per-Pixel Lighting"), wxGetTranslation(pixel_lighting_desc), vconfig.bEnablePixelLighting));
	szr_enh->Add(CreateCheckBox(page_enh, _("Force Texture Filtering"), wxGetTranslation(force_filtering_desc), vconfig.bForceFiltering));
	szr_enh->Add(CreateCheckBox(page_enh, _("Widescreen Hack"), wxGetTranslation(ws_hack_desc), vconfig.bWidescreenHack));
	szr_enh->Add(CreateCheckBox(page_enh, _("Disable Fog"), wxGetTranslation(disable_fog_desc), vconfig.bDisableFog));

	wxStaticBoxSizer* const group_enh = new wxStaticBoxSizer(wxVERTICAL, page_enh, _("Enhancements"));
	group_enh->Add(szr_enh, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_enh_main->Add(group_enh, 0, wxEXPAND | wxALL, 5);

	// - stereoscopy

	if (vconfig.backend_info.bSupportsGeometryShaders)
	{
		wxFlexGridSizer* const szr_stereo = new wxFlexGridSizer(2, 5, 5);

		szr_stereo->Add(new wxStaticText(page_enh, wxID_ANY, _("Stereoscopic 3D Mode:")), 1, wxALIGN_CENTER_VERTICAL, 0);

		const wxString stereo_choices[] = { _("Off"), _("Side-by-Side"), _("Top-and-Bottom"), _("Anaglyph"), _("Nvidia 3D Vision") };
		wxChoice* stereo_choice = CreateChoice(page_enh, vconfig.iStereoMode, wxGetTranslation(stereo_3d_desc), vconfig.backend_info.bSupports3DVision ? ArraySize(stereo_choices) : ArraySize(stereo_choices) - 1, stereo_choices);
		stereo_choice->Bind(wxEVT_CHOICE, &VideoConfigDiag::Event_StereoMode, this);
		szr_stereo->Add(stereo_choice);

		wxSlider* const sep_slider = new wxSlider(page_enh, wxID_ANY, vconfig.iStereoDepth, 0, 100, wxDefaultPosition, wxDefaultSize);
		sep_slider->Bind(wxEVT_SLIDER, &VideoConfigDiag::Event_StereoDepth, this);
		RegisterControl(sep_slider, wxGetTranslation(stereo_depth_desc));

		szr_stereo->Add(new wxStaticText(page_enh, wxID_ANY, _("Depth:")), 1, wxALIGN_CENTER_VERTICAL, 0);
		szr_stereo->Add(sep_slider, 0, wxEXPAND | wxRIGHT);

		conv_slider = new wxSlider(page_enh, wxID_ANY, vconfig.iStereoConvergencePercentage, 0, 200, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS);
		conv_slider->ClearTicks();
		conv_slider->SetTick(100);
		conv_slider->Bind(wxEVT_SLIDER, &VideoConfigDiag::Event_StereoConvergence, this);
		RegisterControl(conv_slider, wxGetTranslation(stereo_convergence_desc));

		szr_stereo->Add(new wxStaticText(page_enh, wxID_ANY, _("Convergence:")), 1, wxALIGN_CENTER_VERTICAL, 0);
		szr_stereo->Add(conv_slider, 0, wxEXPAND | wxRIGHT);

		szr_stereo->Add(CreateCheckBox(page_enh, _("Swap Eyes"), wxGetTranslation(stereo_swap_desc), vconfig.bStereoSwapEyes));

		wxStaticBoxSizer* const group_stereo = new wxStaticBoxSizer(wxVERTICAL, page_enh, _("Stereoscopy"));
		group_stereo->Add(szr_stereo, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
		szr_enh_main->Add(group_stereo, 0, wxEXPAND | wxALL, 5);
	}

	szr_enh_main->AddStretchSpacer();
	CreateDescriptionArea(page_enh, szr_enh_main);
	page_enh->SetSizerAndFit(szr_enh_main);
	}


	// -- SPEED HACKS --
	{
	wxPanel* const page_hacks = new wxPanel(notebook);
	notebook->AddPage(page_hacks, _("Hacks"));
	wxBoxSizer* const szr_hacks = new wxBoxSizer(wxVERTICAL);

	// - EFB hacks
	wxStaticBoxSizer* const szr_efb = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Embedded Frame Buffer (EFB)"));

	szr_efb->Add(CreateCheckBox(page_hacks, _("Skip EFB Access from CPU"), wxGetTranslation(efb_access_desc), vconfig.bEFBAccessEnable, true), 0, wxBOTTOM | wxLEFT, 5);
	szr_efb->Add(CreateCheckBox(page_hacks, _("Ignore Format Changes"), wxGetTranslation(efb_emulate_format_changes_desc), vconfig.bEFBEmulateFormatChanges, true), 0, wxBOTTOM | wxLEFT, 5);
	szr_efb->Add(CreateCheckBox(page_hacks, _("Store EFB Copies to Texture Only"), wxGetTranslation(skip_efb_copy_to_ram_desc), vconfig.bSkipEFBCopyToRam), 0, wxBOTTOM | wxLEFT, 5);

	szr_hacks->Add(szr_efb, 0, wxEXPAND | wxALL, 5);

	// Texture cache
	{
	wxStaticBoxSizer* const szr_safetex = new wxStaticBoxSizer(wxHORIZONTAL, page_hacks, _("Texture Cache"));

	// TODO: Use wxSL_MIN_MAX_LABELS or wxSL_VALUE_LABEL with wx 2.9.1
	wxSlider* const stc_slider = new wxSlider(page_hacks, wxID_ANY, 0, 0, 2, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_BOTTOM);
	stc_slider->Bind(wxEVT_SLIDER, &VideoConfigDiag::Event_Stc, this);
	RegisterControl(stc_slider, wxGetTranslation(stc_desc));

	if (vconfig.iSafeTextureCache_ColorSamples == 0) stc_slider->SetValue(0);
	else if (vconfig.iSafeTextureCache_ColorSamples == 512) stc_slider->SetValue(1);
	else if (vconfig.iSafeTextureCache_ColorSamples == 128) stc_slider->SetValue(2);
	else stc_slider->Disable(); // Using custom number of samples; TODO: Inform the user why this is disabled..

	szr_safetex->Add(new wxStaticText(page_hacks, wxID_ANY, _("Accuracy:")), 0, wxALL, 5);
	szr_safetex->AddStretchSpacer(1);
	szr_safetex->Add(new wxStaticText(page_hacks, wxID_ANY, _("Safe")), 0, wxLEFT|wxTOP|wxBOTTOM, 5);
	szr_safetex->Add(stc_slider, 2, wxRIGHT, 0);
	szr_safetex->Add(new wxStaticText(page_hacks, wxID_ANY, _("Fast")), 0, wxRIGHT|wxTOP|wxBOTTOM, 5);
	szr_hacks->Add(szr_safetex, 0, wxEXPAND | wxALL, 5);
	}

	// - XFB
	{
	wxStaticBoxSizer* const group_xfb = new wxStaticBoxSizer(wxHORIZONTAL, page_hacks, _("External Frame Buffer (XFB)"));

	SettingCheckBox* disable_xfb = CreateCheckBox(page_hacks, _("Disable"), wxGetTranslation(xfb_desc), vconfig.bUseXFB, true);
	virtual_xfb = CreateRadioButton(page_hacks, _("Virtual"), wxGetTranslation(xfb_virtual_desc), vconfig.bUseRealXFB, true, wxRB_GROUP);
	real_xfb = CreateRadioButton(page_hacks, _("Real"), wxGetTranslation(xfb_real_desc), vconfig.bUseRealXFB);

	group_xfb->Add(disable_xfb, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
	group_xfb->AddStretchSpacer(1);
	group_xfb->Add(virtual_xfb, 0, wxRIGHT, 5);
	group_xfb->Add(real_xfb, 0, wxRIGHT, 5);
	szr_hacks->Add(group_xfb, 0, wxEXPAND | wxALL, 5);
	} // xfb

	// - other hacks
	{
	wxGridSizer* const szr_other = new wxGridSizer(2, 5, 5);
	szr_other->Add(CreateCheckBox(page_hacks, _("Fast Depth Calculation"), wxGetTranslation(fast_depth_calc_desc), vconfig.bFastDepthCalc));
	szr_other->Add(CreateCheckBox(page_hacks, _("Disable Bounding Box"), wxGetTranslation(disable_bbox_desc), vconfig.bBBoxEnable, true));

	wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Other"));
	group_other->Add(szr_other, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_hacks->Add(group_other, 0, wxEXPAND | wxALL, 5);
	}

	szr_hacks->AddStretchSpacer();
	CreateDescriptionArea(page_hacks, szr_hacks);
	page_hacks->SetSizerAndFit(szr_hacks);
	}

	// -- ADVANCED --
	{
	wxPanel* const page_advanced = new wxPanel(notebook);
	notebook->AddPage(page_advanced, _("Advanced"));
	wxBoxSizer* const szr_advanced = new wxBoxSizer(wxVERTICAL);

	// - debug
	{
	wxGridSizer* const szr_debug = new wxGridSizer(2, 5, 5);

	szr_debug->Add(CreateCheckBox(page_advanced, _("Enable Wireframe"), wxGetTranslation(wireframe_desc), vconfig.bWireFrame));
	szr_debug->Add(CreateCheckBox(page_advanced, _("Show Statistics"), wxGetTranslation(show_stats_desc), vconfig.bOverlayStats));
	szr_debug->Add(CreateCheckBox(page_advanced, _("Texture Format Overlay"), wxGetTranslation(texfmt_desc), vconfig.bTexFmtOverlayEnable));

	wxStaticBoxSizer* const group_debug = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Debugging"));
	szr_advanced->Add(group_debug, 0, wxEXPAND | wxALL, 5);
	group_debug->Add(szr_debug, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	}

	// - utility
	{
	wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5);

	szr_utility->Add(CreateCheckBox(page_advanced, _("Dump Textures"), wxGetTranslation(dump_textures_desc), vconfig.bDumpTextures));
	szr_utility->Add(CreateCheckBox(page_advanced, _("Load Custom Textures"), wxGetTranslation(load_hires_textures_desc), vconfig.bHiresTextures));
	cache_hires_textures = CreateCheckBox(page_advanced, _("Prefetch Custom Textures"), wxGetTranslation(cache_hires_textures_desc), vconfig.bCacheHiresTextures);
	szr_utility->Add(cache_hires_textures);
	szr_utility->Add(CreateCheckBox(page_advanced, _("Dump EFB Target"), wxGetTranslation(dump_efb_desc), vconfig.bDumpEFBTarget));
	szr_utility->Add(CreateCheckBox(page_advanced, _("Free Look"), wxGetTranslation(free_look_desc), vconfig.bFreeLook));
#if defined(HAVE_LIBAV) || defined (_WIN32)
	szr_utility->Add(CreateCheckBox(page_advanced, _("Frame Dumps use FFV1"), wxGetTranslation(use_ffv1_desc), vconfig.bUseFFV1));
#endif

	wxStaticBoxSizer* const group_utility = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Utility"));
	szr_advanced->Add(group_utility, 0, wxEXPAND | wxALL, 5);
	group_utility->Add(szr_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	}

	// - misc
	{
	wxGridSizer* const szr_misc = new wxGridSizer(2, 5, 5);

	szr_misc->Add(CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), vconfig.bCrop));

	// Progressive Scan
	{
	progressive_scan_checkbox = new wxCheckBox(page_advanced, wxID_ANY, _("Enable Progressive Scan"));
	RegisterControl(progressive_scan_checkbox, wxGetTranslation(prog_scan_desc));
	progressive_scan_checkbox->Bind(wxEVT_CHECKBOX, &VideoConfigDiag::Event_ProgressiveScan, this);

	progressive_scan_checkbox->SetValue(SConfig::GetInstance().bProgressive);
	// A bit strange behavior, but this needs to stay in sync with the main progressive boolean; TODO: Is this still necessary?
	SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", SConfig::GetInstance().bProgressive);

	szr_misc->Add(progressive_scan_checkbox);
	}

#if defined WIN32
	// Borderless Fullscreen
	borderless_fullscreen = CreateCheckBox(page_advanced, _("Borderless Fullscreen"), wxGetTranslation(borderless_fullscreen_desc), vconfig.bBorderlessFullscreen);
	szr_misc->Add(borderless_fullscreen);
#endif

	wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Misc"));
	szr_advanced->Add(group_misc, 0, wxEXPAND | wxALL, 5);
	group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	}

	szr_advanced->AddStretchSpacer();
	CreateDescriptionArea(page_advanced, szr_advanced);
	page_advanced->SetSizerAndFit(szr_advanced);
	}

	wxButton* const btn_close = new wxButton(this, wxID_OK, _("Close"));
	btn_close->Bind(wxEVT_BUTTON, &VideoConfigDiag::Event_ClickClose, this);

	Bind(wxEVT_CLOSE_WINDOW, &VideoConfigDiag::Event_Close, this);

	wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL);
	szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5);
	szr_main->Add(btn_close, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5);

	SetSizerAndFit(szr_main);
	Center();
	SetFocus();

	UpdateWindowUI();
}
Example #4
0
MyEditLangDialog::MyEditLangDialog(wxWindow *parent,CodeNode*node)
                : wxDialog(parent, wxID_ANY, wxString(wxT("±à¼­Æ÷")))
{
	wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
	_nowNode = node;
	sizerTop->Add(new wxStaticText(this, wxID_ANY, node->nodeName.c_str()),1,wxEXPAND | wxALL, 5);
	wxSizer * const sizerBtnsBox = new wxStaticBoxSizer(wxVERTICAL, this, "&ÊôÐÔÁбí");
	wxBoxSizer *sizerV = new wxBoxSizer(wxVERTICAL);
	for (std::map<std::string,std::string>::iterator it = node->propies.propies.begin(); it != node->propies.propies.end();++it)
	{
		wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
		if (it->second != "")
		{
			wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, it->second.c_str());
			texts[it->first] = text;
			sizerTop->Add(new wxStaticText(this, wxID_ANY, it->first.c_str()),1,wxEXPAND | wxALL, 5);
			sizerTop->Add(text,1,wxEXPAND | wxALL, 5);
		}
		else
		{
			wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, it->first.c_str());
			texts["VV"] = text;
			sizerTop->Add(text,1,wxEXPAND | wxALL, 5);
		}
		sizerV->Add(sizerTop, wxSizerFlags(1).Expand());

		sizerBtnsBox->Add(sizerV);//, wxSizerFlags(1).Expand());
	}
	{
		wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
		const wxString icons[] =
		{
			"&ɾ³ý",
			"&±à¼­",
			"&Ôö¼Ó",
		};

		m_icons = new wxRadioBox(this, wxID_ANY, "&±à¼­Ñ¡Ïî",
								 wxDefaultPosition, wxDefaultSize,
								 WXSIZEOF(icons), icons,
								 2, wxRA_SPECIFY_ROWS);
		m_icons->SetSelection(2);
		sizerTop->Add(m_icons, wxSizerFlags().Expand().Border());

		sizerBtnsBox->Add(sizerTop);
		sizerBtnsBox->SetMinSize(500,100);
	}
	wxSizer * const AddBtns = new wxStaticBoxSizer(wxVERTICAL, this, "&Ôö¼Ó");
	if (AddBtns)
	{
		wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);

		m_textMsg = new wxTextCtrl(this, wxID_ANY, "",
                               wxDefaultPosition, wxSize(400,200),
                               wxTE_MULTILINE);

		sizerTop->Add(m_textMsg,wxSizerFlags().Centre());
		wxBoxSizer *sizerTop1 = new wxBoxSizer(wxHORIZONTAL);
		sizerTop1->Add(new wxButton(this, 122, "&Ê××Ó"),
                   wxSizerFlags().Centre());
		sizerTop1->Add(new wxButton(this, 123, "&ÏÂÈÎ"),
                   wxSizerFlags().Centre());
		sizerTop->Add(sizerTop1);
		AddBtns->Add(sizerTop);
		sizerTop->SetMinSize(500,210);
	}
	sizerTop->Add(sizerBtnsBox);
	sizerTop->Add(AddBtns);
	SetSizerAndFit(sizerTop,false);
	this->SetSize(300,600);
}
Example #5
0
bool wxGenericProgressDialog::Create( const wxString& title,
                                      const wxString& message,
                                      int maximum,
                                      wxWindow *parent,
                                      int style )
{
    SetTopParent(parent);

    m_parentTop = wxGetTopLevelParent(parent);
    m_pdStyle = style;

    wxWindow* const
        realParent = GetParentForModalDialog(parent, GetWindowStyle());

    if (!wxDialog::Create(realParent, wxID_ANY, title))
        return false;

    SetMaximum(maximum);

    // We need a running event loop in order to update the dialog and be able
    // to process clicks on its buttons, so ensure that there is one running
    // even if this means we have to start it ourselves (this happens most
    // commonly during the program initialization, e.g. for the progress
    // dialogs shown from overridden wxApp::OnInit()).
    if ( !wxEventLoopBase::GetActive() )
    {
        m_tempEventLoop = new wxEventLoop;
        wxEventLoop::SetActive(m_tempEventLoop);
    }

#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
    // we have to remove the "Close" button from the title bar then as it is
    // confusing to have it - it doesn't work anyhow
    //
    // FIXME: should probably have a (extended?) window style for this
    if ( !HasPDFlag(wxPD_CAN_ABORT) )
    {
        EnableCloseButton(false);
    }
#endif // wxMSW

    m_state = HasPDFlag(wxPD_CAN_ABORT) ? Continue : Uncancelable;

    // top-level sizerTop
    wxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL);

    m_msg = new wxStaticText(this, wxID_ANY, message);
    sizerTop->Add(m_msg, 0, wxLEFT | wxRIGHT | wxTOP, 2*LAYOUT_MARGIN);

    int gauge_style = wxGA_HORIZONTAL;
    if ( style & wxPD_SMOOTH )
        gauge_style |= wxGA_SMOOTH;
    gauge_style |= wxGA_PROGRESS;

#ifdef __WXMSW__
    maximum /= m_factor;
#endif

    m_gauge = new wxGauge
                  (
                    this,
                    wxID_ANY,
                    maximum,
                    wxDefaultPosition,
                    // make the progress bar sufficiently long
                    wxSize(wxMin(wxGetClientDisplayRect().width/3, 300), -1),
                    gauge_style
                  );

    sizerTop->Add(m_gauge, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 2*LAYOUT_MARGIN);
    m_gauge->SetValue(0);

    // create the estimated/remaining/total time zones if requested
    m_elapsed =
    m_estimated =
    m_remaining = NULL;

    // also count how many labels we really have
    size_t nTimeLabels = 0;

    wxSizer * const sizerLabels = new wxFlexGridSizer(2);

    if ( style & wxPD_ELAPSED_TIME )
    {
        nTimeLabels++;

        m_elapsed = CreateLabel(GetElapsedLabel(), sizerLabels);
    }

    if ( style & wxPD_ESTIMATED_TIME )
    {
        nTimeLabels++;

        m_estimated = CreateLabel(GetEstimatedLabel(), sizerLabels);
    }

    if ( style & wxPD_REMAINING_TIME )
    {
        nTimeLabels++;

        m_remaining = CreateLabel(GetRemainingLabel(), sizerLabels);
    }
    sizerTop->Add(sizerLabels, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, LAYOUT_MARGIN);

    m_btnAbort =
    m_btnSkip = NULL;

    wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);

    const int borderFlags =
#if defined(__WXMSW__) || defined(__WXOSX__)
        wxALL
#else
        wxBOTTOM | wxTOP
#endif
        ;

    const wxSizerFlags sizerFlags
        = wxSizerFlags().Border(borderFlags, LAYOUT_MARGIN);

    if ( HasPDFlag(wxPD_CAN_SKIP) )
    {
        m_btnSkip = new wxButton(this, wxID_SKIP, _("&Skip"));

        buttonSizer->Add(m_btnSkip, sizerFlags);
    }

    if ( HasPDFlag(wxPD_CAN_ABORT) )
    {
        m_btnAbort = new wxButton(this, wxID_CANCEL);

        buttonSizer->Add(m_btnAbort, sizerFlags);
    }

    if ( !HasPDFlag(wxPD_CAN_SKIP | wxPD_CAN_ABORT) )
        buttonSizer->AddSpacer(LAYOUT_MARGIN);

    sizerTop->Add(buttonSizer, sizerFlags);

    SetSizerAndFit(sizerTop);

    Centre(wxCENTER_FRAME | wxBOTH);

    DisableOtherWindows();

    Show();
    Enable();

    // this one can be initialized even if the others are unknown for now
    //
    // NB: do it after calling Layout() to keep the labels correctly aligned
    if ( m_elapsed )
    {
        SetTimeLabel(0, m_elapsed);
    }

    Update();
    return true;
}
Example #6
0
void TASInputDlg::CreateWiiLayout(int num)
{
	if (m_has_layout)
		return;

	m_buttons[6] = &m_one;
	m_buttons[7] = &m_two;
	m_buttons[8] = &m_plus;
	m_buttons[9] = &m_minus;
	m_buttons[10] = &m_home;

	m_controls[4] = &m_x_cont;
	m_controls[5] = &m_y_cont;
	m_controls[6] = &m_z_cont;

	m_main_stick = CreateStick(ID_MAIN_STICK, 1024, 768, 512, 384, true, false);
	m_main_stick_szr = CreateStickLayout(&m_main_stick, _("IR"));

	m_x_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	m_y_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	m_z_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 616);
	wxStaticBoxSizer* const axisBox = CreateAccelLayout(&m_x_cont, &m_y_cont, &m_z_cont, _("Orientation"));

	wxStaticBoxSizer* const m_buttons_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Buttons"));
	wxGridSizer* const m_buttons_grid = new wxGridSizer(4);

	m_plus = CreateButton("+");
	m_minus = CreateButton("-");
	m_one = CreateButton("1");
	m_two = CreateButton("2");
	m_home = CreateButton("Home");

	m_main_szr = new wxBoxSizer(wxVERTICAL);
	m_wiimote_szr = new wxBoxSizer(wxHORIZONTAL);
	m_ext_szr = new wxBoxSizer(wxHORIZONTAL);

	if (Core::IsRunning())
	{
		m_ext = ((WiimoteEmu::Wiimote*)Wiimote::GetConfig()->controllers[num])->CurrentExtension();
	}
	else
	{
		IniFile ini;
		ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini");
		std::string extension;
		ini.GetIfExists("Wiimote" + std::to_string(num + 1), "Extension", &extension);

		if (extension == "Nunchuk")
			m_ext = 1;
		if (extension == "Classic Controller")
			m_ext = 2;
	}

	m_buttons[11] = &m_c;
	m_buttons[12] = &m_z;
	m_controls[2] = &m_c_stick.x_cont;
	m_controls[3] = &m_c_stick.y_cont;
	m_controls[7] = &m_nx_cont;
	m_controls[8] = &m_ny_cont;
	m_controls[9] = &m_nz_cont;

	m_c_stick = CreateStick(ID_C_STICK, 255, 255, 128, 128, false, true);
	m_c_stick_szr = CreateStickLayout(&m_c_stick, _("Nunchuk stick"));

	m_nx_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	m_ny_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	m_nz_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	wxStaticBoxSizer* const nunchukaxisBox = CreateAccelLayout(&m_nx_cont, &m_ny_cont, &m_nz_cont, _("Nunchuk orientation"));

	m_c = CreateButton("C");
	m_z = CreateButton("Z");
	m_ext_szr->Add(m_c_stick_szr, 0, wxLEFT | wxBOTTOM | wxRIGHT, 5);
	m_ext_szr->Add(nunchukaxisBox);

	for (Control* const control : m_controls)
	{
		if (control != nullptr)
			control->slider->Bind(wxEVT_RIGHT_UP, &TASInputDlg::OnRightClickSlider, this);
	}

	for (unsigned int i = 4; i < 14; ++i)
		if (m_buttons[i] != nullptr)
			m_buttons_grid->Add(m_buttons[i]->checkbox, false);
	m_buttons_grid->AddSpacer(5);

	m_buttons_box->Add(m_buttons_grid);
	m_buttons_box->Add(m_buttons_dpad);

	m_wiimote_szr->Add(m_main_stick_szr, 0, wxALL, 5);
	m_wiimote_szr->Add(axisBox, 0, wxTOP | wxRIGHT, 5);
	m_wiimote_szr->Add(m_buttons_box, 0, wxTOP | wxRIGHT, 5);
	m_main_szr->Add(m_wiimote_szr);
	m_main_szr->Add(m_ext_szr);
	if (m_ext == 1)
		m_main_szr->Show(m_ext_szr);
	else
		m_main_szr->Hide(m_ext_szr);
	SetSizerAndFit(m_main_szr, true);

	ResetValues();
	m_has_layout = true;
}
Example #7
0
DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Context *c, AssStyleStorage *store, std::string const& new_name, wxArrayString const& font_list)
: wxDialog (parent, -1, _("Style Editor"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, c(c)
, is_new(false)
, style(style)
, store(store)
{
	if (new_name.size()) {
		is_new = true;
		style = this->style = new AssStyle(*style);
		style->name = new_name;
	}
	else if (!style) {
		is_new = true;
		style = this->style = new AssStyle;
	}

	work = agi::util::make_unique<AssStyle>(*style);

	SetIcon(GETICON(style_toolbutton_16));

	// Prepare control values
	wxString EncodingValue = std::to_wstring(style->encoding);
	wxString alignValues[9] = { "7", "8", "9", "4", "5", "6", "1", "2", "3" };

	// Encoding options
	wxArrayString encodingStrings;
	AssStyle::GetEncodings(encodingStrings);

	// Create sizers
	wxSizer *NameSizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Style Name"));
	wxSizer *FontSizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Font"));
	wxSizer *ColorsSizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Colors"));
	wxSizer *MarginSizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Margins"));
	wxSizer *OutlineBox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Outline"));
	wxSizer *MiscBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Miscellaneous"));
	wxSizer *PreviewBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Preview"));

	// Create controls
	StyleName = new wxTextCtrl(this, -1, to_wx(style->name));
	FontName = new wxComboBox(this, -1, to_wx(style->font), wxDefaultPosition, wxSize(150, -1), 0, 0, wxCB_DROPDOWN);
	FontSize =  num_text_ctrl(this, style->fontsize, false, wxSize(50, -1));
	BoxBold = new wxCheckBox(this, -1, _("&Bold"));
	BoxItalic = new wxCheckBox(this, -1, _("&Italic"));
	BoxUnderline = new wxCheckBox(this, -1, _("&Underline"));
	BoxStrikeout = new wxCheckBox(this, -1, _("&Strikeout"));
	ColourButton *colorButton[] = {
		new ColourButton(this, wxSize(55, 16), true, style->primary, ColorValidator(&work->primary)),
		new ColourButton(this, wxSize(55, 16), true, style->secondary, ColorValidator(&work->secondary)),
		new ColourButton(this, wxSize(55, 16), true, style->outline, ColorValidator(&work->outline)),
		new ColourButton(this, wxSize(55, 16), true, style->shadow, ColorValidator(&work->shadow))
	};
	for (int i = 0; i < 3; i++)
		margin[i] = spin_ctrl(this, style->Margin[i], 9999);
	Alignment = new wxRadioBox(this, -1, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);
	Outline = num_text_ctrl(this, style->outline_w, false, wxSize(50, -1));
	Shadow = num_text_ctrl(this, style->shadow_w, true, wxSize(50, -1));
	OutlineType = new wxCheckBox(this, -1, _("&Opaque box"));
	ScaleX = num_text_ctrl(this, style->scalex, false);
	ScaleY = num_text_ctrl(this, style->scaley, false);
	Angle = num_text_ctrl(this, style->angle, true);
	Spacing = num_text_ctrl(this, style->spacing, true);
	Encoding = new wxComboBox(this, -1, "", wxDefaultPosition, wxDefaultSize, encodingStrings, wxCB_READONLY);

	// Set control tooltips
	StyleName->SetToolTip(_("Style name"));
	FontName->SetToolTip(_("Font face"));
	FontSize->SetToolTip(_("Font size"));
	colorButton[0]->SetToolTip(_("Choose primary color"));
	colorButton[1]->SetToolTip(_("Choose secondary color"));
	colorButton[2]->SetToolTip(_("Choose outline color"));
	colorButton[3]->SetToolTip(_("Choose shadow color"));
	margin[0]->SetToolTip(_("Distance from left edge, in pixels"));
	margin[1]->SetToolTip(_("Distance from right edge, in pixels"));
	margin[2]->SetToolTip(_("Distance from top/bottom edge, in pixels"));
	OutlineType->SetToolTip(_("When selected, display an opaque box behind the subtitles instead of an outline around the text"));
	Outline->SetToolTip(_("Outline width, in pixels"));
	Shadow->SetToolTip(_("Shadow distance, in pixels"));
	ScaleX->SetToolTip(_("Scale X, in percentage"));
	ScaleY->SetToolTip(_("Scale Y, in percentage"));
	Angle->SetToolTip(_("Angle to rotate in Z axis, in degrees"));
	Encoding->SetToolTip(_("Encoding, only useful in unicode if the font doesn't have the proper unicode mapping"));
	Spacing->SetToolTip(_("Character spacing, in pixels"));
	Alignment->SetToolTip(_("Alignment in screen, in numpad style"));

	// Set up controls
	BoxBold->SetValue(style->bold);
	BoxItalic->SetValue(style->italic);
	BoxUnderline->SetValue(style->underline);
	BoxStrikeout->SetValue(style->strikeout);
	OutlineType->SetValue(style->borderstyle == 3);
	Alignment->SetSelection(AlignToControl(style->alignment));
	// Fill font face list box
	FontName->Freeze();
	FontName->Append(font_list);
	FontName->SetValue(to_wx(style->font));
	FontName->Thaw();

	// Set encoding value
	bool found = false;
	for (size_t i=0;i<encodingStrings.Count();i++) {
		if (encodingStrings[i].StartsWith(EncodingValue)) {
			Encoding->Select(i);
			found = true;
			break;
		}
	}
	if (!found) Encoding->Select(0);

	// Style name sizer
	NameSizer->Add(StyleName, 1, wxALL, 0);

	// Font sizer
	wxSizer *FontSizerTop = new wxBoxSizer(wxHORIZONTAL);
	wxSizer *FontSizerBottom = new wxBoxSizer(wxHORIZONTAL);
	FontSizerTop->Add(FontName, 1, wxALL, 0);
	FontSizerTop->Add(FontSize, 0, wxLEFT, 5);
	FontSizerBottom->AddStretchSpacer(1);
	FontSizerBottom->Add(BoxBold, 0, 0, 0);
	FontSizerBottom->Add(BoxItalic, 0, wxLEFT, 5);
	FontSizerBottom->Add(BoxUnderline, 0, wxLEFT, 5);
	FontSizerBottom->Add(BoxStrikeout, 0, wxLEFT, 5);
	FontSizerBottom->AddStretchSpacer(1);
	FontSizer->Add(FontSizerTop, 1, wxALL | wxEXPAND, 0);
	FontSizer->Add(FontSizerBottom, 1, wxTOP | wxEXPAND, 5);

	// Colors sizer
	wxString colorLabels[] = { _("Primary"), _("Secondary"), _("Outline"), _("Shadow") };
	ColorsSizer->AddStretchSpacer(1);
	for (int i = 0; i < 4; ++i) {
		auto sizer = new wxBoxSizer(wxVERTICAL);
		sizer->Add(new wxStaticText(this, -1, colorLabels[i]), 0, wxBOTTOM | wxALIGN_CENTER, 5);
		sizer->Add(colorButton[i], 0, wxBOTTOM | wxALIGN_CENTER, 5);
		ColorsSizer->Add(sizer, 0, wxLEFT, i?5:0);
	}
	ColorsSizer->AddStretchSpacer(1);

	// Margins
	wxString marginLabels[] = { _("Left"), _("Right"), _("Vert") };
	MarginSizer->AddStretchSpacer(1);
	for (int i=0;i<3;i++) {
		auto sizer = new wxBoxSizer(wxVERTICAL);
		sizer->AddStretchSpacer(1);
		sizer->Add(new wxStaticText(this, -1, marginLabels[i]), 0, wxCENTER, 0);
		sizer->Add(margin[i], 0, wxTOP | wxCENTER, 5);
		sizer->AddStretchSpacer(1);
		MarginSizer->Add(sizer, 0, wxEXPAND | wxLEFT, i?5:0);
	}
	MarginSizer->AddStretchSpacer(1);

	// Margins+Alignment
	wxSizer *MarginAlign = new wxBoxSizer(wxHORIZONTAL);
	MarginAlign->Add(MarginSizer, 1, wxLEFT | wxEXPAND, 0);
	MarginAlign->Add(Alignment, 0, wxLEFT | wxEXPAND, 5);

	// Outline
	add_with_label(OutlineBox, this, _("Outline:"), Outline);
	add_with_label(OutlineBox, this, _("Shadow:"), Shadow);
	OutlineBox->Add(OutlineType, 0, wxLEFT | wxALIGN_CENTER, 5);

	// Misc
	auto MiscBoxTop = new wxFlexGridSizer(2, 4, 5, 5);
	add_with_label(MiscBoxTop, this, _("Scale X%:"), ScaleX);
	add_with_label(MiscBoxTop, this, _("Scale Y%:"), ScaleY);
	add_with_label(MiscBoxTop, this, _("Rotation:"), Angle);
	add_with_label(MiscBoxTop, this, _("Spacing:"), Spacing);

	wxSizer *MiscBoxBottom = new wxBoxSizer(wxHORIZONTAL);
	add_with_label(MiscBoxBottom, this, _("Encoding:"), Encoding);

	MiscBox->Add(MiscBoxTop, wxSizerFlags().Expand().Center());
	MiscBox->Add(MiscBoxBottom, wxSizerFlags().Expand().Center().Border(wxTOP));

	// Preview
	auto previewButton = new ColourButton(this, wxSize(45, 16), false, OPT_GET("Colour/Style Editor/Background/Preview")->GetColor());
	PreviewText = new wxTextCtrl(this, -1, to_wx(OPT_GET("Tool/Style Editor/Preview Text")->GetString()));
	SubsPreview = new SubtitlesPreview(this, wxSize(100, 60), wxSUNKEN_BORDER, OPT_GET("Colour/Style Editor/Background/Preview")->GetColor());

	SubsPreview->SetToolTip(_("Preview of current style"));
	SubsPreview->SetStyle(*style);
	SubsPreview->SetText(from_wx(PreviewText->GetValue()));
	PreviewText->SetToolTip(_("Text to be used for the preview"));
	previewButton->SetToolTip(_("Color of preview background"));

	wxSizer *PreviewBottomSizer = new wxBoxSizer(wxHORIZONTAL);
	PreviewBottomSizer->Add(PreviewText, 1, wxEXPAND | wxRIGHT, 5);
	PreviewBottomSizer->Add(previewButton, 0, wxEXPAND, 0);
	PreviewBox->Add(SubsPreview, 1, wxEXPAND | wxBOTTOM, 5);
	PreviewBox->Add(PreviewBottomSizer, 0, wxEXPAND | wxBOTTOM, 0);

	// Buttons
	auto ButtonSizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL | wxAPPLY | wxHELP);

	// Left side sizer
	wxSizer *LeftSizer = new wxBoxSizer(wxVERTICAL);
	LeftSizer->Add(NameSizer, 0, wxBOTTOM | wxEXPAND, 5);
	LeftSizer->Add(FontSizer, 0, wxBOTTOM | wxEXPAND, 5);
	LeftSizer->Add(ColorsSizer, 0, wxBOTTOM | wxEXPAND, 5);
	LeftSizer->Add(MarginAlign, 0, wxBOTTOM | wxEXPAND, 0);

	// Right side sizer
	wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL);
	RightSizer->Add(OutlineBox, wxSizerFlags().Expand().Border(wxBOTTOM));
	RightSizer->Add(MiscBox, wxSizerFlags().Expand().Border(wxBOTTOM));
	RightSizer->Add(PreviewBox, wxSizerFlags(1).Expand());

	// Controls Sizer
	wxSizer *ControlSizer = new wxBoxSizer(wxHORIZONTAL);
	ControlSizer->Add(LeftSizer, 0, wxEXPAND, 0);
	ControlSizer->Add(RightSizer, 1, wxLEFT | wxEXPAND, 5);

	// General Layout
	wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
	MainSizer->Add(ControlSizer, 1, wxALL | wxALIGN_CENTER | wxEXPAND, 5);
	MainSizer->Add(ButtonSizer, 0, wxBOTTOM | wxEXPAND, 5);

	SetSizerAndFit(MainSizer);

	// Force the style name text field to scroll based on its final size, rather
	// than its initial size
	StyleName->SetInsertionPoint(0);
	StyleName->SetInsertionPoint(-1);

	persist = agi::util::make_unique<PersistLocation>(this, "Tool/Style Editor", true);

	Bind(wxEVT_CHILD_FOCUS, &DialogStyleEditor::OnChildFocus, this);

	Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &DialogStyleEditor::OnCommandPreviewUpdate, this);
	Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, &DialogStyleEditor::OnCommandPreviewUpdate, this);
	Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, &DialogStyleEditor::OnCommandPreviewUpdate, this);

	previewButton->Bind(EVT_COLOR, &DialogStyleEditor::OnPreviewColourChange, this);
	FontName->Bind(wxEVT_COMMAND_TEXT_ENTER, &DialogStyleEditor::OnCommandPreviewUpdate, this);
	PreviewText->Bind(wxEVT_COMMAND_TEXT_UPDATED, &DialogStyleEditor::OnPreviewTextChange, this);

	Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(&DialogStyleEditor::Apply, this, true, true), wxID_OK);
	Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(&DialogStyleEditor::Apply, this, true, false), wxID_APPLY);
	Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(&DialogStyleEditor::Apply, this, false, true), wxID_CANCEL);
	Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(&HelpButton::OpenPage, "Style Editor"), wxID_HELP);

	for (int i = 0; i < 4; ++i)
		colorButton[i]->Bind(EVT_COLOR, &DialogStyleEditor::OnSetColor, this);
}
Example #8
0
WxBarFrame::WxBarFrame(const wxString& title)
	: wxFrame(NULL, wxID_ANY, title)
{
	// Create a top-level panel to hold all the contents of the frame
	wxPanel* panel = new wxPanel(this, wxID_ANY);

	// Create the data for the bar chart widget
	wxVector<wxString> labels;
	labels.push_back("January");
	labels.push_back("February");
	labels.push_back("March");
	labels.push_back("April");
	labels.push_back("May");
	labels.push_back("June");
	labels.push_back("July");
	wxBarChartData chartData(labels);

	// Add the first dataset
	wxVector<wxDouble> points1;
	points1.push_back(3);
	points1.push_back(2.5);
	points1.push_back(1.2);
	points1.push_back(3);
	points1.push_back(6);
	points1.push_back(5);
	points1.push_back(1);
	wxBarChartDataset::ptr dataset1(
		new wxBarChartDataset(
			wxColor(220, 220, 220, 0x7F),
			wxColor(220, 220, 220, 0xCC),
			points1)
		);
	chartData.AddDataset(dataset1);

	// Add the second dataset
	wxVector<wxDouble> points2;
	points2.push_back(1);
	points2.push_back(1.33);
	points2.push_back(2.5);
	points2.push_back(2);
	points2.push_back(3);
	points2.push_back(1.8);
	points2.push_back(0.4);
	wxBarChartDataset::ptr dataset2(new wxBarChartDataset(
		wxColor(151, 187, 205, 0x7F),
		wxColor(151, 187, 205, 0xFF),
		points2));
	chartData.AddDataset(dataset2);

	// Create the bar chart widget
	wxBarChartCtrl* barChartCtrl = new wxBarChartCtrl(panel, wxID_ANY, chartData);

	// Set up the sizer for the panel
	wxBoxSizer* panelSizer = new wxBoxSizer(wxHORIZONTAL);
	panelSizer->Add(barChartCtrl, 1, wxEXPAND);
	panel->SetSizer(panelSizer);

	// Set up the sizer for the frame
	wxBoxSizer* topSizer = new wxBoxSizer(wxHORIZONTAL);
	topSizer->Add(panel, 1, wxEXPAND);
	SetSizerAndFit(topSizer);
}
PostProcessingConfigDiag::PostProcessingConfigDiag(wxWindow* parent, const std::string& shader)
    : wxDialog(parent, wxID_ANY, _("Post Processing Shader Configuration")), m_shader(shader)
{
  // Depending on if we are running already, either use the one from the videobackend
  // or generate our own.
  if (g_renderer && g_renderer->GetPostProcessor())
  {
    m_post_processor = g_renderer->GetPostProcessor()->GetConfig();
  }
  else
  {
    m_post_processor = new PostProcessingShaderConfiguration();
    m_post_processor->LoadShader(m_shader);
  }

  // Create our UI classes
  const PostProcessingShaderConfiguration::ConfigMap& config_map = m_post_processor->GetOptions();
  for (const auto& it : config_map)
  {
    if (it.second.m_type ==
        PostProcessingShaderConfiguration::ConfigurationOption::OptionType::OPTION_BOOL)
    {
      ConfigGrouping* group =
          new ConfigGrouping(ConfigGrouping::WidgetType::TYPE_TOGGLE, it.second.m_gui_name,
                             it.first, it.second.m_dependent_option, &it.second);
      m_config_map[it.first] = group;
    }
    else
    {
      ConfigGrouping* group =
          new ConfigGrouping(ConfigGrouping::WidgetType::TYPE_SLIDER, it.second.m_gui_name,
                             it.first, it.second.m_dependent_option, &it.second);
      m_config_map[it.first] = group;
    }
  }

  // Arrange our vectors based on dependency
  for (const auto& it : m_config_map)
  {
    const std::string parent_name = it.second->GetParent();
    if (parent_name.size())
    {
      // Since it depends on a different object, push it to a parent's object
      m_config_map[parent_name]->AddChild(m_config_map[it.first]);
    }
    else
    {
      // It doesn't have a child, just push it to the vector
      m_config_groups.push_back(m_config_map[it.first]);
    }
  }

  // Generate our UI
  wxNotebook* const notebook = new wxNotebook(this, wxID_ANY);
  wxPanel* const page_general = new wxPanel(notebook);
  wxFlexGridSizer* const szr_general = new wxFlexGridSizer(2, 5, 5);

  // Now let's actually populate our window with our information
  bool add_general_page = false;
  for (const auto& it : m_config_groups)
  {
    if (it->HasChildren())
    {
      // Options with children get their own tab
      wxPanel* const page_option = new wxPanel(notebook);
      wxFlexGridSizer* const szr_option = new wxFlexGridSizer(2, 10, 5);
      it->GenerateUI(this, page_option, szr_option);

      // Add all the children
      for (const auto& child : it->GetChildren())
      {
        child->GenerateUI(this, page_option, szr_option);
      }
      page_option->SetSizerAndFit(szr_option);
      notebook->AddPage(page_option, _(it->GetGUIName()));
    }
    else
    {
      // Options with no children go in to the general tab
      if (!add_general_page)
      {
        // Make it so it doesn't show up if there aren't any options without children.
        add_general_page = true;
      }
      it->GenerateUI(this, page_general, szr_general);
    }
  }

  if (add_general_page)
  {
    page_general->SetSizerAndFit(szr_general);
    notebook->InsertPage(0, page_general, _("General"));
  }

  // Close Button
  wxButton* const btn_close = new wxButton(this, wxID_OK, _("Close"));
  btn_close->Bind(wxEVT_BUTTON, &PostProcessingConfigDiag::Event_ClickClose, this);

  Bind(wxEVT_CLOSE_WINDOW, &PostProcessingConfigDiag::Event_Close, this);

  wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL);
  szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5);
  szr_main->Add(btn_close, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5);

  SetSizerAndFit(szr_main);
  Center();
  SetFocus();

  UpdateWindowUI();
}
Example #10
0
WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin)
	: wxDialog(parent, -1, _("Dolphin Wiimote Configuration"))
	, m_plugin(plugin)
{
	wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);


	// "Wiimotes" controls
	wxStaticText* wiimote_label[4];
	wxChoice* wiimote_source_ch[4];

	for (unsigned int i = 0; i < MAX_WIIMOTES; ++i)
	{
		wxString str;
		str.Printf(_("Wiimote %i"), i + 1);

		const wxString src_choices[] = { _("None"),
		_("Emulated Wiimote"), _("Real Wiimote"), _("Hybrid Wiimote") };

		// reserve four ids, so that we can calculate the index from the ids later on
		// Stupid wx 2.8 doesn't support reserving sequential IDs, so we need to do that more complicated..
		int source_ctrl_id =  wxWindow::NewControlId();
		m_wiimote_index_from_ctrl_id.insert(std::pair<wxWindowID, unsigned int>(source_ctrl_id, i));

		int config_bt_id = wxWindow::NewControlId();
		m_wiimote_index_from_conf_bt_id.insert(std::pair<wxWindowID, unsigned int>(config_bt_id, i));

		wiimote_label[i] = new wxStaticText(this, wxID_ANY, str);
		wiimote_source_ch[i] = new wxChoice(this, source_ctrl_id, wxDefaultPosition, wxDefaultSize, sizeof(src_choices)/sizeof(*src_choices), src_choices);
		wiimote_source_ch[i]->Bind(wxEVT_CHOICE, &WiimoteConfigDiag::SelectSource, this);
		wiimote_configure_bt[i] = new wxButton(this, config_bt_id, _("Configure"));
		wiimote_configure_bt[i]->Bind(wxEVT_BUTTON, &WiimoteConfigDiag::ConfigEmulatedWiimote, this);

		m_orig_wiimote_sources[i] = g_wiimote_sources[i];
		wiimote_source_ch[i]->Select(m_orig_wiimote_sources[i]);
		if (m_orig_wiimote_sources[i] != WIIMOTE_SRC_EMU && m_orig_wiimote_sources[i] != WIIMOTE_SRC_HYBRID)
			wiimote_configure_bt[i]->Disable();
	}


	// "Wiimotes" layout
	wxStaticBoxSizer* const wiimote_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Wiimotes"));
	wxFlexGridSizer* const wiimote_sizer = new wxFlexGridSizer(3, 5, 5);
	for (unsigned int i = 0; i < 4; ++i)
	{
		wiimote_sizer->Add(wiimote_label[i], 0, wxALIGN_CENTER_VERTICAL);
		wiimote_sizer->Add(wiimote_source_ch[i], 0, wxALIGN_CENTER_VERTICAL);
		wiimote_sizer->Add(wiimote_configure_bt[i]);
	}
	wiimote_group->Add(wiimote_sizer, 1, wxEXPAND, 5 );


	// "BalanceBoard" layout
	wxStaticBoxSizer* const bb_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Balance Board"));
	wxFlexGridSizer* const bb_sizer = new wxFlexGridSizer(1, 5, 5);
	int source_ctrl_id =  wxWindow::NewControlId();
	m_wiimote_index_from_ctrl_id.insert(std::pair<wxWindowID, unsigned int>(source_ctrl_id, WIIMOTE_BALANCE_BOARD));
	const wxString src_choices[] = { _("None"), _("Real Balance Board") };
	wxChoice* bb_source = new wxChoice(this, source_ctrl_id, wxDefaultPosition, wxDefaultSize, sizeof(src_choices)/sizeof(*src_choices), src_choices);
	bb_source->Bind(wxEVT_CHOICE, &WiimoteConfigDiag::SelectSource, this);

	m_orig_wiimote_sources[WIIMOTE_BALANCE_BOARD] = g_wiimote_sources[WIIMOTE_BALANCE_BOARD];
	bb_source->Select(m_orig_wiimote_sources[WIIMOTE_BALANCE_BOARD] ? 1 : 0);

	bb_sizer->Add(bb_source, 0, wxALIGN_CENTER_VERTICAL);

	bb_group->Add(bb_sizer, 1, wxEXPAND, 5 );


	// "Real wiimotes" controls
	wxButton* const refresh_btn = new wxButton(this, -1, _("Refresh"));
	refresh_btn->Bind(wxEVT_BUTTON, &WiimoteConfigDiag::RefreshRealWiimotes, this);

	wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxVERTICAL, this, _("Real Wiimotes"));

	wxBoxSizer* const real_wiimotes_sizer = new wxBoxSizer(wxHORIZONTAL);

	if (!WiimoteReal::g_wiimote_scanner.IsReady())
		real_wiimotes_group->Add(new wxStaticText(this, -1, _("A supported bluetooth device could not be found.\n"
			"You must manually connect your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5);

	wxCheckBox* const continuous_scanning = new wxCheckBox(this, wxID_ANY, _("Continuous Scanning"));
	continuous_scanning->Bind(wxEVT_CHECKBOX, &WiimoteConfigDiag::OnContinuousScanning, this);
	continuous_scanning->SetValue(SConfig::GetInstance().m_WiimoteContinuousScanning);

	auto wiimote_speaker = new wxCheckBox(this, wxID_ANY, _("Enable Speaker Data"));
	wiimote_speaker->Bind(wxEVT_CHECKBOX, &WiimoteConfigDiag::OnEnableSpeaker, this);
	wiimote_speaker->SetValue(SConfig::GetInstance().m_WiimoteEnableSpeaker);

	real_wiimotes_sizer->Add(continuous_scanning, 0, wxALIGN_CENTER_VERTICAL);
	real_wiimotes_sizer->AddStretchSpacer(1);
	real_wiimotes_sizer->Add(refresh_btn, 0, wxALL | wxALIGN_CENTER, 5);

	real_wiimotes_group->Add(wiimote_speaker, 0);
	real_wiimotes_group->Add(real_wiimotes_sizer, 0, wxEXPAND);

	// "General Settings" controls
	const wxString str[] = { _("Bottom"), _("Top") };
	wxChoice* const WiiSensBarPos = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 2, str);
	wxSlider* const WiiSensBarSens = new wxSlider(this, wxID_ANY, 0, 0, 4);
	wxSlider* const WiimoteSpkVolume = new wxSlider(this, wxID_ANY, 0, 0, 127);
	wxCheckBox* const WiimoteMotor = new wxCheckBox(this, wxID_ANY, _("Wiimote Motor"));

	wxStaticText* const WiiSensBarPosText = new wxStaticText(this, wxID_ANY, _("Sensor Bar Position:"));
	wxStaticText* const WiiSensBarSensText = new wxStaticText(this, wxID_ANY, _("IR Sensitivity:"));
	wxStaticText* const WiiSensBarSensMinText = new wxStaticText(this, wxID_ANY, _("Min"));
	wxStaticText* const WiiSensBarSensMaxText = new wxStaticText(this, wxID_ANY, _("Max"));
	wxStaticText* const WiimoteSpkVolumeText = new wxStaticText(this, wxID_ANY, _("Speaker Volume:"));
	wxStaticText* const WiimoteSpkVolumeMinText = new wxStaticText(this, wxID_ANY, _("Min"));
	wxStaticText* const WiimoteSpkVolumeMaxText = new wxStaticText(this, wxID_ANY, _("Max"));

	// With some GTK themes, no minimum size will be applied - so do this manually here
	WiiSensBarSens->SetMinSize(wxSize(100,-1));
	WiimoteSpkVolume->SetMinSize(wxSize(100,-1));


	// Disable some controls when emulation is running
	if (Core::GetState() != Core::CORE_UNINITIALIZED)
	{
		WiiSensBarPos->Disable();
		WiiSensBarSens->Disable();
		WiimoteSpkVolume->Disable();
		WiimoteMotor->Disable();
		WiiSensBarPosText->Disable();
		WiiSensBarSensText->Disable();
		WiiSensBarSensMinText->Disable();
		WiiSensBarSensMaxText->Disable();
		WiimoteSpkVolumeText->Disable();
		WiimoteSpkVolumeMinText->Disable();
		WiimoteSpkVolumeMaxText->Disable();
		if (NetPlay::IsNetPlayRunning())
		{
			bb_source->Disable();
			for (int i = 0; i < 4; ++i)
			{
				wiimote_label[i]->Disable();
				wiimote_source_ch[i]->Disable();
			}
		}

	}


	// "General Settings" initialization
	WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR"));
	WiiSensBarSens->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u32>("BT.SENS"));
	WiimoteSpkVolume->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.SPKV"));
	WiimoteMotor->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<bool>("BT.MOT"));

	WiiSensBarPos->Bind(wxEVT_CHOICE, &WiimoteConfigDiag::OnSensorBarPos, this);
	WiiSensBarSens->Bind(wxEVT_SLIDER, &WiimoteConfigDiag::OnSensorBarSensitivity, this);
	WiimoteSpkVolume->Bind(wxEVT_SLIDER, &WiimoteConfigDiag::OnSpeakerVolume, this);
	WiimoteMotor->Bind(wxEVT_CHECKBOX, &WiimoteConfigDiag::OnMotor, this);


	// "General Settings" layout
	wxStaticBoxSizer* const general_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("General Settings"));
	wxFlexGridSizer* const choice_sizer = new wxFlexGridSizer(2, 5, 5);

	wxBoxSizer* const sensbarsens_sizer = new wxBoxSizer(wxHORIZONTAL);
	sensbarsens_sizer->Add(WiiSensBarSensMinText, 0, wxALIGN_CENTER_VERTICAL);
	sensbarsens_sizer->Add(WiiSensBarSens);
	sensbarsens_sizer->Add(WiiSensBarSensMaxText, 0, wxALIGN_CENTER_VERTICAL);

	wxBoxSizer* const spkvol_sizer = new wxBoxSizer(wxHORIZONTAL);
	spkvol_sizer->Add(WiimoteSpkVolumeMinText, 0, wxALIGN_CENTER_VERTICAL);
	spkvol_sizer->Add(WiimoteSpkVolume);
	spkvol_sizer->Add(WiimoteSpkVolumeMaxText, 0, wxALIGN_CENTER_VERTICAL);

	choice_sizer->Add(WiiSensBarPosText, 0, wxALIGN_CENTER_VERTICAL);
	choice_sizer->Add(WiiSensBarPos);
	choice_sizer->Add(WiiSensBarSensText, 0, wxALIGN_CENTER_VERTICAL);
	choice_sizer->Add(sensbarsens_sizer);
	choice_sizer->Add(WiimoteSpkVolumeText, 0, wxALIGN_CENTER_VERTICAL);
	choice_sizer->Add(spkvol_sizer);

	wxGridSizer* const general_wiimote_sizer = new wxGridSizer(1, 5, 5);
	general_wiimote_sizer->Add(WiimoteMotor);

	general_sizer->Add(choice_sizer);
	general_sizer->Add(general_wiimote_sizer);


	// Dialog layout
	main_sizer->Add(wiimote_group, 0, wxEXPAND | wxALL, 5);
	main_sizer->Add(bb_group, 0, wxEXPAND | wxALL, 5);
	main_sizer->Add(real_wiimotes_group, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	main_sizer->Add(general_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);

	Bind(wxEVT_BUTTON, &WiimoteConfigDiag::Save, this, wxID_OK);
	Bind(wxEVT_BUTTON, &WiimoteConfigDiag::Cancel, this, wxID_CANCEL);

	SetSizerAndFit(main_sizer);
	Center();
}
Example #11
0
void ConfigDialog::CreateControls()
{
	wxNotebook *book = new wxNotebook(this, wxID_ANY);

	// panel 1
	wxPanel *panel1 = new wxPanel(book);
	book->AddPage(panel1, "General");

	txtOutputPath = new wxTextCtrl(panel1, wxID_ANY, "");
	dropDevices = new wxChoice(panel1, wxID_ANY);
	numClockFreq = new wxSpinCtrl(panel1, wxID_ANY);
	listOptimization = new wxChoice(panel1, wxID_ANY);
	txtOtherOptions = new wxTextCtrl(panel1, wxID_ANY, "");
	txtCOptions = new wxTextCtrl(panel1, wxID_ANY, "");
	txtCPPOptions = new wxTextCtrl(panel1, wxID_ANY, "");
	txtSOptions = new wxTextCtrl(panel1, wxID_ANY, "");

	chkUnsignedChars = new wxCheckBox(panel1, wxID_ANY, "Unsigned Chars (-funsigned-char)");
	chkUnsignedBitfields = new wxCheckBox(panel1, wxID_ANY, "Unsigned Bitfields (-funsigned-bitfields)");
	chkPackStructureMembers = new wxCheckBox(panel1, wxID_ANY, "Pack Structure Members (-fpack-struct)");
	chkShortEnums = new wxCheckBox(panel1, wxID_ANY, "Short Enums (-fshort-enums)");
	chkFunctionSections = new wxCheckBox(panel1, wxID_ANY, "Function Sections (-function-sections)");
	chkDataSections = new wxCheckBox(panel1, wxID_ANY, "Data Sections (-fdata-sections)");

	burnerPanel = new BurnerPanel(project, panel1);

	// panel 1 layout
	wxBoxSizer *sizerPanel1 = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer *topSizerPanel1 = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer *rightSizerPanel1 = new wxBoxSizer(wxVERTICAL);
	wxFlexGridSizer *gridszr1Panel1 = new wxFlexGridSizer(2, 5, 5);
	wxFlexGridSizer *gridszr2Panel1 = new wxFlexGridSizer(2, 5, 5);
	wxStaticBoxSizer *szrBurnerPanel1 = new wxStaticBoxSizer(wxVERTICAL, panel1, "AVRDUDE Command Builder");

	szrBurnerPanel1->Add(burnerPanel, 1, wxEXPAND|wxALL, 5);

	gridszr1Panel1->Add(new wxStaticText(panel1, wxID_ANY, "Output Path:"), 0, wxALIGN_RIGHT);
	gridszr1Panel1->Add(txtOutputPath, 0, wxEXPAND);
	gridszr1Panel1->Add(new wxStaticText(panel1, wxID_ANY, "Device:"), 0, wxALIGN_RIGHT);
	gridszr1Panel1->Add(dropDevices, 0, wxEXPAND);
	gridszr1Panel1->Add(new wxStaticText(panel1, wxID_ANY, "Clock Freq (Hz):"), 0, wxALIGN_RIGHT);
	gridszr1Panel1->Add(numClockFreq, 0, wxEXPAND);
	gridszr1Panel1->Add(new wxStaticText(panel1, wxID_ANY, "Optimization:"), 0, wxALIGN_RIGHT);
	gridszr1Panel1->Add(listOptimization, 0, wxEXPAND);

	gridszr2Panel1->AddGrowableCol(1);
	gridszr2Panel1->Add(new wxStaticText(panel1, wxID_ANY, "Other Options:"), 0, wxALIGN_RIGHT);
	gridszr2Panel1->Add(txtOtherOptions, 1, wxEXPAND);
	gridszr2Panel1->Add(new wxStaticText(panel1, wxID_ANY, "C Only Options:"), 0, wxALIGN_RIGHT);
	gridszr2Panel1->Add(txtCOptions, 1, wxEXPAND);
	gridszr2Panel1->Add(new wxStaticText(panel1, wxID_ANY, "CPP Only Options:"), 0, wxALIGN_RIGHT);
	gridszr2Panel1->Add(txtCPPOptions, 1, wxEXPAND);
	gridszr2Panel1->Add(new wxStaticText(panel1, wxID_ANY, "S Only Options:"), 0, wxALIGN_RIGHT);
	gridszr2Panel1->Add(txtSOptions, 1, wxEXPAND);

	//rightSizerPanel1->Add(new wxStaticText(panel1, wxID_ANY, "Options:"), 0, wxALIGN_CENTER_HORIZONTAL);
	rightSizerPanel1->Add(chkUnsignedChars, 0, wxEXPAND|wxBOTTOM, 5);
	rightSizerPanel1->Add(chkUnsignedBitfields, 0, wxEXPAND|wxBOTTOM, 5);
	rightSizerPanel1->Add(chkPackStructureMembers, 0, wxEXPAND|wxBOTTOM, 5);
	rightSizerPanel1->Add(chkShortEnums, 0, wxEXPAND|wxBOTTOM, 5);
	rightSizerPanel1->Add(chkFunctionSections, 0, wxEXPAND|wxBOTTOM, 5);
	rightSizerPanel1->Add(chkDataSections, 0, wxEXPAND);

	topSizerPanel1->Add(gridszr1Panel1, 0, wxEXPAND|wxALL, 5);
	topSizerPanel1->Add(rightSizerPanel1, 0, wxEXPAND|wxALL, 5);

	sizerPanel1->Add(topSizerPanel1, 0, wxEXPAND|wxALL, 5);
	sizerPanel1->Add(gridszr2Panel1, 0, wxEXPAND|wxALL, 5);
	sizerPanel1->Add(szrBurnerPanel1, 0, wxEXPAND|wxALL, 5);

	panel1->SetSizerAndFit(sizerPanel1);


	// panel 2 (a, b)
	wxNotebook *panel2book = new wxNotebook(book, wxID_ANY);
	book->AddPage(panel2book, "Include Dir");

	// panel 2a
	wxPanel *panel2a = new wxPanel(panel2book);
	panel2book->AddPage(panel2a, "Include Path");
	listIncludePaths = new wxListBox(panel2a, ID_INCLUDE_PATH);
	btnIncDirAdd = new wxButton(panel2a, ID_INCLUDE_PATH_ADD, "Add");
	//btnIncPathMoveUp = new wxButton(panel2a, wxID_ANY, "Move Up");
	//btnIncPathMoveDown = new wxButton(panel2a, wxID_ANY, "Move Down");

	// panel 2a layout
	wxBoxSizer *sizerPanel2a = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer *btnSizerPanel2a = new wxBoxSizer(wxHORIZONTAL);

	btnSizerPanel2a->Add(btnIncDirAdd, 0, wxEXPAND|wxRIGHT, 5);
	//btnSizerPanel2a->Add(btnIncPathMoveUp, 0, wxEXPAND|wxRIGHT, 5);
	//btnSizerPanel2a->Add(btnIncPathMoveDown, 0, wxEXPAND|wxRIGHT, 5);

	sizerPanel2a->Add(listIncludePaths, 1, wxEXPAND|wxALL, 5);
	sizerPanel2a->Add(btnSizerPanel2a, 0, wxEXPAND|wxALL, 5);

	panel2a->SetSizerAndFit(sizerPanel2a);

	// panel 2b
	wxPanel *panel2b = new wxPanel(panel2book);
	panel2book->AddPage(panel2b, "Library Path");
	listLibraryPaths = new wxListBox(panel2b, ID_LIBRARY_PATH);
	btnLibDirAdd = new wxButton(panel2b, ID_LIBRARY_PATH_ADD, "Add");
	//btnLibPathMoveUp = new wxButton(panel2b, wxID_ANY, "Move Up");
	//btnLibPathMoveDown = new wxButton(panel2b, wxID_ANY, "Move Down");

	// panel 2b layout
	wxBoxSizer *sizerPanel2b = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer *btnSizerPanel2b = new wxBoxSizer(wxHORIZONTAL);

	btnSizerPanel2b->Add(btnLibDirAdd, 0, wxEXPAND|wxRIGHT, 5);
	//btnSizerPanel2b->Add(btnLibPathMoveUp, 0, wxEXPAND|wxRIGHT, 5);
	//btnSizerPanel2b->Add(btnLibPathMoveDown, 0, wxEXPAND|wxRIGHT, 5);

	sizerPanel2b->Add(listLibraryPaths, 1, wxEXPAND|wxALL, 5);
	sizerPanel2b->Add(btnSizerPanel2b, 0, wxEXPAND|wxALL, 5);

	panel2b->SetSizerAndFit(sizerPanel2b);

	// panel 3
	wxPanel *panel3 = new wxPanel(book);
	book->AddPage(panel3, "Libraries");
	listAvailLibs = new wxListBox(panel3, wxID_ANY);
	listLinkObj = new wxListBox(panel3, wxID_ANY);
	txtLinkerOptions = new wxTextCtrl(panel3, wxID_ANY, "");
	btnAddLib = new wxButton(panel3, wxID_ANY, "Add ->");
	btnAddLibFile = new wxButton(panel3, wxID_ANY, "Add File ->");
	btnLibRemove = new wxButton(panel3, wxID_ANY, "Remove");

	// panel 3 layout
	wxBoxSizer *sizerPanel3 = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer *topSizerPanel3 = new wxBoxSizer(wxHORIZONTAL);
	wxStaticBoxSizer *leftSizerPanel3 = new wxStaticBoxSizer(wxVERTICAL, panel3, "Available Link Objects");
	wxStaticBoxSizer *rightSizerPanel3 = new wxStaticBoxSizer(wxVERTICAL, panel3, "Included");
	wxStaticBoxSizer *bottonSizerPanel3 = new wxStaticBoxSizer(wxVERTICAL, panel3, "Linker Options:");
	wxBoxSizer *btnSizerPanel3 = new wxBoxSizer(wxVERTICAL);

	leftSizerPanel3->Add(listAvailLibs, 1, wxEXPAND|wxALL, 5);
	rightSizerPanel3->Add(listLinkObj, 1, wxEXPAND|wxALL, 5);
	bottonSizerPanel3->Add(txtLinkerOptions, 0, wxEXPAND|wxALL, 5);

	btnSizerPanel3->Add(btnAddLib, 0, wxEXPAND|wxBOTTOM, 5);
	btnSizerPanel3->Add(btnAddLibFile, 0, wxEXPAND|wxBOTTOM, 5);
	btnSizerPanel3->Add(btnLibRemove, 0, wxEXPAND|wxBOTTOM, 5);

	topSizerPanel3->Add(leftSizerPanel3, 1, wxEXPAND|wxALL, 5);
	topSizerPanel3->Add(btnSizerPanel3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
	topSizerPanel3->Add(rightSizerPanel3, 2, wxEXPAND|wxALL, 5);

	sizerPanel3->Add(topSizerPanel3, 1, wxEXPAND|wxALL, 5);
	sizerPanel3->Add(bottonSizerPanel3, 0, wxEXPAND|wxALL, 5);
	panel3->SetSizerAndFit(sizerPanel3);


	// main layout
	wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
	sizer->Add(book, 1, wxEXPAND|wxALL, 5);
	sizer->AddSpacer(5);
	sizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT, 10);
	SetSizerAndFit(sizer);
}
mxProfile::mxProfile(wxWindow *parent):wxDialog(parent,wxID_ANY,_Z("Opciones del Lenguaje"),wxDefaultPosition,wxDefaultSize),old_config(LS_INIT) {
	
	text=NULL; // para que no procese el evento de seleccion al crear la lista
	
	old_config=config->lang;
	old_profile=config->profile;
	
	wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
	
	wxBoxSizer *search_sizer = new wxBoxSizer(wxHORIZONTAL);
	search=new wxTextCtrl(this,wxID_FIND,"");
	search_sizer->Add(new wxStaticText(this,wxID_ANY,_Z("Buscar: ")),wxSizerFlags().Center());
	search_sizer->Add(search,wxSizerFlags().Proportion(1).Expand());
	
	sizer->Add(search_sizer,wxSizerFlags().Proportion(0).Expand().Border(wxALL,5));
	
	wxBoxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL);

	wxDir dir(config->profiles_dir);
	if ( dir.IsOpened() ) {
		wxString filename;
		wxString spec;
		bool cont = dir.GetFirst(&filename, spec , wxDIR_FILES);
		while ( cont ) {
			perfiles.Add(filename);
			cont = dir.GetNext(&filename);
		}
	}
	perfiles.Sort(comp_nocase);
	for(unsigned int i=0;i<perfiles.GetCount();i++) { 
		LangSettings l(LS_INIT); l.Load(DIR_PLUS_FILE(config->profiles_dir,perfiles[i]));
		descripciones.Add(l.descripcion.c_str());
	}
	
	list = new wxListCtrl(this,wxID_ANY,wxDefaultPosition,wxSize(250,250),wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL);
	list->InsertColumn(0,_Z("Perfil"));
	wxImageList *iml = new wxImageList(24,24,true);
	wxBitmap noimage(DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),"null.png"),wxBITMAP_TYPE_PNG);
	for(unsigned int i=0;i<perfiles.GetCount();i++) {
		wxString ficon=DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),perfiles[i]+".png");
		if (wxFileName::FileExists(ficon))
			iml->Add(wxBitmap(ficon,wxBITMAP_TYPE_PNG));
		else
			iml->Add(noimage);
	}
	iml->Add(wxBitmap(DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),"personalizado.png"),wxBITMAP_TYPE_PNG));
	list->AssignImageList(iml,wxIMAGE_LIST_SMALL);
	
	Search();
	
	text = new wxTextCtrl(this,wxID_ANY,_T(""),wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY);
	LoadProfile();
	
	wxButton *options_button = new mxBitmapButton (this, wxID_ABOUT, bitmaps->buttons.next, _Z("Personalizar..."));
	wxButton *ok_button = new mxBitmapButton (this, wxID_OK, bitmaps->buttons.ok, _Z("Aceptar"));
	wxButton *cancel_button = new mxBitmapButton (this, wxID_CANCEL, bitmaps->buttons.cancel, _Z("Cancelar"));
	button_sizer->Add(options_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand());
	button_sizer->AddStretchSpacer(1);
	button_sizer->Add(cancel_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand());
	button_sizer->Add(ok_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand());
	
	sizer->Add(new wxStaticText(this,wxID_ANY,_Z(" Seleccione un perfil para configurar las reglas de su pseudocódigo:  ")),wxSizerFlags().Expand().Proportion(0).Border(wxTOP,5));
	sizer->Add(list,wxSizerFlags().Expand().Proportion(2).FixedMinSize());
	sizer->Add(new wxStaticText(this,wxID_ANY,_Z("")),wxSizerFlags().Expand().Proportion(0));
	sizer->Add(new wxStaticText(this,wxID_ANY,_Z(" Descripción del perfil seleccionado:")),wxSizerFlags().Expand().Proportion(0));
	sizer->Add(text,wxSizerFlags().Expand().Proportion(1).FixedMinSize());
	sizer->Add(new wxStaticText(this,wxID_ANY,""),wxSizerFlags().Expand().Proportion(0));
	sizer->Add(button_sizer,wxSizerFlags().Expand().Proportion(0));
	
	ok_button->SetDefault();
	SetEscapeId(wxID_CANCEL);
	
	SetSizerAndFit(sizer);
	
	this->Layout(); // para ajustar el tamaño de la columna de la lista
	list->SetColumnWidth(0,list->GetSize().GetWidth()-32);
	
	search->SetFocus();
	
	ShowModal();
}
Example #13
0
void TAdjuster::Set(const TUniformList& uniforms)
{
    bool shown = IsShown();
    if (shown)
        Hide();

    // Remove the old controls.
    for (wxWindowListNode* node = GetChildren().GetFirst(); node;) {
        wxWindow* current = node->GetData();
        node = node->GetNext();
        delete current;
    }
    GetChildren().Clear();
    sliders.clear();

    // Work around a problem with Fit() by resizing to bigger than need be.
    SetSize(500, 500);

    // Create a new vertical layout and iterate through each adjustustable uniform.
    wxBoxSizer* vertical = new wxBoxSizer(wxVERTICAL);
    bool empty = true;
    for (TUniformList::const_iterator u = uniforms.begin(); u != uniforms.end(); ++u) {
        if (u->IsColor()) {
            empty = false;
            wxBoxSizer* horizontal = new wxBoxSizer(wxHORIZONTAL);
            wxButton* button = new wxButton(this, -1, "", wxDefaultPosition);
            button->SetBackgroundColour(u->GetColor());
            wxStaticText* label = new wxStaticText(this, -1, u->GetName(), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
            horizontal->Add(label, 0, wxALIGN_CENTRE_VERTICAL, 5);
            horizontal->Add(button, 1, wxALIGN_CENTRE_VERTICAL | wxEXPAND | wxALL, 5);
            vertical->Add(horizontal, 1, wxEXPAND | wxALL, 10);

            // Add this to the id-uniform map.
            pickers[button->GetId()] = const_cast<TUniform*>(&*u);
            continue;
        }

        if (!u->HasSlider())
            continue;

        // Insert a label-slider pair using a horizontal layout.
        empty = false;
        wxBoxSizer* horizontal = new wxBoxSizer(wxHORIZONTAL);
        wxStaticText* label = new wxStaticText(this, -1, u->GetName(), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
        horizontal->Add(label, 0, wxALIGN_CENTRE_VERTICAL, 5);

        for (int i = 0; i < u->NumComponents(); ++i) {
            float value = u->GetSlider(i) * MaxSliderValue;
            wxSlider* slider = new wxSlider(this, -1, (int) value, 1, MaxSliderValue);
            horizontal->Add(slider, 1, wxALIGN_CENTRE_VERTICAL | wxEXPAND | wxALL, 5);
            sliders[slider->GetId()] = TUniformComponent(const_cast<TUniform*>(&*u), i);
        }

        vertical->Add(horizontal, 1, wxEXPAND | wxALL, 10);
    }

    if (empty) {
        wxStaticText* label = new wxStaticText(this, -1, "The current shader does not have any adjustable uniforms.", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
        vertical->Add(label, 1, wxEXPAND | wxALL, 10);
    }

    SetSizerAndFit(vertical, true);

    if (shown)
        Show();
}
Example #14
0
CorrelParamsFrame::CorrelParamsFrame(const CorrelParams& correl_params,
																		 GdaVarTools::Manager& var_man,
																		 Project* project_)
: wxFrame((wxWindow*) 0, wxID_ANY, "Correlogram Parameters",
					wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE),
CorrelParamsObservable(correl_params, var_man), project(project_),
var_txt(0), var_choice(0), dist_txt(0), dist_choice(0), bins_txt(0),
bins_spn_ctrl(0), thresh_cbx(0), thresh_tctrl(0), thresh_slider(0),
all_pairs_rad(0), est_pairs_txt(0), est_pairs_num_txt(0),
rand_samp_rad(0), max_iter_txt(0), max_iter_tctrl(0),
help_btn(0), apply_btn(0)
{
	LOG_MSG("Entering CorrelParamsFrame::CorrelParamsFrame");
	
	wxPanel* panel = new wxPanel(this);
	panel->SetBackgroundColour(*wxWHITE);
	SetBackgroundColour(*wxWHITE);
	{
		var_txt = new wxStaticText(panel, XRCID("ID_VAR_TXT"), "Variable:");
		var_choice = new wxChoice(panel, XRCID("ID_VAR_CHOICE"), wxDefaultPosition,wxSize(160,-1));
		wxString var_nm = "";
		if (var_man.GetVarsCount() > 0)
            var_nm = var_man.GetName(0);
		UpdateVarChoiceFromTable(var_nm);
        Connect(XRCID("ID_VAR_CHOICE"), wxEVT_CHOICE, wxCommandEventHandler(CorrelParamsFrame::OnVarChoiceSelected));
	}
	wxBoxSizer* var_h_szr = new wxBoxSizer(wxHORIZONTAL);
	var_h_szr->Add(var_txt, 0, wxALIGN_CENTER_VERTICAL);
	var_h_szr->AddSpacer(5);
	var_h_szr->Add(var_choice, 0, wxALIGN_CENTER_VERTICAL);
	
	dist_txt = new wxStaticText(panel, XRCID("ID_DIST_TXT"), "Distance:");
	dist_choice = new wxChoice(panel, XRCID("ID_DIST_CHOICE"), wxDefaultPosition, wxSize(160,-1));
	dist_choice->Append("Euclidean Distance");
	dist_choice->Append("Arc Distance (mi)");
	dist_choice->Append("Arc Distance (km)");
	if (correl_params.dist_metric == WeightsMetaInfo::DM_arc) {
		if (correl_params.dist_units == WeightsMetaInfo::DU_km) {
			dist_choice->SetSelection(2);
		} else {
			dist_choice->SetSelection(1);
		}
	} else {
		dist_choice->SetSelection(0);
	}
	Connect(XRCID("ID_DIST_CHOICE"), wxEVT_CHOICE, wxCommandEventHandler(CorrelParamsFrame::OnDistanceChoiceSelected));
	wxBoxSizer* dist_h_szr = new wxBoxSizer(wxHORIZONTAL);
	dist_h_szr->Add(dist_txt, 0, wxALIGN_CENTER_VERTICAL);
	dist_h_szr->AddSpacer(5);
	dist_h_szr->Add(dist_choice, 0, wxALIGN_CENTER_VERTICAL);
	
	{
		bins_txt = new wxStaticText(panel, XRCID("ID_BINS_TXT"), "Number Bins:");
		wxString vs;
		vs << correl_params.bins;
		bins_spn_ctrl = new wxSpinCtrl(panel, XRCID("ID_BINS_SPN_CTRL"), vs,  wxDefaultPosition, wxSize(75,-1),  wxSP_ARROW_KEYS | wxTE_PROCESS_ENTER,  CorrelParams::min_bins_cnst, CorrelParams::max_bins_cnst, correl_params.bins);
		Connect(XRCID("ID_BINS_SPN_CTRL"), wxEVT_SPINCTRL, wxSpinEventHandler(CorrelParamsFrame::OnBinsSpinEvent));
		Connect(XRCID("ID_BINS_SPN_CTRL"), wxEVT_TEXT_ENTER, wxCommandEventHandler(CorrelParamsFrame::OnBinsTextCtrl));
	}
	wxBoxSizer* bins_h_szr = new wxBoxSizer(wxHORIZONTAL);
	bins_h_szr->Add(bins_txt, 0, wxALIGN_CENTER_VERTICAL);
	bins_h_szr->AddSpacer(5);
	bins_h_szr->Add(bins_spn_ctrl, 0, wxALIGN_CENTER_VERTICAL);
	
	thresh_cbx = new wxCheckBox(panel, XRCID("ID_THRESH_CBX"), "Max Distance:");
	thresh_cbx->SetValue(false);
	thresh_tctrl = new wxTextCtrl(panel, XRCID("ID_THRESH_TCTRL"), "", wxDefaultPosition, wxSize(100,-1), wxTE_PROCESS_ENTER);
	thresh_tctrl->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
	thresh_tctrl->Enable(false);
	//UpdateThreshTctrlVal();
	Connect(XRCID("ID_THRESH_CBX"), wxEVT_CHECKBOX,
					wxCommandEventHandler(CorrelParamsFrame::OnThreshCheckBox));
	Connect(XRCID("ID_THRESH_TCTRL"), wxEVT_TEXT_ENTER,
					wxCommandEventHandler(CorrelParamsFrame::OnThreshTextCtrl));

	wxBoxSizer* thresh_h_szr = new wxBoxSizer(wxHORIZONTAL);
	thresh_h_szr->Add(thresh_cbx, 0, wxALIGN_CENTER_VERTICAL);
	thresh_h_szr->AddSpacer(5);
	thresh_h_szr->Add(thresh_tctrl, 0, wxALIGN_CENTER_VERTICAL);
	thresh_slider = new wxSlider(panel, XRCID("ID_THRESH_SLDR"),
															 sldr_tcks/2, 0, sldr_tcks,
															 wxDefaultPosition, wxSize(180,-1));
	Connect(XRCID("ID_THRESH_SLDR"), wxEVT_SLIDER,
					wxCommandEventHandler(CorrelParamsFrame::OnThreshSlider));
	thresh_slider->Enable(false);
	wxBoxSizer* thresh_sld_h_szr = new wxBoxSizer(wxHORIZONTAL);
	thresh_sld_h_szr->Add(thresh_slider, 0, wxALIGN_CENTER_VERTICAL);
	wxBoxSizer* thresh_v_szr = new wxBoxSizer(wxVERTICAL);
	thresh_v_szr->Add(thresh_h_szr, 0, wxBOTTOM, 5);
	thresh_v_szr->Add(thresh_sld_h_szr, 0, wxALIGN_CENTER_HORIZONTAL);
	
	all_pairs_rad = new wxRadioButton(panel, XRCID("ID_ALL_PAIRS_RAD"), "All Pairs", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_VERTICAL | wxRB_GROUP);
	all_pairs_rad->SetValue(correl_params.method == CorrelParams::ALL_PAIRS);
	Connect(XRCID("ID_ALL_PAIRS_RAD"), wxEVT_RADIOBUTTON, wxCommandEventHandler(CorrelParamsFrame::OnAllPairsRadioSelected));
    
	est_pairs_txt = new wxStaticText(panel, XRCID("ID_EST_PAIRS_TXT"), "Estimated Pairs:");
	est_pairs_num_txt = new wxStaticText(panel, XRCID("ID_EST_PAIRS_NUM_TXT"), "4,000,000");
	wxBoxSizer* est_pairs_h_szr = new wxBoxSizer(wxHORIZONTAL);
	est_pairs_h_szr->Add(est_pairs_txt, 0, wxALIGN_CENTER_VERTICAL);
	est_pairs_h_szr->AddSpacer(5);
	est_pairs_h_szr->Add(est_pairs_num_txt, 0, wxALIGN_CENTER_VERTICAL);
	wxBoxSizer* all_pairs_v_szr = new wxBoxSizer(wxVERTICAL);
	all_pairs_v_szr->Add(all_pairs_rad);
	all_pairs_v_szr->AddSpacer(2);
	all_pairs_v_szr->Add(est_pairs_h_szr, 0, wxLEFT, 18);
	
	rand_samp_rad = new wxRadioButton(panel, XRCID("ID_RAND_SAMP_RAD"), "Random Sample", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_VERTICAL);
	rand_samp_rad->SetValue(correl_params.method != CorrelParams::ALL_PAIRS);
	Connect(XRCID("ID_RAND_SAMP_RAD"), wxEVT_RADIOBUTTON, wxCommandEventHandler(CorrelParamsFrame::OnRandSampRadioSelected));
	max_iter_txt = new wxStaticText(panel, XRCID("ID_MAX_ITER_TXT"), "Sample Size:");
	{
		wxString vs;
		vs << correl_params.max_iterations;
		max_iter_tctrl = new wxTextCtrl(panel, XRCID("ID_MAX_ITER_TCTRL"), vs, wxDefaultPosition, wxSize(100,-1), wxTE_PROCESS_ENTER);
		max_iter_tctrl->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
		Connect(XRCID("ID_MAX_ITER_TCTRL"), wxEVT_TEXT_ENTER, wxCommandEventHandler(CorrelParamsFrame::OnMaxIterTextCtrl));
	}
	wxBoxSizer* max_iter_h_szr = new wxBoxSizer(wxHORIZONTAL);
	max_iter_h_szr->Add(max_iter_txt, 0, wxALIGN_CENTER_VERTICAL);
	max_iter_h_szr->AddSpacer(8);
	max_iter_h_szr->Add(max_iter_tctrl, 0, wxALIGN_CENTER_VERTICAL);
	wxBoxSizer* rand_samp_v_szr = new wxBoxSizer(wxVERTICAL);
	rand_samp_v_szr->Add(rand_samp_rad);
	rand_samp_v_szr->AddSpacer(2);
	rand_samp_v_szr->Add(max_iter_h_szr, 0, wxLEFT, 18);
		
	help_btn = new wxButton(panel, XRCID("ID_HELP_BTN"), "Help", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
	apply_btn = new wxButton(panel, XRCID("ID_APPLY_BTN"), "Apply", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
	Connect(XRCID("ID_HELP_BTN"), wxEVT_BUTTON, wxCommandEventHandler(CorrelParamsFrame::OnHelpBtn));
	Connect(XRCID("ID_APPLY_BTN"), wxEVT_BUTTON, wxCommandEventHandler(CorrelParamsFrame::OnApplyBtn));
	wxBoxSizer* btns_h_szr = new wxBoxSizer(wxHORIZONTAL);
	btns_h_szr->Add(help_btn, 0, wxALIGN_CENTER_VERTICAL);
	btns_h_szr->AddSpacer(15);
	btns_h_szr->Add(apply_btn, 0, wxALIGN_CENTER_VERTICAL);
	
	UpdateEstPairs();
	
	// Arrange above widgets in panel using sizers.
	// Top level panel sizer will be panel_h_szr
	// Below that will be panel_v_szr
	// panel_v_szr will directly receive widgets
	
	wxBoxSizer* panel_v_szr = new wxBoxSizer(wxVERTICAL);
	panel_v_szr->Add(var_h_szr, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	panel_v_szr->AddSpacer(2);
	panel_v_szr->Add(dist_h_szr, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	panel_v_szr->AddSpacer(3);
	panel_v_szr->Add(bins_h_szr, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	panel_v_szr->AddSpacer(3);
	panel_v_szr->Add(thresh_v_szr, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	panel_v_szr->Add(all_pairs_v_szr, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	panel_v_szr->AddSpacer(5);
	panel_v_szr->Add(rand_samp_v_szr, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	panel_v_szr->AddSpacer(10);
	panel_v_szr->Add(btns_h_szr, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	
	wxBoxSizer* panel_h_szr = new wxBoxSizer(wxHORIZONTAL);
	panel_h_szr->Add(panel_v_szr, 1, wxEXPAND);
	panel->SetSizer(panel_h_szr);
	
	// Top Sizer for Frame
	wxBoxSizer* top_h_sizer = new wxBoxSizer(wxHORIZONTAL);
	top_h_sizer->Add(panel, 1, wxEXPAND|wxALL, 8);
	
	SetSizerAndFit(top_h_sizer);
	
	wxCommandEvent ev;
    if (project->GetNumRecords() > 5000)
        OnRandSampRadioSelected(ev);
    else
        OnAllPairsRadioSelected(ev);
        
    Show(true);
	LOG_MSG("Exiting CorrelParamsFrame::CorrelParamsFrame");
}
MusikTagFrame::MusikTagFrame( wxFrame* pParent, CPlaylistCtrl * pPlaylistctrl, int nCurFrame)
	: wxFrame ( pParent, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER|wxCAPTION | wxTAB_TRAVERSAL | wxFRAME_FLOAT_ON_PARENT | wxFRAME_NO_TASKBAR )
	, m_Songs(pPlaylistctrl->Playlist())
{
	pPlaylistctrl->GetSelItems(m_arrSongsSelected);

	m_bDirty = false;
	//---------------//
 	//--- colours ---//
	//---------------//
	static wxColour cBtnFace = wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE );
	this->SetBackgroundColour ( cBtnFace );

	//------------//
	//--- icon ---//
	//------------//
	#if defined (__WXMSW__)
		SetIcon( wxICON( musicbox ) );
	#endif

	//----------------------------//
	//--- initialize variables ---//
	//----------------------------//
	m_WriteTag	= false;
	m_Close		= false;
	nFrame		= nCurFrame;
	
	
	//--- if there is only 1 song selected, setup for single edit mode ---//
	if ( m_arrSongsSelected.GetCount() <= 1 )
	{
		m_EditType = MUSIK_TAG_SINGLE;
	}
	//--- more than 1 song, setup for batch edit mode ---//
	else 
	{
		m_EditType = MUSIK_TAG_MULTIPLE;
	}

	//-----------------//
	//--- set title ---//
	//-----------------//
	SetCaption();

    nIndex = m_arrSongsSelected[0];


	//---------------//
	//--- objects ---//
	//---------------//
	wxStaticText *stFilename	=	new wxStaticText	( this, -1, _("File"));
	tcFilename					=	new wxTextCtrl		( this, -1,	wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY );

	wxStaticText *stTitle		=	new wxStaticText	( this, -1, _("Title"));
	tcTitle						=	new wxTextCtrl		( this, MUSIK_TAG_TITLE, wxT(""));
	chkTitle					=	new wxCheckBox		( this, MUSIK_TAG_CHK_TITLE, wxT("")); 
	
	wxStaticText *stTrackNum	=	new wxStaticText	( this, -1, _("Track #  "));
	tcTrackNum					=	new wxTextCtrl		( this, MUSIK_TAG_TRACKNUM,	wxT(""));
	chkTrackNum					=	new wxCheckBox		( this, MUSIK_TAG_CHK_TRACKNUM,	wxT(""));
    chkIncrementalTrackNum		=	new wxCheckBox		( this, -1,	wxT("Incremental Tracknumbers"));

	wxStaticText *stArtist		=	new wxStaticText	( this, -1, _("Artist"));
	tcArtist					=	new wxTextCtrl		( this, MUSIK_TAG_ARTIST, wxT(""));
	chkArtist					=	new wxCheckBox		( this, MUSIK_TAG_CHK_ARTIST,	wxT(""));

	wxStaticText *stAlbum		=	new wxStaticText	( this, -1, _("Album"));
	tcAlbum						=	new wxTextCtrl		( this, MUSIK_TAG_ALBUM, wxT(""));
	chkAlbum					=	new wxCheckBox		( this, MUSIK_TAG_CHK_ALBUM, wxT(""));

	wxStaticText *stGenre		=	new wxStaticText	( this, -1, _("Genre"));
	cmbGenre					=	new wxComboBox		( this, MUSIK_TAG_GENRE, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN );
	chkGenre					=	new wxCheckBox		( this, MUSIK_TAG_CHK_GENRE, wxT(""));

	wxStaticText *stYear		=	new wxStaticText	( this, -1, _("Year  "),	wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
	tcYear						=	new wxTextCtrl		( this, MUSIK_TAG_YEAR,	wxT(""));
	chkYear						=	new wxCheckBox		( this, MUSIK_TAG_CHK_YEAR,	wxT(""));

	wxStaticText *stNotes		=	new wxStaticText	( this, -1, _("Notes "),	wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
	tcNotes						=	new wxTextCtrl		( this, MUSIK_TAG_NOTES,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE);
	chkNotes					=	new wxCheckBox		( this, MUSIK_TAG_CHK_NOTES,wxT(""));

	chkWriteTag					=	new wxCheckBox		( this, MUSIK_TAG_CHK_WRITETAG, _("Write tags to file    "));
	chkClear					=	new wxCheckBox		( this, MUSIK_TAG_CHK_WRITETAG_CLEAR, _("Clear old tags    "));
	chkRename					=	new wxCheckBox		( this, MUSIK_TAG_CHK_RENAME, _("Rename files"));

	gProgress					=	new wxGauge			( this, -1, 100, wxDefaultPosition, wxSize( -1, 18 ), wxGA_SMOOTH );

	btnNext		= new wxButton( this, MUSIK_TAG_NEXT,	wxT(">"),		wxDefaultPosition, wxDefaultSize ,wxBU_EXACTFIT);
	btnPrev		= new wxButton( this, MUSIK_TAG_PREV,	wxT("<"),		wxDefaultPosition,wxDefaultSize ,wxBU_EXACTFIT);
	btnCancel	= new wxButton( this, MUSIK_TAG_CANCEL,	_("Cancel"));
	btnApply	= new wxButton( this, MUSIK_TAG_APPLY,	_("Apply")	);
	btnOK		= new wxButton( this, MUSIK_TAG_OK,		_("OK")	);


	//-------------------------//
	//---  top row sizer    ---//
	//---      filename     ---//
	//-------------------------//
	wxBoxSizer* hsRow0 = new wxBoxSizer( wxHORIZONTAL );
	hsRow0->Add( stFilename,		0, wxCENTER			);
	hsRow0->Add( tcFilename,		1, wxEXPAND			);

	//-------------------------//
	//---  first row sizer  ---//
	//--- title, track, num ---//
	//-------------------------//
	wxBoxSizer* hsRow1 = new wxBoxSizer( wxHORIZONTAL );
    hsRow1->Add( chkTitle,		0, wxALIGN_CENTER_VERTICAL |wxRIGHT| wxLEFT, 2	);
	hsRow1->Add( stTitle,		0, wxALIGN_CENTER_VERTICAL| wxRIGHT, 2	);
	hsRow1->Add( tcTitle,		1, wxALIGN_CENTER_VERTICAL| wxRIGHT, 2	);
    hsRow1->Add( chkTrackNum,	0, wxALIGN_CENTER_VERTICAL |wxRIGHT| wxLEFT, 2	);
	hsRow1->Add( stTrackNum,	0, wxALIGN_CENTER_VERTICAL| wxRIGHT, 2	);
    {
        wxBoxSizer* hsCol = new wxBoxSizer( wxVERTICAL );
	    hsCol->Add( tcTrackNum,	0);
        hsCol->Add( chkIncrementalTrackNum,0,wxTOP,2);
        hsRow1->Add( hsCol,	0, wxALIGN_CENTER_VERTICAL| wxRIGHT, 2	);
    }
	//------------------------//
	//--- second row sizer ---//
	//---      artist      ---//
	//------------------------//
	wxBoxSizer* hsRow2 = new wxBoxSizer( wxHORIZONTAL	);
    hsRow2->Add( chkArtist,		0, wxCENTER | wxLEFT, 2 );
	hsRow2->Add( stArtist,		0, wxCENTER	| wxRIGHT, 2	);
	hsRow2->Add( tcArtist,		1, wxEXPAND	| wxRIGHT, 2	);

	//-----------------------//
	//--- third row sizer ---//
	//---      album      ---//
	//-----------------------//
	wxBoxSizer* hsRow3 = new wxBoxSizer( wxHORIZONTAL	);
    hsRow3->Add( chkAlbum,		0, wxCENTER |wxRIGHT| wxLEFT, 2	);
	hsRow3->Add( stAlbum,		0, wxCENTER	| wxRIGHT, 2	);
	hsRow3->Add( tcAlbum,		1, wxEXPAND	| wxRIGHT, 2	);

	//------------------------//
	//--- fourth row sizer ---//
	//---    genre, year   ---//
	//------------------------//
	wxBoxSizer* hsRow4 = new wxBoxSizer( wxHORIZONTAL	);
    hsRow4->Add( chkGenre,		0, wxCENTER |wxRIGHT| wxLEFT, 2	);
	hsRow4->Add( stGenre,		0, wxCENTER	| wxRIGHT, 2	);
	hsRow4->Add( cmbGenre,		1, wxEXPAND	| wxRIGHT, 2	);
    hsRow4->Add( chkYear,		0, wxCENTER |wxRIGHT| wxLEFT, 2	);
	hsRow4->Add( stYear,		0, wxCENTER	| wxRIGHT, 2	);
	hsRow4->Add( tcYear,		0, wxCENTER	| wxRIGHT, 2	);

	//-------------------------//
	//--- fifth row sizer   ---//
	//---    notes			---//
	//------------------------//
	wxBoxSizer* hsRow5 = new wxBoxSizer( wxHORIZONTAL	);
    hsRow5->Add( chkNotes,		0, wxCENTER |wxRIGHT| wxLEFT, 2	);
	hsRow5->Add( stNotes,		0, wxCENTER	| wxRIGHT, 2	);
	hsRow5->Add( tcNotes,		1, wxEXPAND	| wxRIGHT, 2	);

	//-----------------------//
	//--- sixth row sizer ---//
	//---  write to file   ---//
	//-----------------------//
	wxBoxSizer *hsRow6 = new wxBoxSizer( wxHORIZONTAL	);
    hsRow6->Add( chkRename,		0, wxTOP, 4	);
	hsRow6->Add( chkWriteTag,	0, wxTOP | wxLEFT, 4	);
	hsRow6->Add( chkClear,		0, wxTOP, 4	);

	//-----------------------//
	//--- seventh row sizer ---//
	//---    progress     ---//
	//-----------------------//
	hsRowProgress = new wxBoxSizer( wxHORIZONTAL	);
	hsRowProgress->Add( gProgress,	1, wxLEFT | wxRIGHT, 2 );

	//--------------------//
	//--- row 1 thru 6 ---//
	//--------------------//
	vsRows = new wxBoxSizer( wxVERTICAL );
	vsRows->Add( hsRow0,	0, wxEXPAND | wxALL, 4 );
	vsRows->Add( hsRow1,	0, wxEXPAND | wxALL, 4 );
	vsRows->Add( hsRow2,	0, wxEXPAND | wxALL, 4 );
	vsRows->Add( hsRow3,	0, wxEXPAND | wxALL, 4 );
	vsRows->Add( hsRow4,	0, wxEXPAND | wxALL, 4 );
	vsRows->Add( hsRow5,	1, wxEXPAND | wxALL, 4 );
	vsRows->Add( hsRow6,	0, wxADJUST_MINSIZE  | wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 16 );
	vsRows->Add( hsRowProgress,	0, wxEXPAND | wxBOTTOM, 2 );
	vsRows->Show( hsRowProgress, FALSE );

	//---------------------------//
	//--- system button sizer ---//
	//---     genre, year     ---//
	//---------------------------//
	hsNav = new wxBoxSizer( wxHORIZONTAL );
	hsNav->Add( btnCancel,	0, wxALIGN_LEFT | wxLEFT,			2	);
	hsNav->Add( -1,-1,	1, wxEXPAND								);
	hsNav->Add( btnPrev,	0, wxALIGN_LEFT|wxADJUST_MINSIZE		);
	hsNav->Add( btnNext,	0, wxALIGN_LEFT|wxADJUST_MINSIZE		);
	hsNav->Add( -1,-1,	1, wxEXPAND								);
	hsNav->Add( btnApply,	0, wxALIGN_RIGHT						);
	hsNav->Add( btnOK,		0, wxALIGN_RIGHT | wxLEFT | wxRIGHT, 2	);

	//-----------------//
	//--- top sizer ---//
	//-----------------//
	wxBoxSizer* vsTopSizer = new wxBoxSizer( wxVERTICAL );
	vsTopSizer->Add( vsRows,	1, wxEXPAND );
	vsTopSizer->Add( hsNav,		0, wxEXPAND | wxBOTTOM, 2 );

	//-------------------//
	//--- layout, etc ---//
	//-------------------//
	SetSizerAndFit( vsTopSizer );
	Layout();
	Centre();

	//-------------------//
	//--- other stuff ---//
	//-------------------//	
	// get genre from db
	wxArrayString arrGenre;
    wxGetApp().Library.GetAllOfColumn(g_PlaylistColumn[PlaylistColumn::GENRE], arrGenre);

	// add standard id3v1 genres to array
	for ( int i = 0; i < 148; i++ )
		arrGenre.Add(ConvFromUTF8( TagLib::ID3v1::genre(i).toCString(true)));
	// case sort first
	arrGenre.Sort();
	// eliminate  double entrys
	for ( size_t i = arrGenre.GetCount() - 1 ; i != (size_t)-1 ; i-- )	
	{
		if( i > 0 && arrGenre[i] == arrGenre[i-1])
			arrGenre.RemoveAt(i);
	}
	// no case sort
	arrGenre.Sort(NoCaseCompareFunc);
	cmbGenre->Append(arrGenre);

}
Example #16
0
EditProperties::EditProperties (Edit *edit,
                                long style)
        : wxDialog (edit, wxID_ANY, wxEmptyString,
                    wxDefaultPosition, wxDefaultSize,
                    style | wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {

    // sets the application title
    SetTitle (_("Properties"));
    wxString text;

    // fullname
    wxBoxSizer *fullname = new wxBoxSizer (wxHORIZONTAL);
    fullname->Add (10, 0);
    fullname->Add (new wxStaticText (this, wxID_ANY, _("Full filename"),
                                     wxDefaultPosition, wxSize(80, wxDefaultCoord)),
                   0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
    fullname->Add (new wxStaticText (this, wxID_ANY, edit->GetFilename()),
                   0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);

    // text info
    wxGridSizer *textinfo = new wxGridSizer (4, 0, 2);
    textinfo->Add (new wxStaticText (this, wxID_ANY, _("Language"),
                                     wxDefaultPosition, wxSize(80, wxDefaultCoord)),
                   0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
    textinfo->Add (new wxStaticText (this, wxID_ANY, edit->m_language->name),
                   0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
    textinfo->Add (new wxStaticText (this, wxID_ANY, _("Lexer-ID: "),
                                     wxDefaultPosition, wxSize(80, wxDefaultCoord)),
                   0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
    text = wxString::Format (wxT("%d"), edit->GetLexer());
    textinfo->Add (new wxStaticText (this, wxID_ANY, text),
                   0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
    wxString EOLtype = wxEmptyString;
    switch (edit->GetEOLMode()) {
        case wxSTC_EOL_CR: {EOLtype = wxT("CR (Unix)"); break; }
        case wxSTC_EOL_CRLF: {EOLtype = wxT("CRLF (Windows)"); break; }
        case wxSTC_EOL_LF: {EOLtype = wxT("CR (Macintosh)"); break; }
    }
    textinfo->Add (new wxStaticText (this, wxID_ANY, _("Line endings"),
                                     wxDefaultPosition, wxSize(80, wxDefaultCoord)),
                   0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
    textinfo->Add (new wxStaticText (this, wxID_ANY, EOLtype),
                   0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);

    // text info box
    wxStaticBoxSizer *textinfos = new wxStaticBoxSizer (
                     new wxStaticBox (this, wxID_ANY, _("Informations")),
                     wxVERTICAL);
    textinfos->Add (textinfo, 0, wxEXPAND);
    textinfos->Add (0, 6);

    // statistic
    wxGridSizer *statistic = new wxGridSizer (4, 0, 2);
    statistic->Add (new wxStaticText (this, wxID_ANY, _("Total lines"),
                                     wxDefaultPosition, wxSize(80, wxDefaultCoord)),
                    0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
    text = wxString::Format (wxT("%d"), edit->GetLineCount());
    statistic->Add (new wxStaticText (this, wxID_ANY, text),
                    0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
    statistic->Add (new wxStaticText (this, wxID_ANY, _("Total chars"),
                                     wxDefaultPosition, wxSize(80, wxDefaultCoord)),
                    0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
    text = wxString::Format (wxT("%d"), edit->GetTextLength());
    statistic->Add (new wxStaticText (this, wxID_ANY, text),
                    0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
    statistic->Add (new wxStaticText (this, wxID_ANY, _("Current line"),
                                     wxDefaultPosition, wxSize(80, wxDefaultCoord)),
                    0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
    text = wxString::Format (wxT("%d"), edit->GetCurrentLine());
    statistic->Add (new wxStaticText (this, wxID_ANY, text),
                    0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
    statistic->Add (new wxStaticText (this, wxID_ANY, _("Current pos"),
                                     wxDefaultPosition, wxSize(80, wxDefaultCoord)),
                    0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
    text = wxString::Format (wxT("%d"), edit->GetCurrentPos());
    statistic->Add (new wxStaticText (this, wxID_ANY, text),
                    0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);

    // char/line statistics
    wxStaticBoxSizer *statistics = new wxStaticBoxSizer (
                     new wxStaticBox (this, wxID_ANY, _("Statistics")),
                     wxVERTICAL);
    statistics->Add (statistic, 0, wxEXPAND);
    statistics->Add (0, 6);

    // total pane
    wxBoxSizer *totalpane = new wxBoxSizer (wxVERTICAL);
    totalpane->Add (fullname, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10);
    totalpane->Add (0, 6);
    totalpane->Add (textinfos, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
    totalpane->Add (0, 10);
    totalpane->Add (statistics, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
    totalpane->Add (0, 6);
    wxButton *okButton = new wxButton (this, wxID_OK, _("OK"));
    okButton->SetDefault();
    totalpane->Add (okButton, 0, wxALIGN_CENTER | wxALL, 10);

    SetSizerAndFit (totalpane);

    ShowModal();
}
Example #17
0
void TASInputDlg::CreateGCLayout()
{
	if (m_has_layout)
		return;

	m_buttons[6] = &m_x;
	m_buttons[7] = &m_y;
	m_buttons[8] = &m_z;
	m_buttons[9] = &m_l;
	m_buttons[10] = &m_r;
	m_buttons[11] = &m_start;

	m_controls[2] = &m_c_stick.x_cont;
	m_controls[3] = &m_c_stick.y_cont;
	m_controls[4] = &m_l_cont;
	m_controls[5] = &m_r_cont;

	wxBoxSizer* const top_box = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer* const bottom_box = new wxBoxSizer(wxHORIZONTAL);
	m_main_stick = CreateStick(ID_MAIN_STICK, 255, 255, 128, 128, false, true);
	wxStaticBoxSizer* const main_box = CreateStickLayout(&m_main_stick, _("Main Stick"));

	m_c_stick = CreateStick(ID_C_STICK, 255, 255, 128, 128, false, true);
	wxStaticBoxSizer* const c_box = CreateStickLayout(&m_c_stick, _("C Stick"));

	wxStaticBoxSizer* const shoulder_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Shoulder Buttons"));
	m_l_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 255, 0);
	m_r_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 255, 0);
	shoulder_box->Add(m_l_cont.slider, 0, wxALIGN_CENTER_VERTICAL);
	shoulder_box->Add(m_l_cont.text, 0, wxALIGN_CENTER_VERTICAL);
	shoulder_box->Add(m_r_cont.slider, 0, wxALIGN_CENTER_VERTICAL);
	shoulder_box->Add(m_r_cont.text, 0, wxALIGN_CENTER_VERTICAL);

	for (Control* const control : m_controls)
	{
		if (control != nullptr)
			control->slider->Bind(wxEVT_RIGHT_UP, &TASInputDlg::OnRightClickSlider, this);
	}

	wxStaticBoxSizer* const m_buttons_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Buttons"));
	wxGridSizer* const m_buttons_grid = new wxGridSizer(4);

	m_x = CreateButton("X");
	m_y = CreateButton("Y");
	m_l = CreateButton("L");
	m_r = CreateButton("R");
	m_z = CreateButton("Z");
	m_start = CreateButton("Start");

	for (unsigned int i = 4; i < 14; ++i)
		if (m_buttons[i] != nullptr)
			m_buttons_grid->Add(m_buttons[i]->checkbox, false);
	m_buttons_grid->AddSpacer(5);

	m_buttons_box->Add(m_buttons_grid);
	m_buttons_box->Add(m_buttons_dpad);

	wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);

	top_box->Add(main_box, 0, wxALL, 5);
	top_box->Add(c_box, 0, wxTOP | wxRIGHT, 5);
	bottom_box->Add(shoulder_box, 0, wxLEFT | wxRIGHT, 5);
	bottom_box->Add(m_buttons_box, 0, wxBOTTOM, 5);
	main_szr->Add(top_box);
	main_szr->Add(bottom_box);
	SetSizerAndFit(main_szr);

	ResetValues();
	m_has_layout = true;
}
Example #18
0
OutputConsole::OutputConsole(const char *title, int style,
                             MenuBarMaker *menuBarMaker)
    : wxFrame(NULL, wxID_ANY, title, wxPoint(50, 50), wxDefaultSize,
              wxDEFAULT_FRAME_STYLE) {
  menuBarMaker_ = menuBarMaker;
  outerSizer_ = new wxBoxSizer(wxVERTICAL);
  output_ = new wxTextCtrl(this, wxID_ANY, "", wxPoint(0, 0),
      wxSize(650, 450), wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP,
      wxDefaultValidator);
  outerSizer_->Add(output_, 1, wxEXPAND);
  style_ = style;
  gfxCheckBox_ = 0;
  abortButton_ = 0;
  if (style != CONSOLE_PLAIN) {
    wxBoxSizer *bottomSizer = new wxBoxSizer(wxHORIZONTAL);
    wxPanel *bottomPanel = new wxPanel(this);
    bottomSizer->AddStretchSpacer(1);
    if (style == CONSOLE_SHIP_STAGE) {
      gfxCheckBox_ = new wxCheckBox(bottomPanel, wxID_ANY, "Enable Gfx");
      bottomSizer->Add(gfxCheckBox_, 0, wxALIGN_RIGHT | wxALL, 4);
    } else if (style == CONSOLE_RUNNER) {
      // On Windows/Mac, it's not picking up the cmd/alt up to hide the hotkey,
      // so just displaying it all the time for now.
#ifdef __WXOSX__
      abortButton_ = new wxButton(bottomPanel, wxID_ANY, "Abo&rt \u2318R");
#elif defined(__WINDOWS__)
      abortButton_ = new wxButton(bottomPanel, wxID_ANY, "Abo&rt  alt-R");
#else
      abortButton_ = new wxButton(bottomPanel, wxID_ANY, "    Abo&rt    ");
#endif
      bottomSizer->Add(abortButton_, 0, wxALIGN_RIGHT | wxALL, 4);
    }
    bottomPanel->SetSizerAndFit(bottomSizer);
    outerSizer_->Add(bottomPanel, 0, wxEXPAND);
  }
  listener_ = 0;
  menusInitialized_ = false;

#ifdef __WINDOWS__
  SetIcon(wxIcon(resourcePath() + BERRYBOTS_ICO, wxBITMAP_TYPE_ICO));
#elif defined(__WXGTK__)
  SetIcon(wxIcon(resourcePath() + BBICON_128, wxBITMAP_TYPE_PNG));
#endif

#ifdef __WXOSX__
  defaultFontSize_ = 12;
#elif defined(__WINDOWS__)
  defaultFontSize_ = 9;
#else
  defaultFontSize_ = 10;
#endif

  fontSize_ = defaultFontSize_;
  output_->SetFont(wxFont(fontSize_, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL,
                          wxFONTWEIGHT_NORMAL));
  SetSizerAndFit(outerSizer_);


  Connect(this->GetId(), wxEVT_ACTIVATE,
          wxActivateEventHandler(OutputConsole::onActivate));
  Connect(this->GetId(), wxEVT_CLOSE_WINDOW,
          wxCommandEventHandler(OutputConsole::onClose));
  if (style == CONSOLE_SHIP_STAGE) {
    Connect(gfxCheckBox_->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED,
            wxCommandEventHandler(OutputConsole::onCheck));
  } else if (style == CONSOLE_RUNNER) {
    Connect(abortButton_->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,
            wxCommandEventHandler(OutputConsole::onAbort));
  }
  
  eventFilter_ = new OutputConsoleEventFilter(this);
  this->GetEventHandler()->AddFilter(eventFilter_);
}
Example #19
0
	BrushToolDlg::BrushToolDlg(wxWindow *frame, wxWindow *parent)
	: wxPanel(parent, wxID_ANY,
	wxPoint(500, 150),
	wxSize(400, 550),
	0, "BrushToolDlg"),
	m_frame(parent),
	m_cur_view(0),
	m_vol1(0),
	m_vol2(0),
	m_max_value(255.0),
	m_dft_ini_thresh(0.0),
	m_dft_gm_falloff(0.0),
	m_dft_scl_falloff(0.0),
	m_dft_scl_translate(0.0),
	m_dft_ca_min(0.0),
	m_dft_ca_max(0.0),
	m_dft_ca_thresh(0.0),
	m_dft_ca_falloff(1.0),
	m_dft_nr_thresh(0.0),
	m_dft_nr_size(0.0)
{
	if (!((VRenderFrame*)m_frame)->GetFreeVersion())
		SetSize(400, 750);
	//validator: floating point 1
	wxFloatingPointValidator<double> vald_fp1(1);
	//validator: floating point 2
	wxFloatingPointValidator<double> vald_fp2(2);
	//validator: integer
	wxIntegerValidator<unsigned int> vald_int;

	wxStaticText *st = 0;

	//group1
	//paint tools
	wxBoxSizer *group1 = new wxStaticBoxSizer(
		new wxStaticBox(this, wxID_ANY, "Selection"),
		wxVERTICAL);

	//toolbar
	m_toolbar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
		wxTB_FLAT|wxTB_TOP|wxTB_NODIVIDER|wxTB_TEXT);
	m_toolbar->AddTool(ID_BrushUndo, "Undo",
		wxGetBitmapFromMemory(undo),
		"Rollback previous brush operation");
	m_toolbar->AddTool(ID_BrushRedo, "Redo",
		wxGetBitmapFromMemory(redo),
		"Redo the rollback brush operation");
	m_toolbar->AddSeparator();
	m_toolbar->AddCheckTool(ID_BrushAppend, "Select",
		wxGetBitmapFromMemory(listicon_brushappend),
		wxNullBitmap,
		"Highlight structures by painting on the render view (hold Shift)");
	m_toolbar->AddCheckTool(ID_BrushDiffuse, "Diffuse",
		wxGetBitmapFromMemory(listicon_brushdiffuse),
		wxNullBitmap,
		"Diffuse highlighted structures by painting (hold Z)");
	m_toolbar->AddCheckTool(ID_BrushSolid, "Solid",
		wxGetBitmapFromMemory(listicon_brushsolid),
		wxNullBitmap,
		"Highlight structures with solid mask");
	m_toolbar->AddCheckTool(ID_BrushDesel, "Unselect",
		wxGetBitmapFromMemory(listicon_brushdesel),
		wxNullBitmap,
		"Reset highlighted structures by painting (hold X)");
	m_toolbar->AddTool(ID_BrushClear, "Reset All",
		wxGetBitmapFromMemory(listicon_brushclear),
		"Reset all highlighted structures");
	m_toolbar->AddSeparator();
	m_toolbar->AddTool(ID_BrushErase, "Erase",
		wxGetBitmapFromMemory(listicon_brusherase),
		"Erase highlighted structures");
	m_toolbar->AddTool(ID_BrushCreate, "Extract",
		wxGetBitmapFromMemory(listicon_brushcreate),
		"Extract highlighted structures out and create a new volume");
	//m_toolbar->AddSeparator();
	//m_toolbar->AddTool(ID_HelpBtn, "Help",
	//      wxGetBitmapFromMemory(listicon_qmark),
	//      "Help on the settings");
	m_toolbar->Realize();

	//Selection adjustment
	wxBoxSizer *sizer11 = new wxStaticBoxSizer(
		new wxStaticBox(this, wxID_ANY, "Selection Settings"),
		wxVERTICAL);
	//stop at boundary
	wxBoxSizer *sizer11_1 = new wxBoxSizer(wxHORIZONTAL);
	m_estimate_thresh_chk = new wxCheckBox(this, ID_EstimateThreshChk, "Auto Thresh:",
		wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
	m_edge_detect_chk = new wxCheckBox(this, ID_BrushEdgeDetectChk, "Edge Detect:",
		wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
	m_hidden_removal_chk = new wxCheckBox(this, ID_BrushHiddenRemovalChk, "Visible Only:",
		wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
	m_select_group_chk = new wxCheckBox(this, ID_BrushSelectGroupChk, "Apply to Group:",
		wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
	sizer11_1->Add(m_estimate_thresh_chk, 0, wxALIGN_CENTER);
	sizer11_1->Add(5, 5);
	sizer11_1->Add(m_edge_detect_chk, 0, wxALIGN_CENTER);
	sizer11_1->Add(5, 5);
	sizer11_1->Add(m_hidden_removal_chk, 0, wxALIGN_CENTER);
	sizer11_1->Add(5, 5);
	sizer11_1->Add(m_select_group_chk, 0, wxALIGN_CENTER);
	//threshold4
	wxBoxSizer *sizer11_2 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "Threshold:",
		wxDefaultPosition, wxSize(70, 20));
	m_brush_scl_translate_sldr = new wxSlider(this, ID_BrushSclTranslateSldr, 0, 0, 2550,
		wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL);
	m_brush_scl_translate_text = new wxTextCtrl(this, ID_BrushSclTranslateText, "0.0",
		wxDefaultPosition, wxSize(50, 20), 0, vald_fp1);
	sizer11_2->Add(5, 5);
	sizer11_2->Add(st, 0, wxALIGN_CENTER);
	sizer11_2->Add(m_brush_scl_translate_sldr, 1, wxEXPAND);
	sizer11_2->Add(m_brush_scl_translate_text, 0, wxALIGN_CENTER);
	sizer11_2->Add(15, 15);
	//2d
	wxBoxSizer *sizer11_3 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "2D Adj. Infl.:",
		wxDefaultPosition, wxSize(70, 20));
	m_brush_2dinfl_sldr = new wxSlider(this, ID_Brush2dinflSldr, 100, 0, 200,
		wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_INVERSE);
	m_brush_2dinfl_text = new wxTextCtrl(this, ID_Brush2dinflText, "1.00",
		wxDefaultPosition, wxSize(40, 20), 0, vald_fp2);
	sizer11_3->Add(5, 5);
	sizer11_3->Add(st, 0, wxALIGN_CENTER);
	sizer11_3->Add(m_brush_2dinfl_sldr, 1, wxEXPAND);
	sizer11_3->Add(m_brush_2dinfl_text, 0, wxALIGN_CENTER);
	sizer11_3->Add(15, 15);
	//sizer21
	sizer11->Add(sizer11_1, 0, wxEXPAND);
	sizer11->Add(5, 5);
	sizer11->Add(sizer11_2, 0, wxEXPAND);
	sizer11->Add(sizer11_3, 0, wxEXPAND);
	sizer11->Hide(sizer11_3, true);

	//Brush properties
	wxBoxSizer *sizer12 = new wxStaticBoxSizer(
		new wxStaticBox(this, wxID_ANY, "Brush Properties"),
		wxVERTICAL);
	wxBoxSizer *sizer12_1 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "Brush sizes can also be set with mouse wheel in painting mode.");
	sizer12_1->Add(5, 5);
	sizer12_1->Add(st, 0, wxALIGN_CENTER);
	//brush size 1
	wxBoxSizer *sizer12_2 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "Center Size:",
		wxDefaultPosition, wxSize(80, 20));
	m_brush_size1_sldr = new wxSlider(this, ID_BrushSize1Sldr, 10, 1, 300,
		wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL);
	m_brush_size1_text = new wxTextCtrl(this, ID_BrushSize1Text, "10",
		wxDefaultPosition, wxSize(50, 20), 0, vald_int);
	sizer12_2->Add(5, 5);
	sizer12_2->Add(st, 0, wxALIGN_CENTER);
	sizer12_2->Add(m_brush_size1_sldr, 1, wxEXPAND);
	sizer12_2->Add(m_brush_size1_text, 0, wxALIGN_CENTER);
	st = new wxStaticText(this, 0, "px",
		wxDefaultPosition, wxSize(25, 15));
	sizer12_2->Add(st, 0, wxALIGN_CENTER);
	//brush size 2
	wxBoxSizer *sizer12_3 = new wxBoxSizer(wxHORIZONTAL);
	m_brush_size2_chk = new wxCheckBox(this, ID_BrushSize2Chk, "GrowSize",
		wxDefaultPosition, wxSize(80, 20), wxALIGN_RIGHT);
	st = new wxStaticText(this, 0, ":",
		wxDefaultPosition, wxSize(5, 20), wxALIGN_RIGHT);
	m_brush_size2_sldr = new wxSlider(this, ID_BrushSize2Sldr, 30, 1, 300,
		wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL);
	m_brush_size2_text = new wxTextCtrl(this, ID_BrushSize2Text, "30",
		wxDefaultPosition, wxSize(50, 20), 0, vald_int);
	m_brush_size2_chk->SetValue(true);
	m_brush_size2_sldr->Enable();
	m_brush_size2_text->Enable();
	sizer12_3->Add(m_brush_size2_chk, 0, wxALIGN_CENTER);
	sizer12_3->Add(st, 0, wxALIGN_CENTER);
	sizer12_3->Add(m_brush_size2_sldr, 1, wxEXPAND);
	sizer12_3->Add(m_brush_size2_text, 0, wxALIGN_CENTER);
	st = new wxStaticText(this, 0, "px",
		wxDefaultPosition, wxSize(25, 15));
	sizer12_3->Add(st, 0, wxALIGN_CENTER);
	//iterations
	wxBoxSizer *sizer12_4 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "Growth:",
		wxDefaultPosition, wxSize(70, 20));
	m_brush_iterw_rb = new wxRadioButton(this, ID_BrushIterWRd, "Weak",
		wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
	m_brush_iters_rb = new wxRadioButton(this, ID_BrushIterSRd, "Normal",
		wxDefaultPosition, wxDefaultSize);
	m_brush_iterss_rb = new wxRadioButton(this, ID_BrushIterSSRd, "Strong",
		wxDefaultPosition, wxDefaultSize);
	m_brush_iterw_rb->SetValue(false);
	m_brush_iters_rb->SetValue(true);
	m_brush_iterss_rb->SetValue(false);
	sizer12_4->Add(5, 5);
	sizer12_4->Add(st, 0, wxALIGN_CENTER);
	sizer12_4->Add(m_brush_iterw_rb, 0, wxALIGN_CENTER);
	sizer12_4->Add(15, 15);
	sizer12_4->Add(m_brush_iters_rb, 0, wxALIGN_CENTER);
	sizer12_4->Add(15, 15);
	sizer12_4->Add(m_brush_iterss_rb, 0, wxALIGN_CENTER);
	//sizer12
	sizer12->Add(sizer12_4, 0, wxEXPAND);
	sizer12->Add(5, 5);
	sizer12->Add(sizer12_2, 0, wxEXPAND);
	sizer12->Add(sizer12_3, 0, wxEXPAND);
	sizer12->Add(5, 5);
	sizer12->Add(sizer12_1, 0, wxEXPAND);

	//group1
	group1->Add(m_toolbar, 0, wxEXPAND);
	group1->Add(5, 5);
	group1->Add(sizer11, 0, wxEXPAND);
	group1->Add(sizer12, 0, wxEXPAND);

	//component analyzer
	wxBoxSizer *sizer13 = new wxStaticBoxSizer(
		new wxStaticBox(this, wxID_ANY, "Component Analyzer"),
		wxVERTICAL);
	//threshold of ccl
	wxBoxSizer *sizer13_1 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "Threshold:",
		wxDefaultPosition, wxSize(75, 20));
	m_ca_thresh_sldr = new wxSlider(this, ID_CAThreshSldr, 0, 0, 2550,
		wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL);
	m_ca_thresh_text = new wxTextCtrl(this, ID_CAThreshText, "0.0",
		wxDefaultPosition, wxSize(50, 20), 0, vald_fp1);
	sizer13_1->Add(st, 0, wxALIGN_CENTER);
	sizer13_1->Add(m_ca_thresh_sldr, 1, wxEXPAND);
	sizer13_1->Add(m_ca_thresh_text, 0, wxALIGN_CENTER);
	m_ca_analyze_btn = new wxButton(this, ID_CAAnalyzeBtn, "Analyze",
		wxDefaultPosition, wxSize(-1, 23));
	sizer13_1->Add(m_ca_analyze_btn, 0, wxALIGN_CENTER);
	//size of ccl
	wxBoxSizer *sizer13_2 = new wxBoxSizer(wxHORIZONTAL);
	m_ca_select_only_chk = new wxCheckBox(this, ID_CASelectOnlyChk, "Selct. Only",
		wxDefaultPosition, wxSize(90, 20));
	sizer13_2->Add(m_ca_select_only_chk, 0, wxALIGN_CENTER);
	sizer13_2->AddStretchSpacer();
	st = new wxStaticText(this, 0, "Min:",
		wxDefaultPosition, wxSize(40, 15));
	sizer13_2->Add(st, 0, wxALIGN_CENTER);
	m_ca_min_text = new wxTextCtrl(this, ID_CAMinText, "0",
		wxDefaultPosition, wxSize(40, 20), 0, vald_int);
	sizer13_2->Add(m_ca_min_text, 0, wxALIGN_CENTER);
	st = new wxStaticText(this, 0, "vx",
		wxDefaultPosition, wxSize(15, 15));
	sizer13_2->Add(st, 0, wxALIGN_CENTER);
	sizer13_2->AddStretchSpacer();
	st = new wxStaticText(this, 0, "Max:",
		wxDefaultPosition, wxSize(40, 15));
	sizer13_2->Add(st, 0, wxALIGN_CENTER);
	m_ca_max_text = new wxTextCtrl(this, ID_CAMaxText, "1000",
		wxDefaultPosition, wxSize(40, 20), 0, vald_int);
	sizer13_2->Add(m_ca_max_text, 0, wxALIGN_CENTER);
	st = new wxStaticText(this, 0, "vx",
		wxDefaultPosition, wxSize(15, 15));
	sizer13_2->Add(st, 0, wxALIGN_CENTER);
	sizer13_2->AddStretchSpacer();
	m_ca_ignore_max_chk = new wxCheckBox(this, ID_CAIgnoreMaxChk, "Ignore Max");
	sizer13_2->Add(m_ca_ignore_max_chk, 0, wxALIGN_CENTER);
	//text result
	wxBoxSizer *sizer13_3 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "Components:");
	sizer13_3->Add(st, 0, wxALIGN_CENTER);
	m_ca_comps_text = new wxTextCtrl(this, ID_CACompsText, "0",
		wxDefaultPosition, wxSize(70, 20), wxTE_READONLY);
	sizer13_3->Add(m_ca_comps_text, 0, wxALIGN_CENTER);
	st = new wxStaticText(this, 0, "Total Volume:");
	sizer13_3->Add(st, 0, wxALIGN_CENTER);
	m_ca_volume_text = new wxTextCtrl(this, ID_CAVolumeText, "0",
		wxDefaultPosition, wxSize(70, 20), wxTE_READONLY);
	sizer13_3->Add(m_ca_volume_text, 0, wxALIGN_CENTER);
	m_ca_size_map_chk = new wxCheckBox(this, ID_CASizeMapChk, "Size-Color",
		wxDefaultPosition, wxSize(75, 20));
	sizer13_3->Add(m_ca_size_map_chk, 0, wxALIGN_CENTER);   
	//export
	wxBoxSizer *sizer13_4 = new wxBoxSizer(wxHORIZONTAL);
	sizer13_4->AddStretchSpacer();
	st = new wxStaticText(this, 0, "Export:  ");
	sizer13_4->Add(st, 0, wxALIGN_CENTER);
	m_ca_multi_chann_btn = new wxButton(this, ID_CAMultiChannBtn, "Multi-Channels",
		wxDefaultPosition, wxSize(-1, 23));
	m_ca_random_color_btn = new wxButton(this, ID_CARandomColorBtn, "Random Colors",
		wxDefaultPosition, wxSize(-1, 23));
	m_ca_annotations_btn = new wxButton(this, ID_CAAnnotationsBtn, "Show Annotations",
		wxDefaultPosition, wxSize(-1, 23));
	sizer13_4->Add(m_ca_multi_chann_btn, 0, wxALIGN_CENTER);
	sizer13_4->Add(m_ca_random_color_btn, 0, wxALIGN_CENTER);
	sizer13_4->Add(m_ca_annotations_btn, 0, wxALIGN_CENTER);
	//sizer13
	sizer13->Add(sizer13_1, 0, wxEXPAND);
	sizer13->Add(sizer13_2, 0, wxEXPAND);
	sizer13->Add(sizer13_3, 0, wxEXPAND);
	sizer13->Add(sizer13_4, 0, wxEXPAND);
	//noise removal
	wxBoxSizer *sizer14 = new wxStaticBoxSizer(
		new wxStaticBox(this, wxID_ANY, "Noise Removal"),
		wxVERTICAL);
	//size threshold
	wxBoxSizer *sizer14_1 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "Size Thresh.:",
		wxDefaultPosition, wxSize(75, -1));
	m_nr_size_sldr = new wxSlider(this, ID_NRSizeSldr, 10, 1, 100,
		wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL);
	m_nr_size_text = new wxTextCtrl(this, ID_NRSizeText, "10",
		wxDefaultPosition, wxSize(40, -1), 0, vald_int);
	sizer14_1->Add(st, 0, wxALIGN_CENTER);
	sizer14_1->Add(m_nr_size_sldr, 1, wxEXPAND);
	sizer14_1->Add(m_nr_size_text, 0, wxALIGN_CENTER);
	st = new wxStaticText(this, 0, "vx",
		wxDefaultPosition, wxSize(25, 15));
	sizer14_1->Add(st, 0, wxALIGN_CENTER);
	//buttons
	wxBoxSizer *sizer14_2 = new wxBoxSizer(wxHORIZONTAL);
	m_nr_analyze_btn = new wxButton(this, ID_NRAnalyzeBtn, "Analyze",
		wxDefaultPosition, wxSize(-1, 23));
	m_nr_remove_btn = new wxButton(this, ID_NRRemoveBtn, "Remove",
		wxDefaultPosition, wxSize(-1, 23));
	sizer14_2->AddStretchSpacer();
	sizer14_2->Add(m_nr_analyze_btn, 0, wxALIGN_CENTER);
	sizer14_2->Add(m_nr_remove_btn, 0, wxALIGN_CENTER);
	//sizer14
	sizer14->Add(sizer14_1, 0, wxEXPAND);
	sizer14->Add(sizer14_2, 0, wxEXPAND);

	//group 2
	//calculations
	wxBoxSizer* group2 = new wxStaticBoxSizer(
		new wxStaticBox(this, wxID_ANY, "Analysis"),
		wxVERTICAL);
	//operand A
	wxBoxSizer *sizer21 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "Volume A:",
		wxDefaultPosition, wxSize(75, 20));
	m_calc_load_a_btn = new wxButton(this, ID_CalcLoadABtn, "Load",
		wxDefaultPosition, wxSize(50, 20));
	m_calc_a_text = new wxTextCtrl(this, ID_CalcAText, "",
		wxDefaultPosition, wxSize(200, 20));
	sizer21->Add(st, 0, wxALIGN_CENTER);
	sizer21->Add(m_calc_load_a_btn, 0, wxALIGN_CENTER);
	sizer21->Add(m_calc_a_text, 1, wxEXPAND);
	//operand B
	wxBoxSizer *sizer22 = new wxBoxSizer(wxHORIZONTAL);
	st = new wxStaticText(this, 0, "Volume B:",
		wxDefaultPosition, wxSize(75, 20));
	m_calc_load_b_btn = new wxButton(this, ID_CalcLoadBBtn, "Load",
		wxDefaultPosition, wxSize(50, 20));
	m_calc_b_text = new wxTextCtrl(this, ID_CalcBText, "",
		wxDefaultPosition, wxSize(200, 20));
	sizer22->Add(st, 0, wxALIGN_CENTER);
	sizer22->Add(m_calc_load_b_btn, 0, wxALIGN_CENTER);
	sizer22->Add(m_calc_b_text, 1, wxEXPAND);
	//single operators
	wxBoxSizer *sizer23 = new wxStaticBoxSizer(
		new wxStaticBox(this, wxID_ANY,
		"Single-valued Operators (Require A)"), wxVERTICAL);
	//sizer23
	m_calc_fill_btn = new wxButton(this, ID_CalcFillBtn, "Consolidate Voxels",
		wxDefaultPosition, wxDefaultSize);
	sizer23->Add(m_calc_fill_btn, 0, wxEXPAND);
	//two operators
	wxBoxSizer *sizer24 = new wxStaticBoxSizer(
		new wxStaticBox(this, wxID_ANY,
		"Two-valued Operators (Require both A and B)"), wxHORIZONTAL);
	m_calc_sub_btn = new wxButton(this, ID_CalcSubBtn, "Subtract",
		wxDefaultPosition, wxSize(50, 25));
	m_calc_add_btn = new wxButton(this, ID_CalcAddBtn, "Add",
		wxDefaultPosition, wxSize(50, 25));
	m_calc_div_btn = new wxButton(this, ID_CalcDivBtn, "Divide",
		wxDefaultPosition, wxSize(50, 25));
	m_calc_isc_btn = new wxButton(this, ID_CalcIscBtn, "Colocalize",
		wxDefaultPosition, wxSize(50, 25));
	sizer24->Add(m_calc_sub_btn, 1, wxEXPAND);
	sizer24->Add(m_calc_add_btn, 1, wxEXPAND);
	sizer24->Add(m_calc_div_btn, 1, wxEXPAND);
	sizer24->Add(m_calc_isc_btn, 1, wxEXPAND);
	//group
	group2->Add(5, 5);
	group2->Add(sizer13, 0, wxEXPAND);
	group2->Add(5, 5);
	group2->Add(sizer14, 0, wxEXPAND);
	group2->Add(5, 5);
	group2->Add(sizer21, 0, wxEXPAND);
	group2->Add(5, 5);
	group2->Add(sizer22, 0, wxEXPAND);
	group2->Add(5, 5);
	group2->Add(sizer23, 0, wxEXPAND);
	group2->Add(5, 5);
	group2->Add(sizer24, 0, wxEXPAND);

	//all controls
	wxBoxSizer *sizerV = new wxBoxSizer(wxVERTICAL);
	sizerV->Add(10, 10);
	sizerV->Add(group1, 0, wxEXPAND);
	sizerV->Add(10, 5);
	sizerV->Add(group2, 0, wxEXPAND);

	SetSizerAndFit(sizerV);
	Layout();

	LoadDefault();
}
Example #20
0
LowessParamFrame::LowessParamFrame(double f, int iter, double delta_factor, Project* project_)
: wxFrame((wxWindow*) 0, wxID_ANY, _("LOWESS Smoother Parameters"),
          wxDefaultPosition, wxSize(400, -1), wxDEFAULT_FRAME_STYLE),
LowessParamObservable(f, iter, delta_factor), 
project(project_)
{
	wxLogMessage("Entering LowessParamFrame::LowessParamFrame");
	
	wxPanel* panel = new wxPanel(this);
	panel->SetBackgroundColour(*wxWHITE);
	SetBackgroundColour(*wxWHITE);

	wxButton* help_btn = new wxButton(panel, XRCID("ID_HELP_BTN"),  _("Help"),
                                      wxDefaultPosition, wxDefaultSize,
                                      wxBU_EXACTFIT);
	wxButton* apply_btn = new wxButton(panel, XRCID("ID_APPLY_BTN"), _("Apply"),
                                       wxDefaultPosition, wxDefaultSize,
                                       wxBU_EXACTFIT);
	wxButton* reset_defaults_btn = new wxButton(panel,
                                                XRCID("ID_RESET_DEFAULTS_BTN"),
                                                _("Reset"), wxDefaultPosition,
                                                wxDefaultSize, wxBU_EXACTFIT);
	wxStaticText* f_stat_t = new wxStaticText(panel, wxID_ANY, _("Bandwidth:"));
	f_text = new wxTextCtrl(panel, XRCID("ID_F_TEXT"),
                            wxString::Format("%f", GetF()), wxDefaultPosition,
                            wxSize(100, -1), wxTE_PROCESS_ENTER);
	f_text->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
	Connect(XRCID("ID_F_TEXT"), wxEVT_TEXT,
            wxCommandEventHandler(LowessParamFrame::OnFTextChange));
    Connect(XRCID("ID_F_TEXT"), wxEVT_COMMAND_TEXT_ENTER,
            wxCommandEventHandler(LowessParamFrame::OnApplyBtn));

	wxStaticText* iter_stat_t = new wxStaticText(panel, wxID_ANY,
                                                 _("Iterations:"));
	iter_text = new wxTextCtrl(panel, XRCID("ID_ITER_TEXT"),
                               wxString::Format("%d", GetIter()),
                               wxDefaultPosition, wxSize(100, -1),
                               wxTE_PROCESS_ENTER);
	iter_text->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
	Connect(XRCID("ID_ITER_TEXT"), 
            wxEVT_TEXT,
            wxCommandEventHandler(LowessParamFrame::OnIterTextChange));
    Connect(XRCID("ID_ITER_TEXT"), wxEVT_COMMAND_TEXT_ENTER,
            wxCommandEventHandler(LowessParamFrame::OnApplyBtn));
	
	wxStaticText* delta_factor_stat_t =
		new wxStaticText(panel, wxID_ANY, _("Delta Factor:"));
	delta_factor_text = new wxTextCtrl(panel, 
                                       XRCID("ID_DELTA_FACTOR_TEXT"),
                                       wxString::Format("%.4f", GetDeltaFactor()),
                                       wxDefaultPosition, wxSize(100, -1),
                                       wxTE_PROCESS_ENTER);
	delta_factor_text->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
    
	Connect(XRCID("ID_DELTA_FACTOR_TEXT"), 
            wxEVT_TEXT,
            wxCommandEventHandler(LowessParamFrame::OnDeltaFactorTextChange));
    Connect(XRCID("ID_DELTA_FACTOR_TEXT"), wxEVT_COMMAND_TEXT_ENTER,
            wxCommandEventHandler(LowessParamFrame::OnApplyBtn));
	Connect(XRCID("ID_HELP_BTN"), 
            wxEVT_BUTTON,
            wxCommandEventHandler(LowessParamFrame::OnHelpBtn));
	Connect(XRCID("ID_APPLY_BTN"), 
            wxEVT_BUTTON,
            wxCommandEventHandler(LowessParamFrame::OnApplyBtn));
	Connect(XRCID("ID_RESET_DEFAULTS_BTN"), 
            wxEVT_BUTTON,
            wxCommandEventHandler(LowessParamFrame::OnResetDefaultsBtn));
		
	// Arrange above widgets in panel using sizers.
	// Top level panel sizer will be panel_h_szr
	// Below that will be panel_v_szr
	// panel_v_szr will directly receive widgets
	
	wxFlexGridSizer* fg_sizer = new wxFlexGridSizer(3, 2, 3, 3);
	fg_sizer->Add(f_stat_t, 0, wxALIGN_CENTRE_VERTICAL | wxALIGN_RIGHT);
	fg_sizer->Add(f_text, 0, wxALIGN_CENTRE_VERTICAL);
	fg_sizer->Add(iter_stat_t, 0, wxALIGN_CENTRE_VERTICAL | wxALIGN_RIGHT);
	fg_sizer->Add(iter_text, 0, wxALIGN_CENTRE_VERTICAL);
	fg_sizer->Add(delta_factor_stat_t, 0, wxALIGN_CENTRE_VERTICAL|wxALIGN_RIGHT);
	fg_sizer->Add(delta_factor_text, 0, wxALIGN_CENTRE_VERTICAL);
	
	wxBoxSizer* btns_row1_h_szr = new wxBoxSizer(wxHORIZONTAL);
	btns_row1_h_szr->Add(help_btn, 0, wxALIGN_CENTER_VERTICAL);
	btns_row1_h_szr->AddSpacer(8);
	btns_row1_h_szr->Add(reset_defaults_btn, 0, wxALIGN_CENTER_VERTICAL);
	btns_row1_h_szr->AddSpacer(8);
	btns_row1_h_szr->Add(apply_btn, 0, wxALIGN_CENTER_VERTICAL);
		
	wxBoxSizer* panel_v_szr = new wxBoxSizer(wxVERTICAL);
	panel_v_szr->Add(fg_sizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	panel_v_szr->AddSpacer(2);
	panel_v_szr->Add(btns_row1_h_szr, 0,  wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	
	wxBoxSizer* panel_h_szr = new wxBoxSizer(wxHORIZONTAL);
	panel_h_szr->Add(panel_v_szr, 1, wxEXPAND);
	
	panel->SetSizer(panel_h_szr);
	
	// Top Sizer for Frame
	wxBoxSizer* top_h_sizer = new wxBoxSizer(wxHORIZONTAL);
	top_h_sizer->Add(panel, 1, wxEXPAND|wxALL, 8);
	
	SetSizerAndFit(top_h_sizer);
	Show(true);
	
	wxLogMessage("Exiting LowessParamFrame::LowessParamFrame");
}
SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std::string& title)
    : wxDialog(parent, wxID_ANY,
               wxString(wxString::Format(_("Dolphin %s Graphics Configuration"), title)))
{
  VideoConfig& vconfig = g_Config;

  vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");

  wxNotebook* const notebook = new wxNotebook(this, wxID_ANY);

  // -- GENERAL --
  {
    wxPanel* const page_general = new wxPanel(notebook);
    notebook->AddPage(page_general, _("General"));
    wxBoxSizer* const szr_general = new wxBoxSizer(wxVERTICAL);

    // - rendering
    {
      wxStaticBoxSizer* const group_rendering =
          new wxStaticBoxSizer(wxVERTICAL, page_general, _("Rendering"));
      szr_general->Add(group_rendering, 0, wxEXPAND | wxALL, 5);
      wxGridSizer* const szr_rendering = new wxGridSizer(2, 5, 5);
      group_rendering->Add(szr_rendering, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);

      // backend
      wxStaticText* const label_backend = new wxStaticText(page_general, wxID_ANY, _("Backend:"));
      wxChoice* const choice_backend = new wxChoice(page_general, wxID_ANY);

      for (const auto& backend : g_available_video_backends)
      {
        choice_backend->AppendString(StrToWxStr(backend->GetDisplayName()));
      }

      // TODO: How to get the translated plugin name?
      choice_backend->SetStringSelection(StrToWxStr(g_video_backend->GetName()));
      choice_backend->Bind(wxEVT_CHOICE, &SoftwareVideoConfigDialog::Event_Backend, this);

      szr_rendering->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5);
      szr_rendering->Add(choice_backend, 1, 0, 0);

      if (Core::GetState() != Core::CORE_UNINITIALIZED)
      {
        label_backend->Disable();
        choice_backend->Disable();
      }

      // xfb
      szr_rendering->Add(
          new SettingCheckBox(page_general, _("Bypass XFB"), "", vconfig.bUseXFB, true));
    }

    // - info
    {
      wxStaticBoxSizer* const group_info =
          new wxStaticBoxSizer(wxVERTICAL, page_general, _("Overlay Information"));
      szr_general->Add(group_info, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
      wxGridSizer* const szr_info = new wxGridSizer(2, 5, 5);
      group_info->Add(szr_info, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);

      szr_info->Add(
          new SettingCheckBox(page_general, _("Various Statistics"), "", vconfig.bOverlayStats));
    }

    // - utility
    {
      wxStaticBoxSizer* const group_utility =
          new wxStaticBoxSizer(wxVERTICAL, page_general, _("Utility"));
      szr_general->Add(group_utility, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
      wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5);
      group_utility->Add(szr_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);

      szr_utility->Add(
          new SettingCheckBox(page_general, _("Dump Textures"), "", vconfig.bDumpTextures));
      szr_utility->Add(
          new SettingCheckBox(page_general, _("Dump Objects"), "", vconfig.bDumpObjects));

      // - debug only
      wxStaticBoxSizer* const group_debug_only_utility =
          new wxStaticBoxSizer(wxHORIZONTAL, page_general, _("Debug Only"));
      group_utility->Add(group_debug_only_utility, 0, wxEXPAND | wxBOTTOM, 5);
      wxGridSizer* const szr_debug_only_utility = new wxGridSizer(2, 5, 5);
      group_debug_only_utility->Add(szr_debug_only_utility, 1,
                                    wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);

      szr_debug_only_utility->Add(
          new SettingCheckBox(page_general, _("Dump TEV Stages"), "", vconfig.bDumpTevStages));
      szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump Texture Fetches"), "",
                                                      vconfig.bDumpTevTextureFetches));
    }

    // - misc
    {
      wxStaticBoxSizer* const group_misc =
          new wxStaticBoxSizer(wxVERTICAL, page_general, _("Drawn Object Range"));
      szr_general->Add(group_misc, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
      wxFlexGridSizer* const szr_misc = new wxFlexGridSizer(2, 5, 5);
      group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);

      szr_misc->Add(
          new IntegerSetting<int>(page_general, _("Start"), vconfig.drawStart, 0, 100000));
      szr_misc->Add(new IntegerSetting<int>(page_general, _("End"), vconfig.drawEnd, 0, 100000));
    }

    page_general->SetSizerAndFit(szr_general);
  }

  wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL);
  szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5);
  szr_main->Add(new wxButton(this, wxID_OK, _("Close"), wxDefaultPosition), 0,
                wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5);

  SetSizerAndFit(szr_main);
  Center();
  SetFocus();
}
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager ) :
    wxPanel( aParent, -1 ), m_ModelManager( aCacheManager )
{
    if( NULL != m_ModelManager )
        m_resolver = m_ModelManager->GetResolver();
    else
        m_resolver = NULL;

    canvas = NULL;
    model = NULL;
    xscale = NULL;
    yscale = NULL;
    zscale = NULL;
    xrot = NULL;
    yrot = NULL;
    zrot = NULL;
    xoff = NULL;
    yoff = NULL;
    zoff = NULL;

    wxBoxSizer* mainBox = new wxBoxSizer( wxVERTICAL );
    wxStaticBoxSizer* vbox = new wxStaticBoxSizer( wxVERTICAL, this, _( "3D Preview" ) );
    m_FileTree = NULL;

    if( NULL != aParent )
        m_FileTree = (wxGenericDirCtrl*)
            aParent->FindWindowByLabel( wxT( "3D_MODEL_SELECTOR" ), aParent );

    wxFloatingPointValidator< float > valScale( 4 );
    valScale.SetRange( 0.0001, 9999 );
    wxFloatingPointValidator< float > valRotate( 2 );
    valRotate.SetRange( -180.0, 180.0 );
    wxFloatingPointValidator< float > valOffset( 6 );

    wxStaticBoxSizer* vbScale = new wxStaticBoxSizer( wxVERTICAL, this, _( "Scale" )  );
    wxStaticBoxSizer* vbRotate = new wxStaticBoxSizer( wxVERTICAL, this, _( "Rotation" ) );
    wxStaticBoxSizer* vbOffset = new wxStaticBoxSizer( wxVERTICAL, this, _( "Offset (inches)" ) );

    wxStaticBox* modScale = vbScale->GetStaticBox();
    wxStaticBox* modRotate = vbRotate->GetStaticBox();
    wxStaticBox* modOffset = vbOffset->GetStaticBox();

    wxBoxSizer* hbS1 = new wxBoxSizer( wxHORIZONTAL );
    wxBoxSizer* hbS2 = new wxBoxSizer( wxHORIZONTAL );
    wxBoxSizer* hbS3 = new wxBoxSizer( wxHORIZONTAL );
    wxStaticText* txtS1 = new wxStaticText( modScale, -1, wxT( "X:" ) );
    wxStaticText* txtS2 = new wxStaticText( modScale, -1, wxT( "Y:" ) );
    wxStaticText* txtS3 = new wxStaticText( modScale, -1, wxT( "Z:" ) );
    xscale = new wxTextCtrl( modScale, ID_SCALEX, "1.0", wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER, valScale );
    yscale = new wxTextCtrl( modScale, ID_SCALEY, "1.0", wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER, valScale );
    zscale = new wxTextCtrl( modScale, ID_SCALEZ, "1.0", wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER, valScale );
    xscale->SetMaxLength( 9 );
    yscale->SetMaxLength( 9 );
    zscale->SetMaxLength( 9 );
    hbS1->Add( txtS1, 0, wxALL, 2 );
    hbS1->Add( xscale, 0, wxALL, 2 );
    hbS2->Add( txtS2, 0, wxALL, 2 );
    hbS2->Add( yscale, 0, wxALL, 2 );
    hbS3->Add( txtS3, 0, wxALL, 2 );
    hbS3->Add( zscale, 0, wxALL, 2 );
    vbScale->Add( hbS1, 0, wxEXPAND | wxALL, 2 );
    vbScale->Add( hbS2, 0, wxEXPAND | wxALL, 2 );
    vbScale->Add( hbS3, 0, wxEXPAND | wxALL, 2 );

    wxBoxSizer* hbR1 = new wxBoxSizer( wxHORIZONTAL );
    wxBoxSizer* hbR2 = new wxBoxSizer( wxHORIZONTAL );
    wxBoxSizer* hbR3 = new wxBoxSizer( wxHORIZONTAL );
    wxStaticText* txtR1 = new wxStaticText( modRotate, ID_ROTX, wxT( "X:" ) );
    wxStaticText* txtR2 = new wxStaticText( modRotate, ID_ROTY, wxT( "Y:" ) );
    wxStaticText* txtR3 = new wxStaticText( modRotate, ID_ROTZ, wxT( "Z:" ) );
    xrot = new wxTextCtrl( modRotate, ID_ROTX, "0.0", wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER, valRotate );
    yrot = new wxTextCtrl( modRotate, ID_ROTY, "0.0", wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER, valRotate );
    zrot = new wxTextCtrl( modRotate, ID_ROTZ, "0.0", wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER, valRotate );
    xrot->SetMaxLength( 9 );
    yrot->SetMaxLength( 9 );
    zrot->SetMaxLength( 9 );
    hbR1->Add( txtR1, 0, wxALL, 2 );
    hbR1->Add( xrot, 0, wxALL, 2 );
    hbR2->Add( txtR2, 0, wxALL, 2 );
    hbR2->Add( yrot, 0, wxALL, 2 );
    hbR3->Add( txtR3, 0, wxALL, 2 );
    hbR3->Add( zrot, 0, wxALL, 2 );
    vbRotate->Add( hbR1, 0, wxEXPAND | wxALL, 2 );
    vbRotate->Add( hbR2, 0, wxEXPAND | wxALL, 2 );
    vbRotate->Add( hbR3, 0, wxEXPAND | wxALL, 2 );

    wxBoxSizer* hbO1 = new wxBoxSizer( wxHORIZONTAL );
    wxBoxSizer* hbO2 = new wxBoxSizer( wxHORIZONTAL );
    wxBoxSizer* hbO3 = new wxBoxSizer( wxHORIZONTAL );
    wxStaticText* txtO1 = new wxStaticText( modOffset, -1, wxT( "X:" ) );
    wxStaticText* txtO2 = new wxStaticText( modOffset, -1, wxT( "Y:" ) );
    wxStaticText* txtO3 = new wxStaticText( modOffset, -1, wxT( "Z:" ) );
    xoff = new wxTextCtrl( modOffset, ID_OFFX, "0.0", wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER, valOffset );
    yoff = new wxTextCtrl( modOffset, ID_OFFY, "0.0", wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER, valOffset );
    zoff = new wxTextCtrl( modOffset, ID_OFFZ, "0.0", wxDefaultPosition, wxDefaultSize,
        wxTE_PROCESS_ENTER, valOffset );
    xoff->SetMaxLength( 9 );
    yoff->SetMaxLength( 9 );
    zoff->SetMaxLength( 9 );
    hbO1->Add( txtO1, 0, wxALL, 2 );
    hbO1->Add( xoff, 0, wxALL, 2 );
    hbO2->Add( txtO2, 0, wxALL, 2 );
    hbO2->Add( yoff, 0, wxALL, 2 );
    hbO3->Add( txtO3, 0, wxALL, 2 );
    hbO3->Add( zoff, 0, wxALL, 2 );
    vbOffset->Add( hbO1, 0, wxEXPAND | wxALL, 2 );
    vbOffset->Add( hbO2, 0, wxEXPAND | wxALL, 2 );
    vbOffset->Add( hbO3, 0, wxEXPAND | wxALL, 2 );

    // hbox holding orientation data and preview
    wxBoxSizer* hbox = new wxBoxSizer( wxHORIZONTAL );
    // vbox holding orientation data
    wxBoxSizer* vboxOrient = new wxBoxSizer( wxVERTICAL );
    // vbox holding the preview and view buttons
    wxBoxSizer* vboxPrev = new wxBoxSizer( wxVERTICAL );

    vboxOrient->Add( vbScale, 0, wxALL, 5 );
    vboxOrient->Add( vbRotate, 0, wxALL, 5 );
    vboxOrient->Add( vbOffset, 0, wxALL, 5 );
    vboxOrient->AddSpacer( 20 );

    // add preview items
    preview = new wxPanel( this, -1 );
    preview->SetMinSize( wxSize( 320, 200 ) );
    preview->SetBackgroundColour( wxColor( 0, 0, 0 ));
    vboxPrev->Add( preview, 1, wxEXPAND | wxALIGN_CENTER | wxLEFT | wxRIGHT, 5 );
    // buttons:
    wxButton* vFront = new wxButton( this, ID_3D_FRONT, wxT( "F" ) );
    wxButton* vBack = new wxButton( this, ID_3D_BACK, wxT( "B" ) );
    wxButton* vLeft = new wxButton( this, ID_3D_LEFT, wxT( "L" ) );
    wxButton* vRight = new wxButton( this, ID_3D_RIGHT, wxT( "R" ) );
    wxButton* vTop = new wxButton( this, ID_3D_TOP, wxT( "T" ) );
    wxButton* vBottom = new wxButton( this, ID_3D_BOTTOM, wxT( "B" ) );
    wxButton* vISO = new wxButton( this, ID_3D_ISO, wxT( "I" ) );
    wxButton* vUpdate = new wxButton( this, ID_3D_UPDATE, wxT( "U" ) );
    wxBoxSizer* hbBT = new wxBoxSizer( wxHORIZONTAL );
    wxBoxSizer* hbBB = new wxBoxSizer( wxHORIZONTAL );
    hbBT->Add( vISO, 0, wxCENTER | wxALL, 3 );
    hbBT->Add( vLeft, 0, wxCENTER | wxALL, 3 );
    hbBT->Add( vFront, 0, wxCENTER | wxALL, 3 );
    hbBT->Add( vTop, 0, wxCENTER | wxALL, 3 );
    hbBT->AddSpacer( 17 );
    hbBB->Add( vUpdate, 0, wxCENTER | wxALL, 3 );
    hbBB->Add( vRight, 0, wxCENTER | wxALL, 3 );
    hbBB->Add( vBack, 0, wxCENTER | wxALL, 3 );
    hbBB->Add( vBottom, 0, wxCENTER | wxALL, 3 );
    hbBB->AddSpacer( 17 );

    vboxPrev->AddSpacer( 7 );
    vboxPrev->Add( hbBT, 0 );
    vboxPrev->Add( hbBB, 0 );

    // XXX - Suppress the buttons until the Renderer code is ready.
    // vboxPrev->Hide( preview, true );
    vboxPrev->Hide( hbBT, true );
    vboxPrev->Hide( hbBB, true );

    hbox->Add( vboxOrient, 0, wxALL, 5 );
    hbox->Add( vboxPrev, 1, wxEXPAND );
    vbox->Add( hbox, 1, wxEXPAND );

    mainBox->Add( vbox, 1, wxEXPAND | wxALL, 5 );

    if( NULL != m_FileTree )
    {
        // NOTE: if/when the File Selector preview is implemented
        // we may need to hide the orientation boxes to ensure the
        // users have sufficient display area for the browser.
        // hbox->Hide( vboxOrient, true );
        // XXX -
        // NOTE: for now we always suppress the preview and model orientation
        // panels while in the file selector
        //mainBox->Hide( vbox, true );

        hbox->Hide( vboxOrient, true );
        vboxPrev->Hide( hbBT, true );
        vboxPrev->Hide( hbBB, true );
    }

    SetSizerAndFit( mainBox );
    Centre();

    return;
}
DialogSpellChecker::DialogSpellChecker(agi::Context *context)
: wxDialog(context->parent, -1, _("Spell Checker"))
, context(context)
, spellchecker(SpellCheckerFactory::GetSpellChecker())
{
	SetIcon(GETICON(spellcheck_toolbutton_16));

	wxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);

	auto current_word_sizer = new wxFlexGridSizer(2, 5, 5);
	main_sizer->Add(current_word_sizer, wxSizerFlags().Expand().Border(wxALL, 5));

	wxSizer *bottom_sizer = new wxBoxSizer(wxHORIZONTAL);
	main_sizer->Add(bottom_sizer, wxSizerFlags().Expand().Border(~wxTOP & wxALL, 5));

	wxSizer *bottom_left_sizer = new wxBoxSizer(wxVERTICAL);
	bottom_sizer->Add(bottom_left_sizer, wxSizerFlags().Expand().Border(wxRIGHT, 5));

	wxSizer *actions_sizer = new wxBoxSizer(wxVERTICAL);
	bottom_sizer->Add(actions_sizer, wxSizerFlags().Expand());

	// Misspelled word and currently selected correction
	current_word_sizer->AddGrowableCol(1, 1);
	current_word_sizer->Add(new wxStaticText(this, -1, _("Misspelled word:")), 0, wxALIGN_CENTER_VERTICAL);
	current_word_sizer->Add(orig_word = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_READONLY), wxSizerFlags(1).Expand());
	current_word_sizer->Add(new wxStaticText(this, -1, _("Replace with:")), 0, wxALIGN_CENTER_VERTICAL);
	current_word_sizer->Add(replace_word = new wxTextCtrl(this, -1, ""), wxSizerFlags(1).Expand());

	replace_word->Bind(wxEVT_TEXT, [=](wxCommandEvent&) {
		remove_button->Enable(spellchecker->CanRemoveWord(from_wx(replace_word->GetValue())));
	});

	// List of suggested corrections
	suggest_list = new wxListBox(this, -1, wxDefaultPosition, wxSize(300, 150));
	suggest_list->Bind(wxEVT_LISTBOX, &DialogSpellChecker::OnChangeSuggestion, this);
	suggest_list->Bind(wxEVT_LISTBOX_DCLICK, &DialogSpellChecker::OnReplace, this);
	bottom_left_sizer->Add(suggest_list, wxSizerFlags(1).Expand());

	// List of supported spellchecker languages
	{
		if (!spellchecker.get()) {
			wxMessageBox("No spellchecker available.", "Error", wxOK | wxICON_ERROR | wxCENTER);
			throw agi::UserCancelException("No spellchecker available");
		}

		dictionary_lang_codes = to_wx(spellchecker->GetLanguageList());
		if (dictionary_lang_codes.empty()) {
			wxMessageBox("No spellchecker dictionaries available.", "Error", wxOK | wxICON_ERROR | wxCENTER);
			throw agi::UserCancelException("No spellchecker dictionaries available");
		}

		wxArrayString language_names(dictionary_lang_codes);
		for (size_t i = 0; i < dictionary_lang_codes.size(); ++i) {
			if (const wxLanguageInfo *info = wxLocale::FindLanguageInfo(dictionary_lang_codes[i]))
				language_names[i] = info->Description;
		}

		language = new wxComboBox(this, -1, "", wxDefaultPosition, wxDefaultSize, language_names, wxCB_DROPDOWN | wxCB_READONLY);
		wxString cur_lang = to_wx(OPT_GET("Tool/Spell Checker/Language")->GetString());
		int cur_lang_index = dictionary_lang_codes.Index(cur_lang);
		if (cur_lang_index == wxNOT_FOUND) cur_lang_index = dictionary_lang_codes.Index("en");
		if (cur_lang_index == wxNOT_FOUND) cur_lang_index = dictionary_lang_codes.Index("en_US");
		if (cur_lang_index == wxNOT_FOUND) cur_lang_index = 0;
		language->SetSelection(cur_lang_index);
		language->Bind(wxEVT_COMBOBOX, &DialogSpellChecker::OnChangeLanguage, this);

		bottom_left_sizer->Add(language, wxSizerFlags().Expand().Border(wxTOP, 5));
	}

	{
		wxSizerFlags button_flags = wxSizerFlags().Expand().Bottom().Border(wxBOTTOM, 5);

		auto make_checkbox = [&](wxString const& text, const char *opt) {
			auto checkbox = new wxCheckBox(this, -1, text);
			actions_sizer->Add(checkbox, button_flags);
			checkbox->SetValue(OPT_GET(opt)->GetBool());
			checkbox->Bind(wxEVT_CHECKBOX,
				[=](wxCommandEvent &evt) { OPT_SET(opt)->SetBool(!!evt.GetInt()); });
		};

		make_checkbox(_("&Skip Comments"), "Tool/Spell Checker/Skip Comments");
		make_checkbox(_("Ignore &UPPERCASE words"), "Tool/Spell Checker/Skip Uppercase");

		wxButton *button;

		actions_sizer->Add(button = new wxButton(this, -1, _("&Replace")), button_flags);
		button->Bind(wxEVT_BUTTON, &DialogSpellChecker::OnReplace, this);

		actions_sizer->Add(button = new wxButton(this, -1, _("Replace &all")), button_flags);
		button->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) {
			auto_replace[from_wx(orig_word->GetValue())] = from_wx(replace_word->GetValue());
			Replace();
			FindNext();
		});

		actions_sizer->Add(button = new wxButton(this, -1, _("&Ignore")), button_flags);
		button->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) { FindNext(); });

		actions_sizer->Add(button = new wxButton(this, -1, _("Ignore a&ll")), button_flags);
		button->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) {
			auto_ignore.insert(from_wx(orig_word->GetValue()));
			FindNext();
		});

		actions_sizer->Add(add_button = new wxButton(this, -1, _("Add to &dictionary")), button_flags);
		add_button->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) {
			spellchecker->AddWord(from_wx(orig_word->GetValue()));
			FindNext();
		});

		actions_sizer->Add(remove_button = new wxButton(this, -1, _("Remove fro&m dictionary")), button_flags);
		remove_button->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) {
			spellchecker->RemoveWord(from_wx(replace_word->GetValue()));
			SetWord(from_wx(orig_word->GetValue()));
		});

		actions_sizer->Add(new HelpButton(this, "Spell Checker"), button_flags);

		actions_sizer->Add(new wxButton(this, wxID_CANCEL), button_flags.Border(0));
	}

	SetSizerAndFit(main_sizer);
	CenterOnParent();

	if (FindNext())
		Show();
}
Example #24
0
mxLibToBuildWindow::mxLibToBuildWindow(mxProjectConfigWindow *aparent, project_configuration *conf, project_library *alib) : wxDialog(aparent,wxID_ANY,LANG(LIBTOBUILD_CAPTION,"Generar biblioteca"),wxDefaultPosition,wxDefaultSize,wxALWAYS_SHOW_SB | wxALWAYS_SHOW_SB | wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER) {

	parent=aparent;
	constructed=false;
	configuration=conf;
	lib=alib;
	
	wxBoxSizer *mySizer= new wxBoxSizer(wxVERTICAL);
	wxBoxSizer *butSizer = new wxBoxSizer(wxHORIZONTAL);
	
	name = mxUT::AddTextCtrl(mySizer,this,LANG(LIBTOBUILD_NAME,"Nombre"),lib?lib->libname:"");
	path = mxUT::AddTextCtrl(mySizer,this,LANG(LIBTOBUILD_DIR,"Directorio de salida"),lib?lib->path:configuration->temp_folder);
	filename = mxUT::AddTextCtrl(mySizer,this,LANG(LIBTOBUILD_FILE,"Archivo de salida"),"");
	filename->SetEditable(false);
	extra_link = mxUT::AddTextCtrl(mySizer,this,LANG(LIBTOBUILD_EXTRA_LINK,"Opciones de enlazado"),lib?lib->extra_link:"");
	
	wxArrayString tipos;
	tipos.Add(LANG(LIBTOBUILD_DYNAMIC,"Dinamica"));
	tipos.Add(LANG(LIBTOBUILD_STATIC,"Estatica"));
	type = mxUT::AddComboBox(mySizer,this,LANG(LIBTOBUILD_TYPE,"Tipo de biblioteca"),tipos,0);
	if (lib) type->SetSelection(lib->is_static?1:0);
		
	wxSizer *src_sizer = new wxBoxSizer(wxHORIZONTAL);
	wxSizer *szsrc_buttons = new wxBoxSizer(wxVERTICAL);
	szsrc_buttons->Add(new wxButton(this,mxID_LIBS_IN,">>>",wxDefaultPosition,wxSize(50,-1)),sizers->BA10_Exp0);
	szsrc_buttons->Add(new wxButton(this,mxID_LIBS_OUT,"<<<",wxDefaultPosition,wxSize(50,-1)),sizers->BA10_Exp0);
	wxSizer *szsrc_in = new wxBoxSizer(wxVERTICAL);
	szsrc_in->Add(new wxStaticText(this,wxID_ANY,LANG(LIBTOBUILD_SOURCES_IN,"Fuentes a incluir")),sizers->Exp0);
	sources_in = new wxListBox(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,0,nullptr,wxLB_SORT|wxLB_EXTENDED|wxLB_NEEDED_SB);
	szsrc_in->Add(sources_in,sizers->Exp1);
	wxSizer *szsrc_out = new wxBoxSizer(wxVERTICAL);
	szsrc_out->Add(new wxStaticText(this,wxID_ANY,LANG(LIBTOBUILD_SOURCES_OUT,"Fuentes a excluir")),sizers->Exp0);
	sources_out = new wxListBox(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,0,nullptr,wxLB_SORT|wxLB_EXTENDED|wxLB_NEEDED_SB);
	szsrc_out->Add(sources_out,sizers->Exp1);
	src_sizer->Add(szsrc_out,sizers->Exp1);
	src_sizer->Add(szsrc_buttons,sizers->Center);
	src_sizer->Add(szsrc_in,sizers->Exp1);
	mySizer->Add(src_sizer,sizers->BA10_Exp1);
	
	default_lib = mxUT::AddCheckBox(mySizer,this,LANG(LIBTOBUILD_DEFAULT,"Biblioteca por defecto para nuevos fuentes"),lib?lib->default_lib:false);
	
	wxBitmapButton *help_button = new wxBitmapButton(this,mxID_HELP_BUTTON,*bitmaps->buttons.help);
	butSizer->Add(help_button,sizers->BA5);
	butSizer->AddStretchSpacer();
	wxBitmapButton *cancel_button = new mxBitmapButton(this,wxID_CANCEL,bitmaps->buttons.cancel,LANG(GENERAL_CANCEL_BUTTON,"&Cancelar"));
	butSizer->Add(cancel_button,sizers->BA5);
	wxBitmapButton *ok_button = new mxBitmapButton (this,wxID_OK,bitmaps->buttons.ok,LANG(GENERAL_OK_BUTTON,"&Aceptar"));
	butSizer->Add(ok_button,sizers->BA5);
	
	mySizer->Add(butSizer,sizers->BA5_Exp0);
	
	mySizer->SetMinSize(400,400);
	SetSizerAndFit(mySizer);
	ok_button->SetDefault();
	SetEscapeId(wxID_CANCEL);
	
	project->AssociateLibsAndSources(configuration);

	LocalListIterator<project_file_item*> item(&project->files_sources);
	while (item.IsValid()) {
		if (lib && item->lib==lib)
			sources_in->Append(item->name);
		else
			sources_out->Append(item->name);
		item.Next();
	}
	
	constructed=true;
	SetFName();
	name->SetFocus();
	ShowModal();
}
Example #25
0
WeightsManFrame::WeightsManFrame(wxFrame *parent, Project* project,
								 const wxString& title, const wxPoint& pos,
								 const wxSize& size, const long style)
: TemplateFrame(parent, project, title, pos, size, style),
conn_hist_canvas(0),
conn_map_canvas(0),
project_p(project),
w_man_int(project->GetWManInt()), w_man_state(project->GetWManState()),
table_int(project->GetTableInt()), suspend_w_man_state_updates(false),
create_btn(0), load_btn(0), remove_btn(0), w_list(0)
{
	LOG_MSG("Entering WeightsManFrame::WeightsManFrame");
	
	panel = new wxPanel(this);
	panel->SetBackgroundColour(*wxWHITE);
	SetBackgroundColour(*wxWHITE);
	
	create_btn = new wxButton(panel, XRCID("ID_CREATE_BTN"), "Create",  wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
    
	load_btn = new wxButton(panel, XRCID("ID_LOAD_BTN"), "Load", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
    
	remove_btn = new wxButton(panel, XRCID("ID_REMOVE_BTN"), "Remove", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
    
    histogram_btn = new wxButton(panel, XRCID("ID_HISTOGRAM_BTN"), "Histogram", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
    
    connectivity_map_btn = new wxButton(panel, XRCID("ID_CONNECT_MAP_BTN"), "Connectivity Map", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
	
	Connect(XRCID("ID_CREATE_BTN"), wxEVT_BUTTON, wxCommandEventHandler(WeightsManFrame::OnCreateBtn));
	Connect(XRCID("ID_LOAD_BTN"), wxEVT_BUTTON, wxCommandEventHandler(WeightsManFrame::OnLoadBtn));
	Connect(XRCID("ID_REMOVE_BTN"), wxEVT_BUTTON, wxCommandEventHandler(WeightsManFrame::OnRemoveBtn));
    Connect(XRCID("ID_HISTOGRAM_BTN"), wxEVT_BUTTON, wxCommandEventHandler(WeightsManFrame::OnHistogramBtn));
    Connect(XRCID("ID_CONNECT_MAP_BTN"), wxEVT_BUTTON, wxCommandEventHandler(WeightsManFrame::OnConnectMapBtn));

	w_list = new wxListCtrl(panel, XRCID("ID_W_LIST"), wxDefaultPosition, wxSize(-1, 100), wxLC_REPORT);
    
	// Note: search for "ungrouped_list" for examples of wxListCtrl usage.
	w_list->AppendColumn("Weights Name");
	w_list->SetColumnWidth(TITLE_COL, 300);
	InitWeightsList();
	
	Connect(XRCID("ID_W_LIST"), wxEVT_LIST_ITEM_SELECTED, wxListEventHandler(WeightsManFrame::OnWListItemSelect));
	Connect(XRCID("ID_W_LIST"), wxEVT_LIST_ITEM_DESELECTED, wxListEventHandler(WeightsManFrame::OnWListItemDeselect));
	
	details_win = wxWebView::New(panel, wxID_ANY, wxWebViewDefaultURLStr, wxDefaultPosition, wxSize(-1, 200));

	// Arrange above widgets in panel using sizers.
	// Top level panel sizer will be panel_h_szr
	// Below that will be panel_v_szr
	// panel_v_szr will directly receive widgets
	
	wxBoxSizer* btns_row1_h_szr = new wxBoxSizer(wxHORIZONTAL);
	btns_row1_h_szr->Add(create_btn, 0, wxALIGN_CENTER_VERTICAL);
	btns_row1_h_szr->AddSpacer(5);
	btns_row1_h_szr->Add(load_btn, 0, wxALIGN_CENTER_VERTICAL);
	btns_row1_h_szr->AddSpacer(5);
	btns_row1_h_szr->Add(remove_btn, 0, wxALIGN_CENTER_VERTICAL);
	
    wxBoxSizer* btns_row2_h_szr = new wxBoxSizer(wxHORIZONTAL);
    btns_row2_h_szr->Add(histogram_btn, 0, wxALIGN_CENTER_VERTICAL);
    btns_row2_h_szr->AddSpacer(5);
    btns_row2_h_szr->Add(connectivity_map_btn, 0, wxALIGN_CENTER_VERTICAL);
    btns_row2_h_szr->AddSpacer(5);
 
    
	wxBoxSizer* wghts_list_h_szr = new wxBoxSizer(wxHORIZONTAL);
	wghts_list_h_szr->Add(w_list);
	
	wxBoxSizer* panel_v_szr = new wxBoxSizer(wxVERTICAL);
	panel_v_szr->Add(btns_row1_h_szr, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
    panel_v_szr->AddSpacer(15);
	panel_v_szr->Add(wghts_list_h_szr, 0, wxALIGN_CENTER_HORIZONTAL);
	panel_v_szr->Add(details_win, 1, wxEXPAND);
	panel_v_szr->Add(btns_row2_h_szr, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	
	
	wxBoxSizer* panel_h_szr = new wxBoxSizer(wxHORIZONTAL);
	panel_h_szr->Add(panel_v_szr, 1, wxEXPAND);
	
	panel->SetSizer(panel_h_szr);
	
	
	//wxBoxSizer* right_v_szr = new wxBoxSizer(wxVERTICAL);
	//conn_hist_canvas = new ConnectivityHistCanvas(this, this, project, boost::uuids::nil_uuid());
	//right_v_szr->Add(conn_hist_canvas, 1, wxEXPAND);
	
	// We have decided not to display the ConnectivityMapCanvas.  Uncomment
	// the following 4 lines to re-enable for shape-enabled projects.
	//if (!project->IsTableOnlyProject()) {
	//	conn_map_canvas = new ConnectivityMapCanvas(this, this, project,
	//												boost::uuids::nil_uuid());
	//	right_v_szr->Add(conn_map_canvas, 1, wxEXPAND);
	//}
	
	boost::uuids::uuid default_id = w_man_int->GetDefault();
	SelectId(default_id);
	UpdateButtons();
	
	// Top Sizer for Frame
	wxBoxSizer* top_h_sizer = new wxBoxSizer(wxHORIZONTAL);
	top_h_sizer->Add(panel, 1, wxEXPAND|wxALL, 8);
	//top_h_sizer->Add(right_v_szr, 1, wxEXPAND);
	
	wxColour panel_color = panel->GetBackgroundColour();
	SetBackgroundColour(panel_color);
	//hist_canvas->SetCanvasBackgroundColor(panel_color);
	
	SetSizerAndFit(top_h_sizer);
	DisplayStatusBar(false);

	w_man_state->registerObserver(this);
	Show(true);
	LOG_MSG("Exiting WeightsManFrame::WeightsManFrame");
}
Example #26
0
VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, const std::string& _ininame)
	: wxDialog(parent, -1,
		wxString::Format(_("Dolphin %s Graphics Configuration"), wxGetTranslation(StrToWxStr(title))))
	, vconfig(g_Config)
	, ininame(_ininame)
{
	vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini");

	Bind(wxEVT_UPDATE_UI, &VideoConfigDiag::OnUpdateUI, this);

	wxNotebook* const notebook = new wxNotebook(this, -1);

	// -- GENERAL --
	{
	wxPanel* const page_general = new wxPanel(notebook, -1);
	notebook->AddPage(page_general, _("General"));
	wxBoxSizer* const szr_general = new wxBoxSizer(wxVERTICAL);

	// - basic
	{
	wxFlexGridSizer* const szr_basic = new wxFlexGridSizer(2, 5, 5);

	// backend
	{
	wxStaticText* const label_backend = new wxStaticText(page_general, wxID_ANY, _("Backend:"));
	choice_backend = new wxChoice(page_general, wxID_ANY);
	RegisterControl(choice_backend, wxGetTranslation(backend_desc));

	for (const VideoBackend* backend : g_available_video_backends)
	{
		choice_backend->AppendString(wxGetTranslation(StrToWxStr(backend->GetDisplayName())));
	}

	choice_backend->SetStringSelection(wxGetTranslation(StrToWxStr(g_video_backend->GetDisplayName())));
	choice_backend->Bind(wxEVT_CHOICE, &VideoConfigDiag::Event_Backend, this);

	szr_basic->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5);
	szr_basic->Add(choice_backend, 1, 0, 0);

	if (Core::IsRunning())
	{
		label_backend->Disable();
		choice_backend->Disable();
	}
	}

	// adapter (D3D only)
	if (vconfig.backend_info.Adapters.size())
	{
		wxChoice* const choice_adapter = CreateChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_desc));

		for (const std::string& adapter : vconfig.backend_info.Adapters)
		{
			choice_adapter->AppendString(StrToWxStr(adapter));
		}

		choice_adapter->Select(vconfig.iAdapter);

		szr_basic->Add(new wxStaticText(page_general, -1, _("Adapter:")), 1, wxALIGN_CENTER_VERTICAL, 5);
		szr_basic->Add(choice_adapter, 1, 0, 0);
	}


	// - display
	wxFlexGridSizer* const szr_display = new wxFlexGridSizer(2, 5, 5);

	{

#if !defined(__APPLE__)
	// display resolution
	{
		wxArrayString res_list = GetListOfResolutions();
		if (res_list.empty())
			res_list.Add(_("<No resolutions found>"));
		wxStaticText* const label_display_resolution = new wxStaticText(page_general, wxID_ANY, _("Fullscreen Resolution:"));
		choice_display_resolution = new wxChoice(page_general, wxID_ANY, wxDefaultPosition, wxDefaultSize, res_list);
		RegisterControl(choice_display_resolution, wxGetTranslation(display_res_desc));
		choice_display_resolution->Bind(wxEVT_CHOICE, &VideoConfigDiag::Event_DisplayResolution, this);

		choice_display_resolution->SetStringSelection(StrToWxStr(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution));

		szr_display->Add(label_display_resolution, 1, wxALIGN_CENTER_VERTICAL, 0);
		szr_display->Add(choice_display_resolution);

		if (Core::IsRunning())
		{
			label_display_resolution->Disable();
			choice_display_resolution->Disable();
		}
	}
#endif

	// aspect-ratio
	{
	const wxString ar_choices[] = { _("Auto"), _("Force 16:9"), _("Force 4:3"), _("Stretch to Window") };

	szr_display->Add(new wxStaticText(page_general, -1, _("Aspect Ratio:")), 1, wxALIGN_CENTER_VERTICAL, 0);
	wxChoice* const choice_aspect = CreateChoice(page_general, vconfig.iAspectRatio, wxGetTranslation(ar_desc),
														sizeof(ar_choices)/sizeof(*ar_choices), ar_choices);
	szr_display->Add(choice_aspect, 1, 0, 0);
	}

	// various other display options
	{
	szr_display->Add(CreateCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_desc), vconfig.bVSync));
	szr_display->Add(CreateCheckBox(page_general, _("Use Fullscreen"), wxGetTranslation(use_fullscreen_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen));
	}
	}

	// - other
	wxFlexGridSizer* const szr_other = new wxFlexGridSizer(2, 5, 5);

	{
	SettingCheckBox* render_to_main_cb;
	szr_other->Add(CreateCheckBox(page_general, _("Show FPS"), wxGetTranslation(show_fps_desc), vconfig.bShowFPS));
	szr_other->Add(CreateCheckBox(page_general, _("Log Render Time to File"), wxGetTranslation(log_render_time_to_file_desc), vconfig.bLogRenderTimeToFile));
	szr_other->Add(CreateCheckBox(page_general, _("Auto adjust Window Size"), wxGetTranslation(auto_window_size_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderWindowAutoSize));
	szr_other->Add(CreateCheckBox(page_general, _("Keep Window on Top"), wxGetTranslation(keep_window_on_top_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bKeepWindowOnTop));
	szr_other->Add(CreateCheckBox(page_general, _("Hide Mouse Cursor"), wxGetTranslation(hide_mouse_cursor_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor));
	szr_other->Add(render_to_main_cb = CreateCheckBox(page_general, _("Render to Main Window"), wxGetTranslation(render_to_main_win_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain));

	if (Core::IsRunning())
		render_to_main_cb->Disable();
	}


	wxStaticBoxSizer* const group_basic = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Basic"));
	group_basic->Add(szr_basic, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_general->Add(group_basic, 0, wxEXPAND | wxALL, 5);

	wxStaticBoxSizer* const group_display = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Display"));
	group_display->Add(szr_display, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_general->Add(group_display, 0, wxEXPAND | wxALL, 5);

	wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Other"));
	group_other->Add(szr_other, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_general->Add(group_other, 0, wxEXPAND | wxALL, 5);
	}

	szr_general->AddStretchSpacer();
	CreateDescriptionArea(page_general, szr_general);
	page_general->SetSizerAndFit(szr_general);
	}

	// -- ENHANCEMENTS --
	{
	wxPanel* const page_enh = new wxPanel(notebook, -1);
	notebook->AddPage(page_enh, _("Enhancements"));
	wxBoxSizer* const szr_enh_main = new wxBoxSizer(wxVERTICAL);

	// - enhancements
	wxFlexGridSizer* const szr_enh = new wxFlexGridSizer(2, 5, 5);

	// Internal resolution
	{
	const wxString efbscale_choices[] = { _("Auto (Window Size)"), _("Auto (Multiple of 640x528)"),
		_("1x Native (640x528)"), _("1.5x Native (960x792)"), _("2x Native (1280x1056)"),
		_("2.5x Native (1600x1320)"), _("3x Native (1920x1584)"), _("4x Native (2560x2112)") };

	wxChoice *const choice_efbscale = CreateChoice(page_enh,
		vconfig.iEFBScale, wxGetTranslation(internal_res_desc), sizeof(efbscale_choices)/sizeof(*efbscale_choices), efbscale_choices);

	szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Internal Resolution:")), 1, wxALIGN_CENTER_VERTICAL, 0);
	szr_enh->Add(choice_efbscale);
	}

	// AA
	{
	text_aamode = new wxStaticText(page_enh, -1, _("Anti-Aliasing:"));
	choice_aamode = CreateChoice(page_enh, vconfig.iMultisampleMode, wxGetTranslation(aa_desc));

	for (const std::string& mode : vconfig.backend_info.AAModes)
	{
		choice_aamode->AppendString(wxGetTranslation(StrToWxStr(mode)));
	}

	choice_aamode->Select(vconfig.iMultisampleMode);
	szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0);
	szr_enh->Add(choice_aamode);
	}

	// AF
	{
	const wxString af_choices[] = {"1x", "2x", "4x", "8x", "16x"};
	szr_enh->Add(new wxStaticText(page_enh, -1, _("Anisotropic Filtering:")), 1, wxALIGN_CENTER_VERTICAL, 0);
	szr_enh->Add(CreateChoice(page_enh, vconfig.iMaxAnisotropy, wxGetTranslation(af_desc), 5, af_choices));
	}

	// postproc shader
	if (vconfig.backend_info.PPShaders.size())
	{
		wxFlexGridSizer* const szr_pp = new wxFlexGridSizer(3, 5, 5);
		wxChoice *const choice_ppshader = new wxChoice(page_enh, -1);
		RegisterControl(choice_ppshader, wxGetTranslation(ppshader_desc));
		choice_ppshader->AppendString(_("(off)"));

		button_config_pp = new wxButton(page_enh, wxID_ANY, _("Config"));

		for (const std::string& shader : vconfig.backend_info.PPShaders)
		{
			choice_ppshader->AppendString(StrToWxStr(shader));
		}

		if (vconfig.sPostProcessingShader.empty())
			choice_ppshader->Select(0);
		else
			choice_ppshader->SetStringSelection(StrToWxStr(vconfig.sPostProcessingShader));

		// Should the configuration button be loaded by default?
		PostProcessingShaderConfiguration postprocessing_shader;
		postprocessing_shader.LoadShader(vconfig.sPostProcessingShader);
		button_config_pp->Enable(postprocessing_shader.HasOptions());

		choice_ppshader->Bind(wxEVT_CHOICE, &VideoConfigDiag::Event_PPShader, this);
		button_config_pp->Bind(wxEVT_BUTTON, &VideoConfigDiag::Event_ConfigurePPShader, this);

		szr_enh->Add(new wxStaticText(page_enh, -1, _("Post-Processing Effect:")), 1, wxALIGN_CENTER_VERTICAL, 0);
		szr_pp->Add(choice_ppshader);
		szr_pp->Add(button_config_pp);
		szr_enh->Add(szr_pp);
	}

	// Scaled copy, PL, Bilinear filter
	szr_enh->Add(CreateCheckBox(page_enh, _("Scaled EFB Copy"), wxGetTranslation(scaled_efb_copy_desc), vconfig.bCopyEFBScaled));
	szr_enh->Add(CreateCheckBox(page_enh, _("Per-Pixel Lighting"), wxGetTranslation(pixel_lighting_desc), vconfig.bEnablePixelLighting));
	szr_enh->Add(CreateCheckBox(page_enh, _("Force Texture Filtering"), wxGetTranslation(force_filtering_desc), vconfig.bForceFiltering));

	szr_enh->Add(CreateCheckBox(page_enh, _("Widescreen Hack"), wxGetTranslation(ws_hack_desc), vconfig.bWidescreenHack));
	szr_enh->Add(CreateCheckBox(page_enh, _("Disable Fog"), wxGetTranslation(disable_fog_desc), vconfig.bDisableFog));

	wxStaticBoxSizer* const group_enh = new wxStaticBoxSizer(wxVERTICAL, page_enh, _("Enhancements"));
	group_enh->Add(szr_enh, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_enh_main->Add(group_enh, 0, wxEXPAND | wxALL, 5);


	szr_enh_main->AddStretchSpacer();
	CreateDescriptionArea(page_enh, szr_enh_main);
	page_enh->SetSizerAndFit(szr_enh_main);
	}


	// -- SPEED HACKS --
	{
	wxPanel* const page_hacks = new wxPanel(notebook, -1);
	notebook->AddPage(page_hacks, _("Hacks"));
	wxBoxSizer* const szr_hacks = new wxBoxSizer(wxVERTICAL);

	// - EFB hacks
	wxStaticBoxSizer* const szr_efb = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Embedded Frame Buffer"));

	// EFB copies
	wxStaticBoxSizer* const group_efbcopy = new wxStaticBoxSizer(wxHORIZONTAL, page_hacks, _("EFB Copies"));

	SettingCheckBox* efbcopy_disable = CreateCheckBox(page_hacks, _("Disable"), wxGetTranslation(efb_copy_desc), vconfig.bEFBCopyEnable, true);
	efbcopy_texture = CreateRadioButton(page_hacks, _("Texture"), wxGetTranslation(efb_copy_texture_desc), vconfig.bCopyEFBToTexture, false, wxRB_GROUP);
	efbcopy_ram = CreateRadioButton(page_hacks, _("RAM"), wxGetTranslation(efb_copy_ram_desc), vconfig.bCopyEFBToTexture, true);
	cache_efb_copies = CreateCheckBox(page_hacks, _("Enable Cache"), wxGetTranslation(cache_efb_copies_desc), vconfig.bEFBCopyCacheEnable);

	group_efbcopy->Add(efbcopy_disable, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
	group_efbcopy->AddStretchSpacer(1);
	group_efbcopy->Add(efbcopy_texture, 0, wxRIGHT, 5);
	group_efbcopy->Add(efbcopy_ram, 0, wxRIGHT, 5);
	group_efbcopy->Add(cache_efb_copies, 0, wxRIGHT, 5);

	szr_efb->Add(CreateCheckBox(page_hacks, _("Skip EFB Access from CPU"), wxGetTranslation(efb_access_desc), vconfig.bEFBAccessEnable, true), 0, wxBOTTOM | wxLEFT, 5);
	szr_efb->Add(CreateCheckBox(page_hacks, _("Ignore Format Changes"), wxGetTranslation(efb_emulate_format_changes_desc), vconfig.bEFBEmulateFormatChanges, true), 0, wxBOTTOM | wxLEFT, 5);
	szr_efb->Add(group_efbcopy, 0, wxEXPAND | wxALL, 5);
	szr_hacks->Add(szr_efb, 0, wxEXPAND | wxALL, 5);

	// Texture cache
	{
	wxStaticBoxSizer* const szr_safetex = new wxStaticBoxSizer(wxHORIZONTAL, page_hacks, _("Texture Cache"));

	// TODO: Use wxSL_MIN_MAX_LABELS or wxSL_VALUE_LABEL with wx 2.9.1
	wxSlider* const stc_slider = new wxSlider(page_hacks, wxID_ANY, 0, 0, 2, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_BOTTOM);
	stc_slider->Bind(wxEVT_SLIDER, &VideoConfigDiag::Event_Stc, this);
	RegisterControl(stc_slider, wxGetTranslation(stc_desc));

	if (vconfig.iSafeTextureCache_ColorSamples == 0) stc_slider->SetValue(0);
	else if (vconfig.iSafeTextureCache_ColorSamples == 512) stc_slider->SetValue(1);
	else if (vconfig.iSafeTextureCache_ColorSamples == 128) stc_slider->SetValue(2);
	else stc_slider->Disable(); // Using custom number of samples; TODO: Inform the user why this is disabled..

	szr_safetex->Add(new wxStaticText(page_hacks, wxID_ANY, _("Accuracy:")), 0, wxALL, 5);
	szr_safetex->AddStretchSpacer(1);
	szr_safetex->Add(new wxStaticText(page_hacks, wxID_ANY, _("Safe")), 0, wxLEFT|wxTOP|wxBOTTOM, 5);
	szr_safetex->Add(stc_slider, 2, wxRIGHT, 0);
	szr_safetex->Add(new wxStaticText(page_hacks, wxID_ANY, _("Fast")), 0, wxRIGHT|wxTOP|wxBOTTOM, 5);
	szr_hacks->Add(szr_safetex, 0, wxEXPAND | wxALL, 5);
	}

	// - XFB
	{
	wxStaticBoxSizer* const group_xfb = new wxStaticBoxSizer(wxHORIZONTAL, page_hacks, _("External Frame Buffer"));

	SettingCheckBox* disable_xfb = CreateCheckBox(page_hacks, _("Disable"), wxGetTranslation(xfb_desc), vconfig.bUseXFB, true);
	virtual_xfb = CreateRadioButton(page_hacks, _("Virtual"), wxGetTranslation(xfb_virtual_desc), vconfig.bUseRealXFB, true, wxRB_GROUP);
	real_xfb = CreateRadioButton(page_hacks, _("Real"), wxGetTranslation(xfb_real_desc), vconfig.bUseRealXFB);

	group_xfb->Add(disable_xfb, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
	group_xfb->AddStretchSpacer(1);
	group_xfb->Add(virtual_xfb, 0, wxRIGHT, 5);
	group_xfb->Add(real_xfb, 0, wxRIGHT, 5);
	szr_hacks->Add(group_xfb, 0, wxEXPAND | wxALL, 5);
	} // xfb

	// - other hacks
	{
	wxGridSizer* const szr_other = new wxGridSizer(2, 5, 5);
	szr_other->Add(CreateCheckBox(page_hacks, _("Disable Destination Alpha"), wxGetTranslation(disable_dstalpha_desc), vconfig.bDstAlphaPass));
	szr_other->Add(CreateCheckBox(page_hacks, _("OpenMP Texture Decoder"), wxGetTranslation(omp_desc), vconfig.bOMPDecoder));
	szr_other->Add(CreateCheckBox(page_hacks, _("Fast Depth Calculation"), wxGetTranslation(fast_depth_calc_desc), vconfig.bFastDepthCalc));

	wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Other"));
	group_other->Add(szr_other, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	szr_hacks->Add(group_other, 0, wxEXPAND | wxALL, 5);
	}

	szr_hacks->AddStretchSpacer();
	CreateDescriptionArea(page_hacks, szr_hacks);
	page_hacks->SetSizerAndFit(szr_hacks);
	}

	// -- ADVANCED --
	{
	wxPanel* const page_advanced = new wxPanel(notebook, -1);
	notebook->AddPage(page_advanced, _("Advanced"));
	wxBoxSizer* const szr_advanced = new wxBoxSizer(wxVERTICAL);

	// - debug
	{
	wxGridSizer* const szr_debug = new wxGridSizer(2, 5, 5);

	szr_debug->Add(CreateCheckBox(page_advanced, _("Enable Wireframe"), wxGetTranslation(wireframe_desc), vconfig.bWireFrame));
	szr_debug->Add(CreateCheckBox(page_advanced, _("Show EFB Copy Regions"), wxGetTranslation(efb_copy_regions_desc), vconfig.bShowEFBCopyRegions));
	szr_debug->Add(CreateCheckBox(page_advanced, _("Show Statistics"), wxGetTranslation(show_stats_desc), vconfig.bOverlayStats));
	szr_debug->Add(CreateCheckBox(page_advanced, _("Texture Format Overlay"), wxGetTranslation(texfmt_desc), vconfig.bTexFmtOverlayEnable));

	wxStaticBoxSizer* const group_debug = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Debugging"));
	szr_advanced->Add(group_debug, 0, wxEXPAND | wxALL, 5);
	group_debug->Add(szr_debug, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	}

	// - utility
	{
	wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5);

	szr_utility->Add(CreateCheckBox(page_advanced, _("Dump Textures"), wxGetTranslation(dump_textures_desc), vconfig.bDumpTextures));
	szr_utility->Add(CreateCheckBox(page_advanced, _("Load Custom Textures"), wxGetTranslation(load_hires_textures_desc), vconfig.bHiresTextures));
	szr_utility->Add(CreateCheckBox(page_advanced, _("Dump EFB Target"), wxGetTranslation(dump_efb_desc), vconfig.bDumpEFBTarget));
	szr_utility->Add(CreateCheckBox(page_advanced, _("Dump Frames"), wxGetTranslation(dump_frames_desc), vconfig.bDumpFrames));
	szr_utility->Add(CreateCheckBox(page_advanced, _("Free Look"), wxGetTranslation(free_look_desc), vconfig.bFreeLook));
#if !defined WIN32 && defined HAVE_LIBAV
	szr_utility->Add(CreateCheckBox(page_advanced, _("Frame Dumps use FFV1"), wxGetTranslation(use_ffv1_desc), vconfig.bUseFFV1));
#endif

	wxStaticBoxSizer* const group_utility = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Utility"));
	szr_advanced->Add(group_utility, 0, wxEXPAND | wxALL, 5);
	group_utility->Add(szr_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	}

	// - misc
	{
	wxGridSizer* const szr_misc = new wxGridSizer(2, 5, 5);

	szr_misc->Add(CreateCheckBox(page_advanced, _("Show Input Display"), wxGetTranslation(show_input_display_desc), vconfig.bShowInputDisplay));
	szr_misc->Add(CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), vconfig.bCrop));

	// Progressive Scan
	{
	wxCheckBox* const cb_prog_scan = new wxCheckBox(page_advanced, wxID_ANY, _("Enable Progressive Scan"));
	RegisterControl(cb_prog_scan, wxGetTranslation(prog_scan_desc));
	cb_prog_scan->Bind(wxEVT_CHECKBOX, &VideoConfigDiag::Event_ProgressiveScan, this);
	if (Core::IsRunning())
		cb_prog_scan->Disable();

	cb_prog_scan->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive);
	// A bit strange behavior, but this needs to stay in sync with the main progressive boolean; TODO: Is this still necessary?
	SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive);

	szr_misc->Add(cb_prog_scan);
	}

	// Borderless Fullscreen
	borderless_fullscreen = CreateCheckBox(page_advanced, _("Borderless Fullscreen"), wxGetTranslation(borderless_fullscreen_desc), vconfig.bBorderlessFullscreen);
	borderless_fullscreen->Show(vconfig.backend_info.bSupportsExclusiveFullscreen);
	szr_misc->Add(borderless_fullscreen);

	wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Misc"));
	szr_advanced->Add(group_misc, 0, wxEXPAND | wxALL, 5);
	group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
	}

	szr_advanced->AddStretchSpacer();
	CreateDescriptionArea(page_advanced, szr_advanced);
	page_advanced->SetSizerAndFit(szr_advanced);
	}

	wxButton* const btn_close = new wxButton(this, wxID_OK, _("Close"));
	btn_close->Bind(wxEVT_BUTTON, &VideoConfigDiag::Event_ClickClose, this);

	Bind(wxEVT_CLOSE_WINDOW, &VideoConfigDiag::Event_Close, this);

	wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL);
	szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5);
	szr_main->Add(btn_close, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5);

	SetSizerAndFit(szr_main);
	Center();
	SetFocus();

	UpdateWindowUI();
}
Example #27
0
MemoryViewerPanel::MemoryViewerPanel(wxWindow* parent) 
	: wxFrame(parent, wxID_ANY, "Memory Viewer", wxDefaultPosition, wxSize(700, 450))
{
	exit = false;
	m_addr = 0;
	m_colcount = 16;
	m_rowcount = 16;

	this->SetBackgroundColour(wxColour(240,240,240)); //This fix the ugly background color under Windows
	wxBoxSizer* s_panel = new wxBoxSizer(wxVERTICAL);

	//Tools
	wxBoxSizer* s_tools = new wxBoxSizer(wxHORIZONTAL);

	//Tools: Memory Viewer Options
	wxStaticBoxSizer* s_tools_mem = new wxStaticBoxSizer(wxHORIZONTAL, this, "Memory Viewer Options");

	wxStaticBoxSizer* s_tools_mem_addr = new wxStaticBoxSizer(wxHORIZONTAL, this, "Address");
	t_addr = new wxTextCtrl(this, wxID_ANY, "00000000", wxDefaultPosition, wxSize(60,-1));
	t_addr->SetMaxLength(8);
	s_tools_mem_addr->Add(t_addr);

	wxStaticBoxSizer* s_tools_mem_bytes = new wxStaticBoxSizer(wxHORIZONTAL, this, "Bytes");
	sc_bytes = new wxSpinCtrl(this, wxID_ANY, "16", wxDefaultPosition, wxSize(44,-1));
	sc_bytes->SetRange(1, 16);
	s_tools_mem_bytes->Add(sc_bytes);

	wxStaticBoxSizer* s_tools_mem_buttons = new wxStaticBoxSizer(wxHORIZONTAL, this, "Control");
	wxButton* b_fprev = new wxButton(this, wxID_ANY, "<<", wxDefaultPosition, wxSize(21, 21));
	wxButton* b_prev  = new wxButton(this, wxID_ANY, "<", wxDefaultPosition, wxSize(21, 21));
	wxButton* b_next  = new wxButton(this, wxID_ANY, ">", wxDefaultPosition, wxSize(21, 21));
	wxButton* b_fnext = new wxButton(this, wxID_ANY, ">>", wxDefaultPosition, wxSize(21, 21));
	s_tools_mem_buttons->Add(b_fprev);
	s_tools_mem_buttons->Add(b_prev);
	s_tools_mem_buttons->Add(b_next);
	s_tools_mem_buttons->Add(b_fnext);

	s_tools_mem->Add(s_tools_mem_addr);
	s_tools_mem->Add(s_tools_mem_bytes);
	s_tools_mem->Add(s_tools_mem_buttons);

	//Tools: Raw Image Preview Options
	wxStaticBoxSizer* s_tools_img = new wxStaticBoxSizer(wxHORIZONTAL, this, "Raw Image Preview");

	wxStaticBoxSizer* s_tools_img_size = new wxStaticBoxSizer(wxHORIZONTAL, this, "Size");
	sc_img_size_x = new wxSpinCtrl(this, wxID_ANY, "256", wxDefaultPosition, wxSize(60,-1));
	sc_img_size_y = new wxSpinCtrl(this, wxID_ANY, "256", wxDefaultPosition, wxSize(60,-1));
	s_tools_img_size->Add(sc_img_size_x);
	s_tools_img_size->Add(new wxStaticText(this, wxID_ANY, " x "));
	s_tools_img_size->Add(sc_img_size_y);

	sc_img_size_x->SetRange(1, 8192);
	sc_img_size_y->SetRange(1, 8192);

	wxStaticBoxSizer* s_tools_img_mode = new wxStaticBoxSizer(wxHORIZONTAL, this, "Mode");
	cbox_img_mode = new wxComboBox(this, wxID_ANY);
	cbox_img_mode->Append("RGB");
	cbox_img_mode->Append("ARGB");
	cbox_img_mode->Append("RGBA");
	cbox_img_mode->Append("ABGR");
	cbox_img_mode->Select(1); //ARGB
	s_tools_img_mode->Add(cbox_img_mode);

	s_tools_img->Add(s_tools_img_size);
	s_tools_img->Add(s_tools_img_mode);

	//Tools: Run tools
	wxStaticBoxSizer* s_tools_buttons = new wxStaticBoxSizer(wxVERTICAL, this, "Tools");
	wxButton* b_img = new wxButton(this, wxID_ANY, "View\nimage", wxDefaultPosition, wxSize(52,-1));
	s_tools_buttons->Add(b_img);

	//Tools: Tools = Memory Viewer Options + Raw Image Preview Options + Buttons
	s_tools->AddSpacer(10);
	s_tools->Add(s_tools_mem);
	s_tools->AddSpacer(10);
	s_tools->Add(s_tools_img);
	s_tools->AddSpacer(10);
	s_tools->Add(s_tools_buttons);
	s_tools->AddSpacer(10);

	//Memory Panel
	wxBoxSizer* s_mem_panel = new wxBoxSizer(wxHORIZONTAL);
	t_mem_addr  = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER|wxTE_READONLY);
	t_mem_hex   = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER|wxTE_READONLY);
	t_mem_ascii = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER|wxTE_READONLY);
	t_mem_addr->SetMinSize(wxSize(68, 228));
	t_mem_addr->SetForegroundColour(wxColour(75, 135, 150));
	
	t_mem_addr->SetScrollbar(wxVERTICAL, 0, 0, 0);
	t_mem_hex ->SetScrollbar(wxVERTICAL, 0, 0, 0);
	t_mem_ascii->SetScrollbar(wxVERTICAL, 0, 0, 0);
	t_mem_addr ->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
	t_mem_hex  ->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
	t_mem_ascii->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));

	s_mem_panel->AddSpacer(10);
	s_mem_panel->Add(t_mem_addr);
	s_mem_panel->Add(t_mem_hex);
	s_mem_panel->Add(t_mem_ascii);
	s_mem_panel->AddSpacer(10);

	//Memory Panel: Set size of the wxTextCtrl's
	int x, y;
	t_mem_hex->GetTextExtent(wxT("T"), &x, &y);
	t_mem_hex->SetMinSize(wxSize(x * 3*m_colcount + 6, 228));
	t_mem_hex->SetMaxSize(wxSize(x * 3*m_colcount + 6, 228));
	t_mem_ascii->SetMinSize(wxSize(x * m_colcount + 6, 228));
	t_mem_ascii->SetMaxSize(wxSize(x * m_colcount + 6, 228));

	//Merge and display everything
	s_panel->AddSpacer(10);
	s_panel->Add(s_tools);
	s_panel->AddSpacer(10);
	s_panel->Add(s_mem_panel, 0, 0, 100);
	s_panel->AddSpacer(10);
	SetSizerAndFit(s_panel);

	//Events
	t_addr  ->Bind(wxEVT_TEXT_ENTER, &MemoryViewerPanel::OnChangeToolsAddr, this);
	sc_bytes->Bind(wxEVT_TEXT_ENTER, &MemoryViewerPanel::OnChangeToolsBytes, this);
	t_addr  ->Bind(wxEVT_TEXT_ENTER, &MemoryViewerPanel::OnChangeToolsAddr, this);
	sc_bytes->Bind(wxEVT_TEXT_ENTER, &MemoryViewerPanel::OnChangeToolsBytes, this);
	sc_bytes->Bind(wxEVT_SPINCTRL,   &MemoryViewerPanel::OnChangeToolsBytes, this);

	b_prev ->Bind(wxEVT_BUTTON, &MemoryViewerPanel::Prev, this);
	b_next ->Bind(wxEVT_BUTTON, &MemoryViewerPanel::Next, this);
	b_fprev->Bind(wxEVT_BUTTON, &MemoryViewerPanel::fPrev, this);
	b_fnext->Bind(wxEVT_BUTTON, &MemoryViewerPanel::fNext, this);
	b_img  ->Bind(wxEVT_BUTTON, &MemoryViewerPanel::OnShowImage, this);

	t_mem_addr ->Bind(wxEVT_MOUSEWHEEL, &MemoryViewerPanel::OnScrollMemory, this);
	t_mem_hex  ->Bind(wxEVT_MOUSEWHEEL, &MemoryViewerPanel::OnScrollMemory, this);
	t_mem_ascii->Bind(wxEVT_MOUSEWHEEL, &MemoryViewerPanel::OnScrollMemory, this);
	
	//Fill the wxTextCtrl's
	ShowMemory();
};
Example #28
0
PadMapDiag::PadMapDiag(wxWindow* const parent, PadMapping map[], PadMapping wiimotemap[], std::vector<const Player *>& player_list)
	: wxDialog(parent, wxID_ANY, _("Configure Pads"))
	, m_mapping(map)
	, m_wiimapping (wiimotemap)
	, m_player_list(player_list)
{
	wxBoxSizer* const h_szr = new wxBoxSizer(wxHORIZONTAL);
	h_szr->AddSpacer(10);

	wxArrayString player_names;
	player_names.Add(_("None"));
	for (auto& player : m_player_list)
		player_names.Add(player->name);

	for (unsigned int i=0; i<4; ++i)
	{
		wxBoxSizer* const v_szr = new wxBoxSizer(wxVERTICAL);
		v_szr->Add(new wxStaticText(this, wxID_ANY, (wxString(_("Pad ")) + (wxChar)('0'+i))),
					    1, wxALIGN_CENTER_HORIZONTAL);

		m_map_cbox[i] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, player_names);
		m_map_cbox[i]->Bind(wxEVT_CHOICE, &PadMapDiag::OnAdjust, this);
		if (m_mapping[i] == -1)
			m_map_cbox[i]->Select(0);
		else
			for (unsigned int j = 0; j < m_player_list.size(); j++)
				if (m_mapping[i] == m_player_list[j]->pid)
					m_map_cbox[i]->Select(j + 1);

		v_szr->Add(m_map_cbox[i], 1);

		h_szr->Add(v_szr, 1, wxTOP | wxEXPAND, 20);
		h_szr->AddSpacer(10);
	}

	for (unsigned int i=0; i<4; ++i)
	{
		wxBoxSizer* const v_szr = new wxBoxSizer(wxVERTICAL);
		v_szr->Add(new wxStaticText(this, wxID_ANY, (wxString(_("Wiimote ")) + (wxChar)('0'+i))),
					    1, wxALIGN_CENTER_HORIZONTAL);

		m_map_cbox[i+4] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, player_names);
		m_map_cbox[i+4]->Bind(wxEVT_CHOICE, &PadMapDiag::OnAdjust, this);
		if (m_wiimapping[i] == -1)
			m_map_cbox[i+4]->Select(0);
		else
			for (unsigned int j = 0; j < m_player_list.size(); j++)
				if (m_wiimapping[i] == m_player_list[j]->pid)
					m_map_cbox[i+4]->Select(j + 1);

		v_szr->Add(m_map_cbox[i+4], 1);

		h_szr->Add(v_szr, 1, wxTOP | wxEXPAND, 20);
		h_szr->AddSpacer(10);
	}

	wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
	main_szr->Add(h_szr);
	main_szr->AddSpacer(5);
	main_szr->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT, 20);
	main_szr->AddSpacer(5);
	SetSizerAndFit(main_szr);
	SetFocus();
}
Example #29
0
SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg)
	: wxDialog(parent, wxID_ANY, "Settings", wxDefaultPosition)
{
	const bool was_running = Emu.Pause();
	if (was_running || Emu.IsReady()) cfg = &rpcs3::state.config;

	static const u32 width = 458;
	static const u32 height = 400;

	// Settings panels
	wxNotebook* nb_config = new wxNotebook(this, wxID_ANY, wxPoint(6, 6), wxSize(width, height));
	wxPanel* p_system = new wxPanel(nb_config, wxID_ANY);
	wxPanel* p_core = new wxPanel(nb_config, wxID_ANY);
	wxPanel* p_graphics = new wxPanel(nb_config, wxID_ANY);
	wxPanel* p_audio = new wxPanel(nb_config, wxID_ANY);
	wxPanel* p_io = new wxPanel(nb_config, wxID_ANY);
	wxPanel* p_misc = new wxPanel(nb_config, wxID_ANY);
	wxPanel* p_networking = new wxPanel(nb_config, wxID_ANY);

	nb_config->AddPage(p_core, wxT("Core"));
	nb_config->AddPage(p_graphics, wxT("Graphics"));
	nb_config->AddPage(p_audio, wxT("Audio"));
	nb_config->AddPage(p_io, wxT("Input / Output"));
	nb_config->AddPage(p_misc, wxT("Miscellaneous"));
	nb_config->AddPage(p_networking, wxT("Networking"));
	nb_config->AddPage(p_system, wxT("System"));

	wxBoxSizer* s_subpanel_core = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer* s_subpanel_core1 = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* s_subpanel_core2 = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* s_subpanel_graphics = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer* s_subpanel_graphics1 = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* s_subpanel_graphics2 = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* s_subpanel_audio = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* s_subpanel_io = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer* s_subpanel_io1 = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* s_subpanel_io2 = new wxBoxSizer(wxVERTICAL);

	wxBoxSizer* s_subpanel_system = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* s_subpanel_misc = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* s_subpanel_networking = new wxBoxSizer(wxVERTICAL);

	// Core settings
	wxStaticBoxSizer* s_round_llvm = new wxStaticBoxSizer(wxVERTICAL, p_core, _("LLVM config"));
	wxStaticBoxSizer* s_round_llvm_range = new wxStaticBoxSizer(wxHORIZONTAL, p_core, _("Excluded block range"));
	wxStaticBoxSizer* s_round_llvm_threshold = new wxStaticBoxSizer(wxHORIZONTAL, p_core, _("Compilation threshold"));

	// Graphics
	wxStaticBoxSizer* s_round_gs_render = new wxStaticBoxSizer(wxVERTICAL, p_graphics, _("Render"));
	wxStaticBoxSizer* s_round_gs_d3d_adaptater = new wxStaticBoxSizer(wxVERTICAL, p_graphics, _("D3D Adaptater"));
	wxStaticBoxSizer* s_round_gs_res = new wxStaticBoxSizer(wxVERTICAL, p_graphics, _("Resolution"));
	wxStaticBoxSizer* s_round_gs_aspect = new wxStaticBoxSizer(wxVERTICAL, p_graphics, _("Aspect ratio"));
	wxStaticBoxSizer* s_round_gs_frame_limit = new wxStaticBoxSizer(wxVERTICAL, p_graphics, _("Frame limit"));

	// Input / Output
	wxStaticBoxSizer* s_round_io_pad_handler = new wxStaticBoxSizer(wxVERTICAL, p_io, _("Pad Handler"));
	wxStaticBoxSizer* s_round_io_keyboard_handler = new wxStaticBoxSizer(wxVERTICAL, p_io, _("Keyboard Handler"));
	wxStaticBoxSizer* s_round_io_mouse_handler = new wxStaticBoxSizer(wxVERTICAL, p_io, _("Mouse Handler"));
	wxStaticBoxSizer* s_round_io_camera = new wxStaticBoxSizer(wxVERTICAL, p_io, _("Camera"));
	wxStaticBoxSizer* s_round_io_camera_type = new wxStaticBoxSizer(wxVERTICAL, p_io, _("Camera type"));

	// Audio
	wxStaticBoxSizer* s_round_audio_out = new wxStaticBoxSizer(wxVERTICAL, p_audio, _("Audio Out"));

	// Miscellaneous
	wxStaticBoxSizer* s_round_hle_log_lvl = new wxStaticBoxSizer(wxVERTICAL, p_misc, _("Log Level"));

	// Networking
	wxStaticBoxSizer* s_round_net_status = new wxStaticBoxSizer(wxVERTICAL, p_networking, _("Connection status"));
	wxStaticBoxSizer* s_round_net_interface = new wxStaticBoxSizer(wxVERTICAL, p_networking, _("Network adapter"));

	// System
	wxStaticBoxSizer* s_round_sys_lang = new wxStaticBoxSizer(wxVERTICAL, p_system, _("Language"));


	wxRadioBox* rbox_ppu_decoder;
	wxRadioBox* rbox_spu_decoder;
	wxComboBox* cbox_gs_render = new wxComboBox(p_graphics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_gs_d3d_adaptater = new wxComboBox(p_graphics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_gs_resolution = new wxComboBox(p_graphics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_gs_aspect = new wxComboBox(p_graphics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_gs_frame_limit = new wxComboBox(p_graphics, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_pad_handler = new wxComboBox(p_io, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);;
	wxComboBox* cbox_keyboard_handler = new wxComboBox(p_io, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_mouse_handler = new wxComboBox(p_io, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_camera = new wxComboBox(p_io, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_camera_type = new wxComboBox(p_io, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_audio_out = new wxComboBox(p_audio, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_hle_loglvl = new wxComboBox(p_misc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_net_status = new wxComboBox(p_networking, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_net_interface = new wxComboBox(p_networking, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY);
	wxComboBox* cbox_sys_lang = new wxComboBox(p_system, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY);

	wxCheckBox* chbox_core_llvm_exclud = new wxCheckBox(p_core, wxID_ANY, "Compiled blocks exclusion");
	wxCheckBox* chbox_core_hook_stfunc = new wxCheckBox(p_core, wxID_ANY, "Hook static functions");
	wxCheckBox* chbox_core_load_liblv2 = new wxCheckBox(p_core, wxID_ANY, "Load liblv2.sprx");
	wxCheckBox* chbox_gs_log_prog = new wxCheckBox(p_graphics, wxID_ANY, "Log shader programs");
	wxCheckBox* chbox_gs_dump_depth = new wxCheckBox(p_graphics, wxID_ANY, "Write Depth Buffer");
	wxCheckBox* chbox_gs_dump_color = new wxCheckBox(p_graphics, wxID_ANY, "Write Color Buffers");
	wxCheckBox* chbox_gs_read_color = new wxCheckBox(p_graphics, wxID_ANY, "Read Color Buffers");
	wxCheckBox* chbox_gs_read_depth = new wxCheckBox(p_graphics, wxID_ANY, "Read Depth Buffer");
	wxCheckBox* chbox_gs_vsync = new wxCheckBox(p_graphics, wxID_ANY, "VSync");
	wxCheckBox* chbox_gs_debug_output = new wxCheckBox(p_graphics, wxID_ANY, "Debug Output");
	wxCheckBox* chbox_gs_3dmonitor = new wxCheckBox(p_graphics, wxID_ANY, "3D Monitor");
	wxCheckBox* chbox_gs_overlay = new wxCheckBox(p_graphics, wxID_ANY, "Debug overlay");
	wxCheckBox* chbox_audio_dump = new wxCheckBox(p_audio, wxID_ANY, "Dump to file");
	wxCheckBox* chbox_audio_conv = new wxCheckBox(p_audio, wxID_ANY, "Convert to 16 bit");
	wxCheckBox* chbox_hle_logging = new wxCheckBox(p_misc, wxID_ANY, "Log everything");
	wxCheckBox* chbox_rsx_logging = new wxCheckBox(p_misc, wxID_ANY, "RSX Logging");
	wxCheckBox* chbox_hle_savetty = new wxCheckBox(p_misc, wxID_ANY, "Save TTY output to file");
	wxCheckBox* chbox_hle_exitonstop = new wxCheckBox(p_misc, wxID_ANY, "Exit RPCS3 when process finishes");
	wxCheckBox* chbox_hle_always_start = new wxCheckBox(p_misc, wxID_ANY, "Always start after boot");
	wxCheckBox* chbox_hle_use_default_ini = new wxCheckBox(p_misc, wxID_ANY, "Use default configuration");

	wxTextCtrl* txt_dbg_range_min = new wxTextCtrl(p_core, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(55, 20));
	wxTextCtrl* txt_dbg_range_max = new wxTextCtrl(p_core, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(55, 20));
	wxTextCtrl* txt_llvm_threshold = new wxTextCtrl(p_core, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(55, 20));

	//Auto Pause
	wxCheckBox* chbox_dbg_ap_systemcall = new wxCheckBox(p_misc, wxID_ANY, "Auto Pause at System Call");
	wxCheckBox* chbox_dbg_ap_functioncall = new wxCheckBox(p_misc, wxID_ANY, "Auto Pause at Function Call");

	//Custom EmulationDir
	wxCheckBox* chbox_emulationdir_enable = new wxCheckBox(p_system, wxID_ANY, "Use path below as EmulationDir. (Restart required)");
	wxTextCtrl* txt_emulationdir_path = new wxTextCtrl(p_system, wxID_ANY, fs::get_executable_dir());


	wxArrayString ppu_decoder_modes;
	ppu_decoder_modes.Add("Interpreter");
	ppu_decoder_modes.Add("Interpreter 2");
	ppu_decoder_modes.Add("Recompiler (LLVM)");
	rbox_ppu_decoder = new wxRadioBox(p_core, wxID_ANY, "PPU Decoder", wxDefaultPosition, wxSize(215, -1), ppu_decoder_modes, 1);

#if !defined(LLVM_AVAILABLE)
	rbox_ppu_decoder->Enable(2, false);
#endif

	wxArrayString spu_decoder_modes;
	spu_decoder_modes.Add("Interpreter (precise)");
	spu_decoder_modes.Add("Interpreter (fast)");
	spu_decoder_modes.Add("Recompiler (ASMJIT)");
	rbox_spu_decoder = new wxRadioBox(p_core, wxID_ANY, "SPU Decoder", wxDefaultPosition, wxSize(215, -1), spu_decoder_modes, 1);

	cbox_gs_render->Append("Null");
	cbox_gs_render->Append("OpenGL");

#ifdef _MSC_VER
	Microsoft::WRL::ComPtr<IDXGIFactory4> dxgiFactory;
	Microsoft::WRL::ComPtr<IDXGIAdapter> adapter;

	if (SUCCEEDED(CreateDXGIFactory(IID_PPV_ARGS(&dxgiFactory))))
	{
		cbox_gs_render->Append("DirectX 12");

		for (uint id = 0; dxgiFactory->EnumAdapters(id, adapter.GetAddressOf()) != DXGI_ERROR_NOT_FOUND; id++)
		{
			DXGI_ADAPTER_DESC adapterDesc;
			adapter->GetDesc(&adapterDesc);
			cbox_gs_d3d_adaptater->Append(adapterDesc.Description);
		}
	}
	else
	{
		cbox_gs_d3d_adaptater->Enable(false);
		chbox_gs_overlay->Enable(false);
	}
#endif

	for (int i = 1; i < WXSIZEOF(ResolutionTable); ++i)
	{
		cbox_gs_resolution->Append(wxString::Format("%dx%d", ResolutionTable[i].width.value(), ResolutionTable[i].height.value()));
	}

	cbox_gs_aspect->Append("4:3");
	cbox_gs_aspect->Append("16:9");

	for (auto item : { "Off", "50", "59.94", "30", "60", "Auto" })
		cbox_gs_frame_limit->Append(item);

	cbox_pad_handler->Append("Null");
	cbox_pad_handler->Append("Windows");
#ifdef _MSC_VER
	cbox_pad_handler->Append("XInput");
#endif

	//cbox_pad_handler->Append("DirectInput");

	cbox_keyboard_handler->Append("Null");
	cbox_keyboard_handler->Append("Windows");
	//cbox_keyboard_handler->Append("DirectInput");

	cbox_mouse_handler->Append("Null");
	cbox_mouse_handler->Append("Windows");
	//cbox_mouse_handler->Append("DirectInput");

	cbox_audio_out->Append("Null");
	cbox_audio_out->Append("OpenAL");
#ifdef _MSC_VER
	cbox_audio_out->Append("XAudio2");
#endif

	cbox_camera->Append("Null");
	cbox_camera->Append("Connected");

	cbox_camera_type->Append("Unknown");
	cbox_camera_type->Append("EyeToy");
	cbox_camera_type->Append("PlayStation Eye");
	cbox_camera_type->Append("USB Video Class 1.1");

	cbox_hle_loglvl->Append("All");
	cbox_hle_loglvl->Append("Warnings");
	cbox_hle_loglvl->Append("Success");
	cbox_hle_loglvl->Append("Errors");
	cbox_hle_loglvl->Append("Nothing");

	cbox_net_status->Append("IP Obtained");
	cbox_net_status->Append("Obtaining IP");
	cbox_net_status->Append("Connecting");
	cbox_net_status->Append("Disconnected");

	for(const auto& adapterName : GetAdapters())
		cbox_net_interface->Append(adapterName);

	static wxString s_langs[] =
	{
		"Japanese", "English (US)", "French", "Spanish", "German",
		"Italian", "Dutch", "Portuguese (PT)", "Russian",
		"Korean", "Chinese (Trad.)", "Chinese (Simp.)", "Finnish",
		"Swedish", "Danish", "Norwegian", "Polish", "English (UK)"
	};

	for (const auto& lang : s_langs)
		cbox_sys_lang->Append(lang);

	chbox_core_llvm_exclud->SetValue(cfg->core.llvm.exclusion_range.value());
	chbox_gs_log_prog->SetValue(rpcs3::config.rsx.log_programs.value());
	chbox_gs_dump_depth->SetValue(cfg->rsx.opengl.write_depth_buffer.value());
	chbox_gs_dump_color->SetValue(cfg->rsx.opengl.write_color_buffers.value());
	chbox_gs_read_color->SetValue(cfg->rsx.opengl.read_color_buffers.value());
	chbox_gs_read_depth->SetValue(cfg->rsx.opengl.read_depth_buffer.value());
	chbox_gs_vsync->SetValue(rpcs3::config.rsx.vsync.value());
	chbox_gs_debug_output->SetValue(cfg->rsx.d3d12.debug_output.value());
	chbox_gs_3dmonitor->SetValue(rpcs3::config.rsx._3dtv.value());
	chbox_gs_overlay->SetValue(cfg->rsx.d3d12.overlay.value());
	chbox_audio_dump->SetValue(rpcs3::config.audio.dump_to_file.value());
	chbox_audio_conv->SetValue(rpcs3::config.audio.convert_to_u16.value());
	chbox_hle_logging->SetValue(rpcs3::config.misc.log.hle_logging.value());
	chbox_rsx_logging->SetValue(rpcs3::config.misc.log.rsx_logging.value());
	chbox_hle_savetty->SetValue(rpcs3::config.misc.log.save_tty.value());
	chbox_hle_exitonstop->SetValue(rpcs3::config.misc.exit_on_stop.value());
	chbox_hle_always_start->SetValue(rpcs3::config.misc.always_start.value());
	chbox_hle_use_default_ini->SetValue(rpcs3::config.misc.use_default_ini.value());
	chbox_core_hook_stfunc->SetValue(cfg->core.hook_st_func.value());
	chbox_core_load_liblv2->SetValue(cfg->core.load_liblv2.value());

	//Auto Pause related
	chbox_dbg_ap_systemcall->SetValue(rpcs3::config.misc.debug.auto_pause_syscall.value());
	chbox_dbg_ap_functioncall->SetValue(rpcs3::config.misc.debug.auto_pause_func_call.value());

	//Custom EmulationDir
	chbox_emulationdir_enable->SetValue(rpcs3::config.system.emulation_dir_path_enable.value());
	txt_emulationdir_path->SetValue(rpcs3::config.system.emulation_dir_path.value());

	rbox_ppu_decoder->SetSelection((int)cfg->core.ppu_decoder.value());
	txt_dbg_range_min->SetValue(cfg->core.llvm.min_id.string_value());
	txt_dbg_range_max->SetValue(cfg->core.llvm.max_id.string_value());
	txt_llvm_threshold->SetValue(cfg->core.llvm.threshold.string_value());
	rbox_spu_decoder->SetSelection((int)cfg->core.spu_decoder.value());
	cbox_gs_render->SetSelection((int)cfg->rsx.renderer.value());
	cbox_gs_d3d_adaptater->SetSelection(cfg->rsx.d3d12.adaptater.value());
	cbox_gs_resolution->SetSelection(ResolutionIdToNum((int)cfg->rsx.resolution.value()) - 1);
	cbox_gs_aspect->SetSelection((int)cfg->rsx.aspect_ratio.value() - 1);
	cbox_gs_frame_limit->SetSelection((int)cfg->rsx.frame_limit.value());
	cbox_pad_handler->SetSelection((int)cfg->io.pad_handler_mode.value());
	cbox_keyboard_handler->SetSelection((int)cfg->io.keyboard_handler_mode.value());
	cbox_mouse_handler->SetSelection((int)cfg->io.mouse_handler_mode.value());
	cbox_audio_out->SetSelection((int)cfg->audio.out.value());
	cbox_camera->SetSelection((int)cfg->io.camera.value());
	cbox_camera_type->SetSelection((int)cfg->io.camera_type.value());
	cbox_hle_loglvl->SetSelection((int)rpcs3::config.misc.log.level.value());
	cbox_net_status->SetSelection((int)rpcs3::config.misc.net.status.value());
	cbox_net_interface->SetSelection((int)rpcs3::config.misc.net._interface.value());
	cbox_sys_lang->SetSelection((int)rpcs3::config.system.language.value());

	// Core
	s_round_llvm->Add(chbox_core_llvm_exclud, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_llvm_range->Add(txt_dbg_range_min, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_llvm_range->Add(txt_dbg_range_max, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_llvm->Add(s_round_llvm_range, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_llvm_threshold->Add(txt_llvm_threshold, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_llvm->Add(s_round_llvm_threshold, wxSizerFlags().Border(wxALL, 5).Expand());

	// Rendering
	s_round_gs_render->Add(cbox_gs_render, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_gs_d3d_adaptater->Add(cbox_gs_d3d_adaptater, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_gs_res->Add(cbox_gs_resolution, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_gs_aspect->Add(cbox_gs_aspect, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_gs_frame_limit->Add(cbox_gs_frame_limit, wxSizerFlags().Border(wxALL, 5).Expand());

	// Input/Output
	s_round_io_pad_handler->Add(cbox_pad_handler, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_io_keyboard_handler->Add(cbox_keyboard_handler, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_io_mouse_handler->Add(cbox_mouse_handler, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_io_camera->Add(cbox_camera, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_io_camera_type->Add(cbox_camera_type, wxSizerFlags().Border(wxALL, 5).Expand());

	s_round_audio_out->Add(cbox_audio_out, wxSizerFlags().Border(wxALL, 5).Expand());

	// Miscellaneous
	s_round_hle_log_lvl->Add(cbox_hle_loglvl, wxSizerFlags().Border(wxALL, 5).Expand());

	// Networking
	s_round_net_status->Add(cbox_net_status, wxSizerFlags().Border(wxALL, 5).Expand());
	s_round_net_interface->Add(cbox_net_interface, wxSizerFlags().Border(wxALL, 5).Expand());

	s_round_sys_lang->Add(cbox_sys_lang, wxSizerFlags().Border(wxALL, 5).Expand());

	// Core
	s_subpanel_core1->Add(rbox_ppu_decoder, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_core2->Add(rbox_spu_decoder, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_core1->Add(s_round_llvm, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_core1->Add(chbox_core_hook_stfunc, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_core1->Add(chbox_core_load_liblv2, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_core->Add(s_subpanel_core1);
	s_subpanel_core->Add(s_subpanel_core2);

	// Graphics
	s_subpanel_graphics1->Add(s_round_gs_render, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics1->Add(s_round_gs_res, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics1->Add(s_round_gs_d3d_adaptater, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics1->Add(chbox_gs_dump_color, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics1->Add(chbox_gs_read_color, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics1->Add(chbox_gs_dump_depth, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics1->Add(chbox_gs_read_depth, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics1->Add(chbox_gs_vsync, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics2->Add(s_round_gs_aspect, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics2->Add(s_round_gs_frame_limit, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics2->AddSpacer(68);
	s_subpanel_graphics2->Add(chbox_gs_debug_output, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics2->Add(chbox_gs_3dmonitor, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics2->Add(chbox_gs_overlay, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics2->Add(chbox_gs_log_prog, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_graphics->Add(s_subpanel_graphics1);
	s_subpanel_graphics->Add(s_subpanel_graphics2);

	// Input - Output
	s_subpanel_io1->Add(s_round_io_pad_handler, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_io1->Add(s_round_io_keyboard_handler, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_io1->Add(s_round_io_mouse_handler, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_io2->Add(s_round_io_camera, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_io2->Add(s_round_io_camera_type, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_io->Add(s_subpanel_io1);
	s_subpanel_io->Add(s_subpanel_io2);

	// Audio
	s_subpanel_audio->Add(s_round_audio_out, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_audio->Add(chbox_audio_dump, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_audio->Add(chbox_audio_conv, wxSizerFlags().Border(wxALL, 5).Expand());

	// Miscellaneous
	s_subpanel_misc->Add(s_round_hle_log_lvl, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_misc->Add(chbox_hle_logging, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_misc->Add(chbox_rsx_logging, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_misc->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_misc->Add(chbox_hle_exitonstop, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_misc->Add(chbox_hle_always_start, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_misc->Add(chbox_hle_use_default_ini, wxSizerFlags().Border(wxALL, 5).Expand());

	// Auto Pause
	s_subpanel_misc->Add(chbox_dbg_ap_systemcall, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_misc->Add(chbox_dbg_ap_functioncall, wxSizerFlags().Border(wxALL, 5).Expand());

	// Networking
	s_subpanel_networking->Add(s_round_net_status, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_networking->Add(s_round_net_interface, wxSizerFlags().Border(wxALL, 5).Expand());

	// System
	s_subpanel_system->Add(s_round_sys_lang, wxSizerFlags().Border(wxALL, 5).Expand());

	// Custom EmulationDir
	s_subpanel_system->Add(chbox_emulationdir_enable, wxSizerFlags().Border(wxALL, 5).Expand());
	s_subpanel_system->Add(txt_emulationdir_path, wxSizerFlags().Border(wxALL, 5).Expand());

	// Buttons
	wxBoxSizer* s_b_panel(new wxBoxSizer(wxHORIZONTAL));
	s_b_panel->Add(new wxButton(this, wxID_OK), wxSizerFlags().Border(wxALL, 5).Bottom());
	s_b_panel->Add(new wxButton(this, wxID_CANCEL), wxSizerFlags().Border(wxALL, 5).Bottom());

	// Resize panels 
	SetSizerAndFit(s_subpanel_core, false);
	SetSizerAndFit(s_subpanel_graphics, false);
	SetSizerAndFit(s_subpanel_io, false);
	SetSizerAndFit(s_subpanel_audio, false);
	SetSizerAndFit(s_subpanel_misc, false);
	SetSizerAndFit(s_subpanel_networking, false);
	SetSizerAndFit(s_subpanel_system, false);
	SetSizerAndFit(s_b_panel, false);

	SetSize(width + 26, height + 80);

	if (ShowModal() == wxID_OK)
	{
		long llvmthreshold;
		long minllvmid, maxllvmid;
		txt_dbg_range_min->GetValue().ToLong(&minllvmid);
		txt_dbg_range_max->GetValue().ToLong(&maxllvmid);
		txt_llvm_threshold->GetValue().ToLong(&llvmthreshold);

		// individual settings
		cfg->core.ppu_decoder = rbox_ppu_decoder->GetSelection();
		cfg->core.llvm.exclusion_range = chbox_core_llvm_exclud->GetValue();
		cfg->core.llvm.min_id = minllvmid;
		cfg->core.llvm.max_id = maxllvmid;
		cfg->core.llvm.threshold = llvmthreshold;
		cfg->core.spu_decoder = rbox_spu_decoder->GetSelection();
		cfg->core.hook_st_func = chbox_core_hook_stfunc->GetValue();
		cfg->core.load_liblv2 = chbox_core_load_liblv2->GetValue();

		cfg->rsx.renderer = cbox_gs_render->GetSelection();
		cfg->rsx.d3d12.adaptater = cbox_gs_d3d_adaptater->GetSelection();
		cfg->rsx.resolution = ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1);
		cfg->rsx.aspect_ratio = cbox_gs_aspect->GetSelection() + 1;
		cfg->rsx.frame_limit = cbox_gs_frame_limit->GetSelection();
		cfg->rsx.opengl.write_depth_buffer = chbox_gs_dump_depth->GetValue();
		cfg->rsx.opengl.write_color_buffers = chbox_gs_dump_color->GetValue();
		cfg->rsx.opengl.read_color_buffers = chbox_gs_read_color->GetValue();
		cfg->rsx.opengl.read_depth_buffer = chbox_gs_read_depth->GetValue();

		cfg->audio.out = cbox_audio_out->GetSelection();

		cfg->io.pad_handler_mode = cbox_pad_handler->GetSelection();
		cfg->io.keyboard_handler_mode = cbox_keyboard_handler->GetSelection();
		cfg->io.mouse_handler_mode = cbox_mouse_handler->GetSelection();
		cfg->io.camera = cbox_camera->GetSelection();
		cfg->io.camera_type = cbox_camera_type->GetSelection();

		
		// global settings
		rpcs3::config.rsx.log_programs = chbox_gs_log_prog->GetValue();
		rpcs3::config.rsx.vsync = chbox_gs_vsync->GetValue();
		rpcs3::config.rsx._3dtv = chbox_gs_3dmonitor->GetValue();
		rpcs3::config.rsx.d3d12.debug_output = chbox_gs_debug_output->GetValue();
		rpcs3::config.rsx.d3d12.overlay = chbox_gs_overlay->GetValue();
		rpcs3::config.audio.dump_to_file = chbox_audio_dump->GetValue();
		rpcs3::config.audio.convert_to_u16 = chbox_audio_conv->GetValue();
		rpcs3::config.misc.log.level = cbox_hle_loglvl->GetSelection();
		rpcs3::config.misc.log.hle_logging = chbox_hle_logging->GetValue();
		rpcs3::config.misc.log.rsx_logging = chbox_rsx_logging->GetValue();
		rpcs3::config.misc.log.save_tty = chbox_hle_savetty->GetValue();
		rpcs3::config.misc.net.status = cbox_net_status->GetSelection();
		rpcs3::config.misc.net._interface = cbox_net_interface->GetSelection();
		rpcs3::config.misc.debug.auto_pause_syscall = chbox_dbg_ap_systemcall->GetValue();
		rpcs3::config.misc.debug.auto_pause_func_call = chbox_dbg_ap_functioncall->GetValue();
		rpcs3::config.misc.always_start = chbox_hle_always_start->GetValue();
		rpcs3::config.misc.exit_on_stop = chbox_hle_exitonstop->GetValue();
		rpcs3::config.misc.use_default_ini = chbox_hle_use_default_ini->GetValue();
		rpcs3::config.system.language = cbox_sys_lang->GetSelection();
		rpcs3::config.system.emulation_dir_path_enable = chbox_emulationdir_enable->GetValue();
		rpcs3::config.system.emulation_dir_path = txt_emulationdir_path->GetValue().ToStdString();
		rpcs3::config.save();

		cfg->save();
	}

	if (was_running) Emu.Resume();
}
Example #30
0
RegisterEditorDialog::RegisterEditorDialog(wxPanel *parent, u32 _pc, cpu_thread* _cpu, CPUDisAsm* _disasm)
	: wxDialog(parent, wxID_ANY, "Edit registers")
	, pc(_pc)
	, cpu(_cpu)
	, disasm(_disasm)
{
	wxBoxSizer* s_panel_margin_x = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer* s_panel_margin_y = new wxBoxSizer(wxVERTICAL);

	wxBoxSizer* s_panel = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* s_t1_panel = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer* s_t2_panel = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer* s_t3_panel = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer* s_b_panel = new wxBoxSizer(wxHORIZONTAL);

	wxStaticText* t1_text = new wxStaticText(this, wxID_ANY, "Register:     ");
	t1_register = new wxComboBox(this, wxID_ANY);
	wxStaticText* t2_text = new wxStaticText(this, wxID_ANY, "Value (Hex):");
	t2_value = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200, -1));

	s_t1_panel->Add(t1_text);
	s_t1_panel->AddSpacer(8);
	s_t1_panel->Add(t1_register);

	s_t2_panel->Add(t2_text);
	s_t2_panel->AddSpacer(8);
	s_t2_panel->Add(t2_value);

	s_b_panel->Add(new wxButton(this, wxID_OK), wxLEFT, 0, 5);
	s_b_panel->AddSpacer(5);
	s_b_panel->Add(new wxButton(this, wxID_CANCEL), wxLEFT, 0, 5);

	s_panel->Add(s_t1_panel);
	s_panel->AddSpacer(8);
	s_panel->Add(s_t2_panel);
	s_panel->AddSpacer(16);
	s_panel->Add(s_b_panel);

	s_panel_margin_y->AddSpacer(12);
	s_panel_margin_y->Add(s_panel);
	s_panel_margin_y->AddSpacer(12);
	s_panel_margin_x->AddSpacer(12);
	s_panel_margin_x->Add(s_panel_margin_y);
	s_panel_margin_x->AddSpacer(12);

	Bind(wxEVT_COMBOBOX, &RegisterEditorDialog::updateRegister, this);

	switch (g_system)
	{
	case system_type::ps3:
	{
		if (_cpu->id >= ppu_thread::id_min)
		{
			for (int i = 0; i < 32; i++) t1_register->Append(wxString::Format("GPR[%d]", i));
			for (int i = 0; i < 32; i++) t1_register->Append(wxString::Format("FPR[%d]", i));
			for (int i = 0; i < 32; i++) t1_register->Append(wxString::Format("VR[%d]", i));
			t1_register->Append("CR");
			t1_register->Append("LR");
			t1_register->Append("CTR");
			//t1_register->Append("XER");
			//t1_register->Append("FPSCR");
		}
		else
		{
			for (int i = 0; i < 128; i++) t1_register->Append(wxString::Format("GPR[%d]", i));
		}

		break;
	}

	default:
		wxMessageBox("Not supported thread.", "Error");
		return;
	}

	SetSizerAndFit(s_panel_margin_x);

	if (ShowModal() == wxID_OK)
	{
		std::string reg = fmt::ToUTF8(t1_register->GetStringSelection());
		std::string value = fmt::ToUTF8(t2_value->GetValue());

		if (g_system == system_type::ps3 && cpu->id >= ppu_thread::id_min)
		{
			auto& ppu = *static_cast<ppu_thread*>(cpu);

			while (value.length() < 32) value = "0" + value;
			const auto first_brk = reg.find('[');
			try
			{
				if (first_brk != -1)
				{
					const long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - first_brk - 2).c_str());
					if (reg.find("GPR") == 0 || reg.find("FPR") == 0)
					{
						const ullong reg_value = std::stoull(value.substr(16, 31), 0, 16);
						if (reg.find("GPR") == 0) ppu.gpr[reg_index] = (u64)reg_value;
						if (reg.find("FPR") == 0) (u64&)ppu.fpr[reg_index] = (u64)reg_value;
						return;
					}
					if (reg.find("VR") == 0)
					{
						const ullong reg_value0 = std::stoull(value.substr(16, 31), 0, 16);
						const ullong reg_value1 = std::stoull(value.substr(0, 15), 0, 16);
						ppu.vr[reg_index]._u64[0] = (u64)reg_value0;
						ppu.vr[reg_index]._u64[1] = (u64)reg_value1;
						return;
					}
				}
				if (reg == "LR" || reg == "CTR")
				{
					const ullong reg_value = std::stoull(value.substr(16, 31), 0, 16);
					if (reg == "LR") ppu.lr = (u64)reg_value;
					if (reg == "CTR") ppu.ctr = (u64)reg_value;
					return;
				}
				if (reg == "CR")
				{
					const ullong reg_value = std::stoull(value.substr(24, 31), 0, 16);
					if (reg == "CR") ppu.cr_unpack((u32)reg_value);
					return;
				}
			}
			catch (std::invalid_argument&) //if any of the stoull conversion fail
			{
			}
		}
		else if (g_system == system_type::ps3 && cpu->id < ppu_thread::id_min)
		{
			auto& spu = *static_cast<SPUThread*>(cpu);

			while (value.length() < 32) value = "0" + value;
			const auto first_brk = reg.find('[');
			try
			{
				if (first_brk != -1)
				{
					const long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - 2).c_str());
					if (reg.find("GPR") == 0)
					{
						const ullong reg_value0 = std::stoull(value.substr(16, 31), 0, 16);
						const ullong reg_value1 = std::stoull(value.substr(0, 15), 0, 16);
						spu.gpr[reg_index]._u64[0] = (u64)reg_value0;
						spu.gpr[reg_index]._u64[1] = (u64)reg_value1;
						return;
					}
				}
			}
			catch (std::invalid_argument&)
			{
			}
		}

		wxMessageBox("This value could not be converted.\nNo changes were made.", "Error");
	}
}