Fixed issue #1619: TortoiseGitMerge: Ribbon UI/toolbars can be toggled
authorSven Strickroth <email@cs-ware.de>
Thu, 31 Jan 2013 21:32:59 +0000 (31 22:32 +0100)
committerSven Strickroth <email@cs-ware.de>
Thu, 31 Jan 2013 21:32:59 +0000 (31 22:32 +0100)
Signed-off-by: Sven Strickroth <email@cs-ware.de>
src/Changelog.txt
src/Resources/Toolbar.bmp
src/Resources/TortoiseMergeENG.rc
src/TortoiseMerge/MainFrm.cpp
src/TortoiseMerge/MainFrm.h
src/TortoiseMerge/SetMainPage.cpp
src/TortoiseMerge/SetMainPage.h
src/TortoiseMerge/resource.h

index 52e0306..208efeb 100644 (file)
@@ -10,6 +10,7 @@ Released: unreleased
  * Fixed issue #1611: Changing Search criteria with empty search field refreshes log content\r
  * Fixed issue #1620: Apply Patch serial can't open file dialog on WinXP\r
  * Fixed issue #1533: Could not parse git.exe version number\r
+ * Fixed issue #1619: TortoiseGitMerge: Ribbon UI/toolbars can be toggled\r
 \r
 = Release 1.8.0.0 =\r
 Released: 2013-01-27\r
dissimilarity index 72%
index c4f217a..58b47cf 100644 (file)
Binary files a/src/Resources/Toolbar.bmp and b/src/Resources/Toolbar.bmp differ
index 84d37f9..609901e 100644 (file)
@@ -199,6 +199,7 @@ BEGIN
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,56,236,10\r
     CONTROL         "Show linenumber&s",IDC_LINENUMBERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,67,236,10\r
     CONTROL         "Add new files automatically to Git",IDC_AUTOADD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,79,236,10\r
+    CONTROL         "Use Ribbons",IDC_USERIBBONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,90,236,10\r
     LTEXT           "&Tab size:",IDC_STATIC,15,118,54,8\r
     EDITTEXT        IDC_TABSIZE,80,115,41,14,ES_AUTOHSCROLL | ES_NUMBER\r
     LTEXT           "&Font:",IDC_STATIC,15,135,52,8\r
@@ -344,6 +345,160 @@ END
 \r
 /////////////////////////////////////////////////////////////////////////////\r
 //\r
