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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 863
Date       : Sat Apr 22 19:04:19 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/Makefile.am
   M /Trunk/XaraLX/Kernel/layergal.cpp
   M /Trunk/XaraLX/Kernel/newcol.cpp
   M /Trunk/XaraLX/Kernel/sgallery.cpp
   M /Trunk/XaraLX/Kernel/sgallery.h
   M /Trunk/XaraLX/Kernel/sgcolour.cpp
   M /Trunk/XaraLX/Kernel/sgcolour.h
   M /Trunk/XaraLX/Kernel/sginit.cpp
   M /Trunk/XaraLX/Kernel/sglayer.cpp
   M /Trunk/XaraLX/wxOil/errors.cpp

First hack at colour gallery
Fixed gallery menu.
Fixed duplication of galleries & gallery finding routines (for the third time)


Diff:
Index: Trunk/XaraLX/Kernel/Makefile.am
===================================================================
--- Trunk/XaraLX/Kernel/Makefile.am	(revision 862)
+++ Trunk/XaraLX/Kernel/Makefile.am	(revision 863)
@@ -61,6 +61,7 @@
 	penedit.cpp aligndlg.cpp exjpeg.cpp aboutdlg.cpp sgdrag.cpp sginit.cpp sgtree.cpp \
 	bmpprefs.cpp expbmp.cpp expcol.cpp prvwflt.cpp bmpexdoc.cpp webop.cpp \
 	zdeflate.cpp jpgdest.cpp webparam.cpp bmpalint.cpp zdftrees.cpp animparams.cpp \
-	sglayer.cpp layermgr.cpp layergal.cpp backgrnd.cpp viewmenu.cpp renddlg.cpp
+	sglayer.cpp layermgr.cpp layergal.cpp backgrnd.cpp viewmenu.cpp renddlg.cpp \
+	sgcolour.cpp
 
 AM_CXXFLAGS = $(XARAFLAGS)
Index: Trunk/XaraLX/Kernel/sgallery.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgallery.cpp	(revision 862)
+++ Trunk/XaraLX/Kernel/sgallery.cpp	(revision 863)
@@ -769,6 +769,8 @@
 
 				It always calls the base class in order to show/hide the gallery
 
+				NOTE THAT THIS CAN DELETE THE OBJECT CONCERNED!
+
 ********************************************************************************************/
 
 void SuperGallery::SetVisibility(BOOL Open)
@@ -781,6 +783,8 @@
 
 	// Now call the base class to show/hide ourselves
 	DialogOp::SetVisibility(Open);
+	if (!Open)
+		End(); // Return quick, this deletes the super gallery
 }
 
 
@@ -3585,10 +3589,46 @@
 }
 
 
+/********************************************************************************************
 
+>	static SuperGallery* SuperGallery::FindSuperGallery(ResourceID SuperGalleryID, INT32 limit = -1)
 
+	Author:		Mark_Neves (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	26/4/94
+	Inputs:		SuperGalleryID - resource ID to find
+	Outputs:	-
+	Returns:	ptr to SuperGallery
+				NULL is returned if not found
+	Purpose:	Looks for a given SuperGallery by using its name 
+	Errors:		-
+	SeeAlso:	-
 
+********************************************************************************************/
 
+SuperGallery* SuperGallery::FindSuperGallery(ResourceID SuperGalleryID)
+{
+	List*       	pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogOp));
+	SuperGallery*	pSuperGallery = (SuperGallery*)pList->GetHead();
+	
+	while (pSuperGallery != NULL)
+	{
+		if (pSuperGallery->IsKindOf(CC_RUNTIME_CLASS(SuperGallery)))
+		{
+			if (pSuperGallery->DlgResID == SuperGalleryID)
+				return (pSuperGallery);
+		}
+
+		pSuperGallery = (SuperGallery*)pList->GetNext(pSuperGallery);
+	}
+
+	return NULL;
+}
+
+
+
+
+
+
 const CDlgMode SGalleryOptionsDlg::Mode = MODELESS; // Mode of the dialog  
 
 const UINT32 SGalleryOptionsDlg::IDD = _R(IDD_SGDISPLAY);
Index: Trunk/XaraLX/Kernel/sgcolour.h
===================================================================
--- Trunk/XaraLX/Kernel/sgcolour.h	(revision 862)
+++ Trunk/XaraLX/Kernel/sgcolour.h	(revision 863)
@@ -630,7 +630,7 @@
 	static OpState	GetState(String_256*, OpDescriptor*);		
     void 			Do(OpDescriptor*);
 
-	static DialogBarOp *FindGallery(void);
+	static SuperGallery *FindGallery(void);
 			// Finds the Colour gallery class instance
 };  
 
Index: Trunk/XaraLX/Kernel/sglayer.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sglayer.cpp	(revision 862)
+++ Trunk/XaraLX/Kernel/sglayer.cpp	(revision 863)
@@ -3462,21 +3462,20 @@
 
 BOOL LayerSGallery::CloseLayerGallery()
 {
-	String_32 Name(_R(IDS_LAYERGAL_GALLNAME));
-	DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name);
+	SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(_R(IDD_LAYERSGALLERY));
 
 	// Ensure a valid ptr.
-	if (pDialogBarOp == NULL)
+	if (pSuperGallery == NULL)
 		return FALSE;
 	
-	if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(LayerSGallery))
+	if (pSuperGallery->GetRuntimeClass() == CC_RUNTIME_CLASS(LayerSGallery))
 	{
 PORTNOTE("galleries", "Disabled frame gallery")
 #ifndef EXCLUDE_FROM_XARALX
 		GIFAnimationPropertyTabs::SetFrameGalleryOpen(FALSE);
 #endif
 		// Toggle the visible state of the gallery window
-		pDialogBarOp->SetVisibility( FALSE );
+		pSuperGallery->SetVisibility( FALSE );
 	}
 	else
 	{
Index: Trunk/XaraLX/Kernel/sgcolour.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgcolour.cpp	(revision 862)
+++ Trunk/XaraLX/Kernel/sgcolour.cpp	(revision 863)
@@ -106,7 +106,7 @@
 #include "collist.h"
 #include "colourix.h"
 #include "colormgr.h"
-#include "colpick.h"
+//#include "colpick.h"
 #include "comattrmsg.h"
 #include "docview.h"
 #include "dragcol.h"
@@ -120,8 +120,8 @@
 //#include "jason.h"
 #include "lineattr.h"
 //#include "markn.h"
-#include "newcol.h"
-#include "resdll.h"
+//#include "newcol.h"
+//#include "resdll.h"
 //#include "resource.h"	// For _R(IDS_CANCEL)
 #include "sgcolour.h"
 #include "sgdrag.h"
@@ -138,7 +138,7 @@
 
 // WEBSTER - markn 31/1/97
 #include "helpuser.h"
-#include "xshelpid.h"
+//#include "xshelpid.h"
 //#include "helppath.h"
 
 // Implement the dynamic class bits...
@@ -387,6 +387,8 @@
 				// Call a subroutine to work out and set our current cursor shape
 				return(DetermineCursorShape((SuperGallery *) TargetDialog,
 											DraggedNode, pMousePos));
+			default:
+				break;
 		}
 	}
 
@@ -837,6 +839,9 @@
 					Info += TempStr;
 				}
 				break;
+
+			default:
+				break;
 		}
 
 
@@ -1080,7 +1085,8 @@
 	// WEBSTER - markn 23/1/97
 	// No Circles required.
 	//
-	Renderer->SetFillColour(DocColour(COLOUR_BLACK));
+	DocColour black(COLOUR_BLACK);
+	Renderer->SetFillColour(black);
 #ifndef WEBSTER
 	if (IsASpotColour())
 	{
@@ -1120,7 +1126,7 @@
 	{
 		GridLockRect(MiscInfo, &MyRect);
 
-		IndexedColour *ParentCol = TheColour.FindParentIndexedColour();
+//		IndexedColour *ParentCol = TheColour.FindParentIndexedColour();
 
 		if (Flags.Selected)
 		{
@@ -1141,9 +1147,10 @@
 				if (LineCol != NULL && LineCol->FindParentIndexedColour() == TheColour.FindParentIndexedColour())
 				{
 					// This item is selected and is the current line colour. Put a mark in to indicate this
-					Renderer->SetLineColour(DocColour(COLOUR_BLACK));
+					DocColour black(COLOUR_BLACK);
+					Renderer->SetLineColour(black);
 					Renderer->SetLineWidth(TwoPixels);
-					Renderer->DrawLine(MyRect.lo, DocCoord(MyRect.lox, MyRect.hiy));
+					Renderer->DrawLine(MyRect.lo, DocCoord(MyRect.lo.x, MyRect.hi.y));
 				}
 			}
 		}
@@ -1677,7 +1684,7 @@
 	// allocate exactly the right number of characters, in order to minimise
 	// memory usage (libraries hold thousands of colours, so even one byte less
 	// saves kilobytes of storage over an entire library)
-	INT32 Length = Name->Length();
+//	INT32 Length = Name->Length();
 	ColourName.Alloc(Name->Length());
 	ColourName = *Name;
 }
