Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Feb 28, 2018
1 parent 928fbae commit eeb41e6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion READMEJP.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
「ダイアログの編集」でCtrl+Dを押すと、インデックスを表示するようにした。
RC形式でのエクスポートを実装。
整数の解釈を少し改良した。
2018.XX.YY ver.3.6
2018.02.28 ver.3.6
フォント設定が可能に。
グループボックスの当たり判定を修正。
設定の「IDマクロを使用しない」が正しく更新されていなかったのを修正。
Expand Down
15 changes: 14 additions & 1 deletion include/ConstantsDB.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,22 @@ class ConstantsDB
return FALSE;
}

BOOL AreMacroIDShown() const
{
return !GetValue(L"HIDE.ID", L"HIDE.ID");
}

void ShowMacroID(BOOL bShown = TRUE)
{
TableType& table = m_map[L"HIDE.ID"];
table.clear();
EntryType entry(L"HIDE.ID", !bShown);
table.push_back(entry);
}

StringType GetNameOfResID(INT nIDTYPE_, ValueType value) const
{
if ((BOOL)GetValue(L"HIDE.ID", L"HIDE.ID"))
if (!AreMacroIDShown())
{
if (nIDTYPE_ == IDTYPE_CONTROL)
return mstr_dec_short((SHORT)value);
Expand Down
5 changes: 1 addition & 4 deletions src/MConfigDlg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ class MConfigDlg : public MDialogBase
m_settings.bUpdateResH = (IsDlgButtonChecked(hwnd, chx7) == BST_CHECKED);
m_settings.bCompressByUPX = (IsDlgButtonChecked(hwnd, chx8) == BST_CHECKED);

ConstantsDB::TableType& table = m_db.m_map[L"HIDE.ID"];
table.clear();
ConstantsDB::EntryType entry(L"HIDE.ID", m_settings.bHideID);
table.push_back(entry);
m_db.ShowMacroID(!m_settings.bHideID);

EndDialog(IDOK);
}
Expand Down
32 changes: 13 additions & 19 deletions src/RisohEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void InitCtrlIDComboBox(HWND hCmb, ConstantsDB& db)
ComboBox_AddString(hCmb, it->name.c_str());
}

if ((BOOL)db.GetValue(L"HIDE.ID", L"HIDE.ID"))
if (!db.AreMacroIDShown())
return;

table = db.GetTable(L"RESOURCE.ID.PREFIX");
Expand All @@ -251,7 +251,7 @@ void InitResNameComboBox(HWND hCmb, ConstantsDB& db, MIdOrString id, INT nIDTYPE
{
SetWindowTextW(hCmb, id.c_str());

if ((BOOL)db.GetValue(L"HIDE.ID", L"HIDE.ID"))
if (!db.AreMacroIDShown())
return;

INT k = -1;
Expand Down Expand Up @@ -315,7 +315,7 @@ void InitStringComboBox(HWND hCmb, ConstantsDB& db, MString strString)
{
SetWindowText(hCmb, strString.c_str());

if ((BOOL)db.GetValue(L"HIDE.ID", L"HIDE.ID"))
if (!db.AreMacroIDShown())
return;

ConstantsDB::TableType table;
Expand All @@ -340,7 +340,7 @@ void InitMessageComboBox(HWND hCmb, ConstantsDB& db, MString strString)
{
SetWindowText(hCmb, strString.c_str());

if ((BOOL)db.GetValue(L"HIDE.ID", L"HIDE.ID"))
if (!db.AreMacroIDShown())
return;

ConstantsDB::TableType table;
Expand Down Expand Up @@ -758,7 +758,7 @@ MStringW DumpDataAsString(const std::vector<BYTE>& data)

MStringW GetKeyID(ConstantsDB& db, UINT wId)
{
if ((BOOL)db.GetValue(L"HIDE.ID", L"HIDE.ID"))
if (!db.AreMacroIDShown())
return mstr_dec_short((SHORT)wId);

return db.GetNameOfResID(IDTYPE_COMMAND, wId);
Expand Down Expand Up @@ -2775,7 +2775,7 @@ void MMainWnd::OnInitMenu(HWND hwnd, HMENU hMenu)
else
CheckMenuItem(hMenu, CMDID_ALWAYSCONTROL, MF_UNCHECKED);

if ((BOOL)m_db.GetValue(L"HIDE.ID", L"HIDE.ID"))
if (!m_db.AreMacroIDShown())
CheckMenuItem(hMenu, CMDID_HIDEIDMACROS, MF_CHECKED);
else
CheckMenuItem(hMenu, CMDID_HIDEIDMACROS, MF_UNCHECKED);
Expand Down Expand Up @@ -5851,13 +5851,12 @@ void MMainWnd::OnConfig(HWND hwnd)

void MMainWnd::OnHideIDMacros(HWND hwnd)
{
BOOL bHideID = (BOOL)m_db.GetValue(L"HIDE.ID", L"HIDE.ID");
BOOL bHideID = !m_db.AreMacroIDShown();
bHideID = !bHideID;
m_settings.bHideID = bHideID;
ConstantsDB::TableType& table = m_db.m_map[L"HIDE.ID"];
table.clear();
ConstantsDB::EntryType entry(L"HIDE.ID", bHideID);
table.push_back(entry);

m_db.ShowMacroID(!m_settings.bHideID);

DoRefresh(hwnd);
}

Expand Down Expand Up @@ -7159,14 +7158,9 @@ BOOL MMainWnd::LoadSettings(HWND hwnd)
if (!keyRisoh)
return FALSE;

BOOL bHideID = (BOOL)m_db.GetValue(L"HIDE.ID", L"HIDE.ID");
BOOL bHideID = !m_db.AreMacroIDShown();
keyRisoh.QueryDword(TEXT("HIDE.ID"), (DWORD&)bHideID);
{
ConstantsDB::TableType& table = m_db.m_map[L"HIDE.ID"];
table.clear();
ConstantsDB::EntryType entry(L"HIDE.ID", bHideID);
table.push_back(entry);
}
m_db.ShowMacroID(!bHideID);
m_settings.bHideID = bHideID;

keyRisoh.QueryDword(TEXT("ShowStatusBar"), (DWORD&)m_settings.bShowStatusBar);
Expand Down Expand Up @@ -7297,7 +7291,7 @@ BOOL MMainWnd::SaveSettings(HWND hwnd)
if (m_splitter1.GetPaneCount() >= 1)
m_settings.nTreeViewWidth = m_splitter1.GetPaneExtent(0);

BOOL bHideID = (BOOL)m_db.GetValue(L"HIDE.ID", L"HIDE.ID");
BOOL bHideID = !m_db.AreMacroIDShown();
m_settings.bHideID = bHideID;
keyRisoh.SetDword(TEXT("HIDE.ID"), m_settings.bHideID);
keyRisoh.SetDword(TEXT("ShowStatusBar"), m_settings.bShowStatusBar);
Expand Down

0 comments on commit eeb41e6

Please sign in to comment.