void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) { //TODO bool paused = false; if(Emu.IsRunning()) { Emu.Pause(); paused = true; } wxDialog diag(this, wxID_ANY, "Settings", wxDefaultPosition); wxBoxSizer* s_panel(new wxBoxSizer(wxHORIZONTAL)); wxBoxSizer* s_subpanel1(new wxBoxSizer(wxVERTICAL)); wxBoxSizer* s_subpanel2(new wxBoxSizer(wxVERTICAL)); wxStaticBoxSizer* s_round_cpu( new wxStaticBoxSizer( wxVERTICAL, &diag, _("CPU") ) ); wxStaticBoxSizer* s_round_cpu_decoder( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Decoder") ) ); wxStaticBoxSizer* s_round_gs( new wxStaticBoxSizer( wxVERTICAL, &diag, _("GS") ) ); wxStaticBoxSizer* s_round_gs_render( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Render") ) ); wxStaticBoxSizer* s_round_gs_res( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Default resolution") ) ); wxStaticBoxSizer* s_round_gs_aspect( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Default aspect ratio") ) ); wxStaticBoxSizer* s_round_io( new wxStaticBoxSizer( wxVERTICAL, &diag, _("IO") ) ); wxStaticBoxSizer* s_round_io_pad_handler( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Pad Handler") ) ); wxStaticBoxSizer* s_round_io_keyboard_handler( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Keyboard Handler") ) ); wxStaticBoxSizer* s_round_io_mouse_handler( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Mouse Handler") ) ); wxStaticBoxSizer* s_round_audio( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Audio") ) ); wxStaticBoxSizer* s_round_audio_out( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Audio Out") ) ); wxStaticBoxSizer* s_round_hle( new wxStaticBoxSizer( wxVERTICAL, &diag, _("HLE / Misc.") ) ); wxComboBox* cbox_cpu_decoder = new wxComboBox(&diag, wxID_ANY); wxComboBox* cbox_gs_render = new wxComboBox(&diag, wxID_ANY); wxComboBox* cbox_gs_resolution = new wxComboBox(&diag, wxID_ANY); wxComboBox* cbox_gs_aspect = new wxComboBox(&diag, wxID_ANY); wxComboBox* cbox_pad_handler = new wxComboBox(&diag, wxID_ANY); wxComboBox* cbox_keyboard_handler = new wxComboBox(&diag, wxID_ANY); wxComboBox* cbox_mouse_handler = new wxComboBox(&diag, wxID_ANY); wxComboBox* cbox_audio_out = new wxComboBox(&diag, wxID_ANY); wxCheckBox* chbox_cpu_ignore_rwerrors = new wxCheckBox(&diag, wxID_ANY, "Ignore Read/Write errors"); wxCheckBox* chbox_gs_log_prog = new wxCheckBox(&diag, wxID_ANY, "Log vertex/fragment programs"); wxCheckBox* chbox_gs_dump_depth = new wxCheckBox(&diag, wxID_ANY, "Dump Depth Buffer"); wxCheckBox* chbox_gs_dump_color = new wxCheckBox(&diag, wxID_ANY, "Dump Color Buffers"); wxCheckBox* chbox_gs_vsync = new wxCheckBox(&diag, wxID_ANY, "VSync"); wxCheckBox* chbox_audio_dump = new wxCheckBox(&diag, wxID_ANY, "Dump to file"); wxCheckBox* chbox_hle_logging = new wxCheckBox(&diag, wxID_ANY, "Log all SysCalls"); wxCheckBox* chbox_hle_savetty = new wxCheckBox(&diag, wxID_ANY, "Save TTY output to file"); wxCheckBox* chbox_hle_exitonstop = new wxCheckBox(&diag, wxID_ANY, "Exit RPCS3 when process finishes"); //cbox_cpu_decoder->Append("DisAsm"); cbox_cpu_decoder->Append("Interpreter & DisAsm"); cbox_cpu_decoder->Append("Interpreter"); for(int i=1; i<WXSIZEOF(ResolutionTable); ++i) { cbox_gs_resolution->Append(wxString::Format("%dx%d", ResolutionTable[i].width, ResolutionTable[i].height)); } cbox_gs_aspect->Append("4:3"); cbox_gs_aspect->Append("16:9"); cbox_gs_render->Append("Null"); cbox_gs_render->Append("OpenGL"); //cbox_gs_render->Append("Software"); cbox_pad_handler->Append("Null"); cbox_pad_handler->Append("Windows"); //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"); chbox_cpu_ignore_rwerrors->SetValue(Ini.CPUIgnoreRWErrors.GetValue()); chbox_gs_log_prog->SetValue(Ini.GSLogPrograms.GetValue()); chbox_gs_dump_depth->SetValue(Ini.GSDumpDepthBuffer.GetValue()); chbox_gs_dump_color->SetValue(Ini.GSDumpColorBuffers.GetValue()); chbox_gs_vsync->SetValue(Ini.GSVSyncEnable.GetValue()); chbox_audio_dump->SetValue(Ini.AudioDumpToFile.GetValue()); chbox_hle_logging->SetValue(Ini.HLELogging.GetValue()); chbox_hle_savetty->SetValue(Ini.HLESaveTTY.GetValue()); chbox_hle_exitonstop->SetValue(Ini.HLEExitOnStop.GetValue()); chbox_audio_dump->Enable(Emu.IsStopped()); chbox_hle_logging->Enable(Emu.IsStopped()); cbox_cpu_decoder->SetSelection(Ini.CPUDecoderMode.GetValue() ? Ini.CPUDecoderMode.GetValue() - 1 : 0); cbox_gs_render->SetSelection(Ini.GSRenderMode.GetValue()); cbox_gs_resolution->SetSelection(ResolutionIdToNum(Ini.GSResolution.GetValue()) - 1); cbox_gs_aspect->SetSelection(Ini.GSAspectRatio.GetValue() - 1); cbox_pad_handler->SetSelection(Ini.PadHandlerMode.GetValue()); cbox_keyboard_handler->SetSelection(Ini.KeyboardHandlerMode.GetValue()); cbox_mouse_handler->SetSelection(Ini.MouseHandlerMode.GetValue()); cbox_audio_out->SetSelection(Ini.AudioOutMode.GetValue()); s_round_cpu_decoder->Add(cbox_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_cpu->Add(s_round_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_cpu->Add(chbox_cpu_ignore_rwerrors, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_gs_render->Add(cbox_gs_render, 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->Add(s_round_gs_render, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_gs->Add(s_round_gs_res, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_gs->Add(s_round_gs_aspect, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_gs->Add(chbox_gs_log_prog, wxSizerFlags().Border(wxALL, 5)); s_round_gs->Add(chbox_gs_dump_depth, wxSizerFlags().Border(wxALL, 5)); s_round_gs->Add(chbox_gs_dump_color, wxSizerFlags().Border(wxALL, 5)); s_round_gs->Add(chbox_gs_vsync, wxSizerFlags().Border(wxALL, 5)); 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->Add(s_round_io_pad_handler, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_io->Add(s_round_io_keyboard_handler, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_io->Add(s_round_io_mouse_handler, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_audio_out->Add(cbox_audio_out, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_audio_out->Add(chbox_audio_dump, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_audio->Add(s_round_audio_out, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_hle->Add(chbox_hle_logging, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_hle->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_hle->Add(chbox_hle_exitonstop, wxSizerFlags().Border(wxALL, 5).Expand()); wxBoxSizer* s_b_panel(new wxBoxSizer(wxHORIZONTAL)); s_b_panel->Add(new wxButton(&diag, wxID_OK), wxSizerFlags().Border(wxALL, 5).Center()); s_b_panel->Add(new wxButton(&diag, wxID_CANCEL), wxSizerFlags().Border(wxALL, 5).Center()); //wxBoxSizer* s_conf_panel(new wxBoxSizer(wxHORIZONTAL)); s_subpanel1->Add(s_round_cpu, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel1->Add(s_round_gs, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel1->Add(s_b_panel, wxSizerFlags().Border(wxALL, 8).Expand()); s_subpanel2->Add(s_round_io, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel2->Add(s_round_audio, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel2->Add(s_round_hle, wxSizerFlags().Border(wxALL, 5).Expand()); s_panel->Add(s_subpanel1, wxSizerFlags().Border(wxALL, 5).Expand()); s_panel->Add(s_subpanel2, wxSizerFlags().Border(wxALL, 5).Expand()); diag.SetSizerAndFit( s_panel ); if(diag.ShowModal() == wxID_OK) { Ini.CPUDecoderMode.SetValue(cbox_cpu_decoder->GetSelection() + 1); Ini.CPUIgnoreRWErrors.SetValue(chbox_cpu_ignore_rwerrors->GetValue()); Ini.GSRenderMode.SetValue(cbox_gs_render->GetSelection()); Ini.GSResolution.SetValue(ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1)); Ini.GSAspectRatio.SetValue(cbox_gs_aspect->GetSelection() + 1); Ini.GSVSyncEnable.SetValue(chbox_gs_vsync->GetValue()); Ini.GSLogPrograms.SetValue(chbox_gs_log_prog->GetValue()); Ini.GSDumpDepthBuffer.SetValue(chbox_gs_dump_depth->GetValue()); Ini.GSDumpColorBuffers.SetValue(chbox_gs_dump_color->GetValue()); Ini.PadHandlerMode.SetValue(cbox_pad_handler->GetSelection()); Ini.KeyboardHandlerMode.SetValue(cbox_keyboard_handler->GetSelection()); Ini.MouseHandlerMode.SetValue(cbox_mouse_handler->GetSelection()); Ini.AudioOutMode.SetValue(cbox_audio_out->GetSelection()); Ini.AudioDumpToFile.SetValue(chbox_audio_dump->GetValue()); Ini.HLELogging.SetValue(chbox_hle_logging->GetValue()); Ini.HLESaveTTY.SetValue(chbox_hle_savetty->GetValue()); Ini.HLEExitOnStop.SetValue(chbox_hle_exitonstop->GetValue()); Ini.Save(); } if(paused) Emu.Resume(); }
{ wxT("-35 dB") }, { wxT("-40 dB") }, { wxT("-45 dB") }, { wxT("-50 dB") }, { wxT("-55 dB") }, { wxT("-60 dB") }, { wxT("-65 dB") }, { wxT("-70 dB") }, { wxT("-75 dB") }, { wxT("-80 dB") } }; // Map from position in table above to numerical value. static inline double enumToDB( int val ) { return -( 5.0 * val + 20.0 ); } const size_t Enums::NumDbChoices = WXSIZEOF(Enums::DbChoices); // Declaration of RegionList class RegionList : public std::list < Region > {}; enum kActions { kTruncate, kCompress, nActions }; static const IdentInterfaceSymbol kActionStrings[nActions] = { { XO("Truncate Detected Silence") }, { XO("Compress Excess Silence") }
void RawDataVisualizeFrame::DrawIndividualRawDensityPlot(wxDC& dc){ //PrepareDC(dc); //SetUpDC(dc); int w,h; dc.GetSize(&w, &h); /* labeledplotAxes myAxes(wxPoint(80,80), wxPoint(w-30*5,h-30*5), wxRealPoint(0.0,1000.0), wxRealPoint(50.0,4000.0), true); */ int min_x = min((int)(pltarea_min_x*(double)w),(int)(160*(double)(dc.GetPPI().x)/(double)72)); int min_y = min((int)(pltarea_min_y*(double)h),(int)(165*(double)(dc.GetPPI().x)/(double)72)); int max_x = max((int)((pltarea_max_x-pltarea_min_x)*(double)w),(int)(w - 100*(double)(dc.GetPPI().x)/(double)72 - min_x)); int max_y = max((int)((pltarea_max_y-pltarea_min_y)*(double)h),(int)(h-160*(double)(dc.GetPPI().x)/(double)72 - min_y)); labeledplotAxes myAxes(dc, wxPoint(min_x,min_y), wxPoint(max_x,max_y), wxRealPoint(3.0,0.0), wxRealPoint(15.5,1.0), true); dc.Clear(); myAxes.setBackgroundColor(*wxWHITE_BRUSH); myAxes.setupDCforPlot(dc); // myAxes.addGrid(2, 0.2); wxArrayDouble xtickpoints; wxArrayDouble ytickpoints; int i,j; wxArrayString x_tick_labels; wxArrayString y_tick_labels; for (i=3; i <= 15; i++){ xtickpoints.Add((double)i); x_tick_labels.Add(wxString::Format(_T("%d"), i)); } for (i =0; i <= 10; i++){ ytickpoints.Add((double)i/10.0); y_tick_labels.Add(wxString::Format(_T("%.2f"), i/10.0)); } myAxes.setTickLocationX(xtickpoints); myAxes.setTickLocationY(ytickpoints); myAxes.setTickLabelsX(x_tick_labels); myAxes.setTickLabelsY(y_tick_labels); wxString x_label = wxT("log2 PM"); wxString y_label = wxT("Density"); myAxes.setAxisLabelX(x_label); myAxes.setAxisLabelY(y_label); myAxes.setTitle(MyRawData->GetArrayNames()[whichdensity]); wxPoint xsq[512]; j = whichdensity; for (i =0; i < 512; i++){ xsq[i] = myAxes.FindPoint(wxRealPoint((*DensityPlotStatistics_x)[j*512 + i], (*DensityPlotStatistics_y)[j*512 + i])); } dc.DrawSpline(WXSIZEOF(xsq),xsq); dc.DestroyClippingRegion(); myAxes.Draw(dc); }
int wxStackWalker::InitFrames(wxStackFrame *arr, size_t n, void **addresses, char **syminfo) { // we need to launch addr2line tool to get this information and we need to // have the program name for this wxString exepath = wxStackWalker::GetExePath(); if ( exepath.empty() ) { exepath = wxStandardPaths::Get().GetExecutablePath(); if ( exepath.empty() ) { wxLogDebug(wxT("Cannot parse stack frame because the executable ") wxT("path could not be detected")); return 0; } } // build the (long) command line for executing addr2line in an optimized way // (e.g. use always chars, even in Unicode build: popen() always takes chars) int len = snprintf(g_buf, BUFSIZE, "addr2line -C -f -e \"%s\"", (const char*) exepath.mb_str()); len = (len <= 0) ? strlen(g_buf) : len; // in case snprintf() is broken for (size_t i=0; i<n; i++) { snprintf(&g_buf[len], BUFSIZE - len, " %p", addresses[i]); len = strlen(g_buf); } //wxLogDebug(wxT("piping the command '%s'"), g_buf); // for debug only wxStdioPipe fp(g_buf, "r"); if ( !fp ) return 0; // parse addr2line output (should be exactly 2 lines for each address) // reusing the g_buf used for building the command line above wxString name, filename; unsigned long line = 0, curr = 0; for ( size_t i = 0; i < n; i++ ) { // 1st line has function name if ( fgets(g_buf, WXSIZEOF(g_buf), fp) ) { name = wxString::FromAscii(g_buf); name.RemoveLast(); // trailing newline if ( name == wxT("??") ) name.clear(); } else { wxLogDebug(wxT("cannot read addr2line output for stack frame #%lu"), (unsigned long)i); return false; } // 2nd one -- the file/line info if ( fgets(g_buf, WXSIZEOF(g_buf), fp) ) { filename = wxString::FromAscii(g_buf); filename.RemoveLast(); const size_t posColon = filename.find(wxT(':')); if ( posColon != wxString::npos ) { // parse line number (it's ok if it fails, this will just leave // line at its current, invalid, 0 value) wxString(filename, posColon + 1, wxString::npos).ToULong(&line); // remove line number from 'filename' filename.erase(posColon); if ( filename == wxT("??") ) filename.clear(); } else { wxLogDebug(wxT("Unexpected addr2line format: \"%s\" - ") wxT("the semicolon is missing"), filename.c_str()); } } // now we've got enough info to initialize curr-th stack frame // (at worst, only addresses[i] and syminfo[i] have been initialized, // but wxStackFrame::OnGetName may still be able to get function name): arr[curr++].Set(name, filename, syminfo[i], i, line, addresses[i]); } return curr; }
OggImportPlugin() : ImportPlugin(wxArrayString(WXSIZEOF(exts), exts)) { }
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(); }
// get full hostname (with domain name if possible) bool wxGetFullHostName(wxChar *buf, int maxSize) { #if wxUSE_DYNLIB_CLASS && wxUSE_SOCKETS // TODO should use GetComputerNameEx() when available // we don't want to always link with Winsock DLL as we might not use it at // all, so load it dynamically here if needed (and don't complain if it is // missing, we handle this) wxLogNull noLog; wxDynamicLibrary dllWinsock(wxT("ws2_32.dll"), wxDL_VERBATIM); if ( dllWinsock.IsLoaded() ) { typedef int (PASCAL *WSAStartup_t)(WORD, WSADATA *); typedef int (PASCAL *gethostname_t)(char *, int); typedef hostent* (PASCAL *gethostbyname_t)(const char *); typedef hostent* (PASCAL *gethostbyaddr_t)(const char *, int , int); typedef int (PASCAL *WSACleanup_t)(void); #define LOAD_WINSOCK_FUNC(func) \ func ## _t \ pfn ## func = (func ## _t)dllWinsock.GetSymbol(wxT(#func)) LOAD_WINSOCK_FUNC(WSAStartup); WSADATA wsa; if ( pfnWSAStartup && pfnWSAStartup(MAKEWORD(1, 1), &wsa) == 0 ) { LOAD_WINSOCK_FUNC(gethostname); wxString host; if ( pfngethostname ) { char bufA[256]; if ( pfngethostname(bufA, WXSIZEOF(bufA)) == 0 ) { // gethostname() won't usually include the DNS domain name, // for this we need to work a bit more if ( !strchr(bufA, '.') ) { LOAD_WINSOCK_FUNC(gethostbyname); struct hostent *pHostEnt = pfngethostbyname ? pfngethostbyname(bufA) : NULL; if ( pHostEnt ) { // Windows will use DNS internally now LOAD_WINSOCK_FUNC(gethostbyaddr); pHostEnt = pfngethostbyaddr ? pfngethostbyaddr(pHostEnt->h_addr, 4, AF_INET) : NULL; } if ( pHostEnt ) { host = pHostEnt->h_name; } } } } LOAD_WINSOCK_FUNC(WSACleanup); if ( pfnWSACleanup ) pfnWSACleanup(); if ( !host.empty() ) { wxStrlcpy(buf, host.c_str(), maxSize); return true; } } } #endif // wxUSE_DYNLIB_CLASS && wxUSE_SOCKETS return wxGetHostName(buf, maxSize); }
// Constructor. Parent is the wizard page viewer_wizardpage::viewer_wizardpage( wxWizard *parent, wxBitmap bitmap ) : wxWizardPageSimple( parent ) { wxLogDebug( wxT( "Entering viewer_wizardpage constructor") ); // To set a custom bitmap in a derived wxWizardPageSimple, you just have to // set the wxWizardPageSimple m_bitmap member in the derived constructor. // ( see wx examples ). . m_bitmap = bitmap; // Set up the arrays of the list ctrls. Note can't be external to class, otherwise // won't get translated, since locale isn't set at that point. const wxString device_descriptive_array[] = { _( "Normal resolution Palm OS device" ), _( "High resolution Palm OS device" ) }; // The order of bpp descriptive names and their key parameters obviously have to match const wxString bpp_descriptive_array[] = { _( "Black and white" ), _( "4 shade grayscale" ), _( "16 shade grayscale" ), _( "256 colors" ), _( "Thousands of colors" ) }; // The order of languages and their iso-codes obviously have to match const wxString viewer_languages_descriptive_array[] = { _( "Catalan" ), _( "Czech" ), _( "Danish" ), _( "German" ), _( "English" ), _( "Spanish" ), _( "Faeroese" ), _( "French" ), _( "Italian" ), _( "Japanese" ), _( "Polish" ), _( "Russian" ), _( "Thai" ), _( "Turkish" ), _( "Simplified Chinese" ) }; /* // Now remove the unavailable viewers from the array (ie they weren't installed // as part of the installation package. // Make an int as the array size is going to change as we remove things // This is way off base. Crashes and I mean crashes hard! int total_viewers = WXSIZEOF( viewer_language_iso_codes_array ); for ( int i=total_viewers; 0 <= i; i-- ) { // Look to see if the file exists. // We will assume that both the hires and normal res for a language are // always installed or removed together. if ( ! wxFile::Exists( get_plucker_directory( HANDHELD_VIEWER_SOFTWARE ) + "/" + device_prefix_basename_array[ 0 ] + viewer_language_iso_codes_array[ i ] + ".prc" ) ) { // Remove them from array delete viewer_languages_descriptive_array[ i ]; delete viewer_language_iso_codes_array[ i ]; } } */ // Make a new flexgrid sizer ( format # of rows, # of columns, then hor/vert gaps ) // A zero in the rows or columns makes that parameter increase as things are added wxFlexGridSizer *root_flexgridsizer = new wxFlexGridSizer( 1, 0, 0 ); // Set the growable columns and rows root_flexgridsizer->AddGrowableCol( 0 ); root_flexgridsizer->AddGrowableRow( 1 ); wxStaticBox *software_staticbox = new wxStaticBox( this, -1, _( "Software options" ) ); wxStaticBoxSizer *software_staticboxsizer = new wxStaticBoxSizer( software_staticbox, wxVERTICAL ); // Make a new flexgrid sizer ( format # of rows, # of columns, then hor/vert gaps ) // A zero in the rows or columns makes that parameter increase as things are added wxFlexGridSizer *software_flexgridsizer = new wxFlexGridSizer( 0, 2, 0, 0 ); software_flexgridsizer->AddGrowableCol( 0 ); software_flexgridsizer->AddGrowableCol( 1 ); software_flexgridsizer->AddGrowableRow( 0 ); software_flexgridsizer->AddGrowableRow( 1 ); wxStaticText *viewer_wizardpage_device_statictext = new wxStaticText( this, -1, _( "Type of handheld device:" ), wxDefaultPosition, wxDefaultSize, 0 ); software_flexgridsizer->Add( viewer_wizardpage_device_statictext, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_device_choice = new wxChoice( this, -1, wxDefaultPosition, wxSize( 240,-1 ), WXSIZEOF( device_descriptive_array ), device_descriptive_array, 0 ); software_flexgridsizer->Add( m_device_choice, 0, wxALIGN_CENTRE|wxALL, 5 ); wxStaticText *viewer_wizardpage_bpp_statictext = new wxStaticText( this, -1, _( "Color depth of handheld device:" ), wxDefaultPosition, wxDefaultSize, 0 ); software_flexgridsizer->Add( viewer_wizardpage_bpp_statictext, 0, wxALIGN_CENTRE_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); m_bpp_choice = new wxChoice( this, -1, wxDefaultPosition, wxSize( 240,-1 ), WXSIZEOF( bpp_descriptive_array), bpp_descriptive_array, 0 ); software_flexgridsizer->Add( m_bpp_choice, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); wxStaticText *viewer_wizardpage_language_statictext = new wxStaticText( this, -1, _( "Language for handheld software:" ), wxDefaultPosition, wxDefaultSize, 0 ); software_flexgridsizer->Add( viewer_wizardpage_language_statictext, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); m_language_choice = new wxChoice( this, -1, wxDefaultPosition, wxSize( 240,-1 ), WXSIZEOF( viewer_languages_descriptive_array ), viewer_languages_descriptive_array, 0 ); software_flexgridsizer->Add( m_language_choice, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); software_staticboxsizer->Add( software_flexgridsizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); root_flexgridsizer->Add( software_staticboxsizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); wxStaticBox *install_staticbox = new wxStaticBox( this, -1, _( "Items to install" ) ); wxStaticBoxSizer *install_staticboxsizer = new wxStaticBoxSizer( install_staticbox, wxVERTICAL ); wxString install_viewer_string; install_viewer_string << _( "Install" ) << wxT( " " ) << plkrAPPLICATION_SUITE_NAME << wxT( " " ) << _( "Viewer" ) << wxT( " " ) << _( "(required)" ); m_install_viewer_checkbox = new wxCheckBox( this, -1, install_viewer_string ); install_staticboxsizer->Add( m_install_viewer_checkbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxString install_zlib_string; install_zlib_string << _( "Install ZLIB decompression tool" ) << wxT( " " ) << _( "(strongly recommended)" ); m_install_zlib_checkbox = new wxCheckBox( this, -1, install_zlib_string ); install_staticboxsizer->Add( m_install_zlib_checkbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxString install_manual_string; install_manual_string << _( "Install" ) << wxT( " " ) << plkrAPPLICATION_SUITE_NAME << wxT( " " ) << _( "user's manual" ) << wxT( " " ) << _( "(optional)" ); m_install_manual_checkbox = new wxCheckBox( this, -1, install_manual_string ); install_staticboxsizer->Add( m_install_manual_checkbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); root_flexgridsizer->Add( install_staticboxsizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP, 5 ); // Now that everything is added into the flexgrid sizer, send some commands to // tell it calculate all the control sizes nicely to fill up the available space. SetAutoLayout( TRUE ); SetSizer( root_flexgridsizer ); root_flexgridsizer->Fit( this ); root_flexgridsizer->SetSizeHints( this ); // Initialize the default value of the controls wizardpage_initalize(); wxLogDebug( wxT( "Completed viewer_wizardpage constructor") ); }
wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source) { const wxChar *src = source.c_str(); int lng = source.length(); wxChar tagBuffer[256]; m_Cache = NULL; m_CacheSize = 0; m_CachePos = 0; int pos = 0; while (pos < lng) { if (src[pos] == wxT('<')) // tag found: { if (m_CacheSize % CACHE_INCREMENT == 0) m_Cache = (wxHtmlCacheItem*) realloc(m_Cache, (m_CacheSize + CACHE_INCREMENT) * sizeof(wxHtmlCacheItem)); int tg = m_CacheSize++; int stpos = pos++; m_Cache[tg].Key = stpos; int i; for ( i = 0; pos < lng && i < (int)WXSIZEOF(tagBuffer) - 1 && src[pos] != wxT('>') && !wxIsspace(src[pos]); i++, pos++ ) { tagBuffer[i] = (wxChar)wxToupper(src[pos]); } tagBuffer[i] = _T('\0'); m_Cache[tg].Name = new wxChar[i+1]; memcpy(m_Cache[tg].Name, tagBuffer, (i+1)*sizeof(wxChar)); while (pos < lng && src[pos] != wxT('>')) pos++; if (src[stpos+1] == wxT('/')) // ending tag: { m_Cache[tg].End1 = m_Cache[tg].End2 = -2; // find matching begin tag: for (i = tg; i >= 0; i--) if ((m_Cache[i].End1 == -1) && (wxStrcmp(m_Cache[i].Name, tagBuffer+1) == 0)) { m_Cache[i].End1 = stpos; m_Cache[i].End2 = pos + 1; break; } } else { m_Cache[tg].End1 = m_Cache[tg].End2 = -1; if (wxIsCDATAElement(tagBuffer)) { // store the orig pos in case we are missing the closing // tag (see below) wxInt32 old_pos = pos; bool foundCloseTag = false; // find next matching tag int tag_len = wxStrlen(tagBuffer); while (pos < lng) { // find the ending tag while (pos + 1 < lng && (src[pos] != '<' || src[pos+1] != '/')) ++pos; if (src[pos] == '<') ++pos; // see if it matches int match_pos = 0; while (pos < lng && match_pos < tag_len && src[pos] != '>' && src[pos] != '<') { // cast to wxChar needed to suppress warning in // Unicode build if ((wxChar)wxToupper(src[pos]) == tagBuffer[match_pos]) { ++match_pos; } else if (src[pos] == wxT(' ') || src[pos] == wxT('\n') || src[pos] == wxT('\r') || src[pos] == wxT('\t')) { // need to skip over these } else { match_pos = 0; } ++pos; } // found a match if (match_pos == tag_len) { pos = pos - tag_len - 3; foundCloseTag = true; break; } else // keep looking for the closing tag { ++pos; } } if (!foundCloseTag) { // we didn't find closing tag; this means the markup // is incorrect and the best thing we can do is to // ignore the unclosed tag and continue parsing as if // it didn't exist: pos = old_pos; } } } } pos++; } // ok, we're done, now we'll free .Name members of cache - we don't need it anymore: for (int i = 0; i < m_CacheSize; i++) { delete[] m_Cache[i].Name; m_Cache[i].Name = NULL; } }
/* static */ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded() { wxDynamicLibraryDetailsArray dlls; #ifdef __LINUX__ // examine /proc/self/maps to find out what is loaded in our address space wxFFile file(_T("/proc/self/maps")); if ( file.IsOpened() ) { // details of the module currently being parsed wxString pathCur; void *startCur = NULL, *endCur = NULL; char path[1024]; char buf[1024]; while ( fgets(buf, WXSIZEOF(buf), file.fp()) ) { // format is: "start-end perm offset maj:min inode path", see proc(5) void *start, *end; switch ( sscanf(buf, "%p-%p %*4s %*p %*02x:%*02x %*d %1024s\n", &start, &end, path) ) { case 2: // there may be no path column path[0] = '\0'; break; case 3: // nothing to do, read everything we wanted break; default: // chop '\n' buf[strlen(buf) - 1] = '\0'; wxLogDebug(_T("Failed to parse line \"%s\" in /proc/self/maps."), buf); continue; } wxASSERT_MSG( start >= endCur, _T("overlapping regions in /proc/self/maps?") ); wxString pathNew = wxString::FromAscii(path); if ( pathCur.empty() ) { // new module start pathCur = pathNew; startCur = start; endCur = end; } else if ( pathCur == pathNew && endCur == end ) { // continuation of the same module in the address space endCur = end; } else // end of the current module { dlls.Add(wxDynamicLibraryDetailsCreator::New(startCur, endCur, pathCur)); pathCur.clear(); } } } #endif // __LINUX__ return dlls; }
int wxFileDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle()); WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; static wxChar fileNameBuffer [ wxMAXPATH ]; // the file-name wxChar titleBuffer [ wxMAXFILE+1+wxMAXEXT ]; // the file-name, without path *fileNameBuffer = wxT('\0'); *titleBuffer = wxT('\0'); long msw_flags = OFN_HIDEREADONLY; if ( HasFdFlag(wxFD_NO_FOLLOW) ) msw_flags |= OFN_NODEREFERENCELINKS; if ( HasFdFlag(wxFD_FILE_MUST_EXIST) ) msw_flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; /* If the window has been moved the programmer is probably trying to center or position it. Thus we set the callback or hook function so that we can actually adjust the position. Without moving or centering the dlg, it will just stay in the upper left of the frame, it does not center automatically. */ if (m_bMovedWindow || HasExtraControlCreator()) // we need these flags. { ChangeExceptionPolicy(); msw_flags |= OFN_EXPLORER|OFN_ENABLEHOOK; msw_flags |= OFN_ENABLESIZING; } wxON_BLOCK_EXIT0(RestoreExceptionPolicy); if ( HasFdFlag(wxFD_MULTIPLE) ) { // OFN_EXPLORER must always be specified with OFN_ALLOWMULTISELECT msw_flags |= OFN_EXPLORER | OFN_ALLOWMULTISELECT; } // if wxFD_CHANGE_DIR flag is not given we shouldn't change the CWD which the // standard dialog does by default (notice that under NT it does it anyhow, // OFN_NOCHANGEDIR or not, see below) if ( !HasFdFlag(wxFD_CHANGE_DIR) ) { msw_flags |= OFN_NOCHANGEDIR; } if ( HasFdFlag(wxFD_OVERWRITE_PROMPT) ) { msw_flags |= OFN_OVERWRITEPROMPT; } wxOPENFILENAME of; wxZeroMemory(of); of.lStructSize = gs_ofStructSize; of.hwndOwner = hWndParent; of.lpstrTitle = m_message.t_str(); of.lpstrFileTitle = titleBuffer; of.nMaxFileTitle = wxMAXFILE + 1 + wxMAXEXT; GlobalPtr hgbl; if ( HasExtraControlCreator() ) { msw_flags |= OFN_ENABLETEMPLATEHANDLE; hgbl.Init(256, GMEM_ZEROINIT); GlobalPtrLock hgblLock(hgbl); LPDLGTEMPLATE lpdt = static_cast<LPDLGTEMPLATE>(hgblLock.Get()); // Define a dialog box. lpdt->style = DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS; lpdt->cdit = 0; // Number of controls lpdt->x = 0; lpdt->y = 0; // convert the size of the extra controls to the dialog units const wxSize extraSize = GetExtraControlSize(); const LONG baseUnits = ::GetDialogBaseUnits(); lpdt->cx = ::MulDiv(extraSize.x, 4, LOWORD(baseUnits)); lpdt->cy = ::MulDiv(extraSize.y, 8, HIWORD(baseUnits)); // after the DLGTEMPLATE there are 3 additional WORDs for dialog menu, // class and title, all three set to zeros. of.hInstance = (HINSTANCE)lpdt; } // Convert forward slashes to backslashes (file selector doesn't like // forward slashes) and also squeeze multiple consecutive slashes into one // as it doesn't like two backslashes in a row neither wxString dir; size_t i, len = m_dir.length(); dir.reserve(len); for ( i = 0; i < len; i++ ) { wxChar ch = m_dir[i]; switch ( ch ) { case wxT('/'): // convert to backslash ch = wxT('\\'); // fall through case wxT('\\'): while ( i < len - 1 ) { wxChar chNext = m_dir[i + 1]; if ( chNext != wxT('\\') && chNext != wxT('/') ) break; // ignore the next one, unless it is at the start of a UNC path if (i > 0) i++; else break; } // fall through default: // normal char dir += ch; } } of.lpstrInitialDir = dir.c_str(); of.Flags = msw_flags; of.lpfnHook = wxFileDialogHookFunction; of.lCustData = (LPARAM)this; wxArrayString wildDescriptions, wildFilters; size_t items = wxParseCommonDialogsFilter(m_wildCard, wildDescriptions, wildFilters); wxASSERT_MSG( items > 0 , wxT("empty wildcard list") ); wxString filterBuffer; for (i = 0; i < items ; i++) { filterBuffer += wildDescriptions[i]; filterBuffer += wxT("|"); filterBuffer += wildFilters[i]; filterBuffer += wxT("|"); } // Replace | with \0 for (i = 0; i < filterBuffer.length(); i++ ) { if ( filterBuffer.GetChar(i) == wxT('|') ) { filterBuffer[i] = wxT('\0'); } } of.lpstrFilter = filterBuffer.t_str(); of.nFilterIndex = m_filterIndex + 1; //=== Setting defaultFileName >>========================================= wxStrlcpy(fileNameBuffer, m_fileName.c_str(), WXSIZEOF(fileNameBuffer)); of.lpstrFile = fileNameBuffer; // holds returned filename of.nMaxFile = wxMAXPATH; // we must set the default extension because otherwise Windows would check // for the existing of a wrong file with wxFD_OVERWRITE_PROMPT (i.e. if the // user types "foo" and the default extension is ".bar" we should force it // to check for "foo.bar" existence and not "foo") wxString defextBuffer; // we need it to be alive until GetSaveFileName()! if (HasFdFlag(wxFD_SAVE)) { const wxChar* extension = filterBuffer.t_str(); int maxFilter = (int)(of.nFilterIndex*2L) - 1; for( int j = 0; j < maxFilter; j++ ) // get extension extension = extension + wxStrlen( extension ) + 1; // use dummy name a to avoid assert in AppendExtension defextBuffer = AppendExtension(wxT("a"), extension); if (defextBuffer.StartsWith(wxT("a."))) { defextBuffer = defextBuffer.Mid(2); // remove "a." of.lpstrDefExt = defextBuffer.c_str(); } } // Create a temporary struct to restore the CWD when we exit this function // store off before the standard windows dialog can possibly change it struct CwdRestore { wxString value; ~CwdRestore() { if (!value.empty()) wxSetWorkingDirectory(value); } } cwdOrig; // GetOpenFileName will always change the current working directory on // (according to MSDN) "Windows NT 4.0/2000/XP" because the flag // OFN_NOCHANGEDIR has no effect. If the user did not specify // wxFD_CHANGE_DIR let's restore the current working directory to what it // was before the dialog was shown. if (msw_flags & OFN_NOCHANGEDIR) cwdOrig.value = wxGetCwd(); //== Execute FileDialog >>================================================= if ( !ShowCommFileDialog(&of, m_windowStyle) ) return wxID_CANCEL; m_fileNames.Empty(); if ( ( HasFdFlag(wxFD_MULTIPLE) ) && #if defined(OFN_EXPLORER) ( fileNameBuffer[of.nFileOffset-1] == wxT('\0') ) #else ( fileNameBuffer[of.nFileOffset-1] == wxT(' ') ) #endif // OFN_EXPLORER ) { #if defined(OFN_EXPLORER) m_dir = fileNameBuffer; i = of.nFileOffset; m_fileName = &fileNameBuffer[i]; m_fileNames.Add(m_fileName); i += m_fileName.length() + 1; while (fileNameBuffer[i] != wxT('\0')) { m_fileNames.Add(&fileNameBuffer[i]); i += wxStrlen(&fileNameBuffer[i]) + 1; } #else wxStringTokenizer toke(fileNameBuffer, wxT(" \t\r\n")); m_dir = toke.GetNextToken(); m_fileName = toke.GetNextToken(); m_fileNames.Add(m_fileName); while (toke.HasMoreTokens()) m_fileNames.Add(toke.GetNextToken()); #endif // OFN_EXPLORER m_path = m_dir; if ( m_dir.Last() != wxT('\\') ) m_path += wxT('\\'); m_path += m_fileName; m_filterIndex = (int)of.nFilterIndex - 1; } else { //=== Adding the correct extension >>================================= m_filterIndex = (int)of.nFilterIndex - 1; if ( !of.nFileExtension || (of.nFileExtension && fileNameBuffer[of.nFileExtension] == wxT('\0')) ) { // User has typed a filename without an extension: const wxChar* extension = filterBuffer.t_str(); int maxFilter = (int)(of.nFilterIndex*2L) - 1; for( int j = 0; j < maxFilter; j++ ) // get extension extension = extension + wxStrlen( extension ) + 1; m_fileName = AppendExtension(fileNameBuffer, extension); wxStrlcpy(fileNameBuffer, m_fileName.c_str(), WXSIZEOF(fileNameBuffer)); } m_path = fileNameBuffer; m_fileName = wxFileNameFromPath(fileNameBuffer); m_fileNames.Add(m_fileName); m_dir = wxPathOnly(fileNameBuffer); } return wxID_OK; }
/* static */ size_t wxFontMapperBase::GetSupportedEncodingsCount() { return WXSIZEOF(gs_encodings); }
int wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset) { wxFontEncoding encoding = wxFONTENCODING_SYSTEM; // we're going to modify it, make a copy wxString cs = charset; #if wxUSE_CONFIG && wxUSE_FILECONFIG // first try the user-defined settings wxFontMapperPathChanger path(this, FONTMAPPER_CHARSET_PATH); if ( path.IsOk() ) { wxConfigBase *config = GetConfig(); // do we have an encoding for this charset? long value = config->Read(charset, -1l); if ( value != -1 ) { if ( value == wxFONTENCODING_UNKNOWN ) { // don't try to find it, in particular don't ask the user return value; } if ( value >= 0 && value <= wxFONTENCODING_MAX ) { encoding = (wxFontEncoding)value; } else { wxLogDebug(wxT("corrupted config data: invalid encoding %ld for charset '%s' ignored"), value, charset.c_str()); } } if ( encoding == wxFONTENCODING_SYSTEM ) { // may be we have an alias? config->SetPath(FONTMAPPER_CHARSET_ALIAS_PATH); wxString alias = config->Read(charset); if ( !alias.empty() ) { // yes, we do - use it instead cs = alias; } } } #endif // wxUSE_CONFIG // if didn't find it there, try to recognize it ourselves if ( encoding == wxFONTENCODING_SYSTEM ) { // trim any spaces cs.Trim(true); cs.Trim(false); // discard the optional quotes if ( !cs.empty() ) { if ( cs[0u] == wxT('"') && cs.Last() == wxT('"') ) { cs = wxString(cs.c_str(), cs.length() - 1); } } for ( size_t i = 0; i < WXSIZEOF(gs_encodingNames); ++i ) { for ( const wxChar* const* encName = gs_encodingNames[i]; *encName; ++encName ) { if ( cs.CmpNoCase(*encName) == 0 ) return gs_encodings[i]; } } cs.MakeUpper(); if ( cs.Left(3) == wxT("ISO") ) { // the dash is optional (or, to be exact, it is not, but // several broken programs "forget" it) const wxChar *p = cs.c_str() + 3; if ( *p == wxT('-') ) p++; unsigned int value; if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 ) { // make it 0 based and check that it is strictly positive in // the process (no such thing as iso8859-0 encoding) if ( (value-- > 0) && (value < wxFONTENCODING_ISO8859_MAX - wxFONTENCODING_ISO8859_1) ) { // it's a valid ISO8859 encoding value += wxFONTENCODING_ISO8859_1; encoding = (wxFontEncoding)value; } } } else if ( cs.Left(4) == wxT("8859") ) { const wxChar *p = cs.c_str(); unsigned int value; if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 ) { // make it 0 based and check that it is strictly positive in // the process (no such thing as iso8859-0 encoding) if ( (value-- > 0) && (value < wxFONTENCODING_ISO8859_MAX - wxFONTENCODING_ISO8859_1) ) { // it's a valid ISO8859 encoding value += wxFONTENCODING_ISO8859_1; encoding = (wxFontEncoding)value; } } } else // check for Windows charsets { size_t len; if ( cs.Left(7) == wxT("WINDOWS") ) { len = 7; } else if ( cs.Left(2) == wxT("CP") ) { len = 2; } else // not a Windows encoding { len = 0; } if ( len ) { const wxChar *p = cs.c_str() + len; if ( *p == wxT('-') ) p++; unsigned int value; if ( wxSscanf(p, wxT("%u"), &value) == 1 ) { if ( value >= 1250 ) { value -= 1250; if ( value < wxFONTENCODING_CP12_MAX - wxFONTENCODING_CP1250 ) { // a valid Windows code page value += wxFONTENCODING_CP1250; encoding = (wxFontEncoding)value; } } switch ( value ) { case 866: encoding = wxFONTENCODING_CP866; break; case 874: encoding = wxFONTENCODING_CP874; break; case 932: encoding = wxFONTENCODING_CP932; break; case 936: encoding = wxFONTENCODING_CP936; break; case 949: encoding = wxFONTENCODING_CP949; break; case 950: encoding = wxFONTENCODING_CP950; break; } } } } //else: unknown } return encoding; }
wxTRANSLATE( "MacCentralEurRoman" ), wxTRANSLATE( "MacVietnamese" ), wxTRANSLATE( "MacExtArabic" ), wxTRANSLATE( "MacSymbol" ), wxTRANSLATE( "MacDingbats" ), wxTRANSLATE( "MacTurkish" ), wxTRANSLATE( "MacCroatian" ), wxTRANSLATE( "MacIcelandic" ), wxTRANSLATE( "MacRomanian" ), wxTRANSLATE( "MacCeltic" ), wxTRANSLATE( "MacGaelic" ), wxTRANSLATE( "MacKeyboardGlyphs" ) }; // and the internal names (these are not translated on purpose!) static const wxChar* const gs_encodingNames[WXSIZEOF(gs_encodingDescs)][9] = { // names from the columns correspond to these OS: // Linux Solaris and IRIX HP-UX AIX { wxT("ISO-8859-1"), wxT("ISO8859-1"), wxT("iso88591"), wxT("8859-1"), wxT("iso_8859_1"), NULL }, { wxT("ISO-8859-2"), wxT("ISO8859-2"), wxT("iso88592"), wxT("8859-2"), NULL }, { wxT("ISO-8859-3"), wxT("ISO8859-3"), wxT("iso88593"), wxT("8859-3"), NULL }, { wxT("ISO-8859-4"), wxT("ISO8859-4"), wxT("iso88594"), wxT("8859-4"), NULL }, { wxT("ISO-8859-5"), wxT("ISO8859-5"), wxT("iso88595"), wxT("8859-5"), NULL }, { wxT("ISO-8859-6"), wxT("ISO8859-6"), wxT("iso88596"), wxT("8859-6"), NULL }, { wxT("ISO-8859-7"), wxT("ISO8859-7"), wxT("iso88597"), wxT("8859-7"), NULL }, { wxT("ISO-8859-8"), wxT("ISO8859-8"), wxT("iso88598"), wxT("8859-8"), NULL }, { wxT("ISO-8859-9"), wxT("ISO8859-9"), wxT("iso88599"), wxT("8859-9"), NULL }, { wxT("ISO-8859-10"), wxT("ISO8859-10"), wxT("iso885910"), wxT("8859-10"), NULL }, { wxT("ISO-8859-11"), wxT("ISO8859-11"), wxT("iso885911"), wxT("8859-11"), NULL }, { wxT("ISO-8859-12"), wxT("ISO8859-12"), wxT("iso885912"), wxT("8859-12"), NULL },
static wxString GetFullName(const wxRegKey *pKey, const wxString& szValue); // returns "value" argument of wxRegKey methods converted into a value that can // be passed to win32 registry functions; specifically, converts empty string // to NULL static inline const wxChar *RegValueStr(const wxString& szValue); // ============================================================================ // implementation of wxRegKey class // ============================================================================ // ---------------------------------------------------------------------------- // static functions and variables // ---------------------------------------------------------------------------- const size_t wxRegKey::nStdKeys = WXSIZEOF(aStdKeys); // @@ should take a `StdKey key', but as it's often going to be used in loops // it would require casts in user code. const wxChar *wxRegKey::GetStdKeyName(size_t key) { // return empty string if key is invalid wxCHECK_MSG( key < nStdKeys, wxEmptyString, wxT("invalid key in wxRegKey::GetStdKeyName") ); return aStdKeys[key].szName; } const wxChar *wxRegKey::GetStdKeyShortName(size_t key) { // return empty string if key is invalid wxCHECK( key < nStdKeys, wxEmptyString );
bool wxTextFile::OnRead(const wxMBConv& conv) { // file should be opened wxASSERT_MSG( m_file.IsOpened(), wxT("can't read closed file") ); // read the entire file in memory: this is not the most efficient thing to // do it but there is no good way to avoid it in Unicode build because if // we read the file block by block we can't convert each block to Unicode // separately (the last multibyte char in the block might be only partially // read and so the conversion would fail) and, as the file contents is kept // in memory by wxTextFile anyhow, it shouldn't be a big problem to read // the file entirely size_t bufSize = 0; // number of bytes to (try to) read from disk at once static const size_t BLOCK_SIZE = 4096; wxCharBuffer buf; // first determine if the file is seekable or not and so whether we can // determine its length in advance wxFileOffset fileLength; { wxLogNull logNull; fileLength = m_file.Length(); } // some non-seekable files under /proc under Linux pretend that they're // seekable but always return 0; others do return an error const bool seekable = fileLength != wxInvalidOffset && fileLength != 0; if ( seekable ) { // we know the required length, so set the buffer size in advance bufSize = fileLength; if ( !buf.extend(bufSize) ) return false; // if the file is seekable, also check that we're at its beginning wxASSERT_MSG( m_file.Tell() == 0, wxT("should be at start of file") ); char *dst = buf.data(); for ( size_t nRemaining = bufSize; nRemaining > 0; ) { size_t nToRead = BLOCK_SIZE; // the file size could have changed, avoid overflowing the buffer // even if it did if ( nToRead > nRemaining ) nToRead = nRemaining; ssize_t nRead = m_file.Read(dst, nToRead); if ( nRead == wxInvalidOffset ) { // read error (error message already given in wxFile::Read) return false; } if ( nRead == 0 ) { // this file can't be empty because we checked for this above // so this must be the end of file break; } dst += nRead; nRemaining -= nRead; } wxASSERT_MSG( dst - buf.data() == (wxFileOffset)bufSize, wxT("logic error") ); } else // file is not seekable { char block[BLOCK_SIZE]; for ( ;; ) { ssize_t nRead = m_file.Read(block, WXSIZEOF(block)); if ( nRead == wxInvalidOffset ) { // read error (error message already given in wxFile::Read) return false; } if ( nRead == 0 ) { // if no bytes have been read, presumably this is a // valid-but-empty file if ( bufSize == 0 ) return true; // otherwise we've finished reading the file break; } // extend the buffer for new data if ( !buf.extend(bufSize + nRead) ) return false; // and append it to the buffer memcpy(buf.data() + bufSize, block, nRead); bufSize += nRead; } } const wxString str(buf, conv, bufSize); // there's no risk of this happening in ANSI build #if wxUSE_UNICODE if ( bufSize > 4 && str.empty() ) { wxLogError(_("Failed to convert file \"%s\" to Unicode."), GetName()); return false; } #endif // wxUSE_UNICODE // we don't need this memory any more buf.reset(); // now break the buffer in lines // the beginning of the current line, changes inside the loop wxString::const_iterator lineStart = str.begin(); const wxString::const_iterator end = str.end(); for ( wxString::const_iterator p = lineStart; p != end; p++ ) { const wxChar ch = *p; if ( ch == '\r' || ch == '\n' ) { // Determine the kind of line ending this is. wxTextFileType lineType = wxTextFileType_None; if ( ch == '\r' ) { wxString::const_iterator next = p + 1; if ( next != end && *next == '\n' ) lineType = wxTextFileType_Dos; else lineType = wxTextFileType_Mac; } else // ch == '\n' { lineType = wxTextFileType_Unix; } AddLine(wxString(lineStart, p), lineType); // DOS EOL is the only one consisting of two chars, not one. if ( lineType == wxTextFileType_Dos ) p++; lineStart = p + 1; } } // anything in the last line? if ( lineStart != end ) { // Add the last line; notice that it is certainly not terminated with a // newline, otherwise it would be handled above. wxString lastLine(lineStart, end); AddLine(lastLine, wxTextFileType_None); } return true; }
void FlatAuiTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& page, const wxRect& in_rect, int close_button_state, wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent) { wxCoord normal_textx, normal_texty; wxCoord selected_textx, selected_texty; wxCoord texty; wxFont m_selected_font = m_normal_font; // if the caption is empty, measure some temporary text wxString caption = page.caption; if (caption.empty()) caption = wxT("Xj"); dc.SetFont(m_selected_font); dc.GetTextExtent(caption, &selected_textx, &selected_texty); dc.SetFont(m_normal_font); dc.GetTextExtent(caption, &normal_textx, &normal_texty); // figure out the size of the tab wxSize tab_size = GetTabSize(dc, wnd, page.caption, page.bitmap, page.active, close_button_state, x_extent); wxCoord tab_height = m_tab_ctrl_height - 3; wxCoord tab_width = tab_size.x; wxCoord tab_x = in_rect.x; wxCoord tab_y = in_rect.y + in_rect.height - tab_height; caption = page.caption; // select pen, brush and font for the tab to be drawn if (page.active) { dc.SetFont(m_selected_font); texty = selected_texty; } else { dc.SetFont(m_normal_font); texty = normal_texty; } // create points that will make the tab outline int clip_width = tab_width; if (tab_x + clip_width > in_rect.x + in_rect.width) clip_width = (in_rect.x + in_rect.width) - tab_x; /* wxPoint clip_points[6]; clip_points[0] = wxPoint(tab_x, tab_y+tab_height-3); clip_points[1] = wxPoint(tab_x, tab_y+2); clip_points[2] = wxPoint(tab_x+2, tab_y); clip_points[3] = wxPoint(tab_x+clip_width-1, tab_y); clip_points[4] = wxPoint(tab_x+clip_width+1, tab_y+2); clip_points[5] = wxPoint(tab_x+clip_width+1, tab_y+tab_height-3); // FIXME: these ports don't provide wxRegion ctor from array of points #if !defined(__WXDFB__) && !defined(__WXCOCOA__) // set the clipping region for the tab -- wxRegion clipping_region(WXSIZEOF(clip_points), clip_points); dc.SetClippingRegion(clipping_region); #endif // !wxDFB && !wxCocoa */ // since the above code above doesn't play well with WXDFB or WXCOCOA, // we'll just use a rectangle for the clipping region for now -- dc.SetClippingRegion(tab_x, tab_y, clip_width+1, tab_height-3); wxPoint border_points[4]; if (m_flags &wxAUI_NB_BOTTOM) { border_points[0] = wxPoint(tab_x, tab_y); border_points[1] = wxPoint(tab_x, tab_y+tab_height-4); border_points[2] = wxPoint(tab_x+tab_width, tab_y+tab_height-4); border_points[3] = wxPoint(tab_x+tab_width, tab_y); } else //if (m_flags & wxAUI_NB_TOP) {} { border_points[0] = wxPoint(tab_x, tab_y+tab_height); border_points[1] = wxPoint(tab_x, tab_y); border_points[2] = wxPoint(tab_x+tab_width, tab_y); border_points[3] = wxPoint(tab_x+tab_width, tab_y+tab_height); } // else if (m_flags &wxAUI_NB_LEFT) {} // else if (m_flags &wxAUI_NB_RIGHT) {} int drawn_tab_yoff = border_points[1].y; int drawn_tab_height = border_points[0].y - border_points[1].y; if (page.active) { // draw active tab // draw base background color wxRect r(tab_x, tab_y, tab_width, tab_height); dc.SetPen(wxPen(m_active_colour)); dc.SetBrush(wxBrush(m_active_colour)); dc.DrawRectangle(r.x+1, r.y+1, r.width-1, r.height-4); // this white helps fill out the gradient at the top of the tab dc.SetPen(*wxWHITE_PEN); dc.SetBrush(*wxWHITE_BRUSH); dc.DrawRectangle(r.x+2, r.y+1, r.width-3, r.height-4); // these two points help the rounded corners appear more antialiased dc.SetPen(wxPen(m_active_colour)); dc.DrawPoint(r.x+2, r.y+1); dc.DrawPoint(r.x+r.width-2, r.y+1); // set rectangle down a bit for gradient drawing //r.SetHeight(r.GetHeight()/2); r.x += 2; r.width -= 2; /*r.y += r.height; r.y -= 2;*/ r.y += 1; r.height -= 2; // draw gradient background wxColor top_color = m_active_colour; wxColor bottom_color = m_active_colour; dc.GradientFillLinear(r, bottom_color, top_color, wxSOUTH); // Adapt text color int average = (m_active_colour.Red()+m_active_colour.Green()+m_active_colour.Blue())/3; if (average < 127) dc.SetTextForeground(*wxWHITE); else dc.SetTextForeground(*wxBLACK); } else { // draw inactive tab wxRect r(tab_x, tab_y+1, tab_width, tab_height-3); // start the gradent up a bit and leave the inside border inset // by a pixel for a 3D look. Only the top half of the inactive // tab will have a slight gradient r.x += 3; r.y++; r.width -= 4; r.height /= 2; r.height--; // -- draw top gradient fill for glossy look wxColor top_color = m_base_colour; wxColor bottom_color = gdAuiStepColour(top_color, 160); dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH); r.y += r.height; r.y--; // -- draw bottom fill for glossy look top_color = m_base_colour; bottom_color = m_base_colour; dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH); // Adapt text color int average = (m_base_colour.Red()+m_base_colour.Green()+m_base_colour.Blue())/3; if (average < 127) dc.SetTextForeground(*wxWHITE); else dc.SetTextForeground(*wxBLACK); } // draw tab outline dc.SetPen(m_border_pen); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawPolygon(WXSIZEOF(border_points), border_points); // there are two horizontal grey lines at the bottom of the tab control, // this gets rid of the top one of those lines in the tab control if (page.active) { if (m_flags &wxAUI_NB_BOTTOM) dc.SetPen(wxPen(wxColour(gdAuiStepColour(m_base_colour, 170)))); // else if (m_flags &wxAUI_NB_LEFT) {} // else if (m_flags &wxAUI_NB_RIGHT) {} else //for wxAUI_NB_TOP dc.SetPen(m_base_colour_pen); //GDevelop use white pen so as to conform to white background dc.SetPen(*wxWHITE_PEN); dc.DrawLine(border_points[0].x+1, border_points[0].y, border_points[5].x, border_points[5].y); } int text_offset = tab_x + 8; int close_button_width = 0; if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) { close_button_width = m_active_close_bmp.GetWidth(); } int bitmap_offset = 0; if (page.bitmap.IsOk()) { bitmap_offset = tab_x + 8; // draw bitmap dc.DrawBitmap(page.bitmap, bitmap_offset, drawn_tab_yoff + (drawn_tab_height/2) - (page.bitmap.GetHeight()/2), true); text_offset = bitmap_offset + page.bitmap.GetWidth(); text_offset += 3; // bitmap padding } else { text_offset = tab_x + 8; } wxString draw_text = gdAuiChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width); // draw tab text dc.DrawText(draw_text, text_offset, drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1); // draw focus rectangle if (page.active && (wnd->FindFocus() == wnd)) { wxRect focusRectText(text_offset, (drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1), selected_textx, selected_texty); wxRect focusRect; wxRect focusRectBitmap; if (page.bitmap.IsOk()) focusRectBitmap = wxRect(bitmap_offset, drawn_tab_yoff + (drawn_tab_height/2) - (page.bitmap.GetHeight()/2), page.bitmap.GetWidth(), page.bitmap.GetHeight()); if (page.bitmap.IsOk() && draw_text.IsEmpty()) focusRect = focusRectBitmap; else if (!page.bitmap.IsOk() && !draw_text.IsEmpty()) focusRect = focusRectText; else if (page.bitmap.IsOk() && !draw_text.IsEmpty()) focusRect = focusRectText.Union(focusRectBitmap); focusRect.Inflate(2, 2); wxRendererNative::Get().DrawFocusRect(wnd, dc, focusRect, 0); } // draw close button if necessary if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) { wxBitmap bmp = m_disabled_close_bmp; if (close_button_state == wxAUI_BUTTON_STATE_HOVER || close_button_state == wxAUI_BUTTON_STATE_PRESSED) { bmp = m_active_close_bmp; } wxRect rect(tab_x + tab_width - close_button_width - 1, tab_y + (tab_height/2) - (bmp.GetHeight()/2), close_button_width, tab_height); IndentPressedBitmap(&rect, close_button_state); dc.DrawBitmap(bmp, rect.x, rect.y, true); *out_button_rect = rect; } *out_tab_rect = wxRect(tab_x, tab_y, tab_width, tab_height); dc.DestroyClippingRegion(); }
CameraConfigDialogCtrlSet::CameraConfigDialogCtrlSet(wxWindow *pParent, GuideCamera *pCamera, AdvancedDialog *pAdvancedDialog, BrainCtrlIdMap& CtrlMap) : ConfigDialogCtrlSet(pParent, pAdvancedDialog, CtrlMap) { assert(pCamera); m_pCamera = pCamera; if (m_pCamera->HasSubframes) { m_pUseSubframes = new wxCheckBox(GetParentWindow(AD_cbUseSubFrames), wxID_ANY, _("Use Subframes")); AddCtrl(CtrlMap, AD_cbUseSubFrames, m_pUseSubframes, _("Check to only download subframes (ROIs). Sub-frame size is equal to search region size.")); } int numRows = (int)m_pCamera->HasGainControl + (int)m_pCamera->HasDelayParam + (int)m_pCamera->HasPortNum + 1; int width = StringWidth(_T("0000")) + 30; // Pixel size always m_pPixelSize = NewSpinnerDouble(GetParentWindow(AD_szPixelSize), width, m_pCamera->GetCameraPixelSize(), 0.0, 99.9, 0.1, _("Guide camera un-binned pixel size in microns. Used with the guide telescope focal length to display guiding error in arc-seconds.")); AddLabeledCtrl(CtrlMap, AD_szPixelSize, _("Pixel size"), m_pPixelSize, ""); // Gain control if (m_pCamera->HasGainControl) { int width = StringWidth(_T("0000")) + 30; m_pCameraGain = NewSpinnerInt(GetParentWindow(AD_szGain), width, 100, 0, 100, 1); AddLabeledCtrl(CtrlMap, AD_szGain, _("Camera gain"), m_pCameraGain, _("Camera gain, default = 95 % , lower if you experience noise or wish to guide on a very bright star. Not available on all cameras.")); } // Binning m_binning = 0; if (m_pCamera->MaxBinning > 1) { wxArrayString opts; m_pCamera->GetBinningOpts(&opts); int width = StringArrayWidth(opts); m_binning = new wxChoice(GetParentWindow(AD_binning), wxID_ANY, wxPoint(-1, -1), wxSize(width + 35, -1), opts); AddLabeledCtrl(CtrlMap, AD_binning, _("Binning"), m_binning, _("Camera pixel binning")); } // Delay parameter if (m_pCamera->HasDelayParam) { int width = StringWidth(_T("0000")) + 30; m_pDelay = NewSpinnerInt(GetParentWindow(AD_szDelay), width, 5, 0, 250, 150); AddLabeledCtrl(CtrlMap, AD_szDelay, _("Delay"), m_pDelay, _("LE Read Delay (ms) , Adjust if you get dropped frames")); } // Port number if (m_pCamera->HasPortNum) { wxString port_choices[] = { _T("Port 378"), _T("Port 3BC"), _T("Port 278"), _T("COM1"), _T("COM2"), _T("COM3"), _T("COM4"), _T("COM5"), _T("COM6"), _T("COM7"), _T("COM8"), _T("COM9"), _T("COM10"), _T("COM11"), _T("COM12"), _T("COM13"), _T("COM14"), _T("COM15"), _T("COM16"), }; int width = StringArrayWidth(port_choices, WXSIZEOF(port_choices)); m_pPortNum = new wxChoice(GetParentWindow(AD_szPort), wxID_ANY, wxPoint(-1, -1), wxSize(width + 35, -1), WXSIZEOF(port_choices), port_choices); AddLabeledCtrl(CtrlMap, AD_szPort, _("LE Port"), m_pPortNum, _("Port number for long-exposure control")); } if (m_pCamera->HasCooler) { wxSizer *sz = new wxBoxSizer(wxHORIZONTAL); m_coolerOn = new wxCheckBox(GetParentWindow(AD_cooler), wxID_ANY, _("Cooler On")); m_coolerOn->SetToolTip(_("Turn camera cooler on or off")); sz->Add(m_coolerOn, wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL).Border(wxRIGHT)); m_coolerSetpt = NewSpinnerInt(GetParentWindow(AD_szDelay), width, 5, -99, 99, 1); wxSizer *szt = MakeLabeledControl(AD_cooler, _("Set Temperature"), m_coolerSetpt, _("Cooler setpoint temperature")); sz->Add(szt, wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL)); AddGroup(CtrlMap, AD_cooler, sz); } // Watchdog timeout { int width = StringWidth(_T("0000")) + 30; m_timeoutVal = NewSpinnerInt(GetParentWindow(AD_szCameraTimeout), width, 5, 5, 9999, 1); AddLabeledCtrl(CtrlMap, AD_szCameraTimeout, _("Disconnect nonresponsive\ncamera after (seconds)"), m_timeoutVal, wxString::Format(_("The camera will be disconnected if it fails to respond for this long. " "The default value, %d seconds, should be appropriate for most cameras."), DefaultGuideCameraTimeoutMs / 1000)); } }
WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) { GLint data[512]; const GLint defaultAttribs[] = { AGL_RGBA, AGL_DOUBLEBUFFER, AGL_MINIMUM_POLICY, // never choose less than requested AGL_DEPTH_SIZE, 1, // use largest available depth buffer AGL_RED_SIZE, 1, AGL_GREEN_SIZE, 1, AGL_BLUE_SIZE, 1, AGL_ALPHA_SIZE, 0, AGL_NONE }; const GLint *attribs; if ( !attribList ) { attribs = defaultAttribs; } else { unsigned p = 0; data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX for ( unsigned arg = 0; attribList[arg] !=0 && p < WXSIZEOF(data); ) { switch ( attribList[arg++] ) { case WX_GL_RGBA: data[p++] = AGL_RGBA; break; case WX_GL_BUFFER_SIZE: data[p++] = AGL_BUFFER_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_LEVEL: data[p++]=AGL_LEVEL; data[p++]=attribList[arg++]; break; case WX_GL_DOUBLEBUFFER: data[p++] = AGL_DOUBLEBUFFER; break; case WX_GL_STEREO: data[p++] = AGL_STEREO; break; case WX_GL_AUX_BUFFERS: data[p++] = AGL_AUX_BUFFERS; data[p++] = attribList[arg++]; break; case WX_GL_MIN_RED: data[p++] = AGL_RED_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_MIN_GREEN: data[p++] = AGL_GREEN_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_MIN_BLUE: data[p++] = AGL_BLUE_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_MIN_ALPHA: data[p++] = AGL_ALPHA_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_DEPTH_SIZE: data[p++] = AGL_DEPTH_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_STENCIL_SIZE: data[p++] = AGL_STENCIL_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_MIN_ACCUM_RED: data[p++] = AGL_ACCUM_RED_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_MIN_ACCUM_GREEN: data[p++] = AGL_ACCUM_GREEN_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_MIN_ACCUM_BLUE: data[p++] = AGL_ACCUM_BLUE_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_MIN_ACCUM_ALPHA: data[p++] = AGL_ACCUM_ALPHA_SIZE; data[p++] = attribList[arg++]; break; case WX_GL_SAMPLE_BUFFERS: if ( !wxGLCanvas::IsAGLMultiSampleAvailable() ) { if ( !attribList[arg++] ) break; return NULL; } data[p++] = AGL_SAMPLE_BUFFERS_ARB; if ( (data[p++] = attribList[arg++]) == true ) { // don't use software fallback data[p++] = AGL_NO_RECOVERY; } break; case WX_GL_SAMPLES: if ( !wxGLCanvas::IsAGLMultiSampleAvailable() ) { if ( !attribList[arg++] ) break; return NULL; } data[p++] = AGL_SAMPLES_ARB; data[p++] = attribList[arg++]; break; } } data[p] = AGL_NONE; attribs = data; } return aglChoosePixelFormat(NULL, 0, attribs); }
{-1, NULL}, {-1, NULL}, {-1, NULL}, {-1, NULL}, {-1, NULL}, {-1, NULL}, {-1, NULL}, {-1, NULL}, {-1, NULL}, {-1, NULL}, {-1, NULL}, {-1, NULL}}, 0}, }; const int g_LanguagePrefsSize = WXSIZEOF(g_LanguagePrefs); //---------------------------------------------------------------------------- //! style types const StyleInfo g_StylePrefs [] = { // mySTC_TYPE_DEFAULT {wxT("Default"), wxT("BLACK"), wxT("WHITE"), wxT(""), 10, 0, 0}, // mySTC_TYPE_WORD1 {wxT("Keyword1"), wxT("BLUE"), wxT("WHITE"), wxT(""), 10, mySTC_STYLE_BOLD, 0}, // mySTC_TYPE_WORD2
// Get user name e.g. Julian Smart bool wxGetUserName(wxChar *buf, int maxSize) { wxCHECK_MSG( buf && ( maxSize > 0 ), false, wxT("empty buffer in wxGetUserName") ); #if defined(USE_NET_API) CHAR szUserName[256]; if ( !wxGetUserId(szUserName, WXSIZEOF(szUserName)) ) return false; // TODO how to get the domain name? CHAR *szDomain = ""; // the code is based on the MSDN example (also see KB article Q119670) WCHAR wszUserName[256]; // Unicode user name WCHAR wszDomain[256]; LPBYTE ComputerName; USER_INFO_2 *ui2; // User structure // Convert ANSI user name and domain to Unicode MultiByteToWideChar( CP_ACP, 0, szUserName, strlen(szUserName)+1, wszUserName, WXSIZEOF(wszUserName) ); MultiByteToWideChar( CP_ACP, 0, szDomain, strlen(szDomain)+1, wszDomain, WXSIZEOF(wszDomain) ); // Get the computer name of a DC for the domain. if ( NetGetDCName( NULL, wszDomain, &ComputerName ) != NERR_Success ) { wxLogError(wxT("Cannot find domain controller")); goto error; } // Look up the user on the DC NET_API_STATUS status = NetUserGetInfo( (LPWSTR)ComputerName, (LPWSTR)&wszUserName, 2, // level - we want USER_INFO_2 (LPBYTE *) &ui2 ); switch ( status ) { case NERR_Success: // ok break; case NERR_InvalidComputer: wxLogError(wxT("Invalid domain controller name.")); goto error; case NERR_UserNotFound: wxLogError(wxT("Invalid user name '%s'."), szUserName); goto error; default: wxLogSysError(wxT("Can't get information about user")); goto error; } // Convert the Unicode full name to ANSI WideCharToMultiByte( CP_ACP, 0, ui2->usri2_full_name, -1, buf, maxSize, NULL, NULL ); return true; error: wxLogError(wxT("Couldn't look up full user name.")); return false; #else // !USE_NET_API // Could use NIS, MS-Mail or other site specific programs // Use wxWidgets configuration data bool ok = GetProfileString(WX_SECTION, eUSERNAME, wxEmptyString, buf, maxSize - 1) != 0; if ( !ok ) { ok = wxGetUserId(buf, maxSize); } if ( !ok ) { wxStrlcpy(buf, wxT("Unknown User"), maxSize); } return true; #endif // Win32/16 }
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); }
CNowPlayingCtrl::CNowPlayingCtrl( wxWindow *parent ,CMusikPlayer & refMusikPlayer) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN| wxTAB_TRAVERSAL ) ,m_MusikPlayer(refMusikPlayer) { //-----------------------------// //--- title / artist / time ---// //-----------------------------// //--- now playing static text objects ---// stSong = new wxStaticText_NoFlicker ( this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); stArtist = new wxStaticText_NoFlicker ( this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); stCurtime = new wxStaticText_NoFlicker ( this,MUSIK_NOWPLAYINGCTRL_TIMEDISPLAY, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); //--- fonts ---// stSong->SetFont ( g_fntSong ); stArtist->SetFont ( g_fntArtist ); stCurtime->SetFont ( g_fntTime ); //---------------------------// //--- buttons and bitmaps ---// //---------------------------// //--- bitmaps ---// { wxLogNull lognull; // disable logging in this scope LOAD_BUTTONPNG(Prev); LOAD_BUTTONPNG(Play); LOAD_BUTTONPNG(Pause); LOAD_BUTTONPNG(Stop); LOAD_BUTTONPNG(Next); LOAD_BUTTONPNG(Volume); } wxPanel * pPlayPanel = new wxPanel(this); //--- buttons ---// btnPrev = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_PREV, bmPrev ,wxDefaultPosition,wxDefaultSize,0); btnNext = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_NEXT, bmNext,wxDefaultPosition,wxDefaultSize,0); btnPlayPause = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_PLAYPAUSE, bmPlay,wxDefaultPosition,wxDefaultSize,0); btnStop = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_STOP, bmStop,wxDefaultPosition,wxDefaultSize,0); btnVolume = new wxBitmapButton( pPlayPanel, MUSIK_NOWPLAYINGCTRL_VOLUME, bmVolume,wxDefaultPosition,wxDefaultSize,0); //--- events ---// #ifndef __WXMSW__ btnPrev->SetBitmapFocus ( bmPrevDown ); btnNext->SetBitmapFocus ( bmNextDown ); btnPlayPause->SetBitmapFocus ( bmPlayDown ); btnStop->SetBitmapFocus ( bmStopDown ); btnVolume->SetBitmapFocus ( bmVolumeDown ); #else // defined __WXMSW__ pPrevEvt = new CBtnDownEvt ( btnPrev, &bmPrevDown, &bmPrev ); pNextEvt = new CBtnDownEvt ( btnNext, &bmNextDown, &bmNext ); pPlayEvt = new CBtnDownEvt ( btnPlayPause, &bmPlayDown, &bmPlay ); pPauseEvt = new CBtnDownEvt ( btnPlayPause, &bmPauseDown, &bmPause ); pStopEvt = new CBtnDownEvt ( btnStop, &bmStopDown, &bmStop ); pVolumeEvt = new CBtnDownEvt ( btnVolume, &bmVolumeDown, &bmVolume ); btnPrev->PushEventHandler ( pPrevEvt ); btnNext->PushEventHandler ( pNextEvt ); btnPlayPause->PushEventHandler ( pPlayEvt ); btnStop->PushEventHandler ( pStopEvt ); btnVolume->PushEventHandler ( pVolumeEvt ); #endif //----------------// //--- seek bar ---// //----------------// gSeek = new wxGauge ( pPlayPanel, MUSIK_NOWPLAYINGCTRL_SEEK, 100, wxDefaultPosition, wxSize( 4* wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ), wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) ), wxGA_SMOOTH | wxGA_HORIZONTAL | wxCLIP_CHILDREN ); pSeekEvt = new CGaugeSeekEvt ( gSeek ); gSeek->PushEventHandler( pSeekEvt ); gSeek->Connect(wxEVT_RIGHT_DOWN,wxMouseEventHandler(CNowPlayingCtrl::OnClickTimeDisplay),NULL,this); //---------------------------------// //--- sizer for artist and time ---// //---------------------------------// hsArtistTime = new wxBoxSizer( wxHORIZONTAL ); hsArtistTime->Add( stArtist, 0, wxALIGN_CENTRE_VERTICAL ); hsArtistTime->Add( stCurtime, 1, wxALIGN_CENTRE_VERTICAL|wxLEFT,3 ); //--- song title, artist and time ---// vsLeftCol = new wxBoxSizer( wxVERTICAL ); vsLeftCol->Add( stSong, 1, wxBOTTOM|wxEXPAND , 3 ); vsLeftCol->Add( hsArtistTime, 1, wxEXPAND ); //--- buttons, seek bar panel ---// wxGridSizer *hsButtons = new wxGridSizer(5); hsButtons->Add( btnPrev ,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,1); hsButtons->Add( btnPlayPause ,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,1); hsButtons->Add( btnStop ,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,1); hsButtons->Add( btnNext ,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,1); hsButtons->Add( btnVolume,0,wxALIGN_CENTRE_HORIZONTAL | wxLEFT ,1); vsRightCol = new wxBoxSizer( wxVERTICAL ); //--- playmode ---// wxBoxSizer *vsPlayModeCol = new wxBoxSizer( wxHORIZONTAL ); vsPlayModeCol->Add( hsButtons, 1,wxEXPAND|wxALL,2 ); // vsPlayModeCol->Add( new wxStaticText ( this, -1, _( "Play mode" ) ), 1 ); const wxString playmode_choices[] ={_("Normal"),_("Repeat Song"),_("Repeat List"),_("Shuffle"),_("Auto DJ"),_("Auto DJ Album")}; wxChoice *choicePlaymode = new wxChoice_NoFlicker(pPlayPanel,MUSIK_NOWPLAYINGCTRL_PLAYMODE,wxDefaultPosition,wxDefaultSize,WXSIZEOF(playmode_choices),playmode_choices); int playmode = wxGetApp().Prefs.ePlaymode.val; choicePlaymode->SetSelection(playmode); vsPlayModeCol->Add( choicePlaymode,0, wxRIGHT|wxLEFT|wxALIGN_CENTRE_VERTICAL, 5 ); //-- small top border --// wxCheckBox * pCrossfade = new wxCheckBox_NoFlicker( pPlayPanel, MUSIK_CHK_CROSSFADE, _("Crossfade")); vsPlayModeCol->Add( pCrossfade,0, wxALIGN_CENTRE_VERTICAL|wxRIGHT, 2 ); //-- small top border --// pCrossfade->SetValue( wxGetApp().Prefs.bGlobalFadeEnable ); vsRightCol->Add( vsPlayModeCol, 0 ); //-- small top border --// vsRightCol->Add( gSeek, 0, wxTOP|wxEXPAND, 2 ); //-- small top border --// pPlayPanel->SetSizer(vsRightCol); // wxGridSizer *hsCols = new wxGridSizer( 1,2,0,0); wxBoxSizer *hsCols = new wxBoxSizer(wxHORIZONTAL); hsCols->Add( vsLeftCol, 1, wxALL, 2 ); //hsCols->Add(-1,-1,1,wxEXPAND); hsCols->Add(pPlayPanel, 0, wxALIGN_RIGHT| wxALL, 2 ); SetSizer( hsCols ); m_pTunage = new CTunage; pSecTimer = NULL; StartTimer(); g_TimeSeeking = false; ResetInfo(); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_SONG_CHANGED,MusikPlayerEventHandler(CNowPlayingCtrl::OnSongChanged),NULL,this); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_PLAY_START,MusikPlayerEventHandler(CNowPlayingCtrl::OnPlayStart),NULL,this); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_PLAY_STOP,MusikPlayerEventHandler(CNowPlayingCtrl::OnPlayStop),NULL,this); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_PLAY_PAUSE,MusikPlayerEventHandler(CNowPlayingCtrl::OnPlayPause),NULL,this); m_MusikPlayer.Connect(wxEVT_MUSIKPLAYER_PLAY_RESUME,MusikPlayerEventHandler(CNowPlayingCtrl::OnPlayResume),NULL,this); ActivateHotkeys(); }
wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source) { m_Cache = new wxHtmlTagsCacheData; m_CachePos = 0; wxChar tagBuffer[256]; const wxString::const_iterator end = source.end(); for ( wxString::const_iterator pos = source.begin(); pos < end; ++pos ) { if (*pos == wxT('<')) // tag found: { // don't cache comment tags if ( wxHtmlParser::SkipCommentTag(pos, source.end()) ) continue; size_t tg = Cache().size(); Cache().push_back(wxHtmlCacheItem()); wxString::const_iterator stpos = pos++; Cache()[tg].Key = stpos; int i; for ( i = 0; pos < end && i < (int)WXSIZEOF(tagBuffer) - 1 && *pos != wxT('>') && !wxIsspace(*pos); ++i, ++pos ) { tagBuffer[i] = (wxChar)wxToupper(*pos); } tagBuffer[i] = _T('\0'); Cache()[tg].Name = new wxChar[i+1]; memcpy(Cache()[tg].Name, tagBuffer, (i+1)*sizeof(wxChar)); while (pos < end && *pos != wxT('>')) ++pos; if ((stpos+1) < end && *(stpos+1) == wxT('/')) // ending tag: { Cache()[tg].type = wxHtmlCacheItem::Type_EndingTag; // find matching begin tag: for (i = tg; i >= 0; i--) { if ((Cache()[i].type == wxHtmlCacheItem::Type_NoMatchingEndingTag) && (wxStrcmp(Cache()[i].Name, tagBuffer+1) == 0)) { Cache()[i].type = wxHtmlCacheItem::Type_Normal; Cache()[i].End1 = stpos; Cache()[i].End2 = pos + 1; break; } } } else { Cache()[tg].type = wxHtmlCacheItem::Type_NoMatchingEndingTag; if (wxIsCDATAElement(tagBuffer)) { // store the orig pos in case we are missing the closing // tag (see below) const wxString::const_iterator old_pos = pos; bool foundCloseTag = false; // find next matching tag int tag_len = wxStrlen(tagBuffer); while (pos < end) { // find the ending tag while (pos + 1 < end && (*pos != '<' || *(pos+1) != '/')) ++pos; if (*pos == '<') ++pos; // see if it matches int match_pos = 0; while (pos < end && match_pos < tag_len ) { wxChar c = *pos; if ( c == '>' || c == '<' ) break; // cast to wxChar needed to suppress warning in // Unicode build if ((wxChar)wxToupper(c) == tagBuffer[match_pos]) { ++match_pos; } else if (c == wxT(' ') || c == wxT('\n') || c == wxT('\r') || c == wxT('\t')) { // need to skip over these } else { match_pos = 0; } ++pos; } // found a match if (match_pos == tag_len) { pos = pos - tag_len - 3; foundCloseTag = true; break; } else // keep looking for the closing tag { ++pos; } } if (!foundCloseTag) { // we didn't find closing tag; this means the markup // is incorrect and the best thing we can do is to // ignore the unclosed tag and continue parsing as if // it didn't exist: pos = old_pos; } } } } } // ok, we're done, now we'll free .Name members of cache - we don't need it anymore: for ( wxHtmlTagsCacheData::iterator i = Cache().begin(); i != Cache().end(); ++i ) { delete[] i->Name; i->Name = NULL; } }
void SAuiTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& page, const wxRect& in_rect, int close_button_state, wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent) { wxCoord normal_textx, normal_texty; wxCoord selected_textx, selected_texty; wxCoord texty; // if the caption is empty, measure some temporary text wxString caption = page.caption; if (caption.empty()) caption = wxT("Xj"); dc.SetFont(m_selectedFont); dc.GetTextExtent(caption, &selected_textx, &selected_texty); dc.SetFont(m_normalFont); dc.GetTextExtent(caption, &normal_textx, &normal_texty); bool bluetab = false; if (page.window->GetName() == "startpage") bluetab = true; // figure out the size of the tab wxSize tab_size = GetTabSize(dc, wnd, page.caption, page.bitmap, page.active, close_button_state, x_extent); wxCoord tab_height = m_tabCtrlHeight + 2;// -1;// -3; wxCoord tab_width = tab_size.x; wxCoord tab_x = in_rect.x; wxCoord tab_y = in_rect.y + in_rect.height - tab_height + 3; if (!page.active) { tab_height -= 2; tab_y += 2; } caption = page.caption; // select pen, brush and font for the tab to be drawn if (page.active) { dc.SetFont(m_selectedFont); texty = selected_texty; } else { dc.SetFont(m_normalFont); texty = normal_texty; } // create points that will make the tab outline int clip_width = tab_width; if (tab_x + clip_width > in_rect.x + in_rect.width) clip_width = (in_rect.x + in_rect.width) - tab_x; dc.SetClippingRegion(tab_x, tab_y, clip_width + 1, tab_height - 3); wxPoint border_points[6]; if (m_flags &wxAUI_NB_BOTTOM) { border_points[0] = wxPoint(tab_x, tab_y); border_points[1] = wxPoint(tab_x, tab_y + tab_height - 4); border_points[2] = wxPoint(tab_x, tab_y + tab_height - 4); border_points[3] = wxPoint(tab_x + tab_width, tab_y + tab_height - 4); border_points[4] = wxPoint(tab_x + tab_width, tab_y + tab_height - 4); border_points[5] = wxPoint(tab_x + tab_width, tab_y); } else { border_points[0] = wxPoint(tab_x, tab_y + tab_height - 4); border_points[1] = wxPoint(tab_x, tab_y); border_points[2] = wxPoint(tab_x + 2, tab_y); border_points[3] = wxPoint(tab_x + tab_width - 2, tab_y); border_points[4] = wxPoint(tab_x + tab_width, tab_y); border_points[5] = wxPoint(tab_x + tab_width, tab_y + tab_height - 4); } int drawn_tab_yoff = border_points[1].y + 1; int drawn_tab_height = border_points[0].y - border_points[1].y; wxColour bgcol; if (page.active) { // draw active tab bgcol = m_activeColour; // draw base background color wxRect r(tab_x, tab_y, tab_width, tab_height); dc.SetPen(wxPen(bluetab ? wxColor(224, 238, 255) : m_activeColour)); dc.SetBrush(wxBrush(bluetab ? wxColor(224, 238, 255) : m_activeColour)); dc.DrawRectangle(r.x + 1, r.y + 1, r.width - 1, r.height - 5); // highlight top of tab wxColour col_hilight = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); dc.SetPen(*wxTRANSPARENT_PEN);// *wxWHITE_PEN); dc.SetBrush(wxBrush(col_hilight));// *wxWHITE_BRUSH); dc.DrawRectangle(r.x + 1, r.y + 1, r.width - 1, 1); } else { bgcol = m_inactiveTabColour; wxRect r(tab_x, tab_y, tab_width, tab_height); wxPoint mouse = wnd->ScreenToClient(wxGetMousePosition()); /*if (r.Contains(mouse)) { dc.SetPen(wxPen(m_activeColour)); dc.SetBrush(wxBrush(m_activeColour)); } else {*/ dc.SetPen(wxPen(m_inactiveTabColour)); dc.SetBrush(wxBrush(m_inactiveTabColour)); //} dc.DrawRectangle(r.x + 1, r.y + 1, r.width - 1, r.height - 4); } // draw tab outline dc.SetPen(m_borderPen); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawPolygon(WXSIZEOF(border_points), border_points); // there are two horizontal grey lines at the bottom of the tab control, // this gets rid of the top one of those lines in the tab control if (page.active) { if (m_flags &wxAUI_NB_BOTTOM) dc.SetPen(wxPen(m_baseColour.ChangeLightness(170))); else dc.SetPen(wxPen(bluetab ? wxColor(224, 238, 255) : m_activeColour)); dc.DrawLine(border_points[0].x + 1, border_points[0].y, border_points[5].x, border_points[5].y); } int text_offset = tab_x + 8; int close_button_width = 0; if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) { close_button_width = m_activeCloseBmp.GetWidth(); } int bitmap_offset = 0; if (page.bitmap.IsOk()) { bitmap_offset = tab_x + 8; // draw bitmap dc.DrawBitmap(page.bitmap, bitmap_offset, drawn_tab_yoff + (drawn_tab_height / 2) - (page.bitmap.GetHeight() / 2), true); text_offset = bitmap_offset + page.bitmap.GetWidth(); text_offset += 4; // bitmap padding } else { text_offset = tab_x + 8; } dc.SetTextForeground((page.active && bluetab) ? wxColor(0,0,0) : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); wxString draw_text = wxAuiChopText(dc, caption, tab_width - (text_offset - tab_x) - close_button_width); // draw tab text dc.DrawText(draw_text, text_offset, drawn_tab_yoff + (drawn_tab_height) / 2 - (texty / 2) - 0); // draw focus rectangle if (page.active && (wnd->FindFocus() == wnd)) { wxRect focusRectText(text_offset, (drawn_tab_yoff + (drawn_tab_height) / 2 - (texty / 2) - 1), selected_textx, selected_texty); wxRect focusRect; wxRect focusRectBitmap; if (page.bitmap.IsOk()) focusRectBitmap = wxRect(bitmap_offset, drawn_tab_yoff + (drawn_tab_height / 2) - (page.bitmap.GetHeight() / 2), page.bitmap.GetWidth(), page.bitmap.GetHeight()); if (page.bitmap.IsOk() && draw_text.IsEmpty()) focusRect = focusRectBitmap; else if (!page.bitmap.IsOk() && !draw_text.IsEmpty()) focusRect = focusRectText; else if (page.bitmap.IsOk() && !draw_text.IsEmpty()) focusRect = focusRectText.Union(focusRectBitmap); focusRect.Inflate(2, 2); wxRendererNative::Get().DrawFocusRect(wnd, dc, focusRect, 0); } // draw close button if necessary if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN) { wxBitmap bmp = m_disabledCloseBmp; int offsetY = tab_y; if (m_flags & wxAUI_NB_BOTTOM) offsetY = 1; wxRect rect(tab_x + tab_width - close_button_width - 3, offsetY + (tab_height / 2) - (bmp.GetHeight() / 2), close_button_width, tab_height); IndentPressedBitmap(&rect, close_button_state); if (close_button_state == wxAUI_BUTTON_STATE_HOVER || close_button_state == wxAUI_BUTTON_STATE_PRESSED) { /*wxColour bcol = m_borderPen.GetColour(); float r = ((float)bcol.Red() * 0.2f) + ((float)m_activeColour.Red() * 0.8f); float g = ((float)bcol.Green() * 0.2f) + ((float)m_activeColour.Green() * 0.8f); float b = ((float)bcol.Blue() * 0.2f) + ((float)m_activeColour.Blue() * 0.8f);*/ //captionAccentColour = wxColor(r, g, b); //dc.SetPen(*wxTRANSPARENT_PEN); dc.SetPen(wxPen(Drawing::darkColour(bgcol, 2.0f))); dc.SetBrush(wxBrush(Drawing::lightColour(bgcol, 1.0f))); dc.DrawRectangle(rect.x, rect.y + 1, rect.width - 1, rect.width - 2); bmp = m_activeCloseBmp; //dc.DrawBitmap(bmp, rect.x + 1, rect.y, true); //dc.DrawBitmap(bmp, rect.x - 1, rect.y, true); dc.DrawBitmap(bmp, rect.x, rect.y, true); } else { bmp = m_disabledCloseBmp; dc.DrawBitmap(bmp, rect.x, rect.y, true); } *out_button_rect = rect; } *out_tab_rect = wxRect(tab_x, tab_y, tab_width, tab_height); dc.DestroyClippingRegion(); }
void MyTreeCtrl::CreateButtonsImageList(int size) { if ( size == -1 ) { SetButtonsImageList(NULL); return; } // Make an image list containing small icons wxImageList *images = new wxImageList(size, size, true); // should correspond to TreeCtrlIcon_xxx enum wxBusyCursor wait; wxIcon icons[4]; icons[0] = wxIcon(icon3_xpm); // closed icons[1] = wxIcon(icon3_xpm); // closed, selected icons[2] = wxIcon(icon5_xpm); // open icons[3] = wxIcon(icon5_xpm); // open, selected for ( size_t i = 0; i < WXSIZEOF(icons); i++ ) { int sizeOrig = icons[i].GetWidth(); if ( size == sizeOrig ) { images->Add(icons[i]); } else { images->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size))); } } AssignButtonsImageList(images); #else void MyTreeCtrl::CreateButtonsImageList(int WXUNUSED(size)) { #endif } int MyTreeCtrl::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2) { if ( m_reverseSort ) { // just exchange 1st and 2nd items return wxTreeCtrl::OnCompareItems(item2, item1); } else { return wxTreeCtrl::OnCompareItems(item1, item2); } } void MyTreeCtrl::AddItemsRecursively(const wxTreeItemId& idParent, size_t numChildren, size_t depth, size_t folder) { if ( depth > 0 ) { bool hasChildren = depth > 1; wxString str; for ( size_t n = 0; n < numChildren; n++ ) { // at depth 1 elements won't have any more children if ( hasChildren ) str.Printf(wxT("%s child %d"), wxT("Folder"), n + 1); else str.Printf(wxT("%s child %d.%d"), wxT("File"), folder, n + 1); // here we pass to AppendItem() normal and selected item images (we // suppose that selected image follows the normal one in the enum) int image, imageSel; if ( wxGetApp().ShowImages() ) { image = depth == 1 ? TreeCtrlIcon_File : TreeCtrlIcon_Folder; imageSel = image + 1; } else { image = imageSel = -1; } wxTreeItemId id = AppendItem(idParent, str, image, imageSel, new MyTreeItemData(str)); // and now we also set the expanded one (only for the folders) if ( hasChildren && wxGetApp().ShowImages() ) { SetItemImage(id, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded); } // remember the last child for OnEnsureVisible() if ( !hasChildren && n == numChildren - 1 ) { m_lastItem = id; } AddItemsRecursively(id, numChildren, depth - 1, n + 1); } } //else: done! } void MyTreeCtrl::AddTestItemsToTree(size_t numChildren, size_t depth) { int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_Folder : -1; wxTreeItemId rootId = AddRoot(wxT("Root"), image, image, new MyTreeItemData(wxT("Root item"))); if ( image != -1 ) { SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded); } AddItemsRecursively(rootId, numChildren, depth, 0); // set some colours/fonts for testing SetItemFont(rootId, *wxITALIC_FONT); wxTreeItemIdValue cookie; wxTreeItemId id = GetFirstChild(rootId, cookie); SetItemTextColour(id, *wxBLUE); id = GetNextChild(rootId, cookie); id = GetNextChild(rootId, cookie); SetItemTextColour(id, *wxRED); SetItemBackgroundColour(id, *wxLIGHT_GREY); }
void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S) { wxASSERT(nActions == WXSIZEOF(kActionStrings)); S.AddSpace(0, 5); S.StartStatic(_("Detect Silence")); { S.StartMultiColumn(3, wxALIGN_CENTER_HORIZONTAL); { // Threshold FloatingPointValidator<double> vldThreshold(3, &mThresholdDB, NumValidatorStyle::NO_TRAILING_ZEROES); vldThreshold.SetRange(MIN_Threshold, MAX_Threshold); mThresholdText = S.AddTextBox(_("Threshold:"), wxT(""), 0); mThresholdText->SetValidator(vldThreshold); S.AddUnits(_("dB")); // Ignored silence FloatingPointValidator<double> vldDur(3, &mInitialAllowedSilence, NumValidatorStyle::NO_TRAILING_ZEROES); vldDur.SetRange(MIN_Minimum, MAX_Minimum); mInitialAllowedSilenceT = S.AddTextBox(_("Duration:"), wxT(""), 12); mInitialAllowedSilenceT->SetValidator(vldDur); S.AddUnits(_("seconds")); } S.EndMultiColumn(); } S.EndStatic(); S.StartStatic(_("Action")); { S.StartHorizontalLay(); { // Action choices auto actionChoices = LocalizedStrings(kActionStrings, nActions); mActionChoice = S.AddChoice( {}, wxT(""), &actionChoices); mActionChoice->SetValidator(wxGenericValidator(&mActionIndex)); S.SetSizeHints(-1, -1); } S.EndHorizontalLay(); S.StartMultiColumn(3, wxALIGN_CENTER_HORIZONTAL); { // Truncation / Compression factor FloatingPointValidator<double> vldTrunc(3, &mTruncLongestAllowedSilence, NumValidatorStyle::NO_TRAILING_ZEROES); vldTrunc.SetRange(MIN_Truncate, MAX_Truncate); mTruncLongestAllowedSilenceT = S.AddTextBox(_("Truncate to:"), wxT(""), 12); mTruncLongestAllowedSilenceT->SetValidator(vldTrunc); S.AddUnits(_("seconds")); FloatingPointValidator<double> vldComp(3, &mSilenceCompressPercent, NumValidatorStyle::NO_TRAILING_ZEROES); vldComp.SetRange(MIN_Compress, MAX_Compress); mSilenceCompressPercentT = S.AddTextBox(_("Compress to:"), wxT(""), 12); mSilenceCompressPercentT->SetValidator(vldComp); S.AddUnits(_("%")); } S.EndMultiColumn(); S.StartMultiColumn(2, wxALIGN_CENTER_HORIZONTAL); { mIndependent = S.AddCheckBox(_("Truncate tracks independently"), mbIndependent ? wxT("true") : wxT("false")); } S.EndMultiColumn(); } S.EndStatic(); UpdateUI(); }
void wxGenericColourDialog::CreateWidgets() { wxBeginBusyCursor(); #if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA // Bitmap to preview selected colour (with alpha channel) wxBitmap customColourBmp(m_singleCustomColourRect.GetSize(), 32); customColourBmp.UseAlpha(); DoPreviewBitmap(customColourBmp, m_colourData.GetColour()); m_customColourBmp = new wxStaticBitmap(this, wxID_ANY, customColourBmp, m_singleCustomColourRect.GetLeftTop(), m_singleCustomColourRect.GetSize(), wxBORDER_SUNKEN); // 16 bitmaps to preview custom colours (with alpha channel) for (int i = 0; i < WXSIZEOF(m_customColoursBmp); i++) { int x = ((i % 8)*(m_smallRectangleSize.x+m_gridSpacing)) + m_customColoursRect.x; int y = ((i / 8)*(m_smallRectangleSize.y+m_gridSpacing)) + m_customColoursRect.y; wxBitmap bmp(m_smallRectangleSize, 32); bmp.UseAlpha(); DoPreviewBitmap(bmp, m_customColours[i]); m_customColoursBmp[i] = new wxStaticBitmap(this, wxID_ANY, bmp, wxPoint(x, y), m_smallRectangleSize); m_customColoursBmp[i]->Bind(wxEVT_LEFT_DOWN, &wxGenericColourDialog::OnCustomColourMouseClick, this); } #endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); const int sliderHeight = 160; // first sliders #if wxUSE_SLIDER const int sliderX = m_singleCustomColourRect.x + m_singleCustomColourRect.width + m_sectionSpacing; wxColour c = m_colourData.GetColour(); m_redSlider = new wxSlider(this, wxID_RED_SLIDER, c.Red(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); m_greenSlider = new wxSlider(this, wxID_GREEN_SLIDER, c.Green(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); m_blueSlider = new wxSlider(this, wxID_BLUE_SLIDER, c.Blue(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); if ( m_colourData.GetChooseAlpha() ) { m_alphaSlider = new wxSlider(this, wxID_ANY, c.Alpha(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); m_alphaSlider->Bind(wxEVT_SLIDER, &wxGenericColourDialog::OnAlphaSlider, this); } else { m_alphaSlider = NULL; } wxBoxSizer *sliderSizer = new wxBoxSizer( wxHORIZONTAL ); sliderSizer->Add(sliderX, sliderHeight ); const wxSizerFlags sliderLabelFlags = wxSizerFlags().Right().Border(); const wxSizerFlags onesliderFlags = wxSizerFlags().CenterHorizontal(); const wxSizerFlags sliderFlags = wxSizerFlags().CentreVertical().DoubleBorder(); wxBoxSizer *redSliderSizer = new wxBoxSizer(wxVERTICAL); redSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Red:")), sliderLabelFlags); redSliderSizer->Add(m_redSlider, onesliderFlags); wxBoxSizer *greenSliderSizer = new wxBoxSizer(wxVERTICAL); greenSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Green:")), sliderLabelFlags); greenSliderSizer->Add(m_greenSlider, onesliderFlags); wxBoxSizer *blueSliderSizer = new wxBoxSizer(wxVERTICAL); blueSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Blue:")), sliderLabelFlags); blueSliderSizer->Add(m_blueSlider, onesliderFlags); sliderSizer->Add(redSliderSizer, sliderFlags); sliderSizer->Add(greenSliderSizer, sliderFlags); sliderSizer->Add(blueSliderSizer, sliderFlags); if ( m_colourData.GetChooseAlpha() ) { wxBoxSizer *alphaSliderSizer = new wxBoxSizer(wxVERTICAL); alphaSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Opacity:")), sliderLabelFlags); alphaSliderSizer->Add(m_alphaSlider, onesliderFlags); sliderSizer->Add(alphaSliderSizer, sliderFlags); } topSizer->Add(sliderSizer, wxSizerFlags().Centre().DoubleBorder()); #else topSizer->Add(1, sliderHeight, wxSizerFlags(1).Centre().TripleBorder()); #endif // wxUSE_SLIDER // then the custom button topSizer->Add(new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours") ), wxSizerFlags().DoubleHorzBorder()); // then the standard buttons wxSizer *buttonsizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); if ( buttonsizer ) { topSizer->Add(buttonsizer, wxSizerFlags().Expand().DoubleBorder()); } SetAutoLayout( true ); SetSizer( topSizer ); topSizer->SetSizeHints( this ); topSizer->Fit( this ); Centre( wxBOTH ); wxEndBusyCursor(); }
void wxOS2SelectMatchingFontByName( PFATTRS pFattrs , PFACENAMEDESC pFaceName , PFONTMETRICS pFM , int nNumFonts , const wxFont* pFont ) { int i; int nPointSize; int nIs; int nMinDiff0; int anDiff[16]; int anMinDiff[16]; int nIndex = 0; wxChar zFontFaceName[FACESIZE]; wxString sFaceName; USHORT usWeightClass; int fsSelection = 0; nMinDiff0 = 0xf000; for(i = 0;i < 16; i++) anMinDiff[i] = nMinDiff0; switch (pFont->GetFamily()) { case wxSCRIPT: sFaceName = wxT("Tms Rmn"); break; case wxDECORATIVE: sFaceName = wxT("WarpSans"); break; case wxROMAN: sFaceName = wxT("Tms Rmn"); break; case wxTELETYPE: sFaceName = wxT("Courier") ; break; case wxMODERN: sFaceName = wxT("System VIO") ; break; case wxSWISS: sFaceName = wxT("Helv") ; break; case wxDEFAULT: default: sFaceName = wxT("System VIO") ; } switch (pFont->GetWeight()) { default: wxFAIL_MSG(wxT("unknown font weight")); // fall through usWeightClass = FWEIGHT_DONT_CARE; break; case wxNORMAL: usWeightClass = FWEIGHT_NORMAL; break; case wxLIGHT: usWeightClass = FWEIGHT_LIGHT; break; case wxBOLD: usWeightClass = FWEIGHT_BOLD; break; case wxFONTWEIGHT_MAX: usWeightClass = FWEIGHT_ULTRA_BOLD; break; } pFaceName->usWeightClass = usWeightClass; switch (pFont->GetStyle()) { case wxITALIC: case wxSLANT: fsSelection = FM_SEL_ITALIC; pFaceName->flOptions = FTYPE_ITALIC; break; default: wxFAIL_MSG(wxT("unknown font slant")); // fall through case wxNORMAL: fsSelection = 0; break; } wxStrlcpy(zFontFaceName, sFaceName.c_str(), WXSIZEOF(zFontFaceName)); nPointSize = pFont->GetPointSize(); // // Matching logic to find the right FM struct // nIndex = 0; for(i = 0, nIs = 0; i < nNumFonts; i++) { int nEmHeight = 0; int nXHeight = 0; anDiff[0] = wxGpiStrcmp((wxChar*)pFM[i].szFacename, zFontFaceName); anDiff[1] = abs(pFM[i].lEmHeight - nPointSize); anDiff[2] = abs(pFM[i].usWeightClass - usWeightClass); anDiff[3] = abs((pFM[i].fsSelection & 0x2f) - fsSelection); if(anDiff[0] == 0) { nEmHeight = (int)pFM[i].lEmHeight; nXHeight =(int)pFM[i].lXHeight; if( (nIs & 0x01) == 0) { nIs = 1; nIndex = i; anMinDiff[1] = anDiff[1]; anMinDiff[2] = anDiff[2]; anMinDiff[3] = anDiff[3]; } else if(anDiff[3] < anMinDiff[3]) { nIndex = i; anMinDiff[3] = anDiff[3]; } else if(anDiff[2] < anMinDiff[2]) { nIndex = i; anMinDiff[2] = anDiff[2]; } else if(anDiff[1] < anMinDiff[1]) { nIndex = i; anMinDiff[1] = anDiff[1]; } anMinDiff[0] = 0; } else if(anDiff[0] < anMinDiff[0]) { nIs = 2; nIndex = i; anMinDiff[3] = anDiff[3]; anMinDiff[2] = anDiff[2]; anMinDiff[1] = anDiff[1]; anMinDiff[0] = anDiff[0]; } else if(anDiff[0] == anMinDiff[0]) { if(anDiff[3] < anMinDiff[3]) { nIndex = i; anMinDiff[3] = anDiff[3]; nIs = 2; } else if(anDiff[2] < anMinDiff[2]) { nIndex = i; anMinDiff[2] = anDiff[2]; nIs = 2; } else if(anDiff[1] < anMinDiff[1]) { nIndex = i; anMinDiff[1] = anDiff[1]; nIs = 2; } } } // // Fill in the FATTRS with the best match from FONTMETRICS // pFattrs->usRecordLength = sizeof(FATTRS); // Sets size of structure pFattrs->lMatch = pFM[nIndex].lMatch; // Force match pFattrs->idRegistry = 0; pFattrs->usCodePage = 0; pFattrs->fsFontUse = 0; pFattrs->fsType = 0; pFattrs->lMaxBaselineExt = 0; pFattrs->lAveCharWidth = 0; wxStrcpy((wxChar*)pFattrs->szFacename, (wxChar*)pFM[nIndex].szFacename); if (pFont->GetWeight() == wxNORMAL) pFattrs->fsSelection = 0; else pFattrs->fsSelection = FATTR_SEL_BOLD; if (pFont->GetStyle() == wxITALIC || pFont->GetStyle() == wxSLANT) pFattrs->fsSelection |= FATTR_SEL_ITALIC; if (pFont->GetUnderlined()) pFattrs->fsSelection |= FATTR_SEL_UNDERSCORE; } // end of wxOS2SelectMatchingFontByName
static wxString GetIidName(REFIID riid) { // an association between symbolic name and numeric value of an IID struct KNOWN_IID { const IID *pIid; const wxChar *szName; }; // construct the table containing all known interfaces #define ADD_KNOWN_IID(name) { &IID_I##name, wxT(#name) } static const KNOWN_IID aKnownIids[] = { ADD_KNOWN_IID(AdviseSink), ADD_KNOWN_IID(AdviseSink2), ADD_KNOWN_IID(BindCtx), ADD_KNOWN_IID(ClassFactory), #if ( !defined( __VISUALC__) || (__VISUALC__!=1010) ) && !defined(__MWERKS__) ADD_KNOWN_IID(ContinueCallback), ADD_KNOWN_IID(EnumOleDocumentViews), ADD_KNOWN_IID(OleCommandTarget), ADD_KNOWN_IID(OleDocument), ADD_KNOWN_IID(OleDocumentSite), ADD_KNOWN_IID(OleDocumentView), ADD_KNOWN_IID(Print), #endif ADD_KNOWN_IID(DataAdviseHolder), ADD_KNOWN_IID(DataObject), ADD_KNOWN_IID(Debug), ADD_KNOWN_IID(DebugStream), ADD_KNOWN_IID(DfReserved1), ADD_KNOWN_IID(DfReserved2), ADD_KNOWN_IID(DfReserved3), ADD_KNOWN_IID(Dispatch), ADD_KNOWN_IID(DropSource), ADD_KNOWN_IID(DropTarget), ADD_KNOWN_IID(EnumCallback), ADD_KNOWN_IID(EnumFORMATETC), ADD_KNOWN_IID(EnumGeneric), ADD_KNOWN_IID(EnumHolder), ADD_KNOWN_IID(EnumMoniker), ADD_KNOWN_IID(EnumOLEVERB), ADD_KNOWN_IID(EnumSTATDATA), ADD_KNOWN_IID(EnumSTATSTG), ADD_KNOWN_IID(EnumString), ADD_KNOWN_IID(EnumUnknown), ADD_KNOWN_IID(EnumVARIANT), ADD_KNOWN_IID(ExternalConnection), ADD_KNOWN_IID(InternalMoniker), ADD_KNOWN_IID(LockBytes), ADD_KNOWN_IID(Malloc), ADD_KNOWN_IID(Marshal), ADD_KNOWN_IID(MessageFilter), ADD_KNOWN_IID(Moniker), ADD_KNOWN_IID(OleAdviseHolder), ADD_KNOWN_IID(OleCache), ADD_KNOWN_IID(OleCache2), ADD_KNOWN_IID(OleCacheControl), ADD_KNOWN_IID(OleClientSite), ADD_KNOWN_IID(OleContainer), ADD_KNOWN_IID(OleInPlaceActiveObject), ADD_KNOWN_IID(OleInPlaceFrame), ADD_KNOWN_IID(OleInPlaceObject), ADD_KNOWN_IID(OleInPlaceSite), ADD_KNOWN_IID(OleInPlaceUIWindow), ADD_KNOWN_IID(OleItemContainer), ADD_KNOWN_IID(OleLink), ADD_KNOWN_IID(OleManager), ADD_KNOWN_IID(OleObject), ADD_KNOWN_IID(OlePresObj), ADD_KNOWN_IID(OleWindow), ADD_KNOWN_IID(PSFactory), ADD_KNOWN_IID(ParseDisplayName), ADD_KNOWN_IID(Persist), ADD_KNOWN_IID(PersistFile), ADD_KNOWN_IID(PersistStorage), ADD_KNOWN_IID(PersistStream), ADD_KNOWN_IID(ProxyManager), ADD_KNOWN_IID(RootStorage), ADD_KNOWN_IID(RpcChannel), ADD_KNOWN_IID(RpcProxy), ADD_KNOWN_IID(RpcStub), ADD_KNOWN_IID(RunnableObject), ADD_KNOWN_IID(RunningObjectTable), ADD_KNOWN_IID(StdMarshalInfo), ADD_KNOWN_IID(Storage), ADD_KNOWN_IID(Stream), ADD_KNOWN_IID(StubManager), ADD_KNOWN_IID(Unknown), ADD_KNOWN_IID(ViewObject), ADD_KNOWN_IID(ViewObject2), }; // don't clobber preprocessor name space #undef ADD_KNOWN_IID // try to find the interface in the table for ( size_t ui = 0; ui < WXSIZEOF(aKnownIids); ui++ ) { if ( riid == *aKnownIids[ui].pIid ) { return aKnownIids[ui].szName; } } #ifndef __WXWINCE__ // unknown IID, just transform to string Uuid uuid(riid); return wxString((const wxChar *)uuid); #else return wxEmptyString; #endif }