LRESULT CPreviewWindow::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CDCHandle dc = (HDC) wParam; RECT rc; GetClientRect(&rc); rc.bottom = rc.top + 21; dc.FillSolidRect(&rc, RGB(174, 169, 167)); GetClientRect(&rc); rc.top += 21; dc.Draw3dRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, RGB(103, 99, 96), RGB(200, 199, 196)); CFontHandle oldFont = dc.SelectFont(AtlGetDefaultGuiFont()); dc.SetTextColor(RGB(0, 0, 0)); dc.SetBkMode(TRANSPARENT); const sChar *desc = "(no view item)"; frOpGraph::opMapIt it = g_graph->m_ops.find(m_client.m_curOp); if (it != g_graph->m_ops.end()) desc = it->second.plg->getDisplayName(); dc.TextOut(176, 3, desc); dc.SelectFont(oldFont); return 1; }
LRESULT CPreviewWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CRegKey key; key.Open(HKEY_CURRENT_USER, lpcstrTG2RegKey, KEY_READ); DWORD tiled = 0, zoom = 4, alpha = 1; key.QueryDWORDValue(_T("TextureTiled"), tiled); key.QueryDWORDValue(_T("TextureZoom"), zoom); key.QueryDWORDValue(_T("TextureAlpha"), alpha); key.Close(); m_client.Create(m_hWnd, rcDefault, 0, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN, 0); CFontHandle fnt = AtlGetDefaultGuiFont(); m_tile.Create(m_hWnd, CRect(2, 0, 36, 20), _T("tile"), WS_CHILD|WS_VISIBLE|FRBS_AUTO3D_SINGLE|FRBS_CHECK|FRBS_HOTTRACK|FRBS_SOLID|FRBS_AUTO, 0, 100); m_tile.SetFont(fnt); m_tile.SetCheck(tiled); m_tile.SetColorScheme(RGB(0, 0, 0), RGB(0, 0, 255), RGB(66, 65, 64), RGB(103, 99, 96), RGB(174, 169, 167), RGB(174, 169, 167), RGB(200, 198, 196)); m_client.SetTiled(tiled); if (zoom == 2) zoom++; // 1:3 is out m_zoom.Create(m_hWnd, CRect(40, 0, 100, 20), 0, WS_CHILD|WS_VISIBLE|FRBS_FLAT|FRBS_HOTTRACK, 0, 101); m_zoom.AddMenuItem(1, "1:4"); m_zoom.AddMenuItem(3, "1:2"); m_zoom.AddMenuItem(4, "1:1"); m_zoom.AddMenuItem(5, "2:1"); m_zoom.AddMenuItem(6, "3:1"); m_zoom.AddMenuItem(7, "4:1"); m_zoom.SetSelection(zoom); m_zoom.SetFont(fnt); m_zoom.SetColorScheme(RGB(0, 0, 0), RGB(0, 0, 255), RGB(66, 65, 64), RGB(103, 99, 96), RGB(174, 169, 167), RGB(174, 169, 167), RGB(200, 198, 196)); m_alpha.Create(m_hWnd, CRect(104, 0, 174, 20), 0, WS_CHILD|WS_VISIBLE|FRBS_FLAT|FRBS_HOTTRACK, 0, 102); m_alpha.AddMenuItem(1, "no alpha"); m_alpha.AddMenuItem(2, "photoshop"); m_alpha.SetSelection(alpha); m_alpha.SetFont(fnt); m_alpha.SetColorScheme(RGB(0, 0, 0), RGB(0, 0, 255), RGB(66, 65, 64), RGB(103, 99, 96), RGB(174, 169, 167), RGB(174, 169, 167), RGB(200, 198, 196)); m_client.SetAlphaMode(alpha - 1); static const sInt s1tab[] = { 1, 1, 1, 1, 2, 3, 4 }; static const sInt s2tab[] = { 4, 3, 2, 1, 1, 1, 1 }; m_client.SetScale(s1tab[zoom - 1], s2tab[zoom - 1]); CMessageLoop* pLoop = _Module.GetMessageLoop(); pLoop->AddMessageFilter(this); m_bgBrush.CreateSolidBrush(RGB(174, 169, 167)); bHandled = FALSE; return 0; }
LRESULT CAnimMixer::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { drawBar(1); CPaintDC dc(m_hWnd); // layout elements updateThisClip(); CFontHandle oldFont = dc.SelectFont(AtlGetDefaultGuiFont()); dc.SetTextColor(RGB(255, 255, 255)); dc.SetTextAlign(TA_TOP|TA_LEFT); dc.SetBkMode(TRANSPARENT); if (m_thisClip) { for (sInt i = 0; i < m_thisClip->m_elements.size(); ++i) { frAnimationClip::element& elem = m_thisClip->m_elements[i]; CRect rc; getElemRect(i, rc); dc.Draw3dRect(&rc, RGB(0, 0, 0), RGB(0, 0, 0)); rc.DeflateRect(1, 1); dc.Draw3dRect(&rc, (m_curElem == i) ? RGB(4,78,51) : RGB(75,249,186), (m_curElem == i) ? RGB(75,249,186) : RGB(4, 78, 51)); rc.DeflateRect(1, 1); dc.FillSolidRect(&rc, RGB(6, 158, 106)); fr::string clipName; if (elem.type == 0) // curve clipName = "(curve)"; else { const frAnimationClip* clp = g_graph->m_clips->getClip(elem.id); if (clp) clipName = clp->getName(); else clipName = "(invalid)"; } dc.DrawText(clipName, -1, &rc, DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_END_ELLIPSIS); } } dc.SelectFont(oldFont); drawBar(2); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { hThread = 0; // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); InstallIcon(_T("Tooltip text"), hIconSmall, IDR_TRAYPOPUP); SetDefaultItem(ID_SHOW); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); WTL::CRect r(0, 0, 800, 600); m_hWndClient = m_view.Create(m_hWnd, r, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT, WS_EX_CLIENTEDGE); m_view.SetFont(AtlGetDefaultGuiFont()); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return 0; }
LRESULT CAnimMixer::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { m_frameStep = 1.0f / 8.0f; const sChar* toggles[]={"Snap Left", "Snap Mid", "Snap Right", "Follow mode", 0}; // match this with bit order in flags for (m_cmdButtonCount = 0; toggles[m_cmdButtonCount]; m_cmdButtonCount++); CDCHandle dc = GetDC(); CFontHandle oldFont = dc.SelectFont(AtlGetDefaultGuiFont()); m_cmdButtons = new frButton[m_cmdButtonCount]; sInt xpos = 4; for (sInt i = 0; i < m_cmdButtonCount; i++) { SIZE sz; dc.GetTextExtent(toggles[i], -1, &sz); const sInt width = sz.cx + 8; m_cmdButtons[i].Create(m_hWnd, CRect(xpos, 2, xpos+width, 22), toggles[i], WS_CHILD | WS_VISIBLE | FRBS_AUTO3D_SINGLE | FRBS_CHECK | FRBS_HOTTRACK | FRBS_SOLID | FRBS_AUTO, 0, i + 100); m_cmdButtons[i].SetFont(AtlGetDefaultGuiFont()); m_cmdButtons[i].SetColorScheme(RGB(0, 0, 0), RGB(0, 0, 255), RGB(66, 65, 64), RGB(103, 99, 96), RGB(174, 169, 167), RGB(174, 169, 167), RGB(200, 198, 196)); m_cmdButtons[i].SetCheck(m_flags & (1 << i)); xpos += width + 1; } dc.SelectFont(oldFont); ReleaseDC(dc); bHandled = FALSE; return 0; }
Size get_DefaultSize() { HFONT hFont = null; if(!IsWindow()) hFont = AtlGetDefaultGuiFont(); else hFont = GetFont(); HDC hDC = ::GetDC(NULL); HGDIOBJ hOldFont = ::SelectObject(hDC, hFont); Size sz; ::GetTextExtentPoint32(hDC, _T(" "), 1, &sz); ::SelectObject(hDC, hOldFont); ::ReleaseDC(NULL, hDC); return Size(sz.h + 4, sz.h + 4); }
LRESULT CScriptEditView::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& ) { LRESULT lRet = DefWindowProc( uMsg, wParam, lParam ); if( lRet != -1 ) { m_font = AtlGetDefaultGuiFont(); SetFont( m_font ); SetOptions( ECOOP_OR, ECO_SELECTIONBAR ); SetTabStopWidth(); SetEventMask( GetEventMask() | ENM_CHANGE ); SetModify( FALSE ); } return lRet; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CString szAddress; szAddress.LoadString(IDS_ADDRESS); m_URL.Create(m_hWnd,CRect(0,0,0,18),NULL,WS_CHILD|WS_VISIBLE,WS_EX_STATICEDGE); AddSimpleReBarBand(m_URL,szAddress.GetBuffer(0),TRUE); m_URL.SetFont(AtlGetDefaultGuiFont()); SHAutoComplete(m_URL,SHACF_URLALL); CreateSimpleStatusBar(); m_StatusBar.SubclassWindow(m_hWndStatusBar); int nPanes[]={ID_DEFAULT_PANE,IDR_LOCK,IDR_PROGRESS}; m_StatusBar.SetPanes(nPanes,sizeof(nPanes)/sizeof(int),false); m_StatusBar.SetPaneWidth(IDR_LOCK,30); m_StatusBar.SetPaneWidth(IDR_PROGRESS,50); //TODO: Replace with a URL of your choice m_hWndClient = m_view.Create(m_hWnd, rcDefault, _T("about:blank"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); m_view.GoHome(); return 0; }
LRESULT CLogView::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { DefWindowProc(); SetReadOnly(); SetFont(AtlGetDefaultGuiFont()); SetBackgroundColor(LOG_BGCOLOR); CHARFORMAT cf = {0}; cf.cbSize = sizeof(CHARFORMAT); cf.crTextColor = LOG_DEFAULTCOLOR; cf.yHeight = 200; cf.dwMask = CFM_COLOR | CFM_SIZE; SetDefaultCharFormat(cf); return 0; }
LRESULT CAnimMixer::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { drawBar(1); CDCHandle dc = (HDC) wParam; // prepare... CRect rc; GetClientRect(&rc); CFontHandle oldFont = dc.SelectFont(AtlGetDefaultGuiFont()); dc.SetTextColor(RGB(0, 0, 0)); dc.SetBkMode(TRANSPARENT); CPen blackPen; blackPen.CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); CPenHandle oldPen = dc.SelectPen(blackPen); // fill background dc.FillSolidRect(&rc, RGB(174, 169, 167)); // draw tl bar at y 45 dc.MoveTo(mapTime(0), 45); dc.LineTo(rc.right, 45); // track grid CPen pen_grid; pen_grid.CreatePen(PS_DOT, 1, RGB(174*3/4, 169*3/4, 167*3/4)^RGB(174, 169, 167)); dc.SelectPen(pen_grid); dc.SetROP2(R2_XORPEN); dc.SetBkColor(RGB(0, 0, 0)); dc.SetBkMode(TRANSPARENT); for (sInt trackY=46+22; trackY<rc.bottom; trackY+=22) { dc.MoveTo(mapTime(0), trackY); dc.LineTo(rc.right, trackY); } // bar marks dc.SetROP2(R2_COPYPEN); dc.SelectPen(blackPen); const sF32 xstep = 60000.0f / g_graph->m_bpmRate; const sF32 ixstep = g_graph->m_bpmRate / (60000.0f * m_frameStep); const sInt xms = (m_startPixel) * ixstep; const sInt xme = (m_startPixel + rc.right) * ixstep; LOGFONT lf; ((CFontHandle) AtlGetDefaultGuiFont()).GetLogFont(lf); if (lf.lfHeight<0) lf.lfHeight=MulDiv(-lf.lfHeight, dc.GetDeviceCaps(LOGPIXELSY), 72); for (sInt i=fr::maximum(xms-1,0); i<=xme+1; i++) { const sInt xpos=mapTime(i*xstep); const sInt beat=i&3; dc.MoveTo(xpos, 45); dc.LineTo(xpos, 37-(beat==0)*2); TCHAR buf[32]; sprintf(buf, "%d.%d", i/4, beat); dc.SetTextAlign(TA_BOTTOM|(i?TA_CENTER:TA_LEFT)); dc.TextOut(xpos, 35, buf); if (!beat) { dc.MoveTo(xpos, rc.bottom); dc.LineTo(xpos, 45); } } dc.SelectPen(oldPen); dc.SelectFont(oldFont); return 1; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); m_hWndClient = m_splitter.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_pane.SetPaneContainerExtendedStyle(PANECNT_NOBORDER); m_pane.Create(m_splitter, _T("Workspace"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_Workspace.Create(m_pane, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN , WS_EX_CLIENTEDGE); m_Workspace.SetFont(AtlGetDefaultGuiFont()); m_pane.SetClient(m_Workspace); /* m_Editspace.Create(m_splitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); m_Editspace.SetFont(AtlGetDefaultGuiFont()); m_Editspace.SetTitleBarWindow(m_hWnd); m_splitter.SetSplitterPanes(m_pane, m_Editspace); */ m_Documents.Create(m_splitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); m_Documents.SetFont(AtlGetDefaultGuiFont()); m_Documents.SetTitleBarWindow(m_hWnd); m_splitter.SetSplitterPanes(m_pane, m_Documents); UpdateLayout(); m_splitter.SetSplitterPosPct(25); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); UISetCheck(ID_VIEW_TREEPANE, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); CMenuHandle menuMain = m_CmdBar.GetMenu(); // m_Editspace.SetWindowMenu(menuMain.GetSubMenu(WINDOW_MENU_POSITION)); m_Documents.SetWindowMenu(menuMain.GetSubMenu(WINDOW_MENU_POSITION)); //drag files DragAcceptFiles(TRUE); m_PluginManager.LoadPlugins(GetModulePath(_Module.m_hInst)+_T("\\plugins")); m_PluginManager.ConnectionAll(this,NULL); // FireWorkspaceNew(_T("Undefine Workspace")); // this->m_Solution.Open(_T("Undefine")); // this->m_Solution.m_projs.AddProject(_T("Undefine")); this->m_Solution.Create(_T("Undefine")); return 0; }