+// Bitmap\r
+//\r
+\r
+IDR_MAINFRAME           BITMAP                  "Toolbar.bmp"\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Toolbar\r
+//\r
+\r
+IDR_MAINFRAME TOOLBAR 16, 16\r
+BEGIN\r
+    BUTTON      ID_FILE_OPEN\r
+    BUTTON      ID_FILE_SAVE\r
+    SEPARATOR\r
+    BUTTON      ID_FILE_RELOAD\r
+    BUTTON      ID_EDIT_UNDO\r
+    SEPARATOR\r
+    BUTTON      ID_NAVIGATE_PREVIOUSDIFFERENCE\r
+    BUTTON      ID_NAVIGATE_NEXTDIFFERENCE\r
+    BUTTON      ID_NAVIGATE_PREVIOUSCONFLICT\r
+    BUTTON      ID_NAVIGATE_NEXTCONFLICT\r
+    SEPARATOR\r
+    BUTTON      ID_EDIT_USELEFTBLOCK\r
+    SEPARATOR\r
+    BUTTON      ID_EDIT_USETHEIRBLOCK\r
+    BUTTON      ID_EDIT_USEMYBLOCK\r
+    BUTTON      ID_EDIT_USETHEIRTHENMYBLOCK\r
+    BUTTON      ID_EDIT_USEMINETHENTHEIRBLOCK\r
+    SEPARATOR\r
+    BUTTON      ID_EDIT_MARKASRESOLVED\r
+    SEPARATOR\r
+    BUTTON      ID_VIEW_WHITESPACES\r
+    BUTTON      ID_VIEW_WRAPLONGLINES\r
+    SEPARATOR\r
+    BUTTON      ID_VIEW_INLINEDIFF\r
+    BUTTON      ID_VIEW_INLINEDIFFWORD\r
+    BUTTON      ID_VIEW_COMPAREWHITESPACES\r
+    BUTTON      ID_VIEW_IGNOREWHITESPACECHANGES\r
+    BUTTON      ID_VIEW_IGNOREALLWHITESPACECHANGES\r
+    SEPARATOR\r
+    BUTTON      ID_VIEW_ONEWAYDIFF\r
+    BUTTON      ID_VIEW_SWITCHLEFT\r
+    BUTTON      ID_VIEW_COLLAPSED\r
+    BUTTON      ID_VIEW_SHOWFILELIST\r
+    SEPARATOR\r
+    BUTTON      ID_VIEW_OPTIONS\r
+    SEPARATOR\r
+    BUTTON      ID_HELP\r
+END\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Menu\r
+//\r
+\r
+IDR_MAINFRAME MENU\r
+BEGIN\r
+    POPUP "&File"\r
+    BEGIN\r
+        MENUITEM "Open",                        ID_FILE_OPEN\r
+        MENUITEM "Save",                        ID_FILE_SAVE\r
+        MENUITEM "Save &as...",                 ID_FILE_SAVE_AS\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "Reload",                      ID_FILE_RELOAD\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "E&xit",                       ID_APP_EXIT\r
+    END\r
+    POPUP "&Edit"\r
+    BEGIN\r
+        MENUITEM "&Undo",                       ID_EDIT_UNDO\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "&Copy",                       ID_EDIT_COPY\r
+        MENUITEM "&Paste",                      ID_EDIT_PASTE\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "Use left block",              ID_EDIT_USELEFTBLOCK\r
+        MENUITEM "Use left file",               ID_EDIT_USELEFTFILE\r
+        MENUITEM "Use block from left before right", ID_EDIT_USEBLOCKFROMLEFTBEFORERIGHT\r
+        MENUITEM "Use block from right before left", ID_EDIT_USEBLOCKFROMRIGHTBEFORELEFT\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "Use 'theirs' text block",     ID_EDIT_USETHEIRBLOCK\r
+        MENUITEM "Use 'mine' text block",       ID_EDIT_USEMYBLOCK\r
+        MENUITEM "Use 'theirs' text block then 'mine'", ID_EDIT_USETHEIRTHENMYBLOCK\r
+        MENUITEM "Use 'mine' text block then 'theirs'", ID_EDIT_USEMINETHENTHEIRBLOCK\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "Find",                        ID_EDIT_FIND\r
+        MENUITEM "Goto Line",                   ID_EDIT_GOTOLINE\r
+        MENUITEM "Mark as resolved",            ID_EDIT_MARKASRESOLVED\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "Create patch file",           ID_EDIT_CREATEUNIFIEDDIFFFILE\r
+    END\r
+    POPUP "&Navigate"\r
+    BEGIN\r
+        MENUITEM "Next difference",             ID_NAVIGATE_NEXTDIFFERENCE\r
+        MENUITEM "Previous difference",         ID_NAVIGATE_PREVIOUSDIFFERENCE\r
+        MENUITEM "Next conflict",               ID_NAVIGATE_NEXTCONFLICT\r
+        MENUITEM "Previous conflict",           ID_NAVIGATE_PREVIOUSCONFLICT\r
+        MENUITEM "Next inline difference",      ID_NAVIGATE_NEXTINLINEDIFF\r
+        MENUITEM "Previous inline difference",  ID_NAVIGATE_PREVINLINEDIFF\r
+    END\r
+    POPUP "&View"\r
+    BEGIN\r
+        MENUITEM "&Toolbar",                    ID_VIEW_TOOLBAR\r
+        MENUITEM "&Status Bar",                 ID_VIEW_STATUS_BAR\r
+        MENUITEM "Line diff bar",               ID_VIEW_LINEDIFFBAR, CHECKED\r
+        MENUITEM "Locator Bar",                 ID_VIEW_LOCATORBAR\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "Wrap long lines",             ID_VIEW_WRAPLONGLINES\r
+        MENUITEM "&Moved blocks",               ID_VIEW_MOVEDBLOCKS\r
+        MENUITEM "Inline diff",                 ID_VIEW_INLINEDIFF\r
+        MENUITEM "Inline diff word-wise",       ID_VIEW_INLINEDIFFWORD\r
+        MENUITEM "Compare whitespaces",         ID_VIEW_COMPAREWHITESPACES\r
+        MENUITEM "Ignore whitespace changes",   ID_VIEW_IGNOREWHITESPACECHANGES\r
+        MENUITEM "Ignore all whitespace changes", ID_VIEW_IGNOREALLWHITESPACECHANGES\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "Show Whitespaces",            ID_VIEW_WHITESPACES\r
+        MENUITEM "Switch between single and double pane view", ID_VIEW_ONEWAYDIFF\r
+        MENUITEM "Switch left and right view",  ID_VIEW_SWITCHLEFT\r
+        MENUITEM "Collapse",                    ID_VIEW_COLLAPSED\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "Settings",                    ID_VIEW_OPTIONS\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "Hide/Show the patch file list", ID_VIEW_SHOWFILELIST\r
+        MENUITEM SEPARATOR\r
+        POPUP "Style"\r
+        BEGIN\r
+            MENUITEM "Windows 2000",                ID_VIEW_APPLOOK_WIN_2000\r
+            MENUITEM "Office XP",                   ID_VIEW_APPLOOK_OFF_XP\r
+            MENUITEM "Windows XP",                  ID_VIEW_APPLOOK_WIN_XP\r
+            MENUITEM "Office 2003",                 ID_VIEW_APPLOOK_OFF_2003\r
+            MENUITEM "Visual Studio 2005",          ID_VIEW_APPLOOK_VS_2005\r
+            MENUITEM "Visual Studio 2008",          ID_VIEW_APPLOOK_VS_2008\r
+            MENUITEM "Windows 7",                   ID_VIEW_APPLOOK_WIN7\r
+            POPUP "Office 2007 colors"\r
+            BEGIN\r
+                MENUITEM "Blue Style",                  ID_VIEW_APPLOOK_OFF_2007_BLUE\r
+                MENUITEM "Black Style",                 ID_VIEW_APPLOOK_OFF_2007_BLACK\r
+                MENUITEM "Silver Style",                ID_VIEW_APPLOOK_OFF_2007_SILVER\r
+                MENUITEM "Aqua Style",                  ID_VIEW_APPLOOK_OFF_2007_AQUA\r
+            END\r
+        END\r
+    END\r
+    POPUP "&Help"\r
+    BEGIN\r
+        MENUITEM "&Help Topics",                ID_HELP\r
+        MENUITEM SEPARATOR\r
+        MENUITEM "&About TortoiseMerge...",     ID_APP_ABOUT\r
+    END\r
+END\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
 // Accelerator\r
 //\r
 \r
