📄 wxosmo4.cpp
字号:
smenu->Append(ID_MCACHE_STOP, wxT("&Stop"), wxT("Stops recording and saves")); smenu->Append(ID_MCACHE_ABORT, wxT("&Abort"), wxT("Stops recording and discards")); menu->Append(0, wxT("&Streaming Cache"), smenu); menu->Enable(FILE_PROPERTIES, 0); menu->AppendSeparator(); menu->Append(TERM_RELOAD, wxT("Reload &Player"), wxT("Reload GPAC Terminal")); menu->AppendSeparator(); menu->Append(FILE_QUIT, wxT("E&xit"), wxT("Quit the application")); b->Append(menu, wxT("&File")); /*view*/ menu = new wxMenu(); vp_list = new wxMenu(); menu->Append(0, wxT("&Viewpoint"), vp_list); smenu = new wxMenu(); smenu->Append(ID_HEADLIGHT, wxT("Headlight"), wxT("Turns headlight on/off"), wxITEM_CHECK); smenu->AppendSeparator(); smenu->Append(ID_NAVIGATE_NONE, wxT("None"), wxT("Disables Navigation"), wxITEM_CHECK); smenu->Append(ID_NAVIGATE_WALK, wxT("Walk"), wxT("Walk Navigation"), wxITEM_CHECK); smenu->Append(ID_NAVIGATE_FLY, wxT("Fly"), wxT("Fly Navigation"), wxITEM_CHECK); smenu->Append(ID_NAVIGATE_EXAMINE, wxT("Examine"), wxT("Examine Navigation"), wxITEM_CHECK); smenu->Append(ID_NAVIGATE_PAN, wxT("Pan"), wxT("Pan Navigation"), wxITEM_CHECK); smenu->Append(ID_NAVIGATE_SLIDE, wxT("Slide"), wxT("Slide Navigation"), wxITEM_CHECK); smenu->Append(ID_NAVIGATE_ORBIT, wxT("Orbit"), wxT("Orbit Navigation"), wxITEM_CHECK); smenu->Append(ID_NAVIGATE_GAME, wxT("Game"), wxT("Game Navigation"), wxITEM_CHECK); smenu->AppendSeparator(); wxMenu *ssmenu = new wxMenu(); ssmenu->Append(ID_COLLIDE_NONE, wxT("None"), wxT("No Collision detection"), wxITEM_CHECK); ssmenu->Append(ID_COLLIDE_REG, wxT("Regular"), wxT("Regular Collision detection"), wxITEM_CHECK); ssmenu->Append(ID_COLLIDE_DISP, wxT("Displacement"), wxT("Collision detecion with camera displacement"), wxITEM_CHECK); smenu->Append(0, wxT("&Collision"), ssmenu); smenu->Append(ID_GRAVITY, wxT("Gravity"), wxT("Turns gravity on/off"), wxITEM_CHECK); smenu->AppendSeparator(); smenu->Append(ID_NAVIGATE_RESET, wxT("Reset"), wxT("Reset Navigation")); menu->Append(0, wxT("&Navigation"), smenu); menu->AppendSeparator(); menu->Append(VIEW_FULLSCREEN, wxT("&Fullscreen"), wxT("Toggles Fullscreen"), wxITEM_CHECK); menu->Append(VIEW_ORIGINAL, wxT("&Original Size"), wxT("Restore original size")); smenu = new wxMenu(); smenu->Append(VIEW_AR_KEEP, wxT("Keep Original\tCtrl+1"), wxT("Keep original aspect ratio"), wxITEM_CHECK); smenu->Append(VIEW_AR_FILL, wxT("Fill Screen\tCtrl+2"), wxT("Stretch presentation to fill screen"), wxITEM_CHECK); smenu->Append(VIEW_AR_43, wxT("Ratio 4/3\tCtrl+3"), wxT("Force aspect ratio to 4/3"), wxITEM_CHECK); smenu->Append(VIEW_AR_169, wxT("Ratio 16/9\tCtrl+4"), wxT("Force aspect ratio to 16/9"), wxITEM_CHECK); menu->Append(0, wxT("&Aspect Ratio"), smenu); smenu->Check(VIEW_AR_KEEP, 1); menu->AppendSeparator(); menu->Append(VIEW_OPTIONS, wxT("&Options"), wxT("View Options")); menu->AppendSeparator(); menu->Append(VIEW_RTI, wxT("&Resource Usage"), wxT("View Resource Usage"), wxITEM_CHECK); menu->Append(VIEW_LOGS, wxT("&Logs"), wxT("View GPAC logs")); b->Append(menu, wxT("&View")); /*play*/ menu = new wxMenu(); sel_menu = new wxMenu(); sel_menu->Append(0, wxT("&Audio"), new wxMenu()); sel_menu->Append(0, wxT("&Video"), new wxMenu()); sel_menu->Append(0, wxT("&Subtitles"), new wxMenu()); sel_menu->AppendSeparator(); sel_menu->Append(ID_ADD_SUB, wxT("&Add Subtitle"), wxT("Adds subtitle")); menu->Append(ID_STREAM_MENU, wxT("&Streams Selection"), sel_menu); chap_menu = new wxMenu(); menu->Append(ID_CHAPTER_MENU, wxT("&Chapters"), chap_menu); menu->AppendSeparator(); menu->Append(VIEW_PLAYLIST, wxT("&Playlist\tCtrl+L"), wxT("Show navigation history as playlist"), wxITEM_CHECK); menu->Append(ID_CLEAR_NAV, wxT("&Clear History"), wxT("Clear navigation history")); menu->AppendSeparator(); menu->Append(FILE_PLAY, wxT("&Play/Pause\tCtrl+P"), wxT("Play/Pause/Resume Presentation")); menu->Append(FILE_STEP, wxT("&Step-by-Step\tCtrl+S"), wxT("Play/Pause/Resume Presentation")); menu->Append(FILE_STOP, wxT("&Stop"), wxT("Stop Presentation")); menu->AppendSeparator(); menu->Append(FILE_RELOAD, wxT("&Reload File\tCtrl+R"), wxT("Reload Presentation")); b->Append(menu, wxT("&Play")); menu = new wxMenu(); menu->Append(APP_SHORTCUTS, wxT("&Shortcuts"), wxT("Show keyboard shortcuts")); menu->Append(APP_NAV_KEYS, wxT("&Navigation Keys"), wxT("Show navigation keys")); menu->AppendSeparator(); menu->Append(APP_ABOUT, wxT("&About"), wxT("Display information and copyright")); b->Append(menu, wxT("&?")); SetMenuBar(b); m_pStatusbar = CreateStatusBar(1, 0, -1, wxT("statusBar")); ws[0] = 60; ws[1] = 70; ws[2] = -1; m_pStatusbar->SetFieldsCount(3, ws); SetStatusBarPane(2); wxColour foreCol = m_pStatusbar->GetBackgroundColour(); SetBackgroundColour(foreCol); m_pTimer = new wxTimer(); m_pTimer->SetOwner(this, ID_CTRL_TIMER); m_bGrabbed = 0; /*create toolbar*/ m_pToolBar = CreateToolBar(wxTB_FLAT|wxTB_HORIZONTAL); m_pOpenFile = new wxBitmap(tool_open_file); m_pPrev = new wxBitmap(tool_prev); m_pNext = new wxBitmap(tool_next); m_pPlay = new wxBitmap(tool_play); m_pPause = new wxBitmap(tool_pause); m_pStep = new wxBitmap(tool_step); m_pStop = new wxBitmap(tool_stop); m_pInfo = new wxBitmap(tool_info); m_pConfig = new wxBitmap(tool_config); m_pSW2D = new wxBitmap(tool_sw_2d); m_pSW3D = new wxBitmap(tool_sw_3d); m_pToolBar->AddTool(FILE_OPEN, wxT(""), *m_pOpenFile, wxT("Open File")); m_pToolBar->AddSeparator(); m_pPrevBut = new wxMenuButton(m_pToolBar, FILE_PREV, *m_pPrev); m_pPrevBut->SetToolTip(wxT("Previous Location")); m_pToolBar->AddControl(m_pPrevBut); m_pNextBut = new wxMenuButton(m_pToolBar, FILE_NEXT, *m_pNext); m_pNextBut->SetToolTip(wxT("Next Location")); m_pToolBar->AddControl(m_pNextBut); m_pToolBar->AddSeparator(); m_pToolBar->AddTool(FILE_PLAY, wxT(""), *m_pPlay, wxT("Play/Pause File")); m_pToolBar->AddTool(FILE_STEP, wxT(""), *m_pStep, wxT("Step-by-Step Mode")); m_pToolBar->AddTool(FILE_STOP, wxT(""), *m_pStop, wxT("Stop File")); m_pToolBar->AddSeparator(); m_pToolBar->AddTool(FILE_PROPERTIES, wxT(""), *m_pInfo, wxT("Show File Information")); m_pToolBar->AddSeparator(); m_pToolBar->AddTool(VIEW_OPTIONS, wxT(""), *m_pConfig, wxT("GPAC Configuration")); m_pToolBar->AddTool(SWITCH_RENDER, wxT(""), *m_pSW3D, wxT("Switch 2D/3D Renderers")); m_pToolBar->Realize(); m_Address = new wxMyComboBox(this, ID_ADDRESS, wxT(""), wxPoint(50, 0), wxSize(80, 20)); wxStaticText *add_text = new wxStaticText(this, -1, wxT("URL"), wxPoint(0, 0), wxSize(40, 20)); add_text->SetBackgroundColour(foreCol); m_pAddBar = new wxBoxSizer(wxHORIZONTAL); m_pAddBar->Add(add_text, 0, wxALIGN_TOP); m_pAddBar->Add(m_Address, 2, wxALIGN_CENTER|wxEXPAND|wxADJUST_MINSIZE); m_pAddBar->SetMinSize(80, 32); m_pAddBar->Layout(); m_pProg = new wxSlider(this, ID_SLIDER, 0, 0, 1000, wxPoint(0, 22), wxSize(80, 22), wxSL_HORIZONTAL|wxSUNKEN_BORDER); m_pProg->Enable(0); m_pProg->Show(); m_pProg->SetBackgroundColour(foreCol); m_pView = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); m_pView->SetBackgroundColour(wxColour(wxT("BLACK")));#ifdef __WXGTK__ m_pVisual = new wxWindow(m_pView, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); m_pVisual->SetBackgroundColour(wxColour(wxT("BLACK")));#endif m_pPlayList = new wxPlaylist(this); m_pPlayList->SetIcon(wxIcon(osmo4)); m_pPlayList->Hide(); Raise(); Show(); m_connected = 0; if (!LoadTerminal()) { Close(TRUE); return; } if (m_bExternalView) SetWindowStyle(wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER)); DoLayout(320, 240); UpdateRenderSwitch(); const char *sOpt = gf_cfg_get_key(m_user.config, "General", "ConsoleOff"); m_console_off = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0; sOpt = gf_cfg_get_key(m_user.config, "General", "Loop"); m_loop = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0; sOpt = gf_cfg_get_key(m_user.config, "General", "LookForSubtitles"); m_lookforsubs = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0; gf_term_set_option(m_term, GF_OPT_AUDIO_VOLUME, 100); ReloadURLs(); Raise(); m_pStatusbar->SetStatusText(wxT("Ready"), 2); m_LastStatusTime = 0; m_pPrevBut->Refresh(); m_pNextBut->Refresh(); wxOsmo4App &app = wxGetApp(); if (app.argc>1) { m_pPlayList->QueueURL(wxString(app.argv[1])); m_pPlayList->RefreshList(); m_pPlayList->PlayNext(); } else { char sPL[GF_MAX_PATH]; strcpy((char *) sPL, szAppPath);#ifdef WIN32 strcat(sPL, "gpac_pl.m3u");#else strcat(sPL, ".gpac_pl.m3u");#endif m_pPlayList->OpenPlaylist(wxString(sPL, wxConvUTF8) ); const char *sOpt = gf_cfg_get_key(m_user.config, "General", "PLEntry"); if (sOpt) { m_pPlayList->m_cur_entry = atoi(sOpt); if (m_pPlayList->m_cur_entry>=(s32)gf_list_count(m_pPlayList->m_entries)) m_pPlayList->m_cur_entry = -1; } sOpt = gf_cfg_get_key(m_user.config, "General", "StartupFile"); if (sOpt) { gf_term_connect(m_term, sOpt); m_bStartupFile = 1; } } sOpt = gf_cfg_get_key(m_user.config, "Audio", "DriverName"); if (!strcmp(sOpt, "No Audio Output Available")) { ::wxLogMessage(wxT("WARNING: no audio output availble - make sure no other program is locking the sound card")); SetStatus(wxT("No audio ouput available")); } else { SetStatus(wxT("Ready")); }}wxOsmo4Frame::~wxOsmo4Frame(){ vp_list = NULL; sel_menu = NULL; if (m_user.modules) gf_modules_del(m_user.modules); gf_sys_close(); if (m_user.config) gf_cfg_del(m_user.config); if (m_chapters_start) free(m_chapters_start); if (m_pView) delete m_pView; //m_pToolBar->RemoveTool(FILE_PREV); //m_pToolBar->RemoveTool(FILE_NEXT); delete m_pPrevBut; delete m_pNextBut; delete m_pPlayList; delete m_pTimer; delete m_pOpenFile; delete m_pPrev; delete m_pNext; delete m_pPlay; delete m_pPause; delete m_pStep; delete m_pStop; delete m_pInfo; delete m_pConfig; delete m_pSW2D; delete m_pSW3D;}BEGIN_EVENT_TABLE(wxOsmo4Frame, wxFrame) EVT_CLOSE(wxOsmo4Frame::OnCloseApp) EVT_MENU(FILE_OPEN, wxOsmo4Frame::OnFileOpen) EVT_MENU(FILE_OPEN_URL, wxOsmo4Frame::OnFileOpenURL) EVT_MENU(FILE_RELOAD, wxOsmo4Frame::OnFileReload) EVT_MENU(FILE_PROPERTIES, wxOsmo4Frame::OnFileProperties) EVT_MENU(TERM_RELOAD, wxOsmo4Frame::OnTermReload) EVT_MENU(FILE_QUIT, wxOsmo4Frame::OnFileQuit) EVT_MENU(VIEW_FULLSCREEN, wxOsmo4Frame::OnFullScreen) EVT_MENU(VIEW_OPTIONS, wxOsmo4Frame::OnOptions) EVT_MENU(VIEW_AR_KEEP, wxOsmo4Frame::OnViewARKeep) EVT_MENU(VIEW_AR_FILL, wxOsmo4Frame::OnViewARFill) EVT_MENU(VIEW_AR_169, wxOsmo4Frame::OnViewAR169) EVT_MENU(VIEW_AR_43, wxOsmo4Frame::OnViewAR43) EVT_MENU(VIEW_ORIGINAL, wxOsmo4Frame::OnViewOriginal) EVT_MENU(VIEW_PLAYLIST, wxOsmo4Frame::OnPlaylist) EVT_UPDATE_UI(VIEW_PLAYLIST, wxOsmo4Frame::OnUpdatePlayList) EVT_MENU(ID_CLEAR_NAV, wxOsmo4Frame::OnClearNav) EVT_UPDATE_UI(ID_STREAM_MENU, wxOsmo4Frame::OnUpdateStreamMenu) EVT_UPDATE_UI(ID_CHAPTER_MENU, wxOsmo4Frame::OnUpdateChapterMenu) EVT_MENU(ID_ADD_SUB, wxOsmo4Frame::OnAddSub) EVT_MENU(ID_MCACHE_ENABLE, wxOsmo4Frame::OnCacheEnable) EVT_UPDATE_UI(ID_MCACHE_ENABLE, wxOsmo4Frame::OnUpdateCacheEnable) EVT_MENU(ID_MCACHE_STOP, wxOsmo4Frame::OnCacheStop) EVT_MENU(ID_MCACHE_ABORT, wxOsmo4Frame::OnCacheAbort) EVT_UPDATE_UI(ID_MCACHE_STOP, wxOsmo4Frame::OnUpdateCacheAbort) EVT_UPDATE_UI(ID_MCACHE_ABORT, wxOsmo4Frame::OnUpdateCacheAbort) EVT_MENU(APP_SHORTCUTS, wxOsmo4Frame::OnShortcuts) EVT_MENU(APP_NAV_KEYS, wxOsmo4Frame::OnNavInfo) EVT_MENU(APP_ABOUT, wxOsmo4Frame::OnAbout) EVT_GPACEVENT(wxOsmo4Frame::OnGPACEvent) EVT_TIMER(ID_CTRL_TIMER, wxOsmo4Frame::OnTimer) EVT_COMMAND_SCROLL(ID_SLIDER, wxOsmo4Frame::OnSlide) EVT_MENU(VIEW_LOGS, wxOsmo4Frame::OnLogs) EVT_MENU(VIEW_RTI, wxOsmo4Frame::OnRTI) EVT_MENUBUTTON_OPEN(FILE_PREV, wxOsmo4Frame::OnFilePrevOpen) EVT_MENUBUTTON_OPEN(FILE_NEXT, wxOsmo4Frame::OnFileNextOpen) EVT_MENU(FILE_PREV, wxOsmo4Frame::OnNavPrev) EVT_UPDATE_UI(FILE_PREV, wxOsmo4Frame::OnUpdateNavPrev) EVT_MENU_RANGE(ID_NAV_PREV_0, ID_NAV_PREV_9, wxOsmo4Frame::OnNavPrevMenu) EVT_MENU(FILE_NEXT, wxOsmo4Frame::OnNavNext) EVT_UPDATE_UI(FILE_NEXT, wxOsmo4Frame::OnUpdateNavNext) EVT_MENU_RANGE(ID_NAV_NEXT_0, ID_NAV_NEXT_9, wxOsmo4Frame::OnNavNextMenu) EVT_TOOL(FILE_PLAY, wxOsmo4Frame::OnFilePlay) EVT_TOOL(FILE_STEP, wxOsmo4Frame::OnFileStep) EVT_TOOL(FILE_STOP, wxOsmo4Frame::OnFileStop) EVT_TOOL(SWITCH_RENDER, wxOsmo4Frame::OnRenderSwitch) EVT_COMBOBOX(ID_ADDRESS, wxOsmo4Frame::OnURLSelect) EVT_MENU_RANGE(ID_SELSTREAM_0, ID_SELSTREAM_9, wxOsmo4Frame::OnStreamSel) EVT_UPDATE_UI_RANGE(ID_SELSTREAM_0, ID_SELSTREAM_9, wxOsmo4Frame::OnUpdateStreamSel) EVT_MENU_RANGE(ID_SETCHAP_FIRST, ID_SETCHAP_LAST, wxOsmo4Frame::OnChapterSel) EVT_UPDATE_UI_RANGE(ID_SETCHAP_FIRST, ID_SETCHAP_LAST, wxOsmo4Frame::OnUpdateChapterSel) EVT_MENU_RANGE(ID_VIEWPOINT_FIRST, ID_VIEWPOINT_LAST, wxOsmo4Frame::OnViewport) EVT_UPDATE_UI_RANGE(ID_VIEWPOINT_FIRST, ID_VIEWPOINT_LAST, wxOsmo4Frame::OnUpdateViewport) EVT_MENU_RANGE(ID_NAVIGATE_NONE, ID_NAVIGATE_GAME, wxOsmo4Frame::OnNavigate) EVT_UPDATE_UI_RANGE(ID_NAVIGATE_NONE, ID_NAVIGATE_GAME, wxOsmo4Frame::OnUpdateNavigation) EVT_MENU(ID_NAVIGATE_RESET, wxOsmo4Frame::OnNavigateReset) EVT_MENU_RANGE(ID_COLLIDE_NONE, ID_COLLIDE_DISP, wxOsmo4Frame::OnCollide) EVT_UPDATE_UI_RANGE(ID_COLLIDE_NONE, ID_COLLIDE_DISP, wxOsmo4Frame::OnUpdateCollide) EVT_MENU(ID_HEADLIGHT, wxOsmo4Frame::OnHeadlight) EVT_UPDATE_UI(ID_HEADLIGHT, wxOsmo4Frame::OnUpdateHeadlight) EVT_MENU(ID_GRAVITY, wxOsmo4Frame::OnGravity) EVT_UPDATE_UI(ID_GRAVITY, wxOsmo4Frame::OnUpdateGravity) EVT_UPDATE_UI(FILE_PROPERTIES, wxOsmo4Frame::OnUpdateNeedsConnect) EVT_UPDATE_UI(FILE_RELOAD, wxOsmo4Frame::OnUpdateNeedsConnect) EVT_UPDATE_UI(FILE_PLAY, wxOsmo4Frame::OnUpdatePlay) EVT_UPDATE_UI(FILE_STOP, wxOsmo4Frame::OnUpdateNeedsConnect) EVT_UPDATE_UI(FILE_STEP, wxOsmo4Frame::OnUpdateNeedsConnect) EVT_UPDATE_UI(VIEW_ORIGINAL, wxOsmo4Frame::OnUpdateNeedsConnect) EVT_UPDATE_UI(VIEW_FULLSCREEN, wxOsmo4Frame::OnUpdateFullScreen) EVT_UPDATE_UI(VIEW_AR_KEEP, wxOsmo4Frame::OnUpdateAR) EVT_UPDATE_UI(VIEW_AR_FILL, wxOsmo4Frame::OnUpdateAR) EVT_UPDATE_UI(VIEW_AR_169, wxOsmo4Frame::OnUpdateAR) EVT_UPDATE_UI(VIEW_AR_43, wxOsmo4Frame::OnUpdateAR) EVT_SIZE(wxOsmo4Frame::OnSize) END_EVENT_TABLE()void wxOsmo4Frame::DoLayout(u32 v_width, u32 v_height){ wxPoint pos; if (!m_Address || !m_pProg) return; int t_h = m_pToolBar->GetSize().y; int a_h = m_pAddBar->GetSize().y; int p_h = m_pProg->GetSize().y; if (m_bExternalView) { if (v_width && v_height) { m_orig_width = v_width; m_orig_height = v_height; } SetClientSize(320, a_h+p_h+t_h); m_pAddBar->SetDimension(0,0, 320, a_h); m_pProg->SetSize(0, t_h+a_h, 320, p_h, 0); return; } if (v_width && v_height) { m_orig_width = v_width; m_orig_height = v_height; v_height += a_h + p_h + t_h; SetClientSize(v_width, v_height); m_pView->SetSize(0, a_h+t_h, v_width, v_height, 0); m_pAddBar->SetDimension(0, t_h, v_width, a_h); m_pProg->SetSize(0, v_height - p_h, v_width, p_h, 0); } wxSize s = GetClientSize(); s.y -= a_h + p_h + t_h; if (m_pView) { m_pView->SetSize(0, a_h+t_h, s.x, s.y, 0); m_pAddBar->SetDimension(0, 0, s.x, a_h); m_pAddBar->SetDimension(0, 0, s.x, a_h); m_pAddBar->Layout(); m_pProg->SetSize(0, s.y+t_h+a_h, s.x, p_h, 0); if (m_term) gf_term_set_size(m_term, s.x, s.y); }}void wxOsmo4Frame::OnSize(wxSizeEvent &event){ DoLayout();}void wxOsmo4Frame::OnCloseApp(wxCloseEvent &WXUNUSED(event)){ if (m_term) gf_term_del(m_term); m_term = NULL; Destroy();}wxString wxOsmo4Frame::GetFileFilter(){ u32 keyCount, i;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -