int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; CRect myRect=CRect( g_config.GetIni().GetValue( _W( "RipperFrame"), _W( "FrameWndLeft"), 0 ), g_config.GetIni().GetValue( _W( "RipperFrame"), _W( "FrameWndTop"), 0 ), g_config.GetIni().GetValue( _W( "RipperFrame"), _W( "FrameWndRight"), 580 ), g_config.GetIni().GetValue( _W( "RipperFrame"), _W( "FrameWndBottom"), 390 ) ); // Move the window if ( myRect.Width() < 100 || myRect.Height() < 100 ) { myRect=CRect( 0, 0, 640, 400 ); } MoveWindow(myRect); // Create status bar if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } CRect rcClient; GetClientRect(rcClient); m_wndStatusBar.SetPaneInfo(1,ID_SEPARATOR,SBPS_NORMAL,320); m_wndStatusBar.SetPaneInfo(0,ID_SEPARATOR,SBPS_STRETCH,100); // Docking is OK EnableDocking(CBRS_ALIGN_ANY); // Create main toolbar if (!m_wndToolBar.Create(this,WS_CHILD|WS_VISIBLE|CBRS_TOP,AFX_IDW_TOOLBAR) || !m_wndToolBar.LoadToolBar(IDW_RECBAR) ) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } // m_wndToolBar.GetToolBarCtrl().AddBitmap(7,IDB_RECBAR256); // =========================================================== #ifdef OLDICONS if (::GetDeviceCaps(GetDC()->m_hDC,BITSPIXEL)>8) { m_bmToolbarHi.LoadMappedBitmap(IDB_RECBAR256); m_wndToolBar.SetBitmap( (HBITMAP)m_bmToolbarHi ); } #else // =========================================================== if ( UseFlatLookToolBar() ) { CImageList imageList; CBitmap bitmap; // ModifyStyle(0, TBSTYLE_FLAT); // Set up hot bar image lists. // Create and set the normal toolbar image list. bitmap.LoadMappedBitmap( IDB_RECBAR256 ); imageList.Create(32, 32, ILC_COLORDDB|ILC_MASK, 13, 1); imageList.Add(&bitmap, RGB(255,0,255)); m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList); imageList.Detach(); bitmap.Detach(); // Create and set the hot toolbar image list. // bitmap.LoadBitmap( IDB_CDPLAYTOOLBAR_H ); // imageList.Create(16, 16, ILC_COLORDDB|ILC_MASK, 13, 1); // imageList.Add(&bitmap, RGB(255,0,255)); // SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList); // imageList.Detach(); // bitmap.Detach(); // Create and set the disabled toolbar image list. bitmap.LoadMappedBitmap( IDB_RECBAR256D ); imageList.Create( 32, 32, ILC_COLORDDB|ILC_MASK, 13, 1); imageList.Add(&bitmap, RGB(255,0,255)); m_wndToolBar.SendMessage( TB_SETDISABLEDIMAGELIST, 0, (LPARAM)imageList.m_hImageList); imageList.Detach(); bitmap.Detach(); // END HIGH RES BUTTONS } #endif // Set toolbar style m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC ); // Allow docking everywhere m_wndToolBar.EnableDocking( CBRS_ALIGN_ANY ); // Dock the contol bar at the right side of the frame window DockControlBar(&m_wndToolBar,AFX_IDW_DOCKBAR_RIGHT); // Create the play tool bar if (!m_wndPlayBar.Create(this,WS_CHILD|WS_VISIBLE|CBRS_TOP, ID_CDSELECTIONBAR_ID ) ) { TRACE0("Failed to create play toolbar\n"); return -1; // fail to create } // Set the style of the toolbar m_wndPlayBar.SetBarStyle(m_wndPlayBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); // Allow docking everywhere m_wndPlayBar.EnableDocking(CBRS_ALIGN_ANY); // Dock the control at the top of the frame window DockControlBar(&m_wndPlayBar,AFX_IDW_DOCKBAR_TOP); // Create the utility tool bar if ( !m_wndUtilBar.Create( this, WS_CHILD | WS_VISIBLE | CBRS_TOP, ID_UTILOOLBAR ) ) { TRACE0("Failed to create play toolbar\n"); return -1; // fail to create } // Set the style of the toolbar m_wndUtilBar.SetBarStyle(m_wndUtilBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); // Allow docking everywhere m_wndUtilBar.EnableDocking(CBRS_ALIGN_ANY); // Dock the control at the top of the frame window DockControlBar(&m_wndUtilBar,AFX_IDW_DOCKBAR_TOP); // Load the state of the Status Bar LoadBarState( _T( "MainFrmBarSettings" ) ); SetLanguageMenu( ); // ShowControlBar( &m_wndPlayBar, // g_config.GetIni().GetValue( _T( "PlayToolBar" ), _T( "Show" ), 1 ), // FALSE ); // ShowControlBar( &m_wndToolBar, // g_config.GetIni().GetValue( _T( "RecordToolBar" ), _T( "Show" ), 1 ), // FALSE ); return 0; }
void CMainFrame::OnLanguageSelection( UINT nID ) { CDocTemplate* pTemplate = NULL; POSITION pos; CDocument* pDocument = NULL; int nLanguageSelection = nID - ID_LANGUAGE_START; if ( 0 == nLanguageSelection ) { WORD nLanguage; CHyperLink myLink; CUString strVersions; // FIXME strVersions.Format( _W("cdexversion=1.70&beta=8&cdexdir=%s" ), (LPCWSTR)g_config.GetAppPath() ); for ( nLanguage=0; nLanguage < g_language.GetNumLanguageStrings(); nLanguage++) { CUString strLangName( g_language.GetLanguageString( nLanguage ) ); CUString strLangVersion; strLangVersion.Format( _W("%s=%s"), (LPCWSTR)strLangName, (LPCWSTR)g_language.GetRevisionLevel( strLangName ) ); strVersions += _W( "&" ) + strLangVersion; } // myLink.GotoURL( _T("www.cdex.n3.net/lang/langcheck.php?") + strVersions , SW_SHOW ); myLink.GotoURL( _T("cdexos.sourceforge.net/lang/cdex_v1.70"), SW_SHOW ); } else { // nLanguageSelection--; // Switch to selected language CString strMenu; m_pPopupMenu->GetMenuString( nLanguageSelection, strMenu, MF_BYPOSITION ); g_language.SetLanguage( CUString( strMenu ) ); // get document template pos = AfxGetApp()->GetFirstDocTemplatePosition(); pTemplate = AfxGetApp()->GetNextDocTemplate( pos ); POSITION docpos = pTemplate->GetFirstDocPosition( ); // Loop through documents in this template while ( docpos ) { VERIFY( pDocument = pTemplate->GetNextDoc(docpos) ); // update all view attached to this document pDocument->UpdateAllViews( NULL,WM_CDEX_INITIAL_UPDATE, NULL ); } g_config.SetLanguage( g_language.GetLanguage() ); g_config.Save(); SetLanguageMenu( ); } }
int CPlayerFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { CImageList imageList; CBitmap bitmap; if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; CRect myRect=CRect( g_config.GetIni().GetValue( _W( "PlayerFrame" ), _W( "FrameWndLeft" ), 100 ), g_config.GetIni().GetValue( _W( "PlayerFrame" ), _W( "FrameWndTop" ), 100 ), g_config.GetIni().GetValue( _W( "PlayerFrame" ), _W( "FrameWndRight"), 350 ), g_config.GetIni().GetValue( _W( "PlayerFrame" ), _W( "FrameWndBottom"), 250 ) ); // Move the window if ( myRect.Width() <100 || myRect.Height() < 100 ) { myRect=CRect( 0, 0, 350, 250 ); } MoveWindow( myRect ); // Create status bar if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndStatusBar.SetPaneInfo( 1, ID_SEPARATOR,SBPS_NORMAL, 150 ); m_wndStatusBar.SetPaneInfo( 0, ID_SEPARATOR,SBPS_STRETCH, 100 ); // Create main toolbar if (!m_wndToolBar.Create( this, WS_CHILD | WS_VISIBLE | CBRS_TOP, AFX_IDW_TOOLBAR) || !m_wndToolBar.LoadToolBar( IDW_PLAYFILEBAR ) ) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if ( UseFlatLookToolBar() ) { m_wndToolBar.ModifyStyle( 0, TBSTYLE_FLAT ); // Set up hot bar image lists. // Create and set the normal toolbar image list. if ( bitmap.LoadBitmap( IDB_FILEPLAYTOOLBAR_C ) ) { if ( imageList.Create( 16, 16, ILC_COLORDDB|ILC_MASK, 13, 1 ) ) { if ( -1 != imageList.Add( &bitmap, RGB(255,0,255) ) ) { m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList); } imageList.Detach(); } bitmap.Detach(); } // Create and set the hot toolbar image list. if ( bitmap.LoadBitmap( IDB_FILEPLAYTOOLBAR_H ) ) { if ( imageList.Create(16, 16, ILC_COLORDDB|ILC_MASK, 13, 1) ) { if ( -1 != imageList.Add(&bitmap, RGB(255,0,255)) ) { m_wndToolBar.SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList); } imageList.Detach(); } bitmap.Detach(); } // Create and set the disabled toolbar image list. if ( bitmap.LoadBitmap( IDB_FILEPLAYTOOLBAR_D ) ) { if ( imageList.Create(16, 16, ILC_COLORDDB|ILC_MASK, 13, 1) ) { if ( -1 != imageList.Add(&bitmap, RGB(255,0,255)) ) { m_wndToolBar.SendMessage(TB_SETDISABLEDIMAGELIST, 0, (LPARAM)imageList.m_hImageList); } imageList.Detach(); } bitmap.Detach(); } } // Docking is OK EnableDocking(CBRS_ALIGN_ANY); // Set the style of the toolbar m_wndToolBar.SetBarStyle( m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC ); // Allow docking everywhere m_wndToolBar.EnableDocking( CBRS_ALIGN_ANY ); // Dock the contol bar at the right side of the frame window DockControlBar(&m_wndToolBar,AFX_IDW_DOCKBAR_TOP); LoadBarState( _T( "PlayerFrmBarSettings" ) ); SetLanguageMenu( ); return 0; }