OSDN Git Service

Fix bugs related to the setting modes on the properties dialog.
authorKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Mon, 20 Jun 2011 07:38:25 +0000 (16:38 +0900)
committerKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Mon, 20 Jun 2011 07:38:25 +0000 (16:38 +0900)
- The setting modes for default and dialogs are initially set to the
  default mode.
- The default key assignments are used after the setting mode
  reverts from the specific mode to the default mode.
- The setting mode can't revert from the disable mode to the default mode.

xkeymacs/profile.cpp

index ff158c9..3133f7c 100644 (file)
@@ -579,18 +579,8 @@ void CProfile::LoadRegistory()
                m_Data[nAppID].SetKillRingMax(AfxGetApp()->GetProfileInt(appName, entry, 1));\r
                entry.LoadString(IDS_REG_ENTRY_USE_DIALOG_SETTING);\r
                m_Data[nAppID].SetUseDialogSetting(AfxGetApp()->GetProfileInt(appName, entry, 1));\r
-               \r
-               int nSettingStyle = SETTING_DEFAULT;\r
-               HKEY hKey;\r
                entry.LoadString(IDS_REG_ENTRY_DISABLE_XKEYMACS);\r
-               if (AfxGetApp()->GetProfileInt(appName, entry, 0))\r
-                       nSettingStyle = SETTING_DISABLE;\r
-               else if (RegOpenKeyEx(HKEY_CURRENT_USER, regApp, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {\r
-                       RegCloseKey(hKey);\r
-                       nSettingStyle = SETTING_SPECIFIC;\r
-               }\r
-               m_Data[nAppID].SetSettingStyle(nSettingStyle);\r
-\r
+               m_Data[nAppID].SetSettingStyle(AfxGetApp()->GetProfileInt(appName, entry, 0) ? SETTING_DISABLE : SETTING_SPECIFIC);\r
                entry.LoadString(IDC_REG_ENTRY_IGNORE_META_CTRL);\r
                m_Data[nAppID].SetIgnoreUndefinedMetaCtrl(AfxGetApp()->GetProfileInt(appName, entry, 0));\r
                entry.LoadString(IDC_REG_ENTRY_IGNORE_C_X);\r
@@ -607,10 +597,13 @@ void CProfile::SaveRegistory()
        const CString section(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION));    \r
        for (int nAppID = 0; nAppID < MAX_APP; nAppID++) {\r
                const CString& appName = m_Data[nAppID].GetApplicationName();\r
-               if (appName.IsEmpty())\r
-                       continue;\r
                CString entry;\r
                entry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
+               if (appName.IsEmpty()) {\r
+                       if (!AfxGetApp()->GetProfileString(section, entry).IsEmpty())\r
+                               AfxGetApp()->WriteProfileString(section, entry, _T(""));\r
+                       continue;\r
+               }\r
                AfxGetApp()->WriteProfileString(section, entry, appName);\r
 \r
                entry.LoadString(IDS_REG_ENTRY_APPLICATOIN_TITLE);\r