Skip to content

Commit fee3ed5

Browse files
ejaquayejaquay
authored andcommitted
Update selected slot description when pak changed
Fixes issue #462. When hardware pak was inserted or removed from selected mpi slot the description was not updated.
1 parent 6aba145 commit fee3ed5

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

mpi/configuration_dialog.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,9 @@ void configuration_dialog::select_new_cartridge(slot_id_type slot)
103103

104104
void configuration_dialog::set_selected_slot(slot_id_type slot)
105105
{
106-
SendDlgItemMessage(
107-
dialog_handle_,
108-
IDC_MODINFO,
109-
WM_SETTEXT,
110-
0,
111-
reinterpret_cast<LPARAM>(mpi_.slot_description(slot).c_str()));
106+
display_slot_description(slot);
112107

108+
// Get radio button IDs
113109
for (auto ndx(0u); ndx < gSlotUiElementIds.size(); ndx++)
114110
{
115111
SendDlgItemMessage(
@@ -125,6 +121,15 @@ void configuration_dialog::set_selected_slot(slot_id_type slot)
125121
configuration_.selected_slot(slot);
126122
}
127123

124+
void configuration_dialog::display_slot_description(slot_id_type slot)
125+
{
126+
SendDlgItemMessage(
127+
dialog_handle_,
128+
IDC_MODINFO,
129+
WM_SETTEXT,
130+
0,
131+
reinterpret_cast<LPARAM>(mpi_.slot_description(slot).c_str()));
132+
}
128133

129134
void configuration_dialog::update_slot_details(slot_id_type slot)
130135
{
@@ -159,17 +164,26 @@ void configuration_dialog::eject_or_select_new_cartridge(slot_id_type slot)
159164
return;
160165
}
161166

167+
162168
if (!mpi_.empty(slot))
163169
{
164170
mpi_.eject_cartridge(slot);
165171
configuration_.slot_cartridge_path(slot, {});
172+
166173
}
167174
else
168175
{
169176
select_new_cartridge(slot);
170177
}
171178

172179
update_slot_details(slot);
180+
181+
// Update description if slot was selected
182+
if (slot == configuration_.selected_slot())
183+
{
184+
display_slot_description(slot);
185+
}
186+
173187
mpi_.build_menu();
174188
}
175189

mpi/configuration_dialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class configuration_dialog
8080
void set_selected_slot(slot_id_type slot);
8181
void update_slot_details(slot_id_type slot);
8282
void eject_or_select_new_cartridge(slot_id_type slot);
83+
void display_slot_description(slot_id_type slot);
8384

8485
static INT_PTR CALLBACK callback_procedure(
8586
HWND hDlg,

0 commit comments

Comments
 (0)