OSDN Git Service

EditorFilepathBar.*: Remove CEditorFilepathBar::LookLikeThisWnd() function
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sat, 28 May 2016 15:10:11 +0000 (00:10 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sat, 28 May 2016 15:10:11 +0000 (00:10 +0900)
Src/ChildFrm.cpp
Src/DirFrame.cpp
Src/EditorFilepathBar.cpp
Src/EditorFilepathBar.h

index 99c6be2..c98bb14 100644 (file)
@@ -520,10 +520,6 @@ void CChildFrame::UpdateHeaderSizes()
                        }
                }
 
-               // prepare file path bar to look as a status bar
-               if (m_wndFilePathBar.LookLikeThisWnd(&m_wndStatusBar) == TRUE)
-                       RecalcLayout();
-
                // resize controls in header dialog bar
                m_wndFilePathBar.Resize(w);
 
index 114630d..13c5a22 100644 (file)
@@ -193,10 +193,6 @@ void CDirFrame::ActivateFrame(int nCmdShow)
                nCmdShow = SW_SHOWNORMAL;
 
        CMDIChildWnd::ActivateFrame(nCmdShow);
-
-       // prepare file path bar to look as a status bar
-       if (m_wndFilePathBar.LookLikeThisWnd(&m_wndStatusBar) == TRUE)
-               RecalcLayout();
 }
 
 /**
index 5dcc65c..15f1627 100644 (file)
@@ -64,10 +64,22 @@ BOOL CEditorFilePathBar::Create(CWnd* pParentWnd)
                        CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY, CEditorFilePathBar::IDD))
                return FALSE;
 
+       NONCLIENTMETRICS ncm = { sizeof NONCLIENTMETRICS };
+       if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof NONCLIENTMETRICS, &ncm, 0))
+       {
+               m_pFont.reset(new CFont());
+               if (m_pFont)
+                       m_pFont->CreateFontIndirect(&ncm.lfStatusFont);
+       }
+
        // subclass the two custom edit boxes
        for (int pane = 0; pane < countof(m_Edit); pane++)
+       {
                m_Edit[pane].SubClassEdit(IDC_STATIC_TITLE_PANE0 + pane, this);
-
+               if (m_pFont)
+                       m_Edit[pane].SetFont(m_pFont.get());
+               m_Edit[pane].SetMargins(4, 4);
+       }
        return TRUE;
 };
 
@@ -87,49 +99,6 @@ void CEditorFilePathBar::SetPaneCount(int nPanes)
        m_nPanes = nPanes;
 }
 
-/**
- * @brief Set look of headerbars similar to other window.
- *
- * @param [in] pWnd Pointer to window we want to imitate
- * @return TRUE if parent must recompute layout
- */
-BOOL CEditorFilePathBar::LookLikeThisWnd(const CWnd * pWnd)
-{
-       // Update font. Note that we must delete previous font
-       // before creating a new one.
-       CFont * pFont = pWnd->GetFont();
-       if (pFont)
-       {
-               m_pFont.reset(new CFont);
-               if (m_pFont != NULL)
-               {
-                       LOGFONT lfFont = {0};
-                       if (pFont->GetLogFont(&lfFont))
-                       {
-                               m_pFont->CreateFontIndirect(&lfFont);
-                               for (int pane = 0; pane < m_nPanes; pane++)
-                               {
-                                       m_Edit[pane].SetFont(m_pFont.get());
-                                       m_Edit[pane].SetMargins(4, 4);
-                               }
-                       }
-               }
-       }
-
-       // Set same dimensions (than window we imitate)
-       CRect rectNew;
-       pWnd->GetWindowRect(rectNew);
-       CRect rectCurrent;
-       GetWindowRect(rectCurrent);
-       if (rectNew != rectCurrent)
-       {
-               SetWindowPos(NULL,0,0,rectNew.Width(), rectNew.Height(),
-                       SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE);     
-               return TRUE;
-       }
-       return FALSE;
-}
-
 /** 
  * @brief Resize both controls to an equal size.
  */
index ad661ba..5f26425 100644 (file)
@@ -59,7 +59,6 @@ public :
 // Dialog Data
        enum { IDD = IDD_EDITOR_HEADERBAR };
        
-       BOOL LookLikeThisWnd(const CWnd * pWnd);
        void Resize();
        void Resize(int widths[]);