📄 wxgpaccontrol.cpp
字号:
m_recfile->Enable(1); m_recfile->SetValue(wxString(sOpt, wxConvUTF8)); } else { m_usename->SetValue(0); m_recfile->Enable(0); m_recfile->SetValue(wxT("uses service URL")); } m_select->Append(wxT("General")); m_select->Append(wxT("MPEG-4 Systems")); m_select->Append(wxT("Media Decoders")); m_select->Append(wxT("Rendering")); m_select->Append(wxT("Renderer 2D")); m_select->Append(wxT("Renderer 3D")); m_select->Append(wxT("Video Output")); m_select->Append(wxT("Audio Output")); m_select->Append(wxT("Text Engine")); m_select->Append(wxT("File Download")); m_select->Append(wxT("Real-Time Streaming")); m_select->Append(wxT("Streaming Cache")); sOpt = gf_cfg_get_key(cfg, "General", "ConfigPanel"); m_sel = sOpt ? atoi(sOpt) : 0; if (m_sel>11) m_sel=11; m_select->SetSelection(m_sel); DoSelect();}BEGIN_EVENT_TABLE(wxGPACControl, wxDialog) EVT_BUTTON(ID_APPLY, wxGPACControl::Apply) EVT_COMBOBOX(ID_SELECT, wxGPACControl::OnSetSelection) EVT_CHECKBOX(ID_FORCE_AUDIO, wxGPACControl::ForceAudio) EVT_COMBOBOX(ID_AUDIO_DRIVER, wxGPACControl::OnSetAudioDriver) EVT_BUTTON(ID_FONT_DIR, wxGPACControl::FontDir) EVT_BUTTON(ID_CACHE_DIR, wxGPACControl::CacheDir) EVT_CHECKBOX(ID_PROGRESSIVE, wxGPACControl::OnProgressive) EVT_CHECKBOX(ID_USE_PROXY, wxGPACControl::OnUseProxy) EVT_CHECKBOX(ID_RTP_OVER_RTSP, wxGPACControl::RTPoverRTSP) EVT_CHECKBOX(ID_RTSP_REBUFFER, wxGPACControl::Rebuffer) EVT_COMBOBOX(ID_RTSP_PORT, wxGPACControl::OnSetRTSPPort) EVT_CHECKBOX(ID_USE_FILENAME, wxGPACControl::OnUseFileName) EVT_BUTTON(ID_RECORD_DIR, wxGPACControl::OnRecDir)END_EVENT_TABLE()wxGPACControl::~wxGPACControl(){ char str[20]; sprintf(str, "%d", m_sel); gf_cfg_set_key(m_pApp->m_user.config, "General", "ConfigPanel", str);}void wxGPACControl::DoSelect(){ /*hide everything*/ s_main->Show(s_general, false); s_main->Show(s_mpeg4, false); s_main->Show(s_mdec, false); s_main->Show(s_rend, false); s_main->Show(s_rend2d, false); s_main->Show(s_rend3d, false); s_main->Show(s_video, false); s_main->Show(s_audio, false); s_main->Show(s_font, false); s_main->Show(s_dnld, false); s_main->Show(s_stream, false); s_main->Show(s_rec, false); switch (m_sel) { case 0: s_main->Show(s_general, true); break; case 1: s_main->Show(s_mpeg4, true); break; case 2: s_main->Show(s_mdec, true); break; case 3: s_main->Show(s_rend, true); break; case 4: s_main->Show(s_rend2d, true); break; case 5: s_main->Show(s_rend3d, true); break; case 6: s_main->Show(s_video, true); break; case 7: s_main->Show(s_audio, true); break; case 8: s_main->Show(s_font, true); break; case 9: s_main->Show(s_dnld, true); break; case 10: s_main->Show(s_stream, true); break; case 11: s_main->Show(s_rec, true); break; } SetSizer(s_main); s_main->Fit(this); //s_main->Layout(); return;}void wxGPACControl::OnSetSelection(wxCommandEvent &WXUNUSED(event)){ m_sel = m_select->GetSelection(); DoSelect();}void wxGPACControl::FontDir(wxCommandEvent &WXUNUSED(event)){ wxDirDialog dlg(this); dlg.SetPath(m_fontdir->GetLabel()); if (dlg.ShowModal() == wxID_OK) { m_fontdir->SetLabel(dlg.GetPath()); }}void wxGPACControl::CacheDir(wxCommandEvent &WXUNUSED(event)){ wxDirDialog dlg(this); dlg.SetPath(m_cachedir->GetLabel()); if (dlg.ShowModal() == wxID_OK) { m_cachedir->SetLabel(dlg.GetPath()); }}void wxGPACControl::OnProgressive(wxCommandEvent &WXUNUSED(event)){ m_sax_duration->Enable(m_progressive->GetValue() ? 1 : 0);}void wxGPACControl::OnUseProxy(wxCommandEvent &WXUNUSED(event)){ m_proxy_name->Enable(m_use_proxy->GetValue() ? 1 : 0);}void wxGPACControl::RTPoverRTSP(wxCommandEvent &WXUNUSED(event)){ m_reorder->Enable(m_rtsp->GetValue() ? 0 : 1);}void wxGPACControl::Rebuffer(wxCommandEvent &WXUNUSED(event)){ if (m_dorebuffer->GetValue()) { m_rebuffer->Enable(); } else { m_rebuffer->Disable(); }}void wxGPACControl::OnSetRTSPPort(wxCommandEvent &WXUNUSED(event)){ if (m_port->GetSelection() > 1) { m_rtsp->Enable(0); m_reorder->Enable(0); } else { m_rtsp->Enable(1); m_reorder->Enable(1); }}void wxGPACControl::OnRecDir(wxCommandEvent &WXUNUSED(event)){ wxDirDialog dlg(this); dlg.SetPath(m_recdir->GetLabel()); if (dlg.ShowModal() == wxID_OK) { m_recdir->SetLabel(dlg.GetPath()); }}void wxGPACControl::OnUseFileName(wxCommandEvent &WXUNUSED(event)){ if (m_usename->GetValue()) { m_recfile->Enable(); m_recfile->SetValue(wxT("record")); } else { m_recfile->Disable(); m_recfile->SetValue(wxT("uses service URL")); }}void wxGPACControl::ForceAudio(wxCommandEvent &WXUNUSED(event)){ if (m_forcecfg->GetValue()) { m_nbbuf->Enable(); m_buflen->Enable(); } else { m_nbbuf->Disable(); m_buflen->Disable(); }}void wxGPACControl::OnSetAudioDriver(wxCommandEvent &WXUNUSED(event)){#ifdef WIN32 if (strstr(m_audio->GetStringSelection().mb_str(wxConvUTF8), "DirectSound")) { m_notifs->Enable(1); } else { m_notifs->Enable(0); }#endif}void wxGPACControl::Apply(wxCommandEvent &WXUNUSED(event)){ Bool need_reload = 0; /*save options*/ GF_Config *cfg = m_pApp->m_user.config; m_pApp->m_loop = m_loop->GetValue() ? 1 : 0; gf_cfg_set_key(cfg, "General", "Loop", m_loop->GetValue() ? "yes" : "no"); m_pApp->m_lookforsubs = m_lookforsubs->GetValue() ? 1 : 0; gf_cfg_set_key(cfg, "General", "LookForSubtitles", m_lookforsubs->GetValue() ? "yes" : "no"); m_pApp->m_console_off = m_noconsole->GetValue() ? 1 : 0; gf_cfg_set_key(cfg, "General", "ConsoleOff", m_noconsole->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "General", "ViewXMT", m_viewxmt->GetValue() ? "yes" : "no"); s32 sel = m_lang->GetSelection(); u32 i=0; while (GF_ISO639_Lang[i]) { /*only use common languages (having both 2- and 3-char code names)*/ if (GF_ISO639_Lang[i+2][0]) { if (!sel) break; sel--; } i+=3; } gf_cfg_set_key(cfg, "Systems", "LanguageName", GF_ISO639_Lang[i]); gf_cfg_set_key(cfg, "Systems", "Language3CC", GF_ISO639_Lang[i+1]); gf_cfg_set_key(cfg, "Systems", "Language2CC", GF_ISO639_Lang[i+2]); sel = m_thread->GetSelection(); gf_cfg_set_key(cfg, "Systems", "ThreadingPolicy", (sel==0) ? "Single" : ( (sel==1) ? "Multi" : "Free")); gf_cfg_set_key(cfg, "Systems", "ForceSingleClock", m_singletime->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Systems", "AlwaysDrawBIFS", m_bifsalwaysdrawn->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Systems", "DefAudioDec", m_decaudio->GetStringSelection().mb_str(wxConvUTF8)); gf_cfg_set_key(cfg, "Systems", "DefVideoDec", m_decvideo->GetStringSelection().mb_str(wxConvUTF8)); gf_cfg_set_key(cfg, "Rendering", "FastRender", m_fast->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Rendering", "ForceSceneSize", m_force_size->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Rendering", "FrameRate", BIFSRates[m_fps->GetSelection()]); sel = m_aa->GetSelection(); gf_cfg_set_key(cfg, "Rendering", "AntiAlias", (sel==0) ? "None" : ( (sel==1) ? "Text" : "All")); sel = m_draw_bounds->GetSelection(); gf_cfg_set_key(cfg, "Rendering", "BoundingVolume", (sel==2) ? "AABB" : (sel==1) ? "Box" : "None"); Bool is_3D = m_use3D->GetValue() ? 1 : 0; if (m_bWas3D != is_3D) { gf_cfg_set_key(cfg, "Rendering", "RendererName", is_3D ? "GPAC 3D Renderer" : "GPAC 2D Renderer"); need_reload = 1; } gf_cfg_set_key(cfg, "Rendering", "Raster2D", m_graph->GetStringSelection().mb_str(wxConvUTF8)); gf_cfg_set_key(cfg, "Render2D", "DirectRender", m_direct->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Render2D", "ScalableZoom", m_scalable->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Render2D", "DisableYUV", m_noyuv->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Render3D", "RasterOutlines", m_raster_outlines->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Render3D", "EmulatePOW2", m_emulpow2->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Render3D", "PolygonAA", m_polyaa->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Render3D", "DisableRectExt", m_norectext->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Render3D", "BitmapCopyPixels", m_copypixels->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Render3D", "BackFaceCulling", m_nobackcull->GetValue() ? "Off" : "On"); sel = m_wire->GetSelection(); gf_cfg_set_key(cfg, "Render3D", "Wireframe", (sel==2) ? "WireOnSolid" : ( (sel==1) ? "WireOnly" : "WireNone" ) ); sel = m_normals->GetSelection(); gf_cfg_set_key(cfg, "Render3D", "DrawNormals", (sel==2) ? "PerVertex" : ( (sel==1) ? "PerFace" : "Never" ) ); gf_cfg_set_key(cfg, "Video", "SwitchResolution", m_switchres->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Video", "UseHardwareMemory", m_usehwmem->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Video", "DriverName", m_video->GetStringSelection().mb_str(wxConvUTF8)); gf_cfg_set_key(cfg, "Audio", "ForceConfig", m_forcecfg->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Audio", "NoResync", m_noresync->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Audio", "DisableMultiChannel", m_nomulitch->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Audio", "NumBuffers", wxString::Format(wxT("%d"), m_nbbuf->GetValue()).mb_str(wxConvUTF8) ); gf_cfg_set_key(cfg, "Audio", "TotalDuration", wxString::Format(wxT("%d"), m_buflen->GetValue()).mb_str(wxConvUTF8) ); gf_cfg_set_key(cfg, "Audio", "DriverName", m_audio->GetStringSelection().mb_str(wxConvUTF8));#ifdef WIN32 if (m_notifs->IsEnabled()) gf_cfg_set_key(cfg, "Audio", "DisableNotification", m_notifs->GetValue() ? "yes" : "no");#endif gf_cfg_set_key(cfg, "FontEngine", "DriverName", m_font->GetStringSelection().mb_str(wxConvUTF8)); gf_cfg_set_key(cfg, "FontEngine", "FontDirectory", m_fontdir->GetLabel().mb_str(wxConvUTF8)); switch (m_texturemode->GetSelection()) { case 2: gf_cfg_set_key(cfg, "FontEngine", "TextureTextMode", "Always"); break; case 1: gf_cfg_set_key(cfg, "FontEngine", "TextureTextMode", "3D"); break; default: gf_cfg_set_key(cfg, "FontEngine", "TextureTextMode", "Never"); break; } gf_cfg_set_key(cfg, "Downloader", "CleanCache", m_cleancache->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "Downloader", "RestartFiles", m_restartcache->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "SAXLoader", "Progressive", m_progressive->GetValue() ? "yes" : "no"); gf_cfg_set_key(cfg, "SAXLoader", "MaxDuration", m_sax_duration->GetLabel().mb_str(wxConvUTF8)); gf_cfg_set_key(cfg, "General", "CacheDirectory", m_cachedir->GetLabel().mb_str(wxConvUTF8)); Bool force_rtsp = 0; switch (m_port->GetSelection()) { case 3: gf_cfg_set_key(cfg, "Streaming", "DefaultPort", "8080"); force_rtsp = 1; break; case 2: gf_cfg_set_key(cfg, "Streaming", "DefaultPort", "80"); force_rtsp = 1; break; case 1: gf_cfg_set_key(cfg, "Streaming", "DefaultPort", "7070"); break; default: gf_cfg_set_key(cfg, "Streaming", "DefaultPort", "554"); break; } if (force_rtsp) { gf_cfg_set_key(cfg, "Streaming", "RTPoverRTSP", "yes"); } else { gf_cfg_set_key(cfg, "Streaming", "RTPoverRTSP", m_rtsp->GetValue() ? "yes" : "no"); if (!m_rtsp->GetValue()) gf_cfg_set_key(cfg, "Streaming", "ReorderSize", m_dorebuffer->GetValue() ? "30" : "0"); } gf_cfg_set_key(cfg, "Streaming", "RTSPTimeout", m_timeout->GetValue().mb_str(wxConvUTF8)); gf_cfg_set_key(cfg, "Network", "BufferLength", m_buffer->GetValue().mb_str(wxConvUTF8)); if (m_dorebuffer->GetValue()) { gf_cfg_set_key(cfg, "Network", "RebufferLength", m_rebuffer->GetValue().mb_str(wxConvUTF8)); } else { gf_cfg_set_key(cfg, "Network", "RebufferLength", "0"); } gf_cfg_set_key(cfg, "StreamingCache", "KeepExistingFiles", m_overwrite->GetValue() ? "no" : "yes"); if (m_usename->GetValue()) { gf_cfg_set_key(cfg, "StreamingCache", "BaseFileName", m_recfile->GetValue().mb_str(wxConvUTF8)); } else { gf_cfg_set_key(cfg, "StreamingCache", "BaseFileName", NULL); } gf_cfg_set_key(cfg, "StreamingCache", "RecordDirectory", m_recdir->GetLabel().mb_str(wxConvUTF8)); if (!need_reload) { gf_term_set_option(m_pApp->m_term, GF_OPT_RELOAD_CONFIG, 1); } else { m_pApp->ReloadTerminal(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -