]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Prep for KfW conversion to ribbon toolbar
authorKevin Wasserman <kevin.wasserman@painless-security.com>
Tue, 3 Apr 2012 11:02:43 +0000 (07:02 -0400)
committerTom Yu <tlyu@mit.edu>
Mon, 27 Aug 2012 23:27:29 +0000 (19:27 -0400)
Upgrade classes: CWinApp->CWinAppEx, CFrameWnd->CFrameWndEx,
CStatusBar->CMFCStatusBar, CToolBar->CMFCToolBar.
Call AfxOleInit() from CLeashApp::InitInstance()
Do not call LoadBarState() (crashes)
or GetToolBarCtrl() (no longer exists)

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>
(cherry picked from commit 7a53399722e129ed9c00f0c37d0c20c0387c829d)

ticket: 7244
status: resolved

src/windows/leash/Leash.cpp
src/windows/leash/Leash.h
src/windows/leash/LeashFrame.cpp
src/windows/leash/LeashFrame.h
src/windows/leash/LeashView.cpp
src/windows/leash/MainFrm.cpp
src/windows/leash/MainFrm.h
src/windows/leash/StdAfx.h

index 0ee617ab57724ddb9c8bde1a6c5a2747f2957ef9..9c187c17464b87b05d4d5431fcf1dc41e98345b8 100644 (file)
@@ -166,6 +166,7 @@ extern "C" {
 
 BOOL CLeashApp::InitInstance()
 {
+    AfxOleInit();
     // NOTE: Not used at this time
     /// Set LEASH_DLL to the path where the Leash.exe is
     char modulePath[MAX_PATH];
index 13b14381a67ea63f1741c5c2b546db70a62a9590..377f0fc7a83edf4a801220f0b34a3ab6715f58aa 100644 (file)
@@ -92,7 +92,7 @@
 // See Leash.cpp for the implementation of this class
 //
 
-class CLeashApp : public CWinApp
+class CLeashApp : public CWinAppEx
 {
 private:
        CString         m_leashDLL;
index f7e4b56e8f945c3be54782ed64ac763e58db6603..224783304708aa76313816d0eb03fd696d65e45d 100644 (file)
@@ -31,9 +31,9 @@ const char CLeashFrame::s_profileMax[] = "max";
 const char CLeashFrame::s_profileTool[] = "tool";
 const char CLeashFrame::s_profileStatus[] = "status";
 
-IMPLEMENT_DYNAMIC(CLeashFrame, CFrameWnd)
+IMPLEMENT_DYNAMIC(CLeashFrame, CFrameWndEx)
 
-BEGIN_MESSAGE_MAP(CLeashFrame, CFrameWnd)
+BEGIN_MESSAGE_MAP(CLeashFrame, CFrameWndEx)
        //{{AFX_MSG_MAP(CLeashFrame)
        ON_WM_DESTROY()
        //}}AFX_MSG_MAP
@@ -101,7 +101,7 @@ void CLeashFrame::OnDestroy()
 
        SaveBarState(AfxGetApp()->m_pszProfileName);
 
-       CFrameWnd::OnDestroy();
+       CFrameWndEx::OnDestroy();
 }
 
 ///////////////////////////////////////////////////////////////
@@ -112,8 +112,7 @@ void CLeashFrame::ActivateFrame(int nCmdShow)
        {
                m_bFirstTime = FALSE;
 
-        LoadBarState(AfxGetApp()->m_pszProfileName);
     }
 
-       CFrameWnd::ActivateFrame(nCmdShow);
+       CFrameWndEx::ActivateFrame(nCmdShow);
 }
index 6d45e78266f3cef49b66cdf8d24650f10f74c201..9e17587a144a34d4b5ef7ea908b5ad533feeeedb 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef _LEASH_PERSISTENT_FRAME
 #define _LEASH_PERSISTENT_FRAME
 
-class CLeashFrame : public CFrameWnd
+class CLeashFrame : public CFrameWndEx
 { // remembers where it was on the desktop
        DECLARE_DYNAMIC(CLeashFrame)
     static const CRect s_rectDefault;
index 163f4632e20925c5895a21d5747733f6b17acba0..bc5d48ebc9e84d4a313e7b0fd75646ce2d770d57 100644 (file)
@@ -1269,7 +1269,7 @@ VOID CLeashView::OnUpdateDisplay()
         m_tvinsert.item.iSelectedImage = NONE_PARENT_NODE;
         m_hPrincipal = m_pTree->InsertItem(&m_tvinsert);
 
-        if (CMainFrame::m_wndToolBar)
+/*        if (CMainFrame::m_wndToolBar)
         {
             CToolBarCtrl *_toolBar = NULL;
             CToolBarCtrl& toolBar = CMainFrame::m_wndToolBar.GetToolBarCtrl();
@@ -1284,12 +1284,13 @@ VOID CLeashView::OnUpdateDisplay()
                            MB_OK|MB_ICONSTOP);
             }
         }
+*/
     }
     else
     {
         // We have some tickets
         m_pTree->SetItemText(m_hPrincipal, sPrincipal);
-
+/*
         if (CMainFrame::m_wndToolBar)
         {
             CToolBarCtrl *_toolBar = NULL;
@@ -1304,6 +1305,7 @@ VOID CLeashView::OnUpdateDisplay()
                 AfxMessageBox("There is a problem with the Leash Toolbar!", MB_OK|MB_ICONSTOP);
             }
         }
+*/
     }
     ReleaseMutex(ticketinfo.lockObj);
 }
