[rst-commit] r178 - /redwax-signtext-windows/trunk/Redwax SignText/Redwax SignText (MFC)/Redwax SignText (MFC)Dlg.cpp

rst-commit at redwax.eu rst-commit at redwax.eu
Sun Jul 7 14:11:38 CEST 2024


Author: minfrin at redwax.eu
Date: Sun Jul  7 14:11:37 2024
New Revision: 178

Log:
Use hard coded magic numbers to align the internal dialog.

Modified:
    redwax-signtext-windows/trunk/Redwax SignText/Redwax SignText (MFC)/Redwax SignText (MFC)Dlg.cpp

Modified: redwax-signtext-windows/trunk/Redwax SignText/Redwax SignText (MFC)/Redwax SignText (MFC)Dlg.cpp
==============================================================================
--- redwax-signtext-windows/trunk/Redwax SignText/Redwax SignText (MFC)/Redwax SignText (MFC)Dlg.cpp	(original)
+++ redwax-signtext-windows/trunk/Redwax SignText/Redwax SignText (MFC)/Redwax SignText (MFC)Dlg.cpp	Sun Jul  7 14:11:37 2024
@@ -275,6 +275,32 @@
 
 void CRedwaxSignTextMFCDlg::ResizeTab()
 {
+#if 0
+
+	RECT rcTab, rcDisplay;
+
+	DWORD dwDlgBase = GetDialogBaseUnits();
+	int cxMargin = LOWORD(dwDlgBase) / 4;
+	int cyMargin = HIWORD(dwDlgBase) / 8;
+
+	m_ctlTab.GetClientRect(&rcTab);
+
+	m_ctlTab.AdjustRect(TRUE, &rcTab);
+	OffsetRect(&rcTab, cxMargin - rcTab.left, cyMargin - rcTab.top);
+
+	// Calculate the display rectangle. 
+	CopyRect(&rcDisplay, &rcTab);
+	m_ctlTab.AdjustRect(FALSE, &rcDisplay);
+
+	for (std::shared_ptr<SignPage>& m_dlg : m_dlgs) {
+		m_dlg->SetWindowPos(NULL,
+			rcDisplay.left, rcDisplay.top + cyMargin, 0, 0,
+			SWP_NOSIZE | SWP_NOZORDER); 
+//		m_dlg->MoveWindow(&rcDisplay, FALSE);
+	}
+
+#endif
+
 #if 1
 
 	RECT rect;
@@ -286,11 +312,23 @@
 	// dialog's client rectangle.
 	m_ctlTab.AdjustRect(FALSE, &rect);
 
+	/*
+	 * Magic numbers.
+	 *
+	 * The calculation above places the window too far up and
+	 * too far to the left. No amount of experimentation has
+	 * identified the magic formula for calculating the inner
+	 * rectangle given the outer rectangle. These magic numbers
+	 * seem to put the tabbed dialos in the correct place.
+	 */
+	rect.top += 20 - 2;
+	rect.bottom += 20 + 4 - 1;
+	rect.left += 16 - 2;
+	rect.right += 16 + 4 - 1;
+
 	// Move the tab control to the new position and size.
 	for (std::shared_ptr<SignPage>& m_dlg : m_dlgs) {
 		m_dlg->MoveWindow(&rect, FALSE);
-//		m_dlg->SetWindowPos(NULL, rc.left, rc.top, 500, 500,
-//			SWP_NOZORDER);
 	}
 #endif
 



More information about the rst-commit mailing list