@@ -427,17 +582,6 @@ IDR_RIBBON              RT_RIBBON_XML           "ribbon.mfcribbon-ms"
 \r
 /////////////////////////////////////////////////////////////////////////////\r
 //\r
-// Menu\r
-//\r
-\r
-IDR_MAINFRAME MENU\r
-BEGIN\r
-    MENUITEM "&File",                       0\r
-END\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
 // String Table\r
 //\r
 \r
index aa2213b..68732cd 100644 (file)
@@ -169,6 +169,7 @@ CMainFrame::CMainFrame()
        , m_regOneWay(L"Software\\TortoiseGitMerge\\OnePane")\r
        , m_regCollapsed(L"Software\\TortoiseGitMerge\\Collapsed", 0)\r
        , m_regInlineDiff(L"Software\\TortoiseGitMerge\\DisplayBinDiff", TRUE)\r
+       , m_regUseRibbons(L"Software\\TortoiseGitMerge\\UseRibbons", TRUE)\r
 {\r
        m_bOneWay = (0 != ((DWORD)m_regOneWay));\r
        theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_VS_2005);\r
@@ -176,6 +177,7 @@ CMainFrame::CMainFrame()
        m_bViewMovedBlocks = !!(DWORD)m_regViewModedBlocks;\r
        m_bWrapLines = !!(DWORD)m_regWrapLines;\r
        m_bInlineDiff = !!m_regInlineDiff;\r
+       m_bUseRibbons = !!m_regUseRibbons;\r
        CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE;\r
 }\r
 \r
@@ -197,18 +199,38 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
 \r
        OnApplicationLook(theApp.m_nAppLook);\r
 \r