index fe1472c9976da4dac6458ecd90e591cc51759929..2332a1b8b39a9d9c5a21eee284a345f6904aa64e 100644 (file)
@@ -33,8 +33,8 @@ static char THIS_FILE[] = __FILE__;
 #define MIN_RIGHT        530
 #define MIN_BOTTOM       280
 
-CStatusBar CMainFrame::m_wndStatusBar;
-CToolBar   CMainFrame::m_wndToolBar;
+CMFCStatusBar CMainFrame::m_wndStatusBar;
+CMFCToolBar   CMainFrame::m_wndToolBar;
 CImageList CMainFrame::m_imageList;
 CImageList CMainFrame::m_disabledImageList;
 BOOL      CMainFrame::m_isMinimum;
@@ -124,67 +124,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
                return -1;      // fail to create
        }
 
-    // Create an image list of Icons so that we can use the best color
-    // depth available on the system and then assign this new list to
-    // be used instead of the single bitmap file assigned to the toolbar
-    // in the resource file
-    CToolBarCtrl *_toolBar = NULL;
-    CToolBarCtrl& toolBar = CMainFrame::m_wndToolBar.GetToolBarCtrl();
-    HICON      hIcon[7];
-    int n;
-
-    for (n = 0; n < 7; n++)
-    {
-        hIcon[n] = NULL;
-    }
-
-    UINT bitsPerPixel = GetDeviceCaps( ::GetDC(::GetDesktopWindow()), BITSPIXEL);
-    UINT ilcColor;
-    if ( bitsPerPixel >= 32 )
-        ilcColor = ILC_COLOR32;
-    else if ( bitsPerPixel >= 24 )
-        ilcColor = ILC_COLOR24;
-    else if ( bitsPerPixel >= 16 )
-        ilcColor = ILC_COLOR16;
-    else if ( bitsPerPixel >= 8 )
-        ilcColor = ILC_COLOR8;
-    else
-        ilcColor = ILC_COLOR;
-
-    m_imageList.Create(18, 18, ilcColor | ILC_MASK, 8, 4);
-    m_imageList.SetBkColor(GetSysColor(COLOR_BTNFACE));
-
-    hIcon[0] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_INIT);
-    hIcon[1] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_RENEW);
-    hIcon[2] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_IMPORT);
-    hIcon[3] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_DESTROY);
-    hIcon[4] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_PASSWORD);
-    hIcon[5] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_REFRESH);
-    hIcon[6] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_SYNC);
-
-    for (n = 0; n < 7; n++)
-    {
-        m_imageList.Add(hIcon[n]);
-    }
-    toolBar.SetImageList(&m_imageList);
-
-    m_disabledImageList.Create(18, 18, ilcColor | ILC_MASK, 8, 4);
-    m_disabledImageList.SetBkColor(GetSysColor(COLOR_INACTIVECAPTIONTEXT));
-
-    hIcon[0] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_INIT_DISABLED);
-    hIcon[1] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_RENEW_DISABLED);
-    hIcon[2] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_IMPORT_DISABLED);
-    hIcon[3] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_DESTROY_DISABLED);
-    hIcon[4] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_PASSWORD_DISABLED);
-    hIcon[5] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_REFRESH_DISABLED);
-    hIcon[6] = AfxGetApp()->LoadIcon(IDI_TOOLBAR_SYNC_DISABLED);
-
-    for (n = 0; n < 7; n++)
-    {
-        m_disabledImageList.Add(hIcon[n]);
-    }
-    toolBar.SetDisabledImageList(&m_disabledImageList);
-
        if (!m_wndStatusBar.Create(this) ||
                !m_wndStatusBar.SetIndicators(indicators,
                  (CLeashApp::m_hAfsDLL ? 4 : 3)))
@@ -196,13 +135,13 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
        }
 
        // TODO: Remove this if you don't want tool tips or a resizeable toolbar
-       m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
+       m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() |
                                     CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
 
        // TODO: Delete these three lines if you don't want the toolbar to
        //  be dockable
-       m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
-       EnableDocking(CBRS_ALIGN_ANY);
+//     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
+//     EnableDocking(CBRS_ALIGN_ANY);
        //DockControlBar(&m_wndToolBar);
 
        return 0;
index 1ccfcfd6bda898489a25869d41342be9e331acdd..2d35bfd77ed72562a123c1d567b0f34d53bc0a63 100644 (file)
@@ -39,8 +39,8 @@ protected: // create from serialization only
 // Attributes
 public:
        static int         m_whatSide;
-    static CStatusBar  m_wndStatusBar;
-       static CToolBar    m_wndToolBar;
+    static CMFCStatusBar  m_wndStatusBar;
+       static CMFCToolBar    m_wndToolBar;
        static BOOL                m_isMinimum;
     static BOOL        m_isBeingResized;
     static CImageList  m_imageList;
index 8717508ec3032037513361e5ac1e9294c38ed336..aa3b90ef0b825517cb9d54a2b887aecb42ee78de 100644 (file)
@@ -21,6 +21,7 @@
 #include "htmlhelp.h"
 
 #endif // _AFX_NO_AFXCMN_SUPPORT
+#include <afxcontrolbars.h>
 
 //{{AFX_INSERT_LOCATION}}
 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.