OSDN Git Service

[ 818198 ] Colors for "ignore blank lines"
authorLaurent Ganier <laoran@users.sourceforge.net>
Wed, 8 Oct 2003 18:25:50 +0000 (18:25 +0000)
committerLaurent Ganier <laoran@users.sourceforge.net>
Wed, 8 Oct 2003 18:25:50 +0000 (18:25 +0000)
Src/MainFrm.cpp
Src/Merge.cpp
Src/Merge.h
Src/Merge.rc
Src/MergeDoc.cpp
Src/MergeEditView.cpp
Src/PropColors.cpp
Src/PropColors.h
Src/readme.txt
Src/resource.h

index 7803d4e..0307cfd 100644 (file)
@@ -711,7 +711,8 @@ void CMainFrame::OnOptions()
        CPropGeneral gen;
        CPropSyntax syn;
        CPropFilter filter(&fileFilters, selectedFilter);
-       CPropColors colors(theApp.GetDiffColor(), theApp.GetSelDiffColor(), theApp.GetDiffDeletedColor(), theApp.GetSelDiffDeletedColor(), theApp.GetDiffTextColor(), theApp.GetSelDiffTextColor());
+       CPropColors colors(theApp.GetDiffColor(), theApp.GetSelDiffColor(), theApp.GetDiffDeletedColor(), theApp.GetSelDiffDeletedColor(), 
+                          theApp.GetDiffTextColor(), theApp.GetSelDiffTextColor(), theApp.GetTrivialColor(), theApp.GetTrivialDeletedColor());
        CPropRegistry regpage;
        sht.AddPage(&gen);
        sht.AddPage(&syn);
@@ -767,6 +768,8 @@ void CMainFrame::OnOptions()
                theApp.SetSelDiffDeletedColor(colors.m_clrSelDiffDeleted);
                theApp.SetDiffTextColor(colors.m_clrDiffText);
                theApp.SetSelDiffTextColor(colors.m_clrSelDiffText);
+               theApp.SetTrivialColor(colors.m_clrTrivial);
+               theApp.SetTrivialDeletedColor(colors.m_clrTrivialDeleted);
 
                theApp.WriteProfileInt(_T("Settings"), _T("VersionSystem"), m_nVerSys);
                theApp.WriteProfileInt(_T("Settings"), _T("ScrollToFirst"), m_bScrollToFirst);
index 5930435..4af2e2b 100644 (file)
@@ -92,6 +92,8 @@ CMergeApp::CMergeApp()
 , m_clrSelDiffDeleted(RGB(240, 192, 192))
 , m_clrDiffText(RGB(0,0,0))
 , m_clrSelDiffText(RGB(0,0,0))
+, m_clrTrivial(RGB(251,242,191))
+, m_clrTrivialDeleted(RGB(233,233,233))
 , m_bNeedIdleTimer(FALSE)
 , m_pDiffTemplate(0)
 , m_pDirTemplate(0)
@@ -167,6 +169,8 @@ BOOL CMergeApp::InitInstance()
        m_clrSelDiffDeleted     = GetProfileInt(_T("Settings"), _T("SelectedDifferenceDeletedColor"), m_clrSelDiffDeleted);
        m_clrDiffText           = GetProfileInt(_T("Settings"), _T("DifferenceTextColor"), m_clrDiffText);
        m_clrSelDiffText        = GetProfileInt(_T("Settings"), _T("SelectedDifferenceTextColor"), m_clrSelDiffText);
+       m_clrTrivial        = GetProfileInt(_T("Settings"), _T("TrivialDifferenceColor"), m_clrTrivial);
+       m_clrTrivialDeleted = GetProfileInt(_T("Settings"), _T("TrivialDifferenceDeletedColor"), m_clrTrivialDeleted);
 
        // CG: The following block was added by the Splash Screen component.
        {
@@ -649,6 +653,8 @@ int CMergeApp::ExitInstance()
        WriteProfileInt(_T("Settings"), _T("SelectedDifferenceDeletedColor"), m_clrSelDiffDeleted);
        WriteProfileInt(_T("Settings"), _T("DifferenceTextColor"), m_clrDiffText);
        WriteProfileInt(_T("Settings"), _T("SelectedDifferenceTextColor"), m_clrSelDiffText);
+       WriteProfileInt(_T("Settings"), _T("TrivialDifferenceColor"), m_clrTrivial);
+       WriteProfileInt(_T("Settings"), _T("TrivialDifferenceDeletedColor"), m_clrTrivialDeleted);
        
        delete m_fileFilterMgr;
 
index 1a3b23c..111157a 100644 (file)
@@ -67,6 +67,8 @@ public:
        COLORREF        m_clrSelDiffDeleted;    // The selected difference deleted color
        COLORREF        m_clrDiffText;                  // The difference text color
        COLORREF        m_clrSelDiffText;               // The selected difference text color
+       COLORREF        m_clrTrivial;        // The ignored lines color
+       COLORREF        m_clrTrivialDeleted; // The ignored and deleted lines color
        BOOL m_bNeedIdleTimer;
        CMultiDocTemplate* m_pDiffTemplate;
        CMultiDocTemplate* m_pDirTemplate;
@@ -79,12 +81,16 @@ public:
        COLORREF GetSelDiffDeletedColor() const { return m_clrSelDiffDeleted; }
        COLORREF GetDiffTextColor() const { return m_clrDiffText; }
        COLORREF GetSelDiffTextColor() const { return m_clrSelDiffText; }
+       COLORREF GetTrivialColor() const { return m_clrTrivial; }
+       COLORREF GetTrivialDeletedColor() const { return m_clrTrivialDeleted; }
        void SetDiffColor(COLORREF clrValue) { m_clrDiff = clrValue; }
        void SetSelDiffColor(COLORREF clrValue) { m_clrSelDiff = clrValue; }
        void SetDiffDeletedColor(COLORREF clrValue) { m_clrDiffDeleted = clrValue; }
        void SetSelDiffDeletedColor(COLORREF clrValue) { m_clrSelDiffDeleted = clrValue; }
        void SetDiffTextColor(COLORREF clrValue) { m_clrDiffText = clrValue; }
        void SetSelDiffTextColor(COLORREF clrValue) { m_clrSelDiffText = clrValue; }
+       void SetTrivialColor(COLORREF clrValue) { m_clrTrivial = clrValue; }
+       void SetTrivialDeletedColor(COLORREF clrValue) { m_clrTrivialDeleted = clrValue; }
        void SetNeedIdleTimer();
        CString GetFileFilterPath() const { return m_sFileFilterPath; }
        void SetFileFilterPath(LPCTSTR szFileFilterPath);
index 7c4e81b..d849157 100644 (file)
@@ -526,6 +526,13 @@ BEGIN
                     BS_OWNERDRAW | WS_TABSTOP,184,49,17,14,WS_EX_TRANSPARENT |
                     WS_EX_CLIENTEDGE
     LTEXT           "Text",IDC_STATIC,184,15,15,8
+    CONTROL         "Dif",IDC_TRIVIAL_DIFF_COLOR,"Button",BS_OWNERDRAW | 
+                    WS_TABSTOP,98,69,17,14,WS_EX_TRANSPARENT | 
+                    WS_EX_CLIENTEDGE
+    LTEXT           "Ignored Difference:",IDC_STATIC,17,69,62,8
+    CONTROL         "Dif",IDC_TRIVIAL_DIFF_DELETED_COLOR,"Button",
+                    BS_OWNERDRAW | WS_TABSTOP,141,69,17,14,WS_EX_TRANSPARENT | 
+                    WS_EX_CLIENTEDGE
 END
 
 IDD_OUTPUT DIALOG DISCARDABLE  0, 0, 278, 157
index 93dd9b6..6ef609d 100644 (file)
@@ -1707,7 +1707,10 @@ void CMergeDoc::PrimeTextBuffers()
                                        {
                                                int idx = curDiff.blank0+b;
                                                m_ltBuf.InsertLine(NULL, 0, idx);
+                                               // ghost lines opposite to trivial lines are ghost and trivial
                                                m_ltBuf.SetLineFlag(idx, LF_GHOST, TRUE, FALSE, FALSE);
+                                               if (curDiff.op == OP_TRIVIAL)
+                                                       m_ltBuf.SetLineFlag(idx, LF_TRIVIAL, TRUE, FALSE, FALSE);
                                                curDiff.dend0++;
                                                LeftExtras++;
                                        }
@@ -1735,7 +1738,10 @@ void CMergeDoc::PrimeTextBuffers()
                                        {
                                                int idx = curDiff.blank1+b;
                                                m_rtBuf.InsertLine(NULL, 0, idx);
+                                               // ghost lines opposite to trivial lines are ghost and trivial
                                                m_rtBuf.SetLineFlag(idx, LF_GHOST, TRUE, FALSE, FALSE);
+                                               if (curDiff.op == OP_TRIVIAL)
+                                                       m_rtBuf.SetLineFlag(idx, LF_TRIVIAL, TRUE, FALSE, FALSE);
                                                curDiff.dend1++;
                                                ++RightExtras;
                                        }
index 7e989b0..4e840f5 100644 (file)
@@ -262,23 +262,25 @@ void CMergeEditView::GetLineColors(int nLineIndex, COLORREF & crBkgnd,
                        }
                        return;
                }
-               else if (dwLineFlags & LF_GHOST)
+               else if (dwLineFlags & LF_TRIVIAL)
                {
-                       if (lineInCurrentDiff)
-                               crBkgnd = theApp.GetSelDiffDeletedColor();
+                       // trivial diff can not be selected
+                       if (dwLineFlags & LF_GHOST)
+                               // ghost lines in trivial diff has their own color
+                               crBkgnd = theApp.GetTrivialDeletedColor();
                        else
-                               crBkgnd = theApp.GetDiffDeletedColor();
+                               crBkgnd = theApp.GetTrivialColor();
                        return;
                }
-               else if (dwLineFlags & LF_TRIVIAL)
+               else if (dwLineFlags & LF_GHOST)
                {
-                       // TODO: Use trivial color when trivial color implemented
                        if (lineInCurrentDiff)
                                crBkgnd = theApp.GetSelDiffDeletedColor();
                        else
                                crBkgnd = theApp.GetDiffDeletedColor();
                        return;
                }
+
        }
        else
        {
index 212bef9..99b0b2c 100644 (file)
@@ -17,10 +17,12 @@ static const TCHAR Section[] = _T("Custom Colors");
 // CPropColors dialog
 
 
-CPropColors::CPropColors( COLORREF clrDiff, COLORREF clrSelDiff, COLORREF clrDiffDeleted, COLORREF clrSelDiffDeleted, COLORREF clrDiffText, COLORREF clrSelDiffText)
+CPropColors::CPropColors( COLORREF clrDiff, COLORREF clrSelDiff, COLORREF clrDiffDeleted, COLORREF clrSelDiffDeleted, COLORREF clrDiffText, COLORREF clrSelDiffText, COLORREF clrTrivial, COLORREF clrTrivialDeleted)
        : CPropertyPage(CPropColors::IDD),
-               m_clrDiff(clrDiff), m_clrSelDiff(clrSelDiff), m_clrDiffDeleted(clrDiffDeleted), m_clrSelDiffDeleted(clrSelDiffDeleted), m_clrDiffText(clrDiffText), m_clrSelDiffText(clrSelDiffText),
-               m_cDiff(clrDiff), m_cSelDiff(clrSelDiff), m_cDiffDeleted(clrDiffDeleted), m_cSelDiffDeleted(clrSelDiffDeleted), m_cDiffText(clrDiffText), m_cSelDiffText(clrSelDiffText)
+               m_clrDiff(clrDiff), m_clrSelDiff(clrSelDiff), m_clrDiffDeleted(clrDiffDeleted), m_clrSelDiffDeleted(clrSelDiffDeleted), 
+               m_clrDiffText(clrDiffText), m_clrSelDiffText(clrSelDiffText), m_clrTrivial(clrTrivial), m_clrTrivialDeleted(clrTrivialDeleted),
+               m_cDiff(clrDiff), m_cSelDiff(clrSelDiff), m_cDiffDeleted(clrDiffDeleted), m_cSelDiffDeleted(clrSelDiffDeleted), 
+               m_cDiffText(clrDiffText), m_cSelDiffText(clrSelDiffText), m_cTrivial(clrTrivial), m_cTrivialDeleted(clrTrivialDeleted)
 {
        //{{AFX_DATA_INIT(CPropColors)
                // NOTE: the ClassWizard will add member initialization here
@@ -32,6 +34,8 @@ void CPropColors::DoDataExchange(CDataExchange* pDX)
 {
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CPropColors)
+       DDX_Control(pDX, IDC_TRIVIAL_DIFF_DELETED_COLOR, m_cTrivialDeleted);
+       DDX_Control(pDX, IDC_TRIVIAL_DIFF_COLOR, m_cTrivial);
        DDX_Control(pDX, IDC_SEL_DIFFERENCE_TEXT_COLOR, m_cSelDiffText);
        DDX_Control(pDX, IDC_DIFFERENCE_TEXT_COLOR, m_cDiffText);
        DDX_Control(pDX, IDC_SEL_DIFFERENCE_DELETED_COLOR, m_cSelDiffDeleted);
@@ -50,6 +54,8 @@ BEGIN_MESSAGE_MAP(CPropColors, CDialog)
        ON_BN_CLICKED(IDC_SEL_DIFFERENCE_COLOR, OnSelDifferenceColor)
        ON_BN_CLICKED(IDC_DIFFERENCE_TEXT_COLOR, OnDifferenceTextColor)
        ON_BN_CLICKED(IDC_SEL_DIFFERENCE_TEXT_COLOR, OnSelDifferenceTextColor)
+       ON_BN_CLICKED(IDC_TRIVIAL_DIFF_COLOR, OnTrivialDiffColor)
+       ON_BN_CLICKED(IDC_TRIVIAL_DIFF_DELETED_COLOR, OnTrivialDiffDeletedColor)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
@@ -140,6 +146,34 @@ void CPropColors::OnSelDifferenceTextColor()
        SaveCustomColors();
 }
 
+void CPropColors::OnTrivialDiffColor() 
+{
+       CColorDialog dialog(m_clrTrivial);
+       LoadCustomColors();
+       dialog.m_cc.lpCustColors = m_cCustColors;
+       
+       if (dialog.DoModal() == IDOK)
+       {
+               m_clrTrivial = dialog.GetColor();
+               m_cTrivial.SetColor(m_clrTrivial);
+       }
+       SaveCustomColors();     
+}
+
+void CPropColors::OnTrivialDiffDeletedColor() 
+{
+       CColorDialog dialog(m_clrTrivialDeleted);
+       LoadCustomColors();
+       dialog.m_cc.lpCustColors = m_cCustColors;
+       
+       if (dialog.DoModal() == IDOK)
+       {
+               m_clrTrivialDeleted = dialog.GetColor();
+               m_cTrivialDeleted.SetColor(m_clrTrivialDeleted);
+       }
+       SaveCustomColors();
+}
+
 void CPropColors::LoadCustomColors()
 {
        for (int i = 0; i < CustomColorsAmount; i++)
index f2e237d..0cf9a8a 100644 (file)
@@ -19,11 +19,13 @@ class CPropColors : public CPropertyPage
 // Construction
 public:
 
-       CPropColors(COLORREF clrDiff, COLORREF clrSelDiff, COLORREF clrDiffDeleted, COLORREF clrSelDiffDeleted, COLORREF clrDiffText, COLORREF clrSelDiffText);   // standard constructor
+       CPropColors(COLORREF clrDiff, COLORREF clrSelDiff, COLORREF clrDiffDeleted, COLORREF clrSelDiffDeleted, COLORREF clrDiffText, COLORREF clrSelDiffText, COLORREF clrTrivial, COLORREF clrTrivialDeleted);   // standard constructor
 
 // Dialog Data
        //{{AFX_DATA(CPropColors)
        enum { IDD = IDD_PROPPAGE_COLORS };
+       CColorButton    m_cTrivialDeleted;
+       CColorButton    m_cTrivial;
        CColorButton    m_cSelDiffText;
        CColorButton    m_cDiffText;
        CColorButton    m_cSelDiffDeleted;
@@ -39,6 +41,8 @@ public:
        COLORREF        m_clrSelDiffDeleted;
        COLORREF        m_clrDiffText;
        COLORREF        m_clrSelDiffText;
+       COLORREF        m_clrTrivial;
+       COLORREF        m_clrTrivialDeleted;
 
        // Overrides
        // ClassWizard generated virtual function overrides
@@ -63,6 +67,8 @@ protected:
        afx_msg void OnSelDifferenceColor();
        afx_msg void OnDifferenceTextColor();
        afx_msg void OnSelDifferenceTextColor();
+       afx_msg void OnTrivialDiffColor();
+       afx_msg void OnTrivialDiffDeletedColor();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 };
index a1bd5e2..7be3664 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-08 Laoran
+ PATCH: [ 818198 ] Colors for "ignore blank lines"
+  WinMerge: MainFrm.cpp Merge.cpp Merge.h Merge.rc MergeDoc.cpp MergeEditView.cpp PropColors.cpp 
+   PropColors.h resource.h
+
 2003-10-08 Kimmo
  PATCH: [ 819188 ] Show column number in statusbar
   WinMerge: ChildFrm.h ChildFrm.cpp Merge.rc MergeEditStatus.h MergeEditView.cpp
index 9308053..cbbc511 100644 (file)
 #define IDC_DIFF_BROWSE_FILE2           1075
 #define IDC_DIFF_BROWSE_RESULT          1076
 #define IDC_DIFF_APPENDFILE             1077
+#define IDC_TRIVIAL_DIFF_COLOR          1078
+#define IDC_TRIVIAL_DIFF_DELETED_COLOR  1079
 #define IDS_NUM_REPLACED                8501
 #define IDS_EDIT_TEXT_NOT_FOUND         8502
 #define IDS_LINE_STATUS_INFO_EOL        8503
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        118
 #define _APS_NEXT_COMMAND_VALUE         32848
-#define _APS_NEXT_CONTROL_VALUE         1078
+#define _APS_NEXT_CONTROL_VALUE         1080
 #define _APS_NEXT_SYMED_VALUE           108
 #endif
 #endif