-       m_wndRibbonBar.Create (this);\r
-       m_wndRibbonBar.LoadFromResource(IDR_RIBBON);\r
-\r
-       // enable the dialog launch button on the view panel\r
-       CMFCRibbonCategory * pMainCat = m_wndRibbonBar.GetCategory(1);\r
-       if (pMainCat)\r
+       if (m_bUseRibbons)\r
        {\r
-               CMFCRibbonPanel * pPanel = pMainCat->GetPanel(3);\r
-               if (pPanel)\r
-                       pPanel->EnableLaunchButton(ID_VIEW_OPTIONS);\r
+               m_wndRibbonBar.Create(this);\r
+               m_wndRibbonBar.LoadFromResource(IDR_RIBBON);\r
+\r
+               // enable the dialog launch button on the view panel\r
+               CMFCRibbonCategory * pMainCat = m_wndRibbonBar.GetCategory(1);\r
+               if (pMainCat)\r
+               {\r
+                       CMFCRibbonPanel * pPanel = pMainCat->GetPanel(3);\r
+                       if (pPanel)\r
+                               pPanel->EnableLaunchButton(ID_VIEW_OPTIONS);\r
+               }\r
        }\r
+       else\r
+       {\r
+               if (!m_wndMenuBar.Create(this))\r
+               {\r
+                       TRACE0("Failed to create menubar\n");\r
+                       return -1; // fail to create\r
+               }\r
+               m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);\r
 \r
+               // prevent the menu bar from taking the focus on activation\r
+               CMFCPopupMenu::SetForceMenuFocus(FALSE);\r
+               if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))\r
+               {\r
+                       TRACE0("Failed to create toolbar\n");\r
+                       return -1; // fail to create\r
+               }\r
+               m_wndToolBar.SetWindowText(_T("Main"));\r
+       }\r
        if (!m_wndStatusBar.Create(this) ||\r
                !m_wndStatusBar.SetIndicators(indicators,\r
                  _countof(indicators)))\r
@@ -233,6 +255,13 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
        m_wndLineDiffBar.m_pMainFrm = this;\r
 \r
        EnableDocking(CBRS_ALIGN_ANY);\r
+       if (!m_bUseRibbons)\r
+       {\r
+               m_wndMenuBar.EnableDocking(CBRS_ALIGN_TOP);\r
+               m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP);\r
+               DockPane(&m_wndMenuBar);\r
+               DockPane(&m_wndToolBar);\r
+       }\r
        DockPane(&m_wndLocatorBar);\r
        DockPane(&m_wndLineDiffBar);\r
        ShowPane(&m_wndLocatorBar, true, false, true);\r
index 12cc799..1a5596f 100644 (file)
@@ -1,5 +1,6 @@
 // TortoiseGitMerge - a Diff/Patch program\r
 \r
+// Copyright (C) 2013 - TortoiseGit\r
 // Copyright (C) 2006-2012 - TortoiseSVN\r
 \r
 // This program is free software; you can redistribute it and/or\r
@@ -192,6 +193,7 @@ protected:
        bool                    m_bInlineDiff;\r
        bool                    m_bLineDiff;\r
        bool                    m_bLocatorBar;\r
+       bool                    m_bUseRibbons;\r
 \r
        CMFCRibbonBar                           m_wndRibbonBar;\r
        CMFCRibbonApplicationButton     m_MainButton;\r
@@ -201,6 +203,7 @@ protected:
        CRegDWORD               m_regOneWay;\r
        CRegDWORD               m_regCollapsed;\r
        CRegDWORD               m_regInlineDiff;\r
+       CRegDWORD               m_regUseRibbons;\r
 public:\r
        CLeftView *             m_pwndLeftView;\r
        CRightView *    m_pwndRightView;\r
@@ -218,4 +221,8 @@ public:
        HWND                    resolveMsgWnd;\r
        WPARAM                  resolveMsgWParam;\r
        LPARAM                  resolveMsgLParam;\r
+\r
+       const CMFCToolBar *   GetToolbar() const { return &m_wndToolBar; }\r
+       CMFCMenuBar     m_wndMenuBar;\r
+       CMFCToolBar     m_wndToolBar;\r
 };
\ No newline at end of file
index 235bd11..1e7ef17 100644 (file)
@@ -1,5 +1,6 @@
 // TortoiseGitMerge - a Diff/Patch program\r
 \r
+// Copyright (C) 2013 - TortoiseGit\r
 // Copyright (C) 2006-2010, 2012 - TortoiseSVN\r
 \r
 // This program is free software; you can redistribute it and/or\r
@@ -57,6 +58,7 @@ CSetMainPage::CSetMainPage()
        m_regUTF8Default = CRegDWORD(_T("Software\\TortoiseGitMerge\\UseUTF8"), FALSE);\r
        m_regAutoAdd = CRegDWORD(_T("Software\\TortoiseGitMerge\\AutoAdd"), TRUE);\r
        m_regMaxInline = CRegDWORD(_T("Software\\TortoiseGitMerge\\InlineDiffMaxLineLength"), 3000);\r
+       m_regUseRibbons = CRegDWORD(L"Software\\TortoiseGitMerge\\UseRibbons", TRUE);\r
 \r
        m_bBackup = m_regBackup;\r
        m_bFirstDiffOnLoad = m_regFirstDiffOnLoad;\r
@@ -69,6 +71,7 @@ CSetMainPage::CSetMainPage()
        m_bUTF8Default = m_regUTF8Default;\r
        m_bAutoAdd = m_regAutoAdd;\r
        m_nMaxInline = m_regMaxInline;\r
+       m_bUseRibbons = m_regUseRibbons;\r
 }\r
 \r
 CSetMainPage::~CSetMainPage()\r
@@ -99,6 +102,7 @@ void CSetMainPage::DoDataExchange(CDataExchange* pDX)
        DDX_Check(pDX, IDC_UTF8DEFAULT, m_bUTF8Default);\r
        DDX_Check(pDX, IDC_AUTOADD, m_bAutoAdd);\r
        DDX_Text(pDX, IDC_MAXINLINE, m_nMaxInline);\r
+       DDX_Check(pDX, IDC_USERIBBONS, m_bUseRibbons);\r
 }\r
 \r
 void CSetMainPage::SaveData()\r
@@ -116,6 +120,7 @@ void CSetMainPage::SaveData()
        m_regUTF8Default = m_bUTF8Default;\r
        m_regAutoAdd = m_bAutoAdd;\r
        m_regMaxInline = m_nMaxInline;\r
+       m_regUseRibbons = m_bUseRibbons;\r
 }\r
 \r
 BOOL CSetMainPage::OnApply()\r
@@ -149,6 +154,7 @@ BOOL CSetMainPage::OnInitDialog()
        m_bUTF8Default = m_regUTF8Default;\r
        m_bAutoAdd = m_regAutoAdd;\r
        m_nMaxInline = m_regMaxInline;\r
+       m_bUseRibbons = m_regUseRibbons;\r
 \r
        DialogEnableWindow(IDC_FIRSTCONFLICTONLOAD, m_bFirstDiffOnLoad);\r
 \r
@@ -196,6 +202,7 @@ BEGIN_MESSAGE_MAP(CSetMainPage, CPropertyPage)
        ON_BN_CLICKED(IDC_UTF8DEFAULT, &CSetMainPage::OnModified)\r
        ON_BN_CLICKED(IDC_AUTOADD, &CSetMainPage::OnModified)\r
        ON_EN_CHANGE(IDC_MAXINLINE, &CSetMainPage::OnModifiedWithReload)\r
+       ON_BN_CLICKED(IDC_USERIBBONS, &CSetMainPage::OnModified)\r
 END_MESSAGE_MAP()\r
 \r
 \r
index 4be5a83..19a8e5d 100644 (file)
@@ -1,5 +1,6 @@
 // TortoiseGitMerge - a Diff/Patch program\r
 \r
+// Copyright (C) 2013 - TortoiseGit\r
 // Copyright (C) 2006-2010 - TortoiseSVN\r
 \r
 // This program is free software; you can redistribute it and/or\r
@@ -79,6 +80,8 @@ protected:
        CRegDWORD               m_regAutoAdd;\r
        int                             m_nMaxInline;\r
        CRegDWORD               m_regMaxInline;\r
+       BOOL                    m_bUseRibbons;\r
+       CRegDWORD               m_regUseRibbons;\r
 \r
        CRegDWORD               m_regFontSize;\r
        DWORD                   m_dwFontSize;\r
index 2a335c0..2c82336 100644 (file)
 #define IDC_LIMITTODIFFS                1065\r
 #define IDC_AUTOADD                     1065\r
 #define IDC_WHOLEWORD                   1066\r
+#define IDC_USERIBBONS                  1066\r
 #define IDC_RESOLVE                     1067\r
 #define IDC_CASEINSENSITIVE             1067\r
 #define IDC_USEBDIFF                    1068\r