@@ -1823,7 +1830,7 @@
 					// Otherwise, the normal click action takes place.
 					// If the drag fails (turns into a click) then the normal click action
 					// takes place, passed on by the GalleryColourDragInfo::OnClick handler
-					SGDisplayGroup *Parent = (SGDisplayGroup *) GetParent();
+//					SGDisplayGroup *Parent = (SGDisplayGroup *) GetParent();
 
 					if (Mouse->DoubleClick) // || Parent->GetParentDocument() != Document::GetSelected())
 					{
@@ -2075,11 +2082,11 @@
 	UpperFile.toUpper();
 
 	if (UpperFile == String_256(TEXT("PANTSPOT")))
-		TitleText.MakeMsg(_R(IDS_PANTONESPOTLIB));						// "PANTONE® Spot Colours"
+		TitleText.MakeMsg(_R(IDS_PANTONESPOTLIB));						// "PANTONE Spot Colours"
 	else if (UpperFile == String_256(TEXT("PPROCESSU")))
-		TitleText.MakeMsg(_R(IDS_PANTONEPROCESSU));						// "PANTONE® Color Name-Uncoated"
+		TitleText.MakeMsg(_R(IDS_PANTONEPROCESSU));						// "PANTONE Color Name-Uncoated"
 	else if (UpperFile == String_256(TEXT("PPROCESSC")))
-		TitleText.MakeMsg(_R(IDS_PANTONEPROCESSC));						// "PANTONE® Color Name-Coated"
+		TitleText.MakeMsg(_R(IDS_PANTONEPROCESSC));						// "PANTONE Color Name-Coated"
 	else if (UpperFile == String_256(TEXT("WEB")))
 		TitleText.MakeMsg(_R(IDS_WEBLIBRARY));							// "Web Colours"
 	else
@@ -2099,7 +2106,7 @@
 	m_DisplayInColourLine = -1;
 
 	// read a preference value for that named gallery
-	BOOL ReadOk = Camelot.GetPrefDirect(TEXT("ColourLine"), UpperFile, &m_DisplayInColourLine);
+	/*BOOL ReadOk =*/ Camelot.GetPrefDirect(TEXT("ColourLine"), UpperFile, &m_DisplayInColourLine);
 	if (m_DisplayInColourLine == -1)
 	{
 		// If the value wasn't present then default to TRUE for "WEB" and FALSE for others
@@ -2333,7 +2340,7 @@
 	String_256 TheFile = Filename.GetFileName(FALSE);
 	TheFile.toUpper();
 	// read a preference value for that named gallery
-	BOOL SetOk = Camelot.SetPrefDirect(TEXT("ColourLine"), TheFile, &m_DisplayInColourLine);
+	/*BOOL SetOk =*/ Camelot.SetPrefDirect(TEXT("ColourLine"), TheFile, &m_DisplayInColourLine);
 
 	return OldState;
 }
@@ -2361,6 +2368,8 @@
 
 ColourSGallery::ColourSGallery()
 {
+	DlgResID = _R(IDD_COLOURSGALLERY);
+
 	ISentTheMessage = FALSE;
 	CurrentColComp  = NULL;
 	CurrentTarget	= NULL;
@@ -2709,6 +2718,8 @@
 		Ptr = Ptr->GetNext();
 	}
 
+PORTNOTE("other", "Colour gallery needs to use the resource system for finding palettes when no path is specified");
+#ifndef EXCLUDE_FROM_XARALX
 	if (Ptr == NULL)
 	{
 		SGDisplayLibColGroup *Bob;
@@ -2752,6 +2763,7 @@
 			FileUtil::StopFindingFiles();
 		}
 	}
+#endif
 
 	// Ensure we know we have to reformat before the next redraw
 	InvalidateCachedFormat();
