MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / PostMsgAfterClose

Method PostMsgAfterClose

source/Configuration/PropertySheetHelper.cpp:261–313  ·  view source on GitHub ↗

On OK: Optionally post a single "uAfterClose" msg after last page closes

Source from the content-addressed store, hash-verified

259
260// On OK: Optionally post a single "uAfterClose" msg after last page closes
261void CPropertySheetHelper::PostMsgAfterClose(HWND hWnd, PAGETYPE page)
262{
263 m_bmPages &= ~(1<<(UINT32)page);
264 if (m_bmPages)
265 return; // Still pages to close
266
267 //
268
269 if (m_ConfigNew.m_uSaveLoadStateMsg && IsConfigChangedForRestart() && IsOkToSaveLoadState(hWnd))
270 {
271 // Drop any config changes, and do load/save state
272 PostMessage(GetFrame().g_hFrameWindow, m_ConfigNew.m_uSaveLoadStateMsg, 0, 0);
273 return;
274 }
275
276 if (m_bDoBenchmark)
277 {
278 // Drop any config changes, and do benchmark
279 PostMessage(GetFrame().g_hFrameWindow, WM_USER_BENCHMARK, 0, 0); // NB. doesn't do WM_USER_RESTART
280 return;
281 }
282
283 if (m_ConfigNew.m_Apple2Type == A2TYPE_CLONE)
284 {
285 MessageBox(hWnd, "Error - Unable to change configuration\n\nReason: A specific clone wasn't selected from the Advanced tab", g_pAppTitle.c_str(), MB_ICONSTOP | MB_SETFOREGROUND);
286 return;
287 }
288
289 _ASSERT(m_ConfigNew.m_CpuType != CPU_UNKNOWN); // NB. Could only ever be CPU_UNKNOWN for a clone (and only if a mistake was made when adding a new clone)
290 if (m_ConfigNew.m_CpuType == CPU_UNKNOWN)
291 {
292 m_ConfigNew.m_CpuType = ProbeMainCpuDefault(m_ConfigNew.m_Apple2Type);
293 }
294
295 bool restart = false;
296
297 if (IsConfigChangedForRestart()) // Only for config that requires a restart
298 {
299 if (!HardwareConfigChanged(hWnd))
300 return; // Cancelled
301
302 if (!IsOkToRestart(hWnd))
303 return; // Cancelled
304
305 ApplyNewConfigForRestart();
306 restart = true;
307 }
308
309 GetPropertySheet().ApplyConfigAfterClose(m_bmAfterClosePages); // For config that does NOT require a restart
310
311 if (restart)
312 GetFrame().Restart();
313}
314
315#define CONFIG_CHANGED(var) \
316 (m_ConfigOld.var != m_ConfigNew.var)

Callers 4

DlgOKMethod · 0.80
DlgOKMethod · 0.80
DlgOKMethod · 0.80
DlgOKMethod · 0.80

Calls 3

ProbeMainCpuDefaultFunction · 0.85
RestartMethod · 0.80
ApplyConfigAfterCloseMethod · 0.45

Tested by

no test coverage detected