OSDN Git Service

A new feature "Ignored Substitutions" (7)
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 26 Jan 2021 07:10:47 +0000 (16:10 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 26 Jan 2021 07:10:47 +0000 (16:10 +0900)
17 files changed:
Src/DiffWrapper.cpp
Src/DirDoc.cpp
Src/FilterList.h
Src/IgnoredSubstitutionsDlg.cpp
Src/MainFrm.cpp
Src/Merge.rc
Src/Merge.vs2017.vcxproj
Src/Merge.vs2019.vcxproj
Src/MergeDoc.cpp
Src/MergeDocLineDiffs.cpp
Src/MergeEditView.cpp
Src/MergeEditView.h
Src/MergeLang.vs2017.vcxproj
Src/MergeLang.vs2019.vcxproj
Src/OptionsDef.h
Src/OptionsInit.cpp
Src/resource.h

index 5236939..71fed66 100644 (file)
 #include "parsers/crystallineparser.h"
 #include "SyntaxColors.h"
 #include "MergeApp.h"
-#include "OptionsMgr.h"
-#include "OptionsDef.h"
 #include "SubstitutionList.h"
-#include "stringdiffs.h"
-
-using namespace strdiff;
 
 using Poco::Debugger;
 using Poco::format;
index 82eb317..0ed5bbc 100644 (file)
@@ -205,8 +205,8 @@ void CDirDoc::LoadIgnoredSubstitutionsList(CDiffContext* pCtxt)
 {
        ASSERT(pCtxt != nullptr);
 
-       bool ignoredSubstitutionsAreEnabled = GetOptionsMgr()->GetBool(OPT_IGNORED_SUBSTITUTIONS_ARE_ENABLED);
-       if (!ignoredSubstitutionsAreEnabled || theApp.m_pIgnoredSubstitutionsList->GetCount() == 0)
+       bool ignoredSubstitutionsEnabled = GetOptionsMgr()->GetBool(OPT_IGNORED_SUBSTITUTIONS_ENABLED);
+       if (!ignoredSubstitutionsEnabled || theApp.m_pIgnoredSubstitutionsList->GetCount() == 0)
        {
                pCtxt->m_pSubstitutionList.reset();
                return;
index 8765030..ae8e2d1 100644 (file)
@@ -40,10 +40,8 @@ public:
        void AddRegExp(const std::string& regularExpression);
        void RemoveAllFilters();
        bool HasRegExps() const;
-       size_t GetCount() const { return m_list.size(); }
        bool Match(const std::string& string, int codepage = ucr::CP_UTF_8);
        const char * GetLastMatchExpression() const;
-       const filter_item& operator[](int index) const;
 
 private:
        std::vector <filter_item_ptr> m_list;
@@ -77,10 +75,3 @@ inline const char * FilterList::GetLastMatchExpression() const
 {
        return m_lastMatchExpression->c_str();
 }
-
-inline const filter_item& FilterList::operator[](int index) const
-{
-       const filter_item_ptr &item = m_list[index];
-       return *item;
-}
-
index 4f0735b..53b965e 100644 (file)
@@ -43,7 +43,7 @@ void IgnoredSubstitutionsDlg::DoDataExchange(CDataExchange* pDX)
 {
        CPropertyPage::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(IgnoredSubstitutionsFiltersDlg)
-       DDX_Check(pDX, IDC_IGNORED_SUSBSTITUTIONS_ARE_ENABLED, m_bEnabled);
+       DDX_Check(pDX, IDC_IGNORED_SUSBSTITUTIONS_ENABLED, m_bEnabled);
        DDX_Control(pDX, IDC_IGNORED_SUBSTITUTIONS_FILTER, m_listFilters);
        //}}AFX_DATA_MAP
 }
index 3fda437..0363c15 100644 (file)
@@ -1675,9 +1675,9 @@ void CMainFrame::OnToolsFilters()
        lineFilters->CloneFrom(theApp.m_pLineFilters.get());
        lineFiltersDlg.SetList(lineFilters.get());
 
-       const bool ignoredSubstitutionsAreEnabledOrig = GetOptionsMgr()->GetBool(OPT_IGNORED_SUBSTITUTIONS_ARE_ENABLED);
+       const bool ignoredSubstitutionsEnabledOrig = GetOptionsMgr()->GetBool(OPT_IGNORED_SUBSTITUTIONS_ENABLED);
 
-       ignoredSubstitutionsDlg.m_bEnabled = ignoredSubstitutionsAreEnabledOrig;
+       ignoredSubstitutionsDlg.m_bEnabled = ignoredSubstitutionsEnabledOrig;
        
        ignoredSubstitutions->CloneFrom(theApp.m_pIgnoredSubstitutionsList.get());
        ignoredSubstitutionsDlg.SetList(ignoredSubstitutions.get());
@@ -1708,8 +1708,8 @@ void CMainFrame::OnToolsFilters()
                bool linefiltersEnabled = lineFiltersDlg.m_bIgnoreRegExp;
                GetOptionsMgr()->SaveOption(OPT_LINEFILTER_ENABLED, linefiltersEnabled);
 
-               bool ignoredSubstitutionsAreEnabled = ignoredSubstitutionsDlg.m_bEnabled;
-               GetOptionsMgr()->SaveOption(OPT_IGNORED_SUBSTITUTIONS_ARE_ENABLED, ignoredSubstitutionsAreEnabled);
+               bool ignoredSubstitutionsEnabled = ignoredSubstitutionsDlg.m_bEnabled;
+               GetOptionsMgr()->SaveOption(OPT_IGNORED_SUBSTITUTIONS_ENABLED, ignoredSubstitutionsEnabled);
 
                // Check if compare documents need rescanning
                bool bFileCompareRescan = false;
@@ -1721,7 +1721,7 @@ void CMainFrame::OnToolsFilters()
                        if
                        (
                                   linefiltersEnabled != lineFiltersEnabledOrig
-                               || ignoredSubstitutionsAreEnabled != ignoredSubstitutionsAreEnabledOrig
+                               || ignoredSubstitutionsEnabled != ignoredSubstitutionsEnabledOrig
                                || !lineFilters->Compare(theApp.m_pLineFilters.get())
                                || !ignoredSubstitutions->Compare(theApp.m_pIgnoredSubstitutionsList.get())
                        )
@@ -1748,7 +1748,6 @@ void CMainFrame::OnToolsFilters()
                theApp.m_pIgnoredSubstitutionsList->CloneFrom(ignoredSubstitutions.get());
                theApp.m_pIgnoredSubstitutionsList->SaveFilters();
 
-
                if (bFileCompareRescan)
                {
                        for (auto pMergeDoc : GetAllMergeDocs())
index 15f4518..df6c2b0 100644 (file)
@@ -1186,7 +1186,7 @@ CAPTION "Ignored Substitutions"
 FONT 8, "MS Shell Dlg", 0, 0, 0x1\r
 BEGIN\r
     LTEXT           "The changes that appear on the panels as the listed pairs below will be ignored or marked as insignificant. Patches are unaffected.",IDC_STATIC,8,6,516,19\r
-    CONTROL         "Enable",IDC_IGNORED_SUSBSTITUTIONS_ARE_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,28,351,9\r
+    CONTROL         "Enable",IDC_IGNORED_SUSBSTITUTIONS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,28,351,9\r
     CONTROL         "",IDC_IGNORED_SUBSTITUTIONS_FILTER,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_EDITLABELS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,6,40,516,111\r
     PUSHBUTTON      "Add",IDC_LFILTER_ADDBTN,7,156,50,14\r
     PUSHBUTTON      "Remove",IDC_LFILTER_REMOVEBTN,63,156,50,14\r
index 17a38d2..5782ec0 100644 (file)
       <UserProperties RESOURCE_FILE="Merge.rc" />\r
     </VisualStudio>\r
   </ProjectExtensions>\r
-</Project>\r
+</Project>
\ No newline at end of file
index 53eb90e..bf4f71b 100644 (file)
       <UserProperties RESOURCE_FILE="Merge.rc" />\r
     </VisualStudio>\r
   </ProjectExtensions>\r
-</Project>\r
+</Project>
\ No newline at end of file
index 9a47bd2..7704c20 100644 (file)
@@ -303,7 +303,7 @@ int CMergeDoc::Rescan(bool &bBinary, IDENTLEVEL &identical,
                m_diffWrapper.SetFilterList(_T(""));
        }
 
-       if (GetOptionsMgr()->GetBool(OPT_IGNORED_SUBSTITUTIONS_ARE_ENABLED) && theApp.m_pIgnoredSubstitutionsList)
+       if (GetOptionsMgr()->GetBool(OPT_IGNORED_SUBSTITUTIONS_ENABLED) && theApp.m_pIgnoredSubstitutionsList)
        {
                m_diffWrapper.SetIgnoredSubstitutionsList(theApp.m_pIgnoredSubstitutionsList->MakeSubstitutionList());
        }
index 513f21e..5a403c0 100644 (file)
@@ -14,8 +14,6 @@
 #include "stringdiffs.h"
 #include "UnicodeString.h"
 #include "IgnoredSubstitutionsList.h"
-#include "OptionsMgr.h"
-#include "OptionsDef.h"
 #include "Merge.h"
 
 #ifdef _DEBUG
@@ -124,9 +122,6 @@ void CMergeDoc::AddToIgnoredSubstitutions(CMergeEditView* pView, bool bReversed)
                //Rescan();
        }
        return;
-       //for (int nGroup = 0; nGroup < m_nGroups; nGroup++)
-       //      for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
-       //              HighlightDiffRect(m_pView[nGroup][nBuffer], rc[nBuffer]);
 }
 
 static inline bool IsDiffPerLine(bool bTableEditing, const DIFFRANGE& cd)
index 3348516..174d4b9 100644 (file)
@@ -159,7 +159,7 @@ BEGIN_MESSAGE_MAP(CMergeEditView, CCrystalEditViewEx)
        ON_UPDATE_COMMAND_UI(ID_SELECTLINEDIFF, OnUpdateSelectLineDiff)
        ON_COMMAND(ID_SELECTPREVLINEDIFF, OnSelectLineDiff<true>)
        ON_UPDATE_COMMAND_UI(ID_SELECTPREVLINEDIFF, OnUpdateSelectLineDiff)
-       ON_COMMAND(ID_ADD_TO_IGNORED_SUBSTITUTIONS, OnAddToIgnoredSubstitutions<false>)
+       ON_COMMAND(ID_ADD_TO_IGNORED_SUBSTITUTIONS, OnAddToIgnoredSubstitutions)
        ON_UPDATE_COMMAND_UI(ID_ADD_TO_IGNORED_SUBSTITUTIONS, OnUpdateAddToIgnoredSubstitutions)
        ON_WM_CONTEXTMENU()
        ON_UPDATE_COMMAND_UI(ID_EDIT_REPLACE, OnUpdateEditReplace)
@@ -2798,11 +2798,10 @@ void CMergeEditView::OnUpdateSelectLineDiff(CCmdUI* pCmdUI)
        pCmdUI->Enable(!GetDocument()->IsEditedAfterRescan());
 }
 
-template<bool reversed>
 void CMergeEditView::OnAddToIgnoredSubstitutions()
 {
        // Pass this to the document, to compare this file to other
-       GetDocument()->AddToIgnoredSubstitutions(this, reversed);
+       GetDocument()->AddToIgnoredSubstitutions(this, false);
 }
 
 void CMergeEditView::OnUpdateAddToIgnoredSubstitutions(CCmdUI* pCmdUI)
@@ -2810,7 +2809,6 @@ void CMergeEditView::OnUpdateAddToIgnoredSubstitutions(CCmdUI* pCmdUI)
        pCmdUI->Enable(GetDocument()->m_nBuffers == 2 && !GetDocument()->IsEditedAfterRescan());
 }
 
-
 /**
  * @brief Enable/disable Replace-menuitem
  */
index f82f294..c46ade1 100644 (file)
@@ -283,7 +283,6 @@ protected:
        template<bool reversed>
        afx_msg void OnSelectLineDiff();
        afx_msg void OnUpdateSelectLineDiff(CCmdUI* pCmdUI);
-       template<bool reversed>
        afx_msg void OnAddToIgnoredSubstitutions();
        afx_msg void OnUpdateAddToIgnoredSubstitutions(CCmdUI* pCmdUI);
        afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
index 67ecc67..36ea1b2 100644 (file)
@@ -169,4 +169,4 @@ popd
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
index a299bac..f63b820 100644 (file)
@@ -168,4 +168,4 @@ popd
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
index 4d61e53..f4d0a33 100644 (file)
@@ -251,7 +251,7 @@ extern const String OPT_FILTER_USERPATH OP("Settings/UserFilterPath");
 extern const String OPT_FILEFILTER_SHARED OP("Settings/Filters/Shared");
 
 /// Ignored Susbstitutions
-extern const String OPT_IGNORED_SUBSTITUTIONS_ARE_ENABLED OP("Settings/IgnoredSubstitutionsAreEnabled");
+extern const String OPT_IGNORED_SUBSTITUTIONS_ENABLED OP("Settings/IgnoredSubstitutionsEnabled");
 
 // Archive support
 extern const String OPT_ARCHIVE_ENABLE OP("Merge7z/Enable");
index c93393e..e30f7fa 100644 (file)
@@ -166,7 +166,7 @@ void Init(COptionsMgr *pOptions)
        pOptions->InitOption(OPT_CUSTOM_TEMP_PATH, _T(""));
 
        pOptions->InitOption(OPT_LINEFILTER_ENABLED, false);
-       pOptions->InitOption(OPT_IGNORED_SUBSTITUTIONS_ARE_ENABLED, false);
+       pOptions->InitOption(OPT_IGNORED_SUBSTITUTIONS_ENABLED, false);
 
        pOptions->InitOption(OPT_FILEFILTER_CURRENT, _T("*.*"));
        // CMainFrame initializes this when it is empty.
index 99b8930..a39e45a 100644 (file)
 #define IDC_ALL_WHITE                   1027\r
 #define IDC_WHITE_CHANGE                1028\r
 #define IDC_WHITESPACE                  1029\r
-#define IDC_IGNORED_SUSBSTITUTIONS_ARE_ENABLED  1030\r
+#define IDC_IGNORED_SUSBSTITUTIONS_ENABLED 1030\r
 #define IDC_EOL_SENSITIVE               1032\r
 #define IDC_CP_SENSITIVE                1033\r
 #define IDC_DIFFERENCE_COLOR            1035\r
 #define IDS_IGNSUB_STR4                 34177\r
 #define IDS_IGNSUB_STR5                 34178\r
 #define ID_FILE_COMPARE_PROPERTIES      34181\r
-#define ID_FIRSTFILE                                   34182\r
-#define ID_PREVFILE                                            34183\r
-#define ID_NEXTFILE                                            34184\r
-#define ID_LASTFILE                                            34185\r
+#define ID_FIRSTFILE                    34182\r
+#define ID_PREVFILE                     34183\r
+#define ID_NEXTFILE                     34184\r
+#define ID_LASTFILE                     34185\r
+#define IDS_OCRRESULT_TEXTONLY          34186\r
+#define IDS_OCRRESULT_POS_LINE          34187\r
+#define IDS_OCRRESULT_POS_WORD          34188\r
 \r
 // Next default values for new objects\r
 // \r
 #ifndef APSTUDIO_READONLY_SYMBOLS\r
 #define _APS_3D_CONTROLS                     1\r
 #define _APS_NEXT_RESOURCE_VALUE        253\r
-#define _APS_NEXT_COMMAND_VALUE         34186\r
+#define _APS_NEXT_COMMAND_VALUE         34189\r
 #define _APS_NEXT_CONTROL_VALUE         8837\r
 #define _APS_NEXT_SYMED_VALUE           118\r
 #endif\r