@@ -2863,8 +2875,11 @@
 
 void ColourSGallery::EditColour(ColourList *ParentList, IndexedColour *TheColour)
 {
+PORTNOTE("other", "disabled colour picker");
+#ifndef EXCLUDE_FROM_XARALX
 	ColourPicker ColPicker;
 	ColPicker.EditColour(ParentList, TheColour);
+#endif
 }
 
 
@@ -3648,58 +3663,54 @@
 		switch (Msg->DlgMsg)
 		{
 			case DIM_CREATE:
-				SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYCOLOURGALLERY, TRUE);
+				SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAYCOLOURGALLERY), TRUE);
 				SetSelectionFromDocument(TRUE);
 				break;
 
 			case DIM_CANCEL:
-				SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYCOLOURGALLERY, FALSE);
+				SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAYCOLOURGALLERY), FALSE);
 				break;
 
 			case DIM_LFT_BN_CLICKED:
 				if (DisplayTree == NULL || !IsVisible())
 					break;
 
-				switch(Msg->GadgetID)
+				if (FALSE) {}
+				else if (Msg->GadgetID == _R(IDC_GALLERY_NAME))
 				{
-					case _R(IDC_GALLERY_NAME):		// Show "rename" dlg
-						{
-							SGDisplayColour *FirstSelected = (SGDisplayColour *)
-												DisplayTree->FindNextSelectedItem(NULL);
-							if (FirstSelected != NULL)
-							{
-								IndexedColour *ColToEdit = FirstSelected->GetDisplayedColour()->
-																FindParentIndexedColour();
+					SGDisplayColour *FirstSelected = (SGDisplayColour *)
+										DisplayTree->FindNextSelectedItem(NULL);
+					if (FirstSelected != NULL)
+					{
+						IndexedColour *ColToEdit = FirstSelected->GetDisplayedColour()->
+														FindParentIndexedColour();
 
-								SGDisplayGroup *DocumentGroup = (SGDisplayGroup *) FirstSelected->GetParent();
-								ERROR3IF(DocumentGroup == NULL, "SGallery DisplayTree linkage corruption detected");
+						SGDisplayGroup *DocumentGroup = (SGDisplayGroup *) FirstSelected->GetParent();
+						ERROR3IF(DocumentGroup == NULL, "SGallery DisplayTree linkage corruption detected");
 
-								Document *ScopeDoc = DocumentGroup->GetParentDocument();
-								ERROR3IF(ScopeDoc == NULL, "SGallery group is not for a document! Unimplemented! Eek!");
+						Document *ScopeDoc = DocumentGroup->GetParentDocument();
+						ERROR3IF(ScopeDoc == NULL, "SGallery group is not for a document! Unimplemented! Eek!");
 
-								ColourList *ColList = ScopeDoc->GetIndexedColours();
-								ERROR3IF(ColList == NULL, "A document with no colour list? Now I've seen it all");
+						ColourList *ColList = ScopeDoc->GetIndexedColours();
+						ERROR3IF(ColList == NULL, "A document with no colour list? Now I've seen it all");
 
-								if (ColToEdit != NULL)
-									ColourNameDlg::InvokeDialog(ColList, ColToEdit);
-							}
-						}
-						break;
-					case _R(IDC_GALLERY_HELP):		// Show help page
-					{
-						TRACEUSER( "Markn", _T("Hello. Do you want help on this gallery?
"));
-						HelpUserTopic(_R(IDS_HELPPATH_Gallery_Colour));
+						if (ColToEdit != NULL)
+							ColourNameDlg::InvokeDialog(ColList, ColToEdit);
 					}
-					break;
-
-					case _R(IDC_COLGAL_BACKGROUND):	// Set a background layer with the selected colour
-						{
-							ApplySelectedAsBackground();
-						}
-						break;
-
 				}
+				else if (Msg->GadgetID == _R(IDC_GALLERY_HELP))
+				{
+					TRACEUSER( "Markn", _T("Hello. Do you want help on this gallery?
"));
+					HelpUserTopic(_R(IDS_HELPPATH_Gallery_Colour));
+				}
+				else if (Msg->GadgetID == _R(IDC_COLGAL_BACKGROUND))	// Set a background layer with the selected colour
+				{
+					ApplySelectedAsBackground();
+				}
 				break;
+
+			default:
+				break;
 		}
 
 		return(SuperGallery::Message(Message));
@@ -3718,7 +3729,7 @@
 
 		switch ( TheMsg->State )
 		{
-			case DocChangingMsg::DocState::BORN:			// New document - add to display tree
+			case DocChangingMsg::BORN:			// New document - add to display tree
 				{
 					CreateNewSubtree(TheMsg->pChangingDoc);	// Add a subtree for this doc
 					ShadeGallery(FALSE);
@@ -3735,6 +3746,9 @@
 //				==== NOTE ====
 //				The base sgallery class handles these messages to automatically remove
 //				the subtree for the dying doc, and/or shade the gallery if no docs are left
+			default:
+				break;
+
 		}
 	}
 	else if (MESSAGE_IS_A(Message, ColourChangingMsg))
@@ -3743,7 +3757,7 @@
 
 		switch (TheMsg->State)
 		{
-			case ColourChangingMsg::ColourState::LISTUPDATED:
+			case ColourChangingMsg::LISTUPDATED:
 				// A document colour list has been changed. We must recreate its display subtree
 				if (!ISentTheMessage && TheMsg->NewColourList != NULL)
 				{
@@ -3770,8 +3784,8 @@
 				break;
 
 
-			case ColourChangingMsg::ColourState::COLOURUPDATED:
-			case ColourChangingMsg::ColourState::COLOURUPDATEDINVISIBLE:
+			case ColourChangingMsg::COLOURUPDATED:
+			case ColourChangingMsg::COLOURUPDATEDINVISIBLE:
 				if (TheMsg->NewColourList != NULL)
 				{
 					Document *ScopeDoc = (Document *)TheMsg->NewColourList->GetParentDocument();
@@ -3779,11 +3793,14 @@
 				}
 				break;
 
-			case ColourChangingMsg::ColourState::SELVIEWCONTEXTCHANGE:
+			case ColourChangingMsg::SELVIEWCONTEXTCHANGE:
 				// Colour separation/correction options for the selected view have
 				// changed, so redraw the entire colour list using the new options.
 				ForceRedrawOfList();
 				break;
+
+			default:
+				break;
 		}
 	}
 	// The new CommonAttrsChanged msg replaces this messages. It handles 
@@ -3794,9 +3811,9 @@
 		SelChangingMsg *Msg = (SelChangingMsg *) Message;
 		switch ( Msg->State )
 		{
-			case SelChangingMsg::SelectionState::COLOURATTCHANGED:
-			case SelChangingMsg::SelectionState::SELECTIONCHANGED:
-			case SelChangingMsg::SelectionState::NODECHANGED:
+			case SelChangingMsg::COLOURATTCHANGED:
+			case SelChangingMsg::SELECTIONCHANGED:
+			case SelChangingMsg::NODECHANGED:
 				if (!AmShaded)			// If we're open & active, set listbox selection
 					SetSelectionFromDocument();
 				break;
@@ -3865,7 +3882,7 @@
 	// have a look at it (to see if it is a group being dragged)
 	if (DragMsg->pInfo->IsKindOf(CC_RUNTIME_CLASS(ColourDragInformation)))
 	{
-		SGColourDragTarget *NewTarget = new SGColourDragTarget(this, GetListGadgetID());
+		/*SGColourDragTarget *NewTarget =*/ new SGColourDragTarget(this, GetListGadgetID());
 	}
 	else
 		SuperGallery::HandleDragStart(DragMsg);
@@ -4748,7 +4765,19 @@
 	 							OpDisplayColourGallery::GetState,
 	 							_R(IDST_COLGAL_OPENGALLERY),
 	 							_R(IDBBL_DISPLAY_COLOUR_GALLERY),
-	 							0	/* bitmap ID */));
+				 				_R(IDC_BTN_SGCOLOUR), // UINT32 resourceID = 0,	// resource ID
+								_R(IDC_BTN_SGCOLOUR), // UINT32 controlID = 0,	// control ID
+								SYSTEMBAR_ILLEGAL,	  // SystemBarType GroupBarID = SYSTEMBAR_ILLEGAL,	// group bar ID
+				 				TRUE,	  // BOOL ReceiveMessages = TRUE,	// BODGE
+				 				FALSE,	  // BOOL Smart = FALSE,
+				 				TRUE,	  // BOOL Clean = TRUE,   
+								NULL,	  // OpDescriptor *pVertOpDesc = NULL,
+								0,	  // UINT32 OneOpenInstID = 0,		
+								0,	  // UINT32 AutoStateFlags = 0,
+								TRUE	  // BOOL fCheckable = FALSE
+								)
+								);
+
 }               
     
 /********************************************************************************************
@@ -4771,9 +4800,9 @@
 	OpState OpSt;  
 
 	// If the gallery is currenty open, then the menu item should be ticked
-	DialogBarOp* pDialogBarOp = FindGallery();
-	if (pDialogBarOp != NULL)
-		OpSt.Ticked = pDialogBarOp->IsVisible();
+	SuperGallery* pSuperGallery = FindGallery();
+	if (pSuperGallery != NULL)
+		OpSt.Ticked = pSuperGallery->IsVisible();
 
 	// If there are no open documents, you can't toggle the gallery
 	OpSt.Greyed = (Document::GetSelected() == NULL);
@@ -4801,15 +4830,15 @@
 
 void OpDisplayColourGallery::Do(OpDescriptor*)
 {
-	DialogBarOp *pDialogBarOp = FindGallery();
+	SuperGallery *pSuperGallery = FindGallery();
 
-	if (pDialogBarOp != NULL)
+	if (pSuperGallery != NULL)
 	{
 		// Toggle the visible state of the gallery window
-		pDialogBarOp->SetVisibility( !pDialogBarOp->IsVisible() );
+		pSuperGallery->SetVisibility( !pSuperGallery->IsVisible() );
 
 		// And update the gallery button state
-		SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYCOLOURGALLERY, pDialogBarOp->IsVisible());
+		SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAYCOLOURGALLERY), pSuperGallery->IsVisible());
 	}
 	
 	End();
@@ -4819,7 +4848,7 @@
 
 /********************************************************************************************
 
->	static DialogBarOp *OpDisplayColourGallery::FindGallery(void)
+>	static SuperGallery *OpDisplayColourGallery::FindGallery(void)
 
 	Author:		Jason_Williams (Xara Group Ltd) <camelotdev@xxxxxxxx>
 	Created:	9/2/95 (base generated in sgbase.cpp)
@@ -4836,15 +4865,16 @@
 
 ********************************************************************************************/
 
-DialogBarOp *OpDisplayColourGallery::FindGallery(void)
+SuperGallery *OpDisplayColourGallery::FindGallery(void)
 {
-	String_32 Name = _R(IDS_SGCOLOUR_COLOUR_GALLERY); // "Colour gallery";
-	DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name);
+	SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(_R(IDD_COLOURSGALLERY));
 
-	if (pDialogBarOp != NULL)
+	if (!pSuperGallery) pSuperGallery = new ColourSGallery;
+
+	if (pSuperGallery != NULL)
 	{
-		if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(ColourSGallery))
-			return(pDialogBarOp);
+		if (pSuperGallery->GetRuntimeClass() == CC_RUNTIME_CLASS(ColourSGallery))
+			return(pSuperGallery);
 
 		ERROR3("Got the Colour gallery but it's not of the ColourSGallery class");
 	}
@@ -4907,7 +4937,7 @@
 	if (IS_OUR_DIALOG_MSG(Message))
 	{
 		DialogMsg* Msg = (DialogMsg*)Message;
-		BOOL EndDialog = FALSE;
+//		BOOL EndDialog = FALSE;
 
 		switch (Msg->DlgMsg)
 		{
@@ -4918,14 +4948,14 @@
 					if (Info->TheName != NULL)			// Must be creating new colour
 					{
 						Name.MakeMsg(_R(IDS_COLNAME_CREATE));
-						SetStringGadgetValue(IDOK, _R(IDS_COLNAME_YCREATE));
-						SetStringGadgetValue(_R(IDC_COLNAME_TEXT), (StringBase *)Info->TheName);
+						SetStringGadgetValue(_R(IDOK), _R(IDS_COLNAME_YCREATE));
+						SetStringGadgetValue(_R(IDC_COLNAME_TEXT), *Info->TheName);
 					}
 					else if (Info->TheColour != NULL)	// Are renaming existing colour
 					{
 						Name.MakeMsg(_R(IDS_COLNAME_ALTER));
-						SetStringGadgetValue(IDOK, _R(IDS_COLNAME_YALTER));
-						SetStringGadgetValue(_R(IDC_COLNAME_TEXT), (StringBase *)Info->TheColour->GetName());
+						SetStringGadgetValue(_R(IDOK), _R(IDS_COLNAME_YALTER));
+						SetStringGadgetValue(_R(IDC_COLNAME_TEXT), *Info->TheColour->GetName());
 					}
 
 					SetTitlebarName(&Name);
@@ -4969,6 +4999,9 @@
 					}
 				}
 				break;
+
+			default:
+				break;
 		}
 
 		return (DLG_EAT_IF_HUNGRY(Msg)); 
Index: Trunk/XaraLX/Kernel/sginit.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sginit.cpp	(revision 862)
+++ Trunk/XaraLX/Kernel/sginit.cpp	(revision 863)
@@ -105,7 +105,7 @@
 //#include "newcol.h"		// For NewColourDlg
 #include "sgallery.h"	// For SGalleryOptionsDlg and SGallerySearchDlg
 //#include "sgbitmap.h"	// For OpDisplayBitmapGallery
-//#include "sgcolour.h"	// For OpDisplayColourGallery && ColourSGallery::Init
+#include "sgcolour.h"	// For OpDisplayColourGallery && ColourSGallery::Init
 //#include "sgfonts.h"	// For OpDisplayFontsGallery
 //#include "sglcart.h"	// For OpDisplayLibClipartGallery et al
 //#include "sglfills.h"	// For OpDisplayLibFillsGallery
@@ -186,11 +186,12 @@
 #ifdef VECTOR_STROKING
 				SGalleryLinePropertiesDlg::Init()	&&
 #endif // VECTOR_STROKING				
+#endif
 				ColourSGallery::Init()				&&
 				OpDisplayColourGallery::Init()		&&
 				ColourNameDlg::Init()				&&
+#ifndef EXCLUDE_FROM_XARALX
 				NewColourDlg::Init()				&&
-
 				OpDisplayBitmapGallery::Init()		&&
 
 				OpDisplayFontsGallery::Init()		&&
Index: Trunk/XaraLX/Kernel/newcol.cpp
===================================================================
--- Trunk/XaraLX/Kernel/newcol.cpp	(revision 862)
+++ Trunk/XaraLX/Kernel/newcol.cpp	(revision 863)
@@ -186,7 +186,7 @@
 	if (IS_OUR_DIALOG_MSG(Message))
 	{
 		DialogMsg* Msg = (DialogMsg*)Message;
-		BOOL EndDialog = FALSE;
+//		BOOL EndDialog = FALSE;
 
 		switch (Msg->DlgMsg)
 		{
@@ -235,12 +235,10 @@
 
 
 			case DIM_LFT_BN_CLICKED:
-				switch(Msg->GadgetID)
+				if (Msg->GadgetID == _R(IDC_NEWCOL_SHADE))
 				{
-					case _R(IDC_NEWCOL_SHADE):
-						SetNameText();			// Ensure name text is updated if necessary
-						ShadeControls();		// And make sure shading of controls is updated
-						break;
+					SetNameText();			// Ensure name text is updated if necessary
+					ShadeControls();		// And make sure shading of controls is updated
 				}
 				break;
 
@@ -284,6 +282,8 @@
 				}
 				break;
 */
+			default:
+				break;
 		}
 
 		return (DLG_EAT_IF_HUNGRY(Msg)); 
@@ -370,7 +370,7 @@
 				AutoName.MakeMsg(_R(IDS_NEWCOLOUR));											// "New Colour"
 		}
 
-		SetStringGadgetValue(_R(IDC_NEWCOL_NAME), (StringBase *) &AutoName);
+		SetStringGadgetValue(_R(IDC_NEWCOL_NAME), AutoName);
 	}
 }
 
@@ -532,7 +532,7 @@
 
 		TCHAR TempStr[256];
 		String_256 jcf(_R(IDS_NEWCOL_RENAMED));
-		wsprintf(TempStr, jcf, (LPCTSTR) UniqueName);
+		camSnprintf(TempStr, 256, jcf, (LPCTSTR) UniqueName);
 
 		// We still don't have a f***ing way of reporting a f***ing message to the user which uses
 		// a STRING so we can f***ing include f***ing useful information at runtime!
Index: Trunk/XaraLX/Kernel/sgallery.h
===================================================================
--- Trunk/XaraLX/Kernel/sgallery.h	(revision 862)
+++ Trunk/XaraLX/Kernel/sgallery.h	(revision 863)
@@ -641,7 +641,8 @@
 public:
 	virtual BOOL IsABar() {return FALSE; } 		// We are not a bar
 	virtual BOOL IsAGallery() {return TRUE; }	// We are a gallery
-	static SuperGallery*		FindSuperGallery(String_32& SuperGalleryName, INT32 limit = -1);
+	static SuperGallery* FindSuperGallery(String_32& SuperGalleryName, INT32 limit = -1);
+	static SuperGallery* FindSuperGallery(ResourceID SuperGalleryID);
 
 	String_32		Name;
 	String_32&		GetGalName()							{ return Name; }
Index: Trunk/XaraLX/Kernel/layergal.cpp
===================================================================
--- Trunk/XaraLX/Kernel/layergal.cpp	(revision 862)
+++ Trunk/XaraLX/Kernel/layergal.cpp	(revision 863)
@@ -1786,7 +1786,18 @@
 	 							OpDisplayLayerGallery::GetState,
 	 							0,	/* help ID */
 	 							_R(IDBBL_DISPLAY_LAYER_GALLERY),
-	 							0	/* bitmap ID */));
+				 				_R(IDC_BTN_SGLAYER), // UINT32 resourceID = 0,	// resource ID
+								_R(IDC_BTN_SGLAYER), // UINT32 controlID = 0,	// control ID
+								SYSTEMBAR_ILLEGAL,	  // SystemBarType GroupBarID = SYSTEMBAR_ILLEGAL,	// group bar ID
+				 				TRUE,	  // BOOL ReceiveMessages = TRUE,	// BODGE
+				 				FALSE,	  // BOOL Smart = FALSE,
+				 				TRUE,	  // BOOL Clean = TRUE,   
+								NULL,	  // OpDescriptor *pVertOpDesc = NULL,
+								0,	  // UINT32 OneOpenInstID = 0,		
+								0,	  // UINT32 AutoStateFlags = 0,
+								TRUE	  // BOOL fCheckable = FALSE
+								)
+								);
 }               
     
 /********************************************************************************************
@@ -1831,8 +1842,7 @@
 	if(LayerDoc)
 	{
 		// If the gallery is currenty open, then the menu item should be ticked
-		String_32 Name(_R(IDS_LAYERGAL_GALLNAME));
-		SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(Name);
+		SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(_R(IDD_LAYERSGALLERY));
 
 		if (pSuperGallery != NULL)
 		{
@@ -1871,8 +1881,7 @@
 
 void OpDisplayLayerGallery::Do(OpDescriptor*)
 {
-	String_32 Name(_R(IDS_LAYERGAL_GALLNAME));
-	SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(Name);
+	SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(_R(IDD_LAYERSGALLERY));
 
 	if (!pSuperGallery) pSuperGallery = new LayerSGallery;
 
@@ -1961,8 +1970,7 @@
 #ifdef WEBSTER
 		
 	// If the gallery is currenty open, then the menu item should be ticked
-	String_32 Name(_R(IDS_FRAMEGAL_GALLNAME));
-	SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(Name);
+	SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(_R(IDD_LAYERSGALLERY));
 
 	if (pSuperGallery != NULL)
 	{
Index: Trunk/XaraLX/wxOil/errors.cpp
===================================================================
--- Trunk/XaraLX/wxOil/errors.cpp	(revision 862)
+++ Trunk/XaraLX/wxOil/errors.cpp	(revision 863)
@@ -689,10 +689,10 @@
 INT32 InformGeneral(UINT32 Error, ErrorInfo* pInfo, UINT32 ModID)
 {
 	if (!pInfo) return _R(IDS_OK); // Catch this early
-	return InformGeneral(Error,ModID, pInfo->ErrorMsg, 
-				  pInfo->Button[1],pInfo->Button[2],pInfo->Button[3],pInfo->Button[4],
+	INT32 num = InformGeneral(Error,ModID, pInfo->ErrorMsg, 
+				  pInfo->Button[0],pInfo->Button[1],pInfo->Button[2],pInfo->Button[3],
 				  pInfo->OK,pInfo->Cancel);
-
+	return num?pInfo->Button[num-1]:_R(IDS_OK);
 	
 }
 


Xara