[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : luke
Repository : xara
Revision : 918
Date : Fri Apr 28 17:39:24 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/bmapprev.cpp
M /Trunk/XaraLX/Kernel/exjpeg.cpp
M /Trunk/XaraLX/Kernel/impexpop.cpp
M /Trunk/XaraLX/Kernel/main2.cpp
M /Trunk/XaraLX/wxOil/dlgmgr.cpp
M /Trunk/XaraLX/wxOil/dlgmgr.h
M /Trunk/XaraLX/wxOil/stdwx.h
M /Trunk/XaraLX/wxOil/xrc/EN/bmapprev.xrc
Bulk of export setup dialog present, some rough edge still need smoothing though (Tabbed dialogs also supported)
Diff:
Index: Trunk/XaraLX/Kernel/bmapprev.cpp
===================================================================
--- Trunk/XaraLX/Kernel/bmapprev.cpp (revision 917)
+++ Trunk/XaraLX/Kernel/bmapprev.cpp (revision 918)
@@ -243,8 +243,6 @@
{
BOOL ok = TRUE;
-PORTNOTE("other","Removed wizard pages code")
-#ifndef EXCLUDE_FROM_XARALX
// flag indicating we are doing a bitmap export
BOOL bExportABitmap = (m_pExportOptions->GetSelectionType() == ABITMAP);
@@ -254,8 +252,11 @@
}
else
{
+PORTNOTE("other","Removed registry usage")
+#ifndef EXCLUDE_FROM_XARALX
// Not exporting a bitmap from the bitmap gallery
AddAPage(_R(IDD_TPALETTE));
+#endif
if (!m_bSlicingImage)
ok = AddAPage(_R(IDD_TBITMAPSIZE));
@@ -268,7 +269,6 @@
// design notes stuff on the image map page is needed in image slicing
if (ok && m_bSlicingImage)
ok = AddAPage(_R(IDD_TIMAPOPTIONS));
-#endif
return (ok);
}
@@ -1159,8 +1159,6 @@
DialogMsg* Msg = ((DialogMsg*) Message);
-PORTNOTETRACE("other","BmapPrevDlg::Message - Do nothing");
-#if !defined(EXCLUDE_FROM_XARALX)
BOOL EndDialog = FALSE; // TRUE if we should quit the dialog
// BOOL CommitValues = FALSE; // TRUE if we should commit the dialog values
@@ -1189,81 +1187,90 @@
}
// Determine from what page the message originated
- switch (Msg->PageID)
+ if( Msg->PageID == _R(IDD_TBITMAPSIZE) )
+ HandleBitmapSizeTabMsg(Msg);
+PORTNOTE("other", "Remove palette usage" )
+#if !defined(EXCLUDE_FROM_XARALX)
+ else
+ if( Msg->PageID == _R(IDD_TPALETTE) )
+ HandlePaletteTabMsg(Msg);
+#endif
+ else
+ if( Msg->PageID == _R(IDD_TIMAPOPTIONS) )
+ HandleImageMapTabMsg(Msg);
+ else
+ if( Msg->PageID == _R(IDD_TBROWSER) )
+ HandleBrowserPreviewTabMsg(Msg);
+ else
+ if( Msg->PageID == _R(IDD_TBITMAPOPTIONS) )
+ HandleBitmapOptionsTabMsg(Msg);
+ else
+ if( Msg->PageID == 0 )
{
- case _R(IDD_TBITMAPSIZE):
- HandleBitmapSizeTabMsg(Msg);
- break;
- case _R(IDD_TPALETTE):
- HandlePaletteTabMsg(Msg);
- break;
- case _R(IDD_TIMAPOPTIONS):
- HandleImageMapTabMsg(Msg);
- break;
- case _R(IDD_TBROWSER):
- HandleBrowserPreviewTabMsg(Msg);
- break;
- case _R(IDD_TBITMAPOPTIONS):
- HandleBitmapOptionsTabMsg(Msg);
- break;
-
- case 0:
- // A message generated from the tabbed dialog itself
- switch (Msg->DlgMsg)
+ // A message generated from the tabbed dialog itself
+ switch (Msg->DlgMsg)
+ {
+ case DIM_CREATE:
{
- case DIM_CREATE:
+ if (!OnCreate()) // initialise
{
- if (!OnCreate()) // initialise
- {
- ERROR3("Problem in OnCreate()");
- return FAIL;
- }
- // disable browser preview for now
-// BOOL Old = m_bDoPreviewInBrowser; // remember the value of the flag
-// m_bDoPreviewInBrowser = FALSE; // disable browser preview
-// DoPreview(); // do preview
-// m_bDoPreviewInBrowser = Old; // restore the setting
-
- // Set up the bubble-help timer.
- SetTimer(BUBBLE_HELP_TIMMER_ID, 100);
- break;
+ ERROR3("Problem in OnCreate()");
+ return FAIL;
}
+ // disable browser preview for now
+// BOOL Old = m_bDoPreviewInBrowser; // remember the value of the flag
+// m_bDoPreviewInBrowser = FALSE; // disable browser preview
+// DoPreview(); // do preview
+// m_bDoPreviewInBrowser = Old; // restore the setting
- case DIM_COMMIT: // Close dialog and insert the bitmap in the document
- EndDialog = TRUE;
- KillTimer(BUBBLE_HELP_TIMMER_ID);
- BmapPrevDlg::m_bClickedOnExport = TRUE;
- ImageMapOnCommit(); // Save the image map values
- break;
+PORTNOTE("other", "Remove bubble help timer usage" );
+#if !defined(EXCLUDE_FROM_XARALX)
+ // Set up the bubble-help timer.
+ SetTimer(BUBBLE_HELP_TIMMER_ID, 100);
+#endif
+ break;
+ }
- case DIM_SOFT_COMMIT: // Update the preview
- EndDialog = FALSE;
- DoPreview();
- BmapPrevDlg::m_bClickedOnExport = FALSE;
- break;
+ case DIM_COMMIT: // Close dialog and insert the bitmap in the document
+ EndDialog = TRUE;
+PORTNOTE("other", "Remove bubble help timer usage" );
+#if !defined(EXCLUDE_FROM_XARALX)
+ KillTimer(BUBBLE_HELP_TIMMER_ID);
+#endif
+ BmapPrevDlg::m_bClickedOnExport = TRUE;
+ ImageMapOnCommit(); // Save the image map values
+ break;
- case DIM_CANCEL: // Close dialog and don't insert the bitmap in the document
- EndDialog = TRUE;
- KillTimer(BUBBLE_HELP_TIMMER_ID);
- BmapPrevDlg::m_bClickedOnExport = FALSE;
- // we have cancelled so these options are not valid
- m_pExportOptions->MarkInvalid();
- break;
+ case DIM_SOFT_COMMIT: // Update the preview
+ EndDialog = FALSE;
+ DoPreview();
+ BmapPrevDlg::m_bClickedOnExport = FALSE;
+ break;
- case DIM_LFT_BN_CLICKED:
- case DIM_RGT_BN_CLICKED:
- // If they clicked on the help button
- if (Msg->GadgetID == IDHELP)
- OnHelpButtonClicked();
- break;
+ case DIM_CANCEL: // Close dialog and don't insert the bitmap in the document
+ EndDialog = TRUE;
+PORTNOTE("other", "Remove bubble help timer usage" );
+#if !defined(EXCLUDE_FROM_XARALX)
+ KillTimer(BUBBLE_HELP_TIMMER_ID);
+#endif
+ BmapPrevDlg::m_bClickedOnExport = FALSE;
+ // we have cancelled so these options are not valid
+ m_pExportOptions->MarkInvalid();
+ break;
- default:
- break;
- }
- break;
- default:
- ERROR3("Message from unknown tab dialog page");
+ case DIM_LFT_BN_CLICKED:
+ case DIM_RGT_BN_CLICKED:
+ // If they clicked on the help button
+ if (Msg->GadgetID == wxID_HELP)
+ OnHelpButtonClicked();
+ break;
+
+ default:
+ break;
+ }
}
+ else
+ ERROR3("Message from unknown tab dialog page");
if (EndDialog) // Dialog communication over
{
@@ -1320,13 +1327,12 @@
// tell the preview dialog to shut down
if (m_DialogWnd != NULL)
- BROADCAST_TO_CLASS( DialogMsg(m_DialogWnd, Msg->DlgMsg, 0, NULL, 0), DialogOp );
+ BROADCAST_TO_CLASS( DialogMsg(m_DialogWnd, Msg->DlgMsg, 0, 0, 0), DialogOp );
m_DialogWnd = NULL;
Close();
End(); // End of dialog
}
-#endif
return DLG_EAT_IF_HUNGRY(Msg); // I return EAT_MSG unless the message needs to be sent to all dialogs
}
Index: Trunk/XaraLX/Kernel/exjpeg.cpp
===================================================================
--- Trunk/XaraLX/Kernel/exjpeg.cpp (revision 917)
+++ Trunk/XaraLX/Kernel/exjpeg.cpp (revision 918)
@@ -1090,7 +1090,7 @@
}
else
{
- ERROR3("Unable to find OPTOKEN_BMAPPREVDLG");
+ ERROR3("Unable to find OPTOKEN_GIFTABDLG");
}
/* if (Ok)
Index: Trunk/XaraLX/Kernel/main2.cpp
===================================================================
--- Trunk/XaraLX/Kernel/main2.cpp (revision 917)
+++ Trunk/XaraLX/Kernel/main2.cpp (revision 918)
@@ -316,9 +316,7 @@
#ifndef EXCLUDE_GALS
SGInit::Init() && // Init/Register all the supergallery related Ops
#endif //EXCLUDE_GALS
-#ifndef EXCLUDE_FROM_XARALX
BmapPrevDlg::Init() && // Bitmap Preview Dialog Box - Dbug Builds for the moment [MartinD]
-#endif //EXCLUDE_FROM_XARALX
// Moved this here from inside ColourSGallery::Init
OpBackground::Init() &&
Index: Trunk/XaraLX/Kernel/impexpop.cpp
===================================================================
--- Trunk/XaraLX/Kernel/impexpop.cpp (revision 917)
+++ Trunk/XaraLX/Kernel/impexpop.cpp (revision 918)
@@ -1167,8 +1167,8 @@
// set up with default attrib for this filter
// and get the user to edit these default params in the export dlg (thats the FALSE param)
PORTNOTE("other", "Use SetUpExportOptions to get defaults only and not do dialog" )
-// ((BaseBitmapFilter*) pFilter)->SetUpExportOptions(&pOptions, FALSE);
- ((BaseBitmapFilter*) pFilter)->SetUpExportOptions(&pOptions, TRUE);
+ ((BaseBitmapFilter*) pFilter)->SetUpExportOptions(&pOptions, FALSE);
+// ((BaseBitmapFilter*) pFilter)->SetUpExportOptions(&pOptions, TRUE);
// the dlg has been up and the user may have the graphic type
// ask the dlg for the type that it used
if (BmapPrevDlg::m_pExportOptions)
Index: Trunk/XaraLX/wxOil/dlgmgr.h
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.h (revision 917)
+++ Trunk/XaraLX/wxOil/dlgmgr.h (revision 918)
@@ -322,7 +322,7 @@
********************************************************************************************/
class OurPropSheet;
-class OurPropShtPage;
+typedef wxNotebookPage OurPropShtPage;
class DialogBarOp;
class DialogManager: public CCObject
@@ -341,7 +341,7 @@
private:
// Creates a DialogBarOp
static BOOL CreateBar(DialogBarOp* DlgOp);
- static BOOL CreateTabbedDialog(DialogTabOp* pTabDlgOp, CDlgMode Mode, INT32 OpeningPage);
+ static wxWindow* CreateTabbedDialog(DialogTabOp* pTabDlgOp, CDlgMode Mode, INT32 OpeningPage);
// Post create gets called after a dialog window has been created.
@@ -763,6 +763,7 @@
// created. See the Create method for a description of why we need this.
static List DlgTagOpToPropShtList;
+ static OurPropSheet* GetPropertySheetFromOp( DialogTabOp* pDialogTabOp );
static BOOL HandleScrollBarMsg(wxWindow *pScrollWnd,
UINT32 wParam,
@@ -917,22 +918,28 @@
********************************************************************************************/
-PORTNOTE("dialog","Removed OurPropSheet")
-#ifndef EXCLUDE_FROM_XARALX
-class OurPropSheet : public CPropertySheet
+class OurPropSheet : public wxPropertySheetDialog
{
public:
- OurPropSheet(String_256* pName, UINT32 SelPage);
+ OurPropSheet( wxWindow* pParentWnd, String_256* pName, UINT32 SelPage );
~OurPropSheet();
- BOOL IsModal(void) { return !m_bModeless; };
+// BOOL IsModal(void) { return !m_bModeless; };
// This very useful function is protected within the MFC base class, so we redefine it
// here as public, and make it return a pointer to one of our Camelot pages.
OurPropShtPage* GetActivePage() const
- { return (OurPropShtPage*) CPropertySheet::GetActivePage(); }
+ { return (OurPropShtPage*)GetBookCtrl()->GetCurrentPage(); }
protected:
+ std::set<wxWindow*> m_setCreateSent;
+
+ void OnSetActive( wxNotebookEvent& event );
+
+ DECLARE_EVENT_TABLE()
+
+PORTNOTE("dialog","Removed Windows callbacks")
+#ifndef EXCLUDE_FROM_XARALX
// Message handlers
//{{AFX_MSG(OurPropSheet)
afx_msg INT32 OnCreate(LPCREATESTRUCT lpCreateStruct);
@@ -951,11 +958,14 @@
// The WindowProc chanels suitable messages to the DialogManager
LRESULT WindowProc(UINT32 Message, WPARAM wParam, LPARAM lParam);
- DECLARE_DYNAMIC(OurPropSheet)
+#endif
+
+ DECLARE_CLASS(OurPropSheet)
friend class DialogManager;
};
-#endif
+PORTNOTE("dialog","Don't need \ can't use OurPropShtPage, removed")
+#ifndef EXCLUDE_FROM_XARALX
/********************************************************************************************
> class OurPropShtPage: public CPropertyPage
@@ -967,19 +977,17 @@
********************************************************************************************/
-PORTNOTE("dialog","Removed OurPropShtPage")
-#ifndef EXCLUDE_FROM_XARALX
-class OurPropShtPage: public CPropertyPage
+class OurPropShtPage: public wxNotebookPage
{
friend class DialogManager;
- DECLARE_DYNAMIC(OurPropShtPage)
+ DECLARE_ABSTRACT_CLASS( OurPropShtPage )
public:
// Construction
OurPropShtPage(CDlgResID DialogResID);
- CDlgResID GetPageID() { return PageID; }
+ CDlgResID GetPageID() { return m_PageID; }
protected:
// The WindowProc chanels suitable messages to the DialogManager
@@ -988,8 +996,8 @@
BOOL OnSetActive();
BOOL OnKillActive();
- CDlgResID PageID; // We store the resource id used to create the page
- BOOL CreateMessageSent; // Becomes TRUE after a Create message is sent for the page.
+ CDlgResID m_PageID; // We store the resource id used to create the page
+ BOOL m_CreateMessageSent; // Becomes TRUE after a Create message is sent for the page.
enum EnabledState { ENABLED, DISABLED, UNKNOWN };
};
@@ -1008,14 +1016,11 @@
********************************************************************************************/
-PORTNOTE("dialog","Removed DlgTagOpToPropShtItem")
-#ifndef EXCLUDE_FROM_XARALX
class DlgTagOpToPropShtItem: public ListItem
{
public:
DialogTabOp* pDialogTabOp;
OurPropSheet* pPropertySheet;
};
-#endif
#endif // !INC_DLGMGR
Index: Trunk/XaraLX/wxOil/xrc/EN/bmapprev.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/bmapprev.xrc (revision 917)
+++ Trunk/XaraLX/wxOil/xrc/EN/bmapprev.xrc (revision 918)
@@ -76,7 +76,7 @@
<pos>228,39d</pos> <size>99,8d</size>
<label>Minimise visible anti-aliasing</label>
</object>
- <title>Bitmap Size</title>
+ <tooltip>Bitmap Size</tooltip>
</object>
<object class="wxPanel" name="IDD_TIMAPOPTIONS">
<pos>0,0d</pos> <size>370,90d</size>
@@ -147,7 +147,7 @@
<pos>81,72d</pos> <size>98,8d</size>
<label>Current drawing must be saved</label>
</object>
- <title>Image Map</title>
+ <tooltip>Image Map</tooltip>
</object>
<object class="wxPanel" name="IDD_TBROWSER">
<pos>0,0d</pos> <size>370,90d</size>
@@ -192,7 +192,7 @@
<pos>240,30d</pos> <size>112,10d</size>
<label>Show all previews in browser</label>
</object>
- <title>Browser Preview</title>
+ <tooltip>Browser Preview</tooltip>
</object>
<object class="wxPanel" name="IDD_TBITMAPOPTIONS">
<pos>0,0d</pos> <size>370,90d</size>
@@ -224,7 +224,7 @@
<pos>6,34d</pos> <size>178,10d</size>
<label>Y</label>
</object>
- <title>Options</title>
+ <tooltip>Options</tooltip>
</object>
<object class="wxPanel" name="IDD_PALETTE_TAB">
<pos>0,0d</pos> <size>370,90d</size>
@@ -322,6 +322,6 @@
<object class="wxComboBox" name="IDC_T2_SORT_LIST">
<pos>296,71d</pos> <size>68,-1d</size>
</object>
- <title>Palette Options</title>
+ <tooltip>Palette Options</tooltip>
</object>
</resource>
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp (revision 917)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp (revision 918)
@@ -150,11 +150,7 @@
CC_IMPLEMENT_DYNAMIC(CGadgetImageList, CCObject);
-PORTNOTE("dialog","Removed OurPropSheet")
-#ifndef EXCLUDE_FROM_XARALX
-IMPLEMENT_DYNAMIC(OurPropSheet, CPropertySheet)
-IMPLEMENT_DYNAMIC(OurPropShtPage, CPropertyPage)
-#endif
+IMPLEMENT_ABSTRACT_CLASS(OurPropSheet, wxNotebookPage);
// Place all statics here please, ordered by class
@@ -276,23 +272,29 @@
}
// ERROR2IF( DlgOp->IS_KIND_OF(DialogBarOp), FALSE, _T("Bar creation not yet supported"));
- ERROR2IF( DlgOp->IS_KIND_OF(DialogTabOp), FALSE, _T("Tabbed dialogs not yet supported"));
+// ERROR2IF( DlgOp->IS_KIND_OF(DialogTabOp), FALSE, _T("Tabbed dialogs not yet supported"));
ERROR2IF( SubDlgID !=0, FALSE, _T("Merging of dialogs not yet supported"));
// if no parent dialog window specified use the main frame window
if ((ParentWnd == NULL) || wxAUImanaged)
ParentWnd = GetMainFrame();
- const TCHAR * pDialogName=CamResource::GetObjectNameFail(MainDlgID);
- ERROR1IF(pDialogName == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
+ const TCHAR* pDialogName = NULL;
+ wxWindow* pDialogWnd = NULL;
- wxWindow * pDialogWnd = NULL;
-
- if (wxAUImanaged)
- pDialogWnd = wxXmlResource::Get()->LoadPanel((wxWindow *)ParentWnd, pDialogName);
+ if( DlgOp->IS_KIND_OF(DialogTabOp) )
+ pDialogWnd = CreateTabbedDialog( (DialogTabOp*)DlgOp, Mode, OpeningPage );
else
- pDialogWnd = wxXmlResource::Get()->LoadDialog((wxWindow *)ParentWnd, pDialogName);
+ {
+ pDialogName=CamResource::GetObjectNameFail(MainDlgID);
+ ERROR1IF(pDialogName == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
+ if (wxAUImanaged)
+ pDialogWnd = wxXmlResource::Get()->LoadPanel((wxWindow *)ParentWnd, pDialogName);
+ else
+ pDialogWnd = wxXmlResource::Get()->LoadDialog((wxWindow *)ParentWnd, pDialogName);
+ }
+
ERROR1IF(pDialogWnd == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
pDialogWnd->Hide();
CamArtProvider::Get()->EnsureChildBitmapsLoaded(pDialogWnd);
@@ -321,7 +323,10 @@
// we call this directly now
BOOL ok = PostCreate(DlgOp);
- if (ok && (Mode == MODAL) && pDialogWnd->IsKindOf(CLASSINFO(wxDialog)))
+ if( ok &&
+ Mode == MODAL &&
+ ( pDialogWnd->IsKindOf( CLASSINFO(wxDialog) ) ||
+ DlgOp->IS_KIND_OF(DialogTabOp) ) )
{
((wxDialog *) pDialogWnd)->ShowModal();
}
@@ -437,6 +442,16 @@
INT32 DialogWidth = DialogRect.GetWidth();
INT32 DialogHeight = DialogRect.GetHeight();
+ OurPropSheet* pPropSheet = NULL;
+ {
+ DlgTagOpToPropShtItem* pItem = (DlgTagOpToPropShtItem*)DlgTagOpToPropShtList.GetHead();
+ if( NULL != pItem &&
+ pDialogOp->IS_KIND_OF(DialogTabOp) )
+ {
+ pPropSheet = pItem->pPropertySheet;
+ }
+ }
+
// Create the WindowIDItem which will be stored in the DialogPosition.
CWindowIDItem *pWinID = new CWindowIDItem;
if( NULL == pWinID )
@@ -482,24 +497,18 @@
if (pDialogOp->IS_KIND_OF(DialogTabOp))
{
-PORTNOTE("dialog","Removed DialogTabOp usage")
-#ifndef EXCLUDE_FROM_XARALX
// Record the active page.
+ ActivePage = ((wxNotebookPage*)pPropSheet->GetActivePage())->GetId();
- ActivePage = ((OurPropShtPage*)pPropSheet->GetActivePage())->GetPageID();
-
if(pPropSheet != NULL)
{
OurPropShtPage *pPage = (OurPropShtPage *)pPropSheet->GetActivePage();
if(pPage != NULL)
- ActivePage = ((OurPropShtPage*)pPropSheet->GetActivePage())->GetPageID();
+ ActivePage = ((wxNotebookPage*)pPropSheet->GetActivePage())->GetId();
}
DlgPos->ActivePage = ActivePage;
DlgPos->ActivePageIndex = 0; // 0 is always the first page
-#else
- ActivePage = 0;
-#endif
}
// Add the position record to the DialogPositionList
DialogPositionList.AddHead((ListItem*)DlgPos);
@@ -519,30 +528,29 @@
FontFactory::ApplyFontToWindow( DialogWnd, STOCKFONT_DIALOG ); */
#endif
-PORTNOTE("dialog","Removed DialogTabOp usage")
-#ifndef EXCLUDE_FROM_XARALX
// BROADCAST a create message to the active page
if (pDialogOp->IS_KIND_OF(DialogTabOp))
{
+PORTNOTE("dialog","Removed what looks like some MFC quirkyness")
+#ifndef EXCLUDE_FROM_XARALX
// MarkH 28/6/99 - New check to Set the ActivePage to the ActiveIndex!
// All related to the proplems with upgrading the MFC with VC6!
if(pPropSheet != NULL)
- {
- (OurPropShtPage*)pPropSheet->SetActivePage(pPropSheet->GetActiveIndex());
- }
- BROADCAST_TO_CLASS(DialogMsg(DialogManager::dlgop->WindowID, DIM_CREATE, NULL, 0, ActivePage) ,DialogOp);
- }
+ (OurPropShtPage*)pPropSheet->GetBookCtrl()->SetActivePage(pPropSheet->GetActiveIndex());
#endif
+ BROADCAST_TO_CLASS(DialogMsg(pDialogOp->WindowID, DIM_CREATE, 0, 0, ActivePage) ,DialogOp);
+ }
+
// Inform the Dialog that it has been created so that it can be initialised
// Note that for DialogTabOp's seperate Create messages are sent for each page
// from the OurPropShtPage OnCreate handler.
// Alex moved this inside the if statement
BROADCAST_TO_CLASS( DialogMsg( pDialogOp->WindowID, DIM_CREATE, 0 ) ,DialogOp );
-PORTNOTE("dialog","Removed DialogTabOp usage")
-#ifndef EXCLUDE_FROM_XARALX
- if ((DialogManager::dlgop->IS_KIND_OF(DialogTabOp)) && pPropSheet && (pPropSheet->GetActivePage()))
+ if( pDialogOp->IS_KIND_OF(DialogTabOp) &&
+ NULL != pPropSheet &&
+ pPropSheet->GetActivePage() )
{
// MarkH 28/6/99 - New bit to get the active page working in tab boxes!
// All related to the proplems with upgrading the MFC with VC6!
@@ -551,13 +559,12 @@
OurPropShtPage *pPage = (OurPropShtPage *)pPropSheet->GetActivePage();
if(pPage != NULL)
{
- ActivePage = ((OurPropShtPage*)pPropSheet->GetActivePage())->GetPageID();
+ ActivePage = ((wxNotebookPage*)pPropSheet->GetActivePage())->GetId();
}
}
- BROADCAST_TO_CLASS(DialogMsg(DialogManager::dlgop->WindowID, DIM_SET_ACTIVE, NULL, 0, ActivePage) ,DialogOp);
+ BROADCAST_TO_CLASS( DialogMsg( pDialogOp->WindowID, DIM_SET_ACTIVE, 0, 0, ActivePage ), DialogOp );
}
-#endif
// If the dialog which has just been created is modal then disable all other
// dialogs.
@@ -4286,13 +4293,13 @@
sels[0]=((wxControlWithItems *)pGadget)->GetSelection();
}
- INT32 Count = sels.GetCount();
+ size_t Count = sels.GetCount();
pList = new INT32[Count+1];
if (pList)
{
- INT32 i;
+ UINT32 i;
for (i=0; i<Count; i++)
{
pList[i]=sels[i];
@@ -6157,6 +6164,35 @@
/********************************************************************************************
+> OurPropSheet* DialogManager::GetPropertySheetFromOp( DialogTabOp* pDialogTabOp )
+
+ Author: Luke_Hart (xara group ltd) <lukeh@xxxxxxxx>
+ created: 28/04/06
+ inputs: pdialogtabop: the operation we wish to find the property sheet for
+ outputs: -
+ returns: The associated Property sheet (or NULL if none)
+ purpose: Find the property sheet associated with the passed DialogTabOp
+ errors: -
+ seealso: -
+
+********************************************************************************************/
+
+OurPropSheet* DialogManager::GetPropertySheetFromOp( DialogTabOp* pDialogTabOp )
+{
+ DlgTagOpToPropShtItem* pTabItem = (DlgTagOpToPropShtItem*)(DlgTagOpToPropShtList.GetHead());
+ while (pTabItem != NULL)
+ {
+ if (pTabItem->pDialogTabOp == pDialogTabOp)
+ return pTabItem->pPropertySheet;
+
+ pTabItem = (DlgTagOpToPropShtItem*)(DlgTagOpToPropShtList.GetNext(pTabItem));
+ }
+
+ return NULL;
+}
+
+/********************************************************************************************
+
> BOOL DialogManager::AddAPage(DialogTabOp* pDialogTabOp, CDlgResID DialogResID)
Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xxxxxxxx>
@@ -6175,41 +6211,47 @@
BOOL DialogManager::AddAPage(DialogTabOp* pDialogTabOp, CDlgResID DialogResID)
{
- PORTNOTETRACE("dialog","DialogManager::AddAPage - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
+ // Try to add the page to the property sheet associated with the DialogTabOp
+ // let's try and find it
+ OurPropSheet* pPropSheet = GetPropertySheetFromOp( pDialogTabOp );
+ ERROR2IF( NULL == pPropSheet, FALSE, _T("Couldn't find DialogTabOp") );
+ wxBookCtrlBase* pNoteBook = pPropSheet->GetBookCtrl();
+
// We need to create a page object
// Because OurPropShtPage is derived from an MFC object we have to cope with exceptions
- OurPropShtPage* pNewPage;
+ wxWindow* pNewPage;
try
{
- pNewPage = new OurPropShtPage(DialogResID);
+ const TCHAR* pDialogName=CamResource::GetObjectNameFail( DialogResID );
+ ERROR1IF(pDialogName == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
+ TRACEUSER( "jlh92", _T("Cre tab %s
"), pDialogName );
+
+ pNewPage = wxXmlResource::Get()->LoadPanel( pNoteBook, pDialogName );
+ ERROR1IF(pNewPage == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
+ pNewPage->SetId( DialogResID );
+
+ CamArtProvider::Get()->EnsureChildBitmapsLoaded( pNewPage );
}
catch( CMemoryException )
{
- ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY))
+ ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY));
}
// Just to be safe
- ERROR1IF(pNewPage == NULL, FALSE, _R(IDS_OUT_OF_MEMORY))
+ ERROR1IF(pNewPage == NULL, FALSE, _R(IDS_OUT_OF_MEMORY));
- // Try to add the page to the property sheet associated with the DialogTabOp
- // let's try and find it
- DlgTagOpToPropShtItem* pTabItem = (DlgTagOpToPropShtItem*)(DlgTagOpToPropShtList.GetHead());
- while (pTabItem != NULL)
+ wxString Title = pNewPage->GetTitle();
+ if (Title.IsEmpty()) Title = pNewPage->GetLabel(); // because wxPanel doesn't seem to support a title
+ if (Title.IsEmpty())
{
- if (pTabItem->pDialogTabOp == pDialogTabOp)
- {
- ERROR2IF(pTabItem->pPropertySheet == NULL, FALSE, "No property sheet associated with DialogTabOp");
- // We have found the property sheet so let's add the page we have just created to it
- pTabItem->pPropertySheet->AddPage(pNewPage);
- return TRUE;
- }
- pTabItem = (DlgTagOpToPropShtItem*)(DlgTagOpToPropShtList.GetNext(pTabItem));
+ // Finally, in desperation, we (mis-)use the tooltip string because now the wx folks have removed
+ // the label, even though it's needed for accessibility. Aarrghh
+ wxToolTip* pTip = pNewPage->GetToolTip();
+ if (pTip) Title=pTip->GetTip();
}
- delete pNewPage;
- ERROR2(FALSE, "Could not find property sheet associated with DialogTabOp");
-#endif
- return false;
+
+ pNoteBook->AddPage( pNewPage, Title );
+ return true;
}
/********************************************************************************************
@@ -6234,9 +6276,7 @@
CWindowID DialogManager::GetPageWindow(CWindowID Win, CDlgResID PageID, INT32* PageIndex)
{
- PORTNOTE("dialog","DialogManager::GetPageWindow - do nothing")
-#ifndef EXCLUDE_FROM_XARALX
- if (PageID == NULL)
+ if (PageID == 0)
{
return Win; // A page is not required
}
@@ -6245,27 +6285,27 @@
ERROR3IF( pCWnd == NULL, "This is not a property sheet, the PageID should be NULL" );
// Ok so Win must be a property sheet, let's make sure
- ERROR3IF(!(pCWnd->IsKindOf(RUNTIME_CLASS(OurPropSheet))), "Don't know what this window is");
+ ERROR3IF( !pCWnd->IsKindOf( CLASSINFO(OurPropSheet) ), "Don't know what this window is" );
OurPropSheet* pPropertySheet = (OurPropSheet*)pCWnd;
- OurPropShtPage* pCurrentPage;
+ wxNotebookPage* pCurrentPage;
// Find the window ID of the page
- for (INT32 i = 0; i < pPropertySheet->GetPageCount(); i++)
+ wxBookCtrlBase* pBookCtrl = pPropertySheet->GetBookCtrl();
+ for (UINT32 i = 0; i < pBookCtrl->GetPageCount(); i++)
{
- pCurrentPage = (OurPropShtPage*)(pPropertySheet->GetPage(i));
- if (pCurrentPage->GetPageID() == PageID)
+ pCurrentPage = (wxNotebookPage*)(pBookCtrl->GetPage(i));
+ if (pCurrentPage->GetId() == INT32(PageID) )
{
if (PageIndex != NULL)
{
*PageIndex = i;
}
// Found page so return window id
- return pCurrentPage->GetSafeHwnd();
+ return pCurrentPage;
}
}
ERROR3("The page specified does not exist on this tabbed dialog");
-#endif
return Win; // Probably safer than NULL
}
@@ -6667,20 +6707,16 @@
CDlgResID DialogManager::GetActivePage()
{
- PORTNOTETRACE("dialog","DialogManager::GetActivePage - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
// first check to see if we have a property sheet object
- if (pPropSheet == NULL)
- return -1;
+ DlgTagOpToPropShtItem* pTabItem = (DlgTagOpToPropShtItem*)DlgTagOpToPropShtList.GetHead();
+ if (pTabItem->pPropertySheet == NULL)
+ return CDlgResID(-1);
- OurPropShtPage* pOurPage = pPropSheet->GetActivePage();
+ OurPropShtPage* pOurPage = pTabItem->pPropertySheet->GetActivePage();
if (pOurPage == NULL)
- return -1;
+ return CDlgResID(-1);
- return pOurPage->GetPageID();
-#else
- return (CDlgResID)(-1);
-#endif
+ return pOurPage->GetId();
}
@@ -6700,15 +6736,16 @@
void DialogManager::SetPropertyPageModified(BOOL Modified)
{
- PORTNOTETRACE("dialog","DialogManager::SetPropertyPageModified - do nothing");
+ DlgTagOpToPropShtItem* pTabItem = (DlgTagOpToPropShtItem*)DlgTagOpToPropShtList.GetHead();
+ if (pTabItem->pPropertySheet != NULL)
+ {
+PORTNOTE( "dialog", "Removed RegisterWindowMessage usage" )
#ifndef EXCLUDE_FROM_XARALX
- if (pPropSheet != NULL)
- {
- CPropertyPage* pActivePage = pPropSheet->GetActivePage();
+ wxNotebookPage* pActivePage = pTabItem->pPropertySheet->GetActivePage();
if (pActivePage != NULL)
pActivePage->SetModified(Modified);
+#endif
}
-#endif
}
@@ -7370,10 +7407,8 @@
********************************************************************************************/
-BOOL DialogManager::CreateTabbedDialog(DialogTabOp* pTabDlgOp, CDlgMode Mode, INT32 OpeningPage)
+wxWindow* DialogManager::CreateTabbedDialog(DialogTabOp* pTabDlgOp, CDlgMode Mode, INT32 OpeningPage)
{
- PORTNOTETRACE("dialog","DialogManager::CreateTabbedDialog - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
// First check if the OpeningPage parameter is not equal to -1, in which case this
// specifies the active page to be opened.
// Has to be an index as otherwise we have not specified the pages yet and so cannot
@@ -7387,6 +7422,8 @@
}
else
{
+PORTNOTE( "dialog", "Remove mainDlgID usage" );
+#ifndef EXCLUDE_FROM_XARALX
// Determine if this dialog has been created before
DialogPosition* pPosDetails = FindDialogPositionRecord(DialogManager::mainDlgID);
if (pPosDetails != NULL)
@@ -7394,6 +7431,7 @@
// The dialog has been created before so find out the index of the active page
ActivePageIndex = pPosDetails->ActivePageIndex;
}
+#endif
}
// ok first try and create the property sheet
@@ -7401,18 +7439,17 @@
// Because OurPropSheet is derived from an MFC object we have to cope with exceptions
try
{
- pPropertySheet = new OurPropSheet(pTabDlgOp->GetName(), ActivePageIndex);
+ pPropertySheet = new OurPropSheet( GetMainFrame(), pTabDlgOp->GetName(), ActivePageIndex );
+// pPropertySheet->Create(WS_POPUP | WS_SYSMENU | WS_BORDER | WS_DLGFRAME, 0)
}
catch( CMemoryException )
{
- ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY))
+ ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY));
}
// Just to be safe
- ERROR1IF(pPropertySheet == NULL, FALSE, _R(IDS_OUT_OF_MEMORY))
+ ERROR1IF(pPropertySheet == NULL, FALSE, _R(IDS_OUT_OF_MEMORY));
- pPropSheet = pPropertySheet;
-
// We need to store a mapping from the property sheet that we have just created
// to the DialogTabOp that it is associated with.We can't use a Cwnd to find the
// property sheet cos we ain't got one yet !
@@ -7432,6 +7469,8 @@
// Now add the Item to the DlgTagOpToPropShtList
DlgTagOpToPropShtList.AddHead(Item);
+ pPropertySheet->CreateButtons( wxOK|wxCANCEL|wxHELP );
+
// Before we can create the property sheet we must add pages to it.
// Let's ask the op do do this for us
if (!(pTabDlgOp->RegisterYourPagesInOrderPlease()))
@@ -7443,10 +7482,15 @@
return FALSE;
}
+ // Get the dialog sized to fit
+ pPropertySheet->LayoutDialog();
+
// Now that the pages have been registered, check if the dialog has been opened
// before. If so force the new ActivePage to be specified rather than the old.
if (OpeningPage != -1)
{
+PORTNOTE( "dialog", "Remove mainDlgID usage" );
+#ifndef EXCLUDE_FROM_XARALX
// Determine if this dialog has been created before
DialogPosition* pPosDetails = FindDialogPositionRecord(DialogManager::mainDlgID);
if (pPosDetails != NULL)
@@ -7464,30 +7508,10 @@
pPosDetails->ActivePageIndex = OpeningPage;
// }
}
+#endif
}
- if (Mode == MODELESS)
- {
- // Let's create a Modeless property sheet
- if (pPropertySheet->Create(GetMainFrame(), WS_POPUP | WS_SYSMENU | WS_BORDER | WS_DLGFRAME, 0))
- {
- return (PostCreate(pPropertySheet->GetSafeHwnd()));
- }
- }
- else
- {
- ERROR2IF(Mode != MODAL, FALSE, "Unknown dialog mode");
- // Create a Modal property sheet, note that PostCreate get's called from the Property
- // sheet's Create method. If a call to PostCreate fails then FALSE is returned from DoModal
- // WM_INIT_DIALOG message
- BOOL ok = pPropertySheet->DoModal();
- // We could not delete the modal property sheet in the Delete method as we are in
- // the middle of the DoModal function at this point. So we must do it here.
- delete pPropertySheet;
- return TRUE;
- }
-#endif
- return FALSE;
+ return pPropertySheet;
}
@@ -8939,10 +8963,9 @@
wxWindow* pGadget = GetGadget(wnd, Gadget);
if (!pGadget) return 0;
- if ( pGadget->IsKindOf(CLASSINFO(wxTreeCtrl))
- )
+ if( pGadget->IsKindOf( CLASSINFO(wxTreeCtrl) ) )
{
- return ((wxTreeCtrl*)pGadget)->GetChildrenCount(hItem, FALSE != bRecursive);
+ return UINT32( ((wxTreeCtrl*)pGadget)->GetChildrenCount( hItem, FALSE != bRecursive ) );
}
ERROR3("SetTreeGadgetItem called on non-tree gadget");
@@ -9023,5 +9046,184 @@
}
+// OurPropSheet methods
+BEGIN_EVENT_TABLE( OurPropSheet, wxPropertySheetDialog )
+ EVT_NOTEBOOK_PAGE_CHANGED( wxID_ANY, OurPropSheet::OnSetActive )
+END_EVENT_TABLE();
+
+/********************************************************************************************
+
+> OurPropSheet::OurPropSheet(String_256* pName)
+
+ Author: Simon
+ Created: 16/11/94
+ Inputs: pName: The name to be displayed in the dialog's title bar
+ Purpose: Constructs a property sheet
+
+********************************************************************************************/
+
+
+OurPropSheet::OurPropSheet( wxWindow* pParentWnd, String_256* pName, UINT32 SelPage )
+ : wxPropertySheetDialog( pParentWnd, wxID_ANY, (TCHAR*)*pName ) // The main frame is the owner of the sheet
+{
+}
+
+/********************************************************************************************
+
+> OurPropSheet::~OurPropSheet()
+
+ Author: Simon
+ Created: 28/11/94
+ Purpose: OurPropertySheet destructor, destroys the property sheet and all pages
+ that it contains
+
+********************************************************************************************/
+
+OurPropSheet::~OurPropSheet()
+{
+}
+
+
+/********************************************************************************************
+
+> void OurPropSheet::OnClose()
+
+ Author: Neville
+ Created: 23/12/94
+ Inputs: -
+ Outputs: -
+ Returns: -
+ Purpose: We override the OnClose method for our property sheet because the base class
+ OnClose method will kill the dialog box without telling us, if we are Modal.
+ Therefore, the dialog has no chance to clean itself up and will instead be
+ set a DIM_CANCEL when the application is closed!
+ Errors: -
+ SeeAlso: -
+
+ Note: This was true when using the VC2 XARAPROP.h/cpp class. Using the VC4 version
+ means that in the modeless case when the user clicks on the close icon on a
+ tabbed dialog box, this function gets called. In the modal case, this function
+ never seems to get called. We are then left with the op etc. still live.
+ CPropertySheet::DoModal calls DestroyWindow() which should be virtual.
+ This also sends a WM_DESTROY message. So, we will take advantage of this and
+ trap the call, clean our op up and then call the baseclass version.
+
+********************************************************************************************/
+
+PORTNOTE("dialog","Removed Windows callback - OurPropSheet::OnClose")
+#ifndef EXCLUDE_FROM_XARALX
+void OurPropSheet::OnClose()
+{
+ // Inform the Dialog that the close icon has been clicked so that it can be be shut
+ // down properly
+
+ // Check if the Cancel button is present and disabled i.e. greyed. If it is then ignore
+ // the message. Do this becuase we might have greyed the cancel button to say that this
+ // is a bad move at this point in time and we do not want the close button coming along
+ // and doing the cancel action when it shoudn't.
+ HWND hGadget = ::GetDlgItem(GetSafeHwnd(), IDCANCEL); // Obtain gadgets window
+ ERROR3IF(hGadget == NULL, "Could not find Cancel button control on tabbed dialog");
+ BOOL ok = TRUE;
+ // Only check if control is present
+ if (hGadget)
+ ok = ::IsWindowEnabled(hGadget); // Get current button state
+
+ // Use NULL as the page id so that the main dialog box gets the message.
+ if (ok)
+ BROADCAST_TO_CLASS(DialogMsg(GetSafeHwnd(), DIM_CANCEL, NULL, 0, NULL), DialogOp);
+ else
+ Beep(); // Warn the user that this is a bad time to do this
+
+ // Could call the main property sheet close method to get it to do its stuff but
+ // hopefully by now the DIM_CANCEL should have done everything that we were
+ // interested in.
+ //CPropertySheet::OnClose();
+}
+#endif
+
+/********************************************************************************************
+
+> virtual BOOL OurPropSheet::DestroyWindow()
+
+ Author: Neville Humphrys
+ Created: 24/7/97
+ Purpose: We override the DestroyWindow method for our property sheet because the base class
+ DestroyWindow method will kill the dialog box without telling us, if we are Modal.
+ Therefore, the dialog has no chance to clean itself up and will instead be
+ set a DIM_CANCEL when the application is closed!
+ SeeAlso: OurPropSheet::OnClose(); CPropertySheet::OnClose();
+
+********************************************************************************************/
+
+PORTNOTE("dialog","Removed Windows callback - OurPropSheet::DestroyWindow")
+#ifndef EXCLUDE_FROM_XARALX
+BOOL OurPropSheet::DestroyWindow()
+{
+ // Tell the system that this is a modal close which we wont have been told about
+ // If we do this then we get a no active page error 3. Use the OnSysCommand trap instead.
+// if (IsModal())
+// BROADCAST_TO_CLASS(DialogMsg(GetSafeHwnd(), DIM_CANCEL, NULL, 0, NULL), DialogOp);
+
+ return CPropertySheet::DestroyWindow();
+}
+#endif
+
+/********************************************************************************************
+
+> void OurPropSheet::OnSysCommand(UINT nID, LPARAM lparam)
+
+ Author: Neville Humphrys
+ Created: 24/7/97
+ Purpose: We override the OnSysCommand method for our property sheet because the base class
+ OnClose method will kill the dialog box without telling us, if we are Modal.
+ Therefore, the dialog has no chance to clean itself up and will instead be
+ set a DIM_CANCEL when the application is closed!
+ SeeAlso: OurPropSheet::DestroyWindow(); OurPropSheet::OnClose(); CPropertySheet::OnClose();
+
+********************************************************************************************/
+
+PORTNOTE("dialog","Removed Windows callback - OurPropSheet::OnSysCommand")
+#ifndef EXCLUDE_FROM_XARALX
+void OurPropSheet::OnSysCommand(UINT nID, LPARAM lparam)
+{
+ // check for clicks on the close icon
+ switch (nID & 0xFFF0)
+ {
+ case SC_CLOSE:
+ {
+ // The baseclass does this
+ /* if (m_bModeless)
+ {
+ SendMessage(WM_CLOSE);
+ return;
+ } */
+ // So we will do this
+ if (!m_bModeless)
+ {
+ BROADCAST_TO_CLASS(DialogMsg(GetSafeHwnd(), DIM_CANCEL, NULL, 0, NULL), DialogOp);
+ }
+ break;
+ }
+ }
+ // The baseclass calls this, we have no need as we will call the baseclass
+ // Default();
+
+ // Always call the baseclass
+ CPropertySheet::OnSysCommand(nID, lparam);
+}
+#endif
+
+void OurPropSheet::OnSetActive( wxNotebookEvent& event )
+{
+ wxWindow* pPage = GetBookCtrl()->GetPage( event.GetSelection() );
+ if( m_setCreateSent.end() == m_setCreateSent.find( pPage ) )
+ {
+ BROADCAST_TO_CLASS( DialogMsg( this, DIM_CREATE, 0, 0, pPage->GetId() ), DialogOp );
+ m_setCreateSent.insert( pPage );
+ }
+
+ BROADCAST_TO_CLASS( DialogMsg( this, DIM_SET_ACTIVE, 0, 0, pPage->GetId() ), DialogOp );
+}
+
Index: Trunk/XaraLX/wxOil/stdwx.h
===================================================================
--- Trunk/XaraLX/wxOil/stdwx.h (revision 917)
+++ Trunk/XaraLX/wxOil/stdwx.h (revision 918)
@@ -127,6 +127,7 @@
#include <wx/treectrl.h>
#include <wx/wxchar.h>
#include <wx/wxprec.h>
+#include <wx/propdlg.h>
#include <wx/xrc/xh_all.h>
#include <wx/xrc/xmlres.h>
@@ -148,6 +149,7 @@
#include <map>
#include <list>
#include <vector>
+#include <set>
#include <iostream>
#include <sstream>
#include <new>
Xara