2 * @file PropProject.cpp
4 * @brief Implementation of PropProject propertysheet
8 #include "PropProject.h"
9 #include "OptionsMgr.h"
10 #include "OptionsPanel.h"
11 #include "OptionsProject.h"
19 * @param [in] optionsMgr Pointer to options manager for handling options.
21 PropProject::PropProject(COptionsMgr *optionsMgr)
22 : OptionsPanel(optionsMgr, PropProject::IDD)
24 for (int i = 0; i < Options::Project::OperationCount; i++)
25 for (int j = 0; j < Options::Project::ItemCount; j++)
26 m_settings[i][j] = false;
30 * @brief Function handling dialog data exchange between GUI and variables.
32 void PropProject::DoDataExchange(CDataExchange* pDX)
34 CDialog::DoDataExchange(pDX);
36 //{{AFX_DATA_MAP(PropEditor)
37 DDX_Control(pDX, IDC_PROJECT_LIST, m_list);
40 if (!pDX->m_bSaveAndValidate)
42 for (int i = 0; i < Options::Project::OperationCount; i++)
43 for (int j = 0; j < Options::Project::ItemCount; j++)
44 m_list.SetItemBooleanValue(j, i + 1, m_settings[i][j]);
49 for (int i = 0; i < Options::Project::OperationCount; i++)
50 for (int j = 0; j < Options::Project::ItemCount; j++)
51 m_settings[i][j] = m_list.GetItemBooleanValue(j, i + 1);
57 BEGIN_MESSAGE_MAP(PropProject, OptionsPanel)
58 //{{AFX_MSG_MAP(PropEditor)
59 // ON_BN_CLICKED(IDC_COMPARE_DEFAULTS, OnDefaults)
64 * @brief Reads options values from storage to UI.
66 void PropProject::ReadOptions()
68 Options::Project::Load(GetOptionsMgr(), m_settings);
72 * @brief Writes options values from UI to storage.
74 void PropProject::WriteOptions()
76 Options::Project::Save(GetOptionsMgr(), m_settings);
80 * @brief Called before propertysheet is drawn.
82 BOOL PropProject::OnInitDialog()
84 OptionsPanel::OnInitDialog();
90 return TRUE; // return TRUE unless you set the focus to a control
91 // EXCEPTION: OCX Property Pages should return FALSE
95 * @brief Initialize listcontrol containing project settings.
97 void PropProject::InitList()
99 // Show selection across entire row.
100 // Also enable infotips.
101 m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);
103 const int lpx = CClientDC(this).GetDeviceCaps(LOGPIXELSX);
104 auto pointToPixel = [lpx](int point) { return MulDiv(point, lpx, 72); };
106 String title = _("Item");
107 m_list.InsertColumn(0, title.c_str(), LVCFMT_LEFT, pointToPixel(150));
109 m_list.InsertColumn(1, title.c_str(), LVCFMT_LEFT, pointToPixel(50));
111 m_list.InsertColumn(2, title.c_str(), LVCFMT_LEFT, pointToPixel(50));
113 m_list.InsertColumn(3, title.c_str(), LVCFMT_LEFT, pointToPixel(50));
115 m_list.SetReadOnlyColumn(0);
116 for (int i = 0; i < Options::Project::OperationCount; ++i)
118 m_list.SetEditStyle(i+1, CSubeditList::EditStyle::EDIT_BOX);
119 m_list.SetBooleanValueColumn(i+1);
122 int nID[Options::Project::ItemCount] = {
123 IDS_PROJECT_ITEM_FILE_FILTER,
124 IDS_PROJECT_ITEM_INCLUDE_SUBFOLDERS,
125 IDS_PROJECT_ITEM_PLUGIN,
126 IDS_PROJECT_ITEM_COMPARE_OPTIONS,
127 IDS_PROJECT_ITEM_HIDDEN_ITEMS
130 for (int i = 0; i < Options::Project::ItemCount; i++)
132 String str = LoadResString(nID[i]);
133 m_list.InsertItem(i, str.c_str());