void CPrintPref::OnBnClickedHcolor() { _GET_SELECTION(idx, hs); CColorDialog aDlg(hs.fontColor, CC_ANYCOLOR|CC_RGBINIT|CC_FULLOPEN); if (aDlg.DoModal() == IDOK) { hs.fontColor = aDlg.GetColor(); // update display m_hsListBox.RedrawItem(idx, true); SetModified(); } }
//================================================================ // Function : COcafApp::OnFileOpen() ///Purpose : //================================================================ void COcafApp::OnFileOpen() { CFileDialog aDlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY, "OCAFSample(STD) (*.std)|*.std|OCAFSample(XML) (*.xml)|*.xml|OCAFSample(Binary) (*.cbf)|*.cbf||"); if (aDlg.DoModal() != IDOK) return; int strLength = aDlg.GetPathName().GetLength()+1; LPTSTR lpszFileName = new TCHAR[strLength]; strcpy_s(lpszFileName, strLength, aDlg.GetPathName() ); OpenDocumentFile(lpszFileName); }
//------------------------------------------------------------------------------ bool WxMainApp::OnInit() { //get base dir wxString strDir; wxSplitPath(wxGetFullModuleName(), &strDir, NULL, NULL); m_strBaseDir = strDir.char_str(wxConvUTF8).data(); m_strBaseDir += "\\"; /////////////////////////////////////////////////////////////////////////////////////////////////// //initialize guiex system try { CGUIFrameworkEditor::ms_pFramework = new CGUIFrameworkEditor( ); CGUIFrameworkEditor::ms_pFramework->Initialize( CGUIIntSize(1024,768), "" ); GSystem->SetDrawExtraInfo( false ); GSystem->SetPlayingAs( false ); GSystem->SetEditorMode( true ); } catch (CGUIBaseException& rError) { wxMessageBox( Gui2wxString(rError.what()), _T("error") ); if( CGUIFrameworkEditor::ms_pFramework ) { CGUIFrameworkEditor::ms_pFramework->Release(); delete CGUIFrameworkEditor::ms_pFramework; CGUIFrameworkEditor::ms_pFramework = NULL; } } //load scintilla dll m_hSciDll = LoadLibrary(_T("SciLexer.DLL")); if (m_hSciDll==NULL) { wxMessageBox(_T("The Scintilla DLL could not be loaded."), _T("Error loading Scintilla"), wxOK|wxCENTER|wxICON_ERROR,NULL); return false; } //load localization config file if( 0 != CPropertyConfigMgr::Instance()->ReadLocalizationConfig(GetBaseDir() + "../editorconfig/localization_config.xml")) { wxMessageBox(_T("failed to read config file localization_config.xml!"), _T("error")); return false; } //load base config file std::vector<wxFileName> vecBaseConfigFile; vecBaseConfigFile.push_back( Gui2wxString(GetBaseDir() + "../editorconfig/libguiex_editor_config.xml")); vecBaseConfigFile.push_back( Gui2wxString(GetBaseDir() + "../editorconfig/libguiex_editor_config_box2d.xml")); vecBaseConfigFile.push_back( Gui2wxString(GetBaseDir() + "../editorconfig/libguiex_editor_config_game.xml")); for( uint32 i=0; i<vecBaseConfigFile.size(); ++i ) { if( 0 != CPropertyConfigMgr::Instance()->ReadPropertyConfig( vecBaseConfigFile[i].GetFullPath())) { wxMessageBox( wxString::Format( _T("failed to read property config file: %s"), vecBaseConfigFile[i].GetFullPath() ), _T("error")); return false; } } //load extend config file if( wxMessageBox( _T("Do you want to load extend widget config file?"), _T("Questing"), wxYES_NO | wxICON_QUESTION) == wxYES ) { wxFileDialog aDlg(NULL, _T("Choose widget config files"), Gui2wxString(GetBaseDir() + "../editorconfig/"), wxEmptyString, _T("widget config files (*.xml)|*.xml"), wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST ); if( wxID_OK == aDlg.ShowModal()) { //try load wxArrayString arrayFiles; aDlg.GetPaths( arrayFiles ); for( uint32 i=0; i<arrayFiles.size(); ++i ) { if( std::find(vecBaseConfigFile.begin(), vecBaseConfigFile.end(), arrayFiles[i]) != vecBaseConfigFile.end() ) { //base config file, ignore it continue; } if( 0 != CPropertyConfigMgr::Instance()->ReadPropertyConfig( arrayFiles[i])) { wxMessageBox( wxString::Format( _T("failed to read property config file: %s"), arrayFiles[i] ), _T("error")); return false; } } } } //check default property if( false == CheckProperty() ) { wxMessageBox(_T("check default property!"), _T("error")); return false; } //create frame wxFrame* frame = new WxMainFrame(NULL, wxID_ANY, wxT("libguiex editor"), wxDefaultPosition, wxSize(1024, 768)); SetTopWindow(frame); frame->Show(); wxToolTip::Enable(true); wxToolTip::SetDelay(1000); return true; }
LRESULT CApp::MenuProc(HWND hWnd, WPARAM wParam, LPARAM lParam) { DbgLog((LOG_TRACE, 5, TEXT("CApp::MenuProc()"))) ; HMENU hMenu = GetMenu(hWnd) ; //Parse the menu selections: switch(LOWORD(wParam)) { case ID_PLAYBACK_PLAY: m_pDvdCore->Play(); break; case ID_PLAYBACK_PREVIOUSCHAPTER: m_pDvdCore->PrevChapter(); break; case ID_PLAYBACK_REWIND: m_pDvdCore->Rewind(); break; case ID_PLAYBACK_PAUSE: m_pDvdCore->Pause(); break; case ID_PLAYBACK_STOP: m_pDvdCore->Stop(); break; case ID_PLAYBACK_FASTFORWARD: m_pDvdCore->FastForward(); break; case ID_PLAYBACK_NEXTCHAPTER: m_pDvdCore->NextChapter(); break; case ID_PLAYBACK_MENUROOT: m_pDvdCore->RootMenu(); break; case ID_OPTIONS_FULLSCREEN: m_pDvdCore->ToggleFullScreen(); break; case ID_PLAYBACK_TITLEMENU: m_pDvdCore->TitleMenu(); break; case ID_FILE_EXIT: DestroyWindow(m_hWnd); break; case ID_OPTIONS_CLOSEDCAPTION: if(false == m_bCaptionsOn) // turn them on { HMENU hSubMenu = GetSubMenu(hMenu, 2); // Options is the 3rd menu starting with 0 CheckMenuItem(hSubMenu, ID_OPTIONS_CLOSEDCAPTION, MF_BYCOMMAND | MF_CHECKED); if(m_pDvdCore->EnableCaptions(true)) m_bCaptionsOn = true; } else // turn them off { HMENU hSubMenu = GetSubMenu(hMenu, 2); // Options is the 3rd menu starting with 0 CheckMenuItem(hSubMenu, ID_OPTIONS_CLOSEDCAPTION, MF_BYCOMMAND | MF_UNCHECKED); if(m_pDvdCore->EnableCaptions(false)) m_bCaptionsOn = false; } break; case ID_OPTIONS_SAVEBOOKMARK: m_pDvdCore->SaveBookmark(); break; case ID_OPTIONS_RESTOREBOOKMARK: m_pDvdCore->RestoreBookmark(); break; case ID_OPTIONS_PARENTALLEVEL: if(Nav_Stopped != m_pDvdCore->GetState() && Graph_Stopped2 != m_pDvdCore->GetState()) // can't change parental level except in stop state { MessageBox(m_hWnd, TEXT("Can't change parental control level during playback. Please stop (twice) first."), TEXT("Error"), MB_OK | MB_ICONINFORMATION) ; break ; } DialogBox(m_hInstance, MAKEINTRESOURCE(IDD_PARENTLEVELS), m_hWnd, reinterpret_cast<DLGPROC>(SelectParentalLevel)); break; case ID_HELP_ABOUTDVDSAMPLE: { CAboutDlg aDlg(m_hInstance, m_hWnd); aDlg.DoModal(); } break; case ID_OPTIONS_SUBPICTURE: { CSPLangDlg aDlg(m_hInstance, m_hWnd); aDlg.DoModal(); } break; case ID_OPTIONS_AUDIOLANGUAGE: { CAudioLangDlg aDlg(m_hInstance, m_hWnd); aDlg.DoModal(); } break; case ID_OPTIONS_ANGLE: { CAngleDlg aDlg(m_hInstance, m_hWnd); aDlg.DoModal(); } break; case ID_FILE_SELECTDISC: OnSelectDisc(); break; case ID_PLAYBACK_STEPFORWARD: m_pDvdCore->FrameStep(); break; case ID_PLAYBACK_GOTO_CHAPTER: { CChapterDlg aDlg(m_hInstance, m_hWnd); if(false == aDlg.DoModal()) break; m_pDvdCore->PlayChapter(aDlg.GetChapter()); } break; case ID_PLAYBACK_GOTO_TITLE: { CTitleDlg aDlg(m_hInstance, m_hWnd); if(false == aDlg.DoModal()) break; m_pDvdCore->PlayChapterInTitle(aDlg.GetTitle(), aDlg.GetChapter()); } break; case ID_PLAYBACK_GOTO_TIME: { CTimeDlg aDlg(m_hInstance, m_hWnd); DVD_HMSF_TIMECODE time = m_pDvdCore->GetTime(); aDlg.SetTime(time); if(false == aDlg.DoModal()) break; m_pDvdCore->PlayTime(aDlg.GetTime()); } break; case ID_OPTIONS_GETDISCTEXT: m_pDvdCore->GetDvdText(); break; case ID_OPTIONS_GETAUDIOATTRIBUTES: m_pDvdCore->GetAudioAttributes(); break; case ID_OPTIONS_GETVIDEOATTRIBUTES: m_pDvdCore->GetVideoAttributes(); break; case ID_OPTIONS_GETSUBPICTUREATTRIBUTES: m_pDvdCore->GetSPAttributes(); break; case ID_OPTIONS_SETKARAOKEMIXING: { CKaraokeDlg aDlg(m_hInstance, m_hWnd); aDlg.DoModal(); // all work happens in the dialog code } break; case ID_OPTIONS_USEVMR9: { UINT uChecked = (m_pDvdCore->ToggleVMR9AndRebuildGraph()) ? (MF_CHECKED) : (MF_UNCHECKED); HMENU hOptMenu = GetSubMenu(hMenu, 2); // options menu CheckMenuItem(hOptMenu, ID_OPTIONS_USEVMR9, uChecked | MF_BYCOMMAND); break; } default: break; } return 0; }