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

[XaraXtreme-commits] Commit Complete



Commit by  : luke
Repository : xara
Revision   : 1745
Date       : Fri Sep  8 15:23:20 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/bmapprev.cpp
   M /Trunk/XaraLX/Kernel/dialogop.cpp
   M /Trunk/XaraLX/Kernel/dialogop.h
   M /Trunk/XaraLX/wxOil/dlgmgr.cpp
   M /Trunk/XaraLX/wxOil/dlgmgr.h

Disable Export button during preview to stop a possible exception


Diff:
Index: Trunk/XaraLX/Kernel/bmapprev.cpp
===================================================================
--- Trunk/XaraLX/Kernel/bmapprev.cpp	(revision 1744)
+++ Trunk/XaraLX/Kernel/bmapprev.cpp	(revision 1745)
@@ -1036,12 +1036,18 @@
 ********************************************************************************************/
 BOOL BmapPrevDlg::DoPreview()
 {
+
 	//	TRACEUSER( "Gerry", _T("DoPreview 0x%08x\n"), m_pExportOptions);
 
 	CDlgResID PageID = GetCurrentPageID();	// Get currently selected Tab id
 	if (m_pPreviewDlg == NULL)
 		return FALSE;
 
+	// Disable 'Export' button to stop nasty crashes
+	TalkToPage(0);
+	bool				fIsExportEnabled = IsGadgetEnabled( wxID_OK );
+	EnableGadget( wxID_OK, false );
+	
 	BOOL ok = (m_pExportOptions != NULL);
 
 	if (ok && !m_pExportOptions->DoesTempFileMatchExportOptions())
@@ -1072,6 +1078,10 @@
 	// Update the palette as it may have been changed when the preview was generated
 	m_PaletteControl.RenderSoon();
 
+	// Re-enable 'Export' button
+	TalkToPage(0);
+	EnableGadget( wxID_OK, fIsExportEnabled );
+	
 	TalkToPage(PageID);
 
 	return ok;
Index: Trunk/XaraLX/Kernel/dialogop.cpp
===================================================================
--- Trunk/XaraLX/Kernel/dialogop.cpp	(revision 1744)
+++ Trunk/XaraLX/Kernel/dialogop.cpp	(revision 1745)
@@ -1800,8 +1800,31 @@
 	return (DlgMgr->EnableGadget(GetReadWriteWindowID(), Gadget, Enabled)); 	
 } 
 
+
 /********************************************************************************************
 
+>	BOOL DialogOp::IsGadgetEnabled( CGadgetID Gadget );
+
+	Author:		Luke_Hart (Xara Group Ltd) <lukeh@xxxxxxxx>
+	Created:	07/09/06
+	Inputs:		WindowID: 		Dialog box window identifier
+				Gadget:			Gadget identifier
+	Outputs:
+	Returns:	TRUE if enabled, else FALSE
+	Purpose:	For checking if a gadget is enabled/disabled.
+
+	Errors:		-
+	SeeAlso:	DialogOp::IsGadgetEnabled
+
+********************************************************************************************/
+
+BOOL DialogOp::IsGadgetEnabled( CGadgetID Gadget )
+{
+	return DlgMgr->IsGadgetEnabled( GetReadWriteWindowID(), Gadget );
+}
+
+/********************************************************************************************
+
 >	BOOL DialogOp::HideGadget(CGadgetID GadgetID, BOOL Hide) 
 
 	Author:		Simon_Maneggio (Xara Group Ltd) <camelotdev@xxxxxxxx>
Index: Trunk/XaraLX/Kernel/dialogop.h
===================================================================
--- Trunk/XaraLX/Kernel/dialogop.h	(revision 1744)
+++ Trunk/XaraLX/Kernel/dialogop.h	(revision 1745)
@@ -380,6 +380,7 @@
 	INT32* GetSelectedItems(CGadgetID GadgetID);
 
 	BOOL EnableGadget(CGadgetID GadgetID, BOOL Enabled);
+	BOOL IsGadgetEnabled( CGadgetID Gadget );
 	BOOL HideGadget(CGadgetID GadgetID, BOOL Hide);
 	BOOL GadgetRedraw(CGadgetID GadgetID, BOOL Redraw);
 	void Layout(BOOL CanYield = FALSE);
Index: Trunk/XaraLX/wxOil/dlgmgr.h
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.h	(revision 1744)
+++ Trunk/XaraLX/wxOil/dlgmgr.h	(revision 1745)
@@ -591,7 +591,8 @@
     
     // ------------------------------------------------------------------------------------- 
     // Functions for changing a gadgets state 
-	static BOOL EnableGadget(CWindowID WindowID, CGadgetID Gadget, BOOL Enabled); 
+	static BOOL EnableGadget(CWindowID WindowID, CGadgetID Gadget, BOOL Enabled);
+	static BOOL IsGadgetEnabled( CWindowID WindowID, CGadgetID Gadget );
 	static BOOL HideGadget(CWindowID WindowID, CGadgetID Gadget, BOOL Hide); 
 	static BOOL GadgetRedraw(CWindowID WindowID, CGadgetID Gadget, BOOL Redraw);
 	static void Layout(CWindowID WindowID, BOOL CanYield=FALSE);
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 1744)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 1745)
@@ -5166,6 +5166,33 @@
 
 /********************************************************************************************
 
+>	BOOL DialogManager::IsGadgetEnabled( CWindowID WindowID, CGadgetID Gadget );
+
+	Author:		Luke_Hart (Xara Group Ltd) <lukeh@xxxxxxxx>
+	Created:	07/09/06
+	Inputs:		WindowID: 		Dialog box window identifier
+				Gadget:			Gadget identifier
+	Outputs:
+	Returns:	TRUE if enabled, else FALSE
+	Purpose:	For checking if a gadget is enabled/disabled.
+
+	Errors:		-
+	SeeAlso:	DialogOp::IsGadgetEnabled
+
+********************************************************************************************/
+
+BOOL DialogManager::IsGadgetEnabled( CWindowID WindowID, CGadgetID Gadget )
+{
+	wxWindow*			pGadget = GetGadget(WindowID, Gadget);
+	if (!pGadget)
+		return FALSE;
+	
+	return pGadget->IsEnabled();
+}
+
+
+/********************************************************************************************
+
 >	BOOL DialogManager::HideGadget(CWindowID WindowID, CGadgetID Gadget, BOOL Hide)
 
 	Author:		Simon_Maneggio (Xara Group Ltd) <camelotdev@xxxxxxxx>


Xara