📄 osmo4_appui.cpp
字号:
gf_term_set_option(iAppView->m_term, GF_OPT_COLLISION, GF_COLLISION_NONE); break; case EOsmo4CollideSimple: gf_term_set_option(iAppView->m_term, GF_OPT_COLLISION, GF_COLLISION_NORMAL); break; case EOsmo4CollideDisp: gf_term_set_option(iAppView->m_term, GF_OPT_COLLISION, GF_COLLISION_DISPLACEMENT); break; case EOsmo4NavGravity: gf_term_set_option(iAppView->m_term, GF_OPT_GRAVITY, !gf_term_get_option(iAppView->m_term, GF_OPT_GRAVITY)); break; case EOsmo4ViewRTI: iAppView->show_rti = !iAppView->show_rti; break; case EOsmo4OptEnableLogs: { const char *opt = gf_cfg_get_key(iAppView->m_user.config, "General", "LogLevel"); if (opt && !stricmp(opt, "debug")) { gf_cfg_set_key(iAppView->m_user.config, "General", "LogLevel", "error"); } else { gf_cfg_set_key(iAppView->m_user.config, "General", "LogLevel", "debug"); } iAppView->SetupLogs(); } break; case EOsmo4OptSwitchRender: { const char *opt = gf_cfg_get_key(iAppView->m_user.config, "Rendering", "RendererName"); if (opt && strstr(opt, "3D")) { gf_cfg_set_key(iAppView->m_user.config, "Rendering", "RendererName", "GPAC 2D Renderer"); } else { gf_cfg_set_key(iAppView->m_user.config, "Rendering", "RendererName", "GPAC 3D Renderer"); } iAppView->ReloadTerminal(); } break; default: if ((aCommand>=EOsmo4OpenRecentFirst) && (aCommand<=EOsmo4OpenRecentLast)) { const char *sOpt = gf_cfg_get_key_name(iAppView->m_user.config, "RecentFiles", aCommand - EOsmo4OpenRecentFirst); if (sOpt) iAppView->Connect(sOpt); } else { iAppView->MessageBox("Unandled command - panic", "Osmo4"); Panic( EOsmo4Ui ); } break; }}// -----------------------------------------------------------------------------// Called by the framework when the application status pane// size is changed. Passes the new client rectangle to the// AppView// -----------------------------------------------------------------------------//void COsmo4AppUi::HandleStatusPaneSizeChange(){ iAppView->SetRect( ClientRect() ); iPlaylist->SetRect( ClientRect() );} void COsmo4AppUi::TogglePlaylist(){ CEikButtonGroupContainer* cba= CEikButtonGroupContainer::Current(); switch (view_mode) { case 0: RemoveFromStack(iAppView); iAppView->ShowHide(0); AddToStackL(iPlaylist); if (cba) { cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK); cba->DrawDeferred(); } view_was_max = StatusPane()->IsVisible() ? 0 : 1; if (view_was_max) StatusPane()->MakeVisible(ETrue); iPlaylist->ShowHide(1); view_mode = 1; break; case 1: RemoveFromStack(iPlaylist); iPlaylist->ShowHide(0); AddToStackL(iAppView); if (cba) { cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT); cba->DrawDeferred(); } iAppView->ShowHide(1); if (view_was_max) StatusPane()->MakeVisible(EFalse); view_was_max = 0; view_mode = 0; break; }}void COsmo4AppUi::PlayURL(const char *url){ if (view_mode) { TogglePlaylist(); } if (url) { char *sep; iAppView->Connect(url); sep = strrchr(url, '\\'); SetTitle(sep ? sep+1 : url); }}void COsmo4AppUi::SetTitleInfo(const char *title){ CEikStatusPane* statusPane = StatusPane(); CAknTitlePane *iTitlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle)); if (!title) title = "Osmo4"; HBufC *htitle = HBufC::NewL( strlen(title)+1); htitle->Des().Copy( TPtrC8(( TText8* ) title) ); iTitlePane->SetText(htitle);}void COsmo4AppUi::SetTitle(const char *title, int store_it){ if (store_it) { if (m_title) free(m_title); m_title = NULL; if (title) m_title = strdup(title); } SetTitleInfo(title ? title : m_title);}void COsmo4AppUi::SetInfo(const char *info){ if (info) { char szTitle[200]; sprintf(szTitle, "%s\n%s", info, m_title ? m_title : "Osmo4"); SetTitleInfo(szTitle); } else { SetTitleInfo(m_title); }}#define DECLARE_MENU_ITEM(__text, __com, __check, __res, has_sep) \ item.iText = __text; \ item.iCommandId = __com; \ item.iFlags = has_sep ? EEikMenuItemSeparatorAfter : 0; \ if (__check) item.iFlags |= EEikMenuItemCheckBox | EEikMenuItemSymbolOn; \ item.iCascadeId = __res; \ aMenuPane->AddMenuItemL(item); void COsmo4AppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane){ CEikMenuPaneItem::SData item; if (aResourceId==R_OSMO4_MENU) { aMenuPane->Reset(); if (view_mode==1) { Bool is_file = iPlaylist->SelectionIsFile(); Bool in_pl = (is_file && iPlaylist->IsInPlaylist()) ? 1 : 0; if (iPlaylist->PlaylistMode()) { DECLARE_MENU_ITEM(_L("Up"), EOsmo4PlayListMoveUp, 0, 0, 0); DECLARE_MENU_ITEM(_L("Down"), EOsmo4PlayListMoveDown, 0, 0, 0); DECLARE_MENU_ITEM(_L("Remove"), EOsmo4PlayListRem, 0, 0, 0); DECLARE_MENU_ITEM(_L("Clear"), EOsmo4PlayListClear, 0, 0, 1); } else if (!in_pl) { DECLARE_MENU_ITEM(_L("Add to PlayList"), EOsmo4PlayListAdd, 0, 0, 1); } else if (is_file) { DECLARE_MENU_ITEM(_L("Remove from Playlist"), EOsmo4PlayListRem, 0, 0, 1); } if (! iPlaylist->PlaylistMode()) { DECLARE_MENU_ITEM(iPlaylist->ViewAllFiles() ? _L("View known files") : _L("View all files"), EOsmo4PlayListAllFiles, 0, 0, 1); } else { DECLARE_MENU_ITEM(_L("Sort"), 0, 0, R_OSMO4_SM1, 1); } DECLARE_MENU_ITEM(iPlaylist->PlaylistMode() ? _L("Browse") : _L("Playlist"), EOsmo4PlayListMode, 0, 0, 0); } else { /*open*/ DECLARE_MENU_ITEM(_L("File"), 0, 0, R_OSMO4_SM1, 0); DECLARE_MENU_ITEM(_L("View"), 0, 0, R_OSMO4_SM2, 0); DECLARE_MENU_ITEM(_L("Options"), 0, 0, R_OSMO4_SM3, 0); //DECLARE_MENU_ITEM(_L("Exit"), EEikCmdExit, 0, 0, 0); } smenu_id = 0; return; } else if (aResourceId==R_OSMO4_SM1) { aMenuPane->Reset(); /*sort menu*/ if (view_mode==1) { } /*file menu*/ else { DECLARE_MENU_ITEM(_L("Open local"), EOsmo4PlayListView, 0, 0, 0); DECLARE_MENU_ITEM(_L("Open URL"), EOsmo4OpenURL, 0, 0, 1); if (gf_cfg_get_key_name(iAppView->m_user.config, "RecentFiles", 0) != NULL) { DECLARE_MENU_ITEM(_L("Recent"), 0, 0, R_OSMO4_SSM1, 0); } DECLARE_MENU_ITEM(_L("Reload"), EOsmo4Reload, 0, 0, 0); } smenu_id = 1; return; } /*not used*/ if (view_mode==1) return; /*View menu*/ if (aResourceId==R_OSMO4_SM2) { aMenuPane->Reset(); /*content view menu*/ if (gf_term_get_option(iAppView->m_term, GF_OPT_NAVIGATION_TYPE) != GF_NAVIGATE_TYPE_NONE) { DECLARE_MENU_ITEM(_L("Navigate"), 0, 0, R_OSMO4_SSM1, 1); } DECLARE_MENU_ITEM(_L("Fullscreen"), EOsmo4Fullscreen, 0, 0, 0); /*don't allow content AR modification by user*/ //DECLARE_MENU_ITEM(_L("Aspect Ratio"), 0, 0, R_OSMO4_SSM2, 1); DECLARE_MENU_ITEM(_L("Maximize size"), EOsmo4ViewMaxSize, (StatusPane()->IsVisible() ? 0 : 1), 0, 1); DECLARE_MENU_ITEM(_L("CPU Usage"), EOsmo4ViewRTI, iAppView->show_rti, 0, 0); smenu_id = 2; return; } /*Option menu*/ if (aResourceId==R_OSMO4_SM3) { const char *opt = gf_cfg_get_key(iAppView->m_user.config, "Rendering", "RendererName"); DECLARE_MENU_ITEM(_L("Use OpenGL"), EOsmo4OptSwitchRender, (opt && strstr(opt, "3D")) ? 1 : 0, 0, 0); DECLARE_MENU_ITEM(_L("Enable Logs"), EOsmo4OptEnableLogs, iAppView->do_log, 0, 0); return; } if (aResourceId==R_OSMO4_SSM1) { aMenuPane->Reset(); if (smenu_id == 1) { u32 i = 0; while (1) { const char *opt = gf_cfg_get_key_name(iAppView->m_user.config, "RecentFiles", i); if (!opt) break; const char *sep = strrchr(opt, '\\'); if (!sep) sep = strrchr(opt, '/'); if (!sep) sep = opt; else sep += 1; item.iText.Copy( TPtrC8(( TText8* ) sep) ); item.iCommandId = EOsmo4OpenRecentFirst + i; item.iFlags = 0; item.iCascadeId = 0; aMenuPane->AddMenuItemL(item); i++; if (i>=10) break; } } else if (smenu_id == 2) { DECLARE_MENU_ITEM(_L("Reset"), EOsmo4NavReset, 0, 0, 1); DECLARE_MENU_ITEM(_L("None"), EOsmo4NavNone, 0, 0, 0); DECLARE_MENU_ITEM(_L("Slide"), EOsmo4NavSlide, 0, 0, 0); if (gf_term_get_option(iAppView->m_term, GF_OPT_NAVIGATION_TYPE) == GF_NAVIGATE_TYPE_3D) { DECLARE_MENU_ITEM(_L("Walk"), EOsmo4NavWalk, 0, 0, 0); DECLARE_MENU_ITEM(_L("Fly"), EOsmo4NavFly, 0, 0, 0); DECLARE_MENU_ITEM(_L("Examine"), EOsmo4NavExamine, 0, 0, 1); DECLARE_MENU_ITEM(_L("Headlight"), EOsmo4NavHeadlight, 0, 0, 0); DECLARE_MENU_ITEM(_L("Gravity"), EOsmo4NavGravity, 0, 0, 0); } } return; } if (aResourceId==R_OSMO4_SSM2) { aMenuPane->Reset(); DECLARE_MENU_ITEM(_L("Keep Original"), EOsmo4AROriginal, 0, 0, 0); DECLARE_MENU_ITEM(_L("Fill Screen"), EOsmo4ARFillScreen, 0, 0, 0); DECLARE_MENU_ITEM(_L("Ratio 4/3"), EOsmo4AR4_3, 0, 0, 0); DECLARE_MENU_ITEM(_L("Ratio 16/9"), EOsmo4AR16_9, 0, 0, 0); return; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -