[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 797
Date       : Mon Apr 10 15:42:52 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/dlgmgr.cpp

Fix to get modal dialogs working


Diff:
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 796)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 797)
@@ -1294,7 +1294,7 @@
 	// Restore the active/disabled window state
 	if (pDlgOp->IsModal())
 	{
-		DialogManager::RestoreActiveDialogState();
+		// DialogManager::RestoreActiveDialogState();
 	}
 
 	DefaultKeyboardFocus();
@@ -2117,7 +2117,8 @@
 //	TRACEUSER("amb",_T("pwxDialog=0x%016llx Gadget=%d(%s) pGadget=0x%016llx"), WindowID, Gadget, CamResource::GetObjectName((ResourceID)Gadget), pGadget);
 	if (!pGadget)
 	{
-		ERROR3_PF((_T("Bad Gadget ID %d(%s) passed"), Gadget, CamResource::GetObjectName((ResourceID)Gadget)));
+		// Some dialogs seem to consciously do this, EG galleries
+//		ERROR3_PF((_T("Bad Gadget ID %d(%s) passed"), Gadget, CamResource::GetObjectName((ResourceID)Gadget)));
 		return NULL;
 	}
 #if 0
@@ -6409,13 +6410,17 @@
 
 BOOL DialogManager::RecordActiveDialogState()
 {
-	PORTNOTETRACE("dialog","DialogManager::RecordActiveDialogState - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
 	// The new way of checking if a modal dialog is about is to determine if the
 	//ActiveDlgStack is empty
 	BOOL IsModal = !(ActiveDlgStack.GetTop() == NULL);
 	// Which window is currently active
-	HWND ActiveWindow = GetActiveWindow();
+	wxWindow * ActiveWindow = wxWindow::FindFocus();
+	
+	// I think we need to look upwards here till we find a TLW
+	while (ActiveWindow && !ActiveWindow->IsKindOf(CLASSINFO(wxTopLevelWindow)) && ActiveWindow->GetParent())
+	{
+		ActiveWindow = ActiveWindow->GetParent();
+	}
 
 	// Record this information
 	ActiveDlgStateItem* pActiveDlgItem = new ActiveDlgStateItem;
@@ -6426,7 +6431,6 @@
 	pActiveDlgItem->fIsAModalDialog	= IsModal;
 
 	DialogManager::ActiveDlgStack.Push(pActiveDlgItem);
-#endif
 	return TRUE;
 }
 


Xara