OSDN Git Service

2005-05-31 Perry
authorPerry Rapp <elsapo@users.sourceforge.net>
Tue, 31 May 2005 16:11:57 +0000 (16:11 +0000)
committerPerry Rapp <elsapo@users.sourceforge.net>
Tue, 31 May 2005 16:11:57 +0000 (16:11 +0000)
 PATCH: [ 1206727 ] decouple codepage module from options files
  Src: codepage.cpp codepage.h MainFrm.cpp MainFrm.h
  Src/Common: LanguageSelect.cpp

Src/Common/LanguageSelect.cpp
Src/MainFrm.cpp
Src/MainFrm.h
Src/codepage.cpp
Src/codepage.h
Src/readme.txt

index 09cb20a..02c5cde 100644 (file)
@@ -7,7 +7,6 @@
 #include "resource.h"
 #include "LanguageSelect.h"
 #include "MainFrm.h"
-#include "codepage.h"
 #include <locale.h>
 
 // Escaped character constants in range 0x80-0xFF are interpreted in current codepage
@@ -587,7 +586,8 @@ void CLanguageSelect::OnOK()
        {
                SetLanguageOverride(lang);
 
-               updateDefaultCodepage(&mf->m_options);
+               CMainFrame * pMainFrame = dynamic_cast<CMainFrame *> ((CFrameWnd*)AfxGetApp()->m_pMainWnd);
+               pMainFrame->UpdateCodepageModule();
 
                // Update the current menu
                if (m_bReloadMenu)
index 46ac678..9eb37d2 100644 (file)
@@ -166,7 +166,7 @@ CMainFrame::CMainFrame()
        m_bFirstTime = TRUE;
        m_bEscShutdown = FALSE;
        OptionsInit(); // Implementation in OptionsInit.cpp
-       updateDefaultCodepage(&m_options);
+       UpdateCodepageModule();
 
        m_bShowErrors = TRUE;
        m_CheckOutMulti = FALSE;
@@ -1146,7 +1146,7 @@ void CMainFrame::OnOptions()
 
        if (rv == IDOK)
        {
-               updateDefaultCodepage(&m_options);
+               UpdateCodepageModule();
                // Call the wrapper to set m_bAllowMixedEol (the wrapper updates the registry)
                SetEOLMixed(m_options.GetBool(OPT_ALLOW_MIXED_EOL));
 
@@ -2842,3 +2842,14 @@ void CMainFrame::OnToolsLoadConfig()
        // set our current settings from configLog settings
        LoadConfigLog(configLog, m_options, m_lfDiff, FromConfigLog);
 }
+
+/**
+ * @brief Send current option settings into codepage module
+ */
+void
+CMainFrame::UpdateCodepageModule()
+{
+       // Get current codepage settings from the options module
+       // and push them into the codepage module
+       updateDefaultCodepage(m_options.GetInt(OPT_CP_DEFAULT_MODE), m_options.GetInt(OPT_CP_DEFAULT_CUSTOM));
+}
index ea77367..c074780 100644 (file)
@@ -119,6 +119,7 @@ public:
        void SelectFilter();
        void ShowVSSError(CException *e, CString strItem);
        void ShowHelp();
+       void UpdateCodepageModule();
 
 // Overrides
        // ClassWizard generated virtual function overrides
index f3846f2..426988c 100644 (file)
@@ -25,9 +25,7 @@
 // $Id$
 
 #include "stdafx.h"
-#include "OptionsMgr.h"
 #include "Merge.h"
-#include "OptionsDef.h"
 #include "codepage.h"
 #include "DirScan.h" // for DirScan_InitializeDefaultCodepage
 
@@ -56,12 +54,10 @@ static CMap<int, int, int, int> f_codepage_info_index;
 /**
  * @brief Update the appropriate default codepage
  */
-void updateDefaultCodepage(CRegOptions * options)
+void updateDefaultCodepage(int cpDefaultMode, int customCodepage)
 {
-       int nDefaultCPMode = options->GetInt(OPT_CP_DEFAULT_MODE);
-
        int wLangId;
-       switch (nDefaultCPMode)
+       switch (cpDefaultMode)
        {
                case 0:
                        f_nDefaultCodepage = GetACP();
@@ -75,7 +71,7 @@ void updateDefaultCodepage(CRegOptions * options)
                                f_nDefaultCodepage = GetACP();
                        break;
                case 2:
-                       f_nDefaultCodepage = options->GetInt(OPT_CP_DEFAULT_CUSTOM);
+                       f_nDefaultCodepage = customCodepage;
                        break;
                default:
                        // no other valid option
index 4f565d9..1f534f9 100644 (file)
@@ -9,7 +9,7 @@
 
 class CRegOptions;
 
-void updateDefaultCodepage(CRegOptions * options);
+void updateDefaultCodepage(int cpDefaultMode, int customCodepage);
 int getDefaultCodepage();
 
 bool isCodepageInstalled(int codepage);
index ead3ff3..358d1cb 100644 (file)
@@ -1,3 +1,8 @@
+2005-05-31 Perry
+ PATCH: [ 1206727 ] decouple codepage module from options files
+  Src: codepage.cpp codepage.h MainFrm.cpp MainFrm.h
+  Src/Common: LanguageSelect.cpp
+
 2005-05-27 Kimmo
  PATCH: [ 1209294 ] Remove running stampver-tool post-build
   Src: Merge.dsp