From: <td...@us...> - 2003-07-31 12:25:35
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1:/tmp/cvs-serv3537 Modified Files: MDITabs.cpp MDITabs.h OutputBar.cpp OutputBar.h Log Message: Fixed Office XP look issues.. Index: MDITabs.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/MDITabs.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MDITabs.cpp 29 Jul 2003 08:06:33 -0000 1.9 --- MDITabs.cpp 31 Jul 2003 12:25:32 -0000 1.10 *************** *** 1,27 **** - /********************************************************************* - Copyright (C) 2002 DeepSoft - M.Deepak - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source distribution. - - http://www.anyedit.org - M.Deepak - de...@an... - **********************************************************************/ - /****************************************************************************\ Datei : MDITabs.h --- 1,2 ---- *************** *** 62,65 **** --- 37,65 ---- m_MenuTab = 0; m_bPreview = FALSE; + + COLORREF clrBtnFace = ::GetSysColor(COLOR_BTNFACE); + BYTE nRed = 0, nGreen = 0, nBlue = 0, nMax = 0; + + nRed = GetRValue(clrBtnFace); + nGreen = GetGValue(clrBtnFace); + nBlue = GetBValue(clrBtnFace); + + nMax = (nRed > nGreen) ? ((nRed > nBlue) ? nRed : nBlue) : ((nGreen > nBlue) ? nGreen : nBlue); + const BYTE nMagicBackgroundOffset = (nMax > (0xFF - 35)) ? (BYTE)(0xFF - nMax) : (BYTE)35; + if(nMax == 0) + { + nRed = (BYTE)(nRed + nMagicBackgroundOffset); + nGreen = (BYTE)(nGreen + nMagicBackgroundOffset); + nBlue = (BYTE)(nBlue + nMagicBackgroundOffset); + } + else + { + nRed = (BYTE)(nRed + (nMagicBackgroundOffset*(nRed/(double)nMax) + 0.5)); + nGreen = (BYTE)(nGreen + (nMagicBackgroundOffset*(nGreen/(double)nMax) + 0.5)); + nBlue = (BYTE)(nBlue + (nMagicBackgroundOffset*(nBlue/(double)nMax) + 0.5)); + } + + m_clrBackground = RGB(nRed, nGreen, nBlue); + m_hbrBackground.CreateSolidBrush(m_clrBackground); } *************** *** 71,75 **** ON_WM_CONTEXTMENU() ON_WM_LBUTTONDBLCLK() ! //}}AFX_MSG_MAP ON_MESSAGE(WM_SIZEPARENT, OnSizeParent) END_MESSAGE_MAP() --- 71,75 ---- ON_WM_CONTEXTMENU() ON_WM_LBUTTONDBLCLK() ! //}}AFX_MSG_MAP ON_MESSAGE(WM_SIZEPARENT, OnSizeParent) END_MESSAGE_MAP() *************** *** 98,103 **** if (m_bTop) { ! pParams->rect.top += height; ! MoveWindow(pParams->rect.left, pParams->rect.top - height, m_width, m_height, true); } else --- 98,103 ---- if (m_bTop) { ! pParams->rect.top += height+1; ! MoveWindow(pParams->rect.left, pParams->rect.top - height-1, m_width, m_height, true); } else *************** *** 122,125 **** --- 122,126 ---- void CMDITabs::Update() { + SetRedraw(false); *************** *** 162,170 **** str.ReleaseBuffer(); //Stan - 2003-01-20 - otherwise a memory leak will happen // IAN : Add overlays as in WndTabs ! ! if (m_bImages) { if (i<9) { HIMAGELIST hilmTemp = ImageList_Merge(m_images, i, m_NumberOverlays, i, 0, 0); --- 163,171 ---- str.ReleaseBuffer(); //Stan - 2003-01-20 - otherwise a memory leak will happen // IAN : Add overlays as in WndTabs ! /*if (m_bImages) { if (i<9) { + HICON hIconOverlay = m_NumberOverlays.ExtractIcon(i); HIMAGELIST hilmTemp = ImageList_Merge(m_images, i, m_NumberOverlays, i, 0, 0); *************** *** 176,180 **** else m_images.Replace(i, (HICON)::GetClassLong(*it, GCL_HICONSM)); ! } SetItem(i, &item); if (*it == active) --- 177,181 ---- else m_images.Replace(i, (HICON)::GetClassLong(*it, GCL_HICONSM)); ! }*/ SetItem(i, &item); if (*it == active) *************** *** 191,196 **** item.mask = TCIF_TEXT|TCIF_PARAM|TCIF_IMAGE; ::GetWindowText(*it, text, 256); ! if (m_bImages) ! m_images.Add((HICON)::GetClassLong(*it, GCL_HICONSM)); item.iImage = i; item.lParam = LPARAM(*it); --- 192,197 ---- item.mask = TCIF_TEXT|TCIF_PARAM|TCIF_IMAGE; ::GetWindowText(*it, text, 256); ! //if (m_bImages) ! // m_images.Add((HICON)::GetClassLong(*it, GCL_HICONSM)); item.iImage = i; item.lParam = LPARAM(*it); *************** *** 225,310 **** DWORD light = ::GetSysColor(COLOR_3DLIGHT); ! // Special preparations for spin-buttons (in case there are more tabs than fit into the window) ! // extend borders and prevent system from overdrawing our new pixels ! /*if (m_bTop) { ! ::SetPixel(dc, m_width - 5, m_height - 8, hilight); ! ::SetPixel(dc, m_width - 5, m_height - 7, light); ! ::SetPixel(dc, m_width - 6, m_height - 8, hilight); ! ::SetPixel(dc, m_width - 6, m_height - 7, light); ! ::ExcludeClipRect(dc, 0, m_height - 6, m_width, m_height - 2); ! ::ExcludeClipRect(dc, m_width - 6, m_height - 8, m_width - 2, m_height - 6); ! } else { ! ::SetPixel(dc, m_width - 5, 2, shadow); ! ::SetPixel(dc, m_width - 5, 3, dark); ! ::SetPixel(dc, m_width - 6, 2, shadow); ! ::SetPixel(dc, m_width - 6, 3, dark); ! ::ExcludeClipRect(dc, 0, 0, m_width, 2); ! ::ExcludeClipRect(dc, m_width - 6, 2, m_width - 2, 4); ! }*/ ! // windows should draw the control as usual ! _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); ! pThreadState->m_lastSentMsg.wParam = WPARAM(HDC(dc)); ! Default(); ! // extend the horizontal border to the left margin ! if (m_bTop) ! { ! ::SetPixel(dc, 0, m_height - 8, hilight); ! ::SetPixel(dc, 0, m_height - 7, light); ! } ! else ! { ! ::SetPixel(dc, 0, 2, shadow); ! } ! //special decos for bottom tabs ! if(!m_bTop) ! { ! HDC hdc = ::GetWindowDC(m_hWnd); ! CRect rectt; ! rectt.left = 1; ! rectt.top = m_bTop ? 2 : -2; ! rectt.right = m_width; ! rectt.bottom = rectt.top+4; ! DrawEdge(hdc, rectt, EDGE_ETCHED,BF_BOTTOM); ! rectt.bottom = rectt.top+5; ! DrawEdge(hdc, rectt, EDGE_SUNKEN ,BF_BOTTOM); ! } ! // special drawing if the leftmost tab is selected ! CRect rect; ! GetItemRect(GetCurSel(), rect); ! if (rect.left == 2) // is at the leftmost position a tab selected? ! { ! // if yes, remove the leftmost white line and extend the bottom border of the tab ! int j = m_bImages ? 1 : 0; ! HPEN pen = ::CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DFACE)); ! HGDIOBJ old = ::SelectObject(dc, pen); ! ::MoveToEx(dc, 0, 2, NULL); ! ::LineTo(dc, 0, 22 + j); ! ::MoveToEx(dc, 1, 2, NULL); ! ::LineTo(dc, 1, 22 + j); ! ::SelectObject(dc, old); ! ::DeleteObject(pen); ! if (m_bTop) ! { ! ::SetPixel(dc, 0, 0, hilight); ! ::SetPixel(dc, 1, 0, hilight); ! ::SetPixel(dc, 0, 1, light); ! ::SetPixel(dc, 1, 1, light); ! } ! else ! { ! ::SetPixel(dc, 0, 22 + j, shadow); ! ::SetPixel(dc, 1, 22 + j, shadow); ! ::SetPixel(dc, 0, 23 + j, dark); ! ::SetPixel(dc, 1, 23 + j, dark); ! } ! } - dc.DeleteDC(); } --- 226,297 ---- DWORD light = ::GetSysColor(COLOR_3DLIGHT); ! ! ! CRect rectCli; ! GetClientRect(&rectCli); ! CBrush btnbrush(::GetSysColor(COLOR_BTNFACE)); ! dc.FillRect(rectCli,&m_hbrBackground); ! CRect rect; ! GetItemRect(GetCurSel(), rect); ! rect.bottom+=2; ! dc.FillRect(rect,&btnbrush); ! rectCli.top = rectCli.bottom - 3; ! dc.FillRect(rectCli,&btnbrush); ! ! CPen penLight (PS_SOLID, 1, ::GetSysColor (COLOR_3DHILIGHT)); ! CPen penDkGray (PS_SOLID, 1, ::GetSysColor (COLOR_3DDKSHADOW)); ! CPen penGray (PS_SOLID, 1, ::GetSysColor (COLOR_3DSHADOW)); ! ! CPen* pOldPen = NULL; ! pOldPen = (CPen*) dc.SelectObject (&penLight); ! dc.MoveTo(rect.left,rect.bottom-1); ! dc.LineTo(rect.left,rect.top); ! dc.LineTo(rect.right,rect.top); ! ! dc.MoveTo(rectCli.left,rectCli.top); ! dc.LineTo(rect.left,rect.bottom-1); ! dc.MoveTo(rect.right,rect.bottom-1); ! dc.LineTo(rectCli.right,rectCli.top); ! dc.SelectObject (&penDkGray); ! dc.MoveTo(rect.right,rect.top); ! dc.LineTo(rect.right,rect.bottom); ! dc.SelectObject (&penGray); ! TCITEM tcItem; ! tcItem.mask = TCIF_TEXT; ! ! DRAWITEMSTRUCT drawItemStruct; ! ! for(int i=0;i<GetItemCount();i++) ! { ! ! ! drawItemStruct.hDC=dc.GetSafeHdc(); ! drawItemStruct.itemID=i; ! ! GetItemRect(i,rect); ! drawItemStruct.rcItem=rect; ! dc.SetBkColor(::GetSysColor(COLOR_BTNFACE)); ! ! if(i!=GetCurSel()) ! { ! if(i!=(GetCurSel()-1)) ! { ! dc.MoveTo(rect.right,rect.top+3); ! dc.LineTo(rect.right,rect.bottom-1); ! } ! dc.SetBkColor(m_clrBackground); ! } ! ! DrawItem(&drawItemStruct); ! } ! dc.SetBkColor(::GetSysColor(COLOR_BTNFACE)); ! dc.SelectObject (pOldPen); } *************** *** 427,430 **** --- 414,473 ---- ::ShowWindow(hWnd, SW_MAXIMIZE); } + } + + void CMDITabs::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct ) + { + + CDC dc; + dc.Attach(lpDrawItemStruct->hDC); + + char buf[255]; + int nCurItem = lpDrawItemStruct->itemID; + + CFont * oldFont; + + if(nCurItem==GetCurSel()) + { + oldFont=(CFont *)dc.SelectObject(m_fontbold); + } + else + { + oldFont=(CFont *)dc.SelectObject(m_font); + } + + TCITEM tcitem; + //Get text of item. + tcitem.mask=TCIF_TEXT; + tcitem.pszText =buf; + tcitem.cchTextMax=sizeof(buf); + GetItem(nCurItem,&tcitem); + + CRect rect=lpDrawItemStruct->rcItem; + rect.OffsetRect(1,4); + + ::DrawText(lpDrawItemStruct->hDC,buf,-1,&rect,DT_CENTER); + dc.Detach(); + } + + + void CMDITabs::PreSubclassWindow() + { + CTabCtrl::PreSubclassWindow(); + + NONCLIENTMETRICS nclim; + nclim.cbSize=sizeof(NONCLIENTMETRICS); + ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, + sizeof(NONCLIENTMETRICS), + &nclim,0); + m_hMenuFont= ::CreateFontIndirect(&nclim.lfMenuFont); + + NONCLIENTMETRICS metrics; + metrics.cbSize = sizeof(metrics); + ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &metrics, 0); + + m_font.CreateFontIndirect(&metrics.lfStatusFont); + metrics.lfStatusFont.lfWeight = FW_BOLD; + m_fontbold.CreateFontIndirect(&metrics.lfStatusFont); + } Index: MDITabs.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/MDITabs.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MDITabs.h 8 May 2003 12:00:56 -0000 1.3 --- MDITabs.h 31 Jul 2003 12:25:32 -0000 1.4 *************** *** 34,37 **** --- 34,38 ---- }; + /****************************************************************************\ CMdiTabs: Deklaration *************** *** 58,62 **** BOOL m_bImages; BOOL m_bTop; ! BOOL m_bPreview; CImageList m_NumberOverlays; --- 59,67 ---- BOOL m_bImages; BOOL m_bTop; ! BOOL m_bPreview; ! CFont m_font,m_fontbold; ! HFONT m_hMenuFont; ! CBrush m_hbrBackground; ! COLORREF m_clrBackground; CImageList m_NumberOverlays; *************** *** 72,80 **** m_bPreview = bPreview; }; // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMDITabs) ! //}}AFX_VIRTUAL // Implementation --- 77,89 ---- m_bPreview = bPreview; }; + protected: + virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMDITabs) ! protected: ! virtual void PreSubclassWindow(); ! //}}AFX_VIRTUAL // Implementation *************** *** 89,93 **** afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); ! //}}AFX_MSG afx_msg LRESULT OnSizeParent(WPARAM, LPARAM lParam); --- 98,102 ---- afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); ! //}}AFX_MSG afx_msg LRESULT OnSizeParent(WPARAM, LPARAM lParam); Index: OutputBar.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/OutputBar.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** OutputBar.cpp 31 Jul 2003 08:57:48 -0000 1.10 --- OutputBar.cpp 31 Jul 2003 12:25:32 -0000 1.11 *************** *** 89,93 **** // Create tabs window: if (!m_wndTabs.Create (CBCGTabWnd::STYLE_3D, ! rectClient, this, 101)) { TRACE0("Failed to create output tab window\n"); --- 89,93 ---- // Create tabs window: if (!m_wndTabs.Create (CBCGTabWnd::STYLE_3D, ! rectClient, this, 102)) { TRACE0("Failed to create output tab window\n"); *************** *** 99,103 **** // Create output panes: ! const DWORD dwStyle = LBS_USETABSTOPS|LBS_HASSTRINGS|LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL; m_wndOutputBuild.Create (dwStyle, rectClient, &m_wndTabs, 1); --- 99,103 ---- // Create output panes: ! const DWORD dwStyle = WS_HSCROLL|LBS_USETABSTOPS|LBS_HASSTRINGS|LBS_NOINTEGRALHEIGHT|WS_CHILD|WS_VISIBLE|WS_VSCROLL; m_wndOutputBuild.Create (dwStyle, rectClient, &m_wndTabs, 1); *************** *** 121,124 **** --- 121,129 ---- m_wndOutputFind2.SetOwner (this); + m_wndEdit.Create (WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_AUTOHSCROLL|ES_AUTOVSCROLL|WS_VSCROLL|WS_HSCROLL|ES_WANTRETURN, rectClient, &m_wndTabs, 5); + m_wndEdit.SetFont (&m_Font); + m_wndEdit.SetTabStops(4); + m_wndEdit.SetOwner (this); + // Fill view context (dummy code, don't seek here something magic :-)): FillBuildWindow (); *************** *** 130,133 **** --- 135,139 ---- m_wndTabs.AddTab (&m_wndOutputFind1, _T("Find in Files 1"), 2); m_wndTabs.AddTab (&m_wndOutputFind2, _T("Find in Files 2"), 3); + m_wndTabs.AddTab (&m_wndEdit, _T("Edit"), 3); return 0; *************** *** 215,222 **** { CListBox::OnWindowPosChanging(lpwndpos); - - // Hide horizontal scrollbar: - ShowScrollBar (SB_HORZ, FALSE); - ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME); } --- 221,224 ---- Index: OutputBar.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/OutputBar.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OutputBar.h 8 May 2003 12:00:56 -0000 1.5 --- OutputBar.h 31 Jul 2003 12:25:32 -0000 1.6 *************** *** 130,133 **** --- 130,134 ---- COutputList m_wndOutputFind1; COutputList m_wndOutputFind2; + CEdit m_wndEdit; |