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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 801
Date       : Tue Apr 11 10:31:40 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/Makefile.am
   M /Trunk/XaraLX/Kernel/aprps.h
   M /Trunk/XaraLX/Kernel/bars.cpp
   M /Trunk/XaraLX/Kernel/layergal.cpp
   M /Trunk/XaraLX/Kernel/layergal.h
   M /Trunk/XaraLX/Kernel/layermgr.cpp
   M /Trunk/XaraLX/Kernel/main.cpp
   M /Trunk/XaraLX/Kernel/main2.cpp
   M /Trunk/XaraLX/Kernel/prevwdlg.h
   M /Trunk/XaraLX/Kernel/rndrgn.h
   M /Trunk/XaraLX/Kernel/sgallery.cpp
   M /Trunk/XaraLX/Kernel/sgallery.h
   M /Trunk/XaraLX/Kernel/sgdrag.cpp
   M /Trunk/XaraLX/Kernel/sgframe.h
   M /Trunk/XaraLX/Kernel/sginit.cpp
   M /Trunk/XaraLX/Kernel/sginit.h
   M /Trunk/XaraLX/Kernel/sglayer.cpp
   M /Trunk/XaraLX/Kernel/sgtree.cpp

First hack at galleries - some functionality in the layer gallery


Diff:
Index: Trunk/XaraLX/Kernel/sgframe.h
===================================================================
--- Trunk/XaraLX/Kernel/sgframe.h	(revision 800)
+++ Trunk/XaraLX/Kernel/sgframe.h	(revision 801)
@@ -99,7 +99,6 @@
 // SGFrame.h - the FrameSGallery (Frame SuperGallery) class
 // Looks remarkably like the layer gallery but looks aren't everything!
 
-
 #ifndef INC_SGFRAME
 #define INC_SGFRAME
 
Index: Trunk/XaraLX/Kernel/prevwdlg.h
===================================================================
--- Trunk/XaraLX/Kernel/prevwdlg.h	(revision 800)
+++ Trunk/XaraLX/Kernel/prevwdlg.h	(revision 801)
@@ -105,7 +105,7 @@
 #include "dialogop.h"
 #include "list.h"
 #include "listitem.h"
-#include "hirestim.h"	// high-resolution timer class
+//#include "hirestim.h"	// high-resolution timer class
 //#include "impexpop.h"
 #include "frameops.h"
 
Index: Trunk/XaraLX/Kernel/bars.cpp
===================================================================
--- Trunk/XaraLX/Kernel/bars.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/bars.cpp	(revision 801)
@@ -5710,6 +5710,7 @@
 	{
 		if (!IsVisible())
 			Create();
+			DialogOp::Open();
 	}
 	else
 	{
Index: Trunk/XaraLX/Kernel/Makefile.am
===================================================================
--- Trunk/XaraLX/Kernel/Makefile.am	(revision 800)
+++ Trunk/XaraLX/Kernel/Makefile.am	(revision 801)
@@ -58,5 +58,6 @@
 	zordops.cpp fillndge.cpp pathndge.cpp opbreak.cpp cmdctrl.cpp opsmooth.cpp \
 	combshps.cpp mkshapes.cpp mkstroke.cpp mrhbits.cpp ndmldink.cpp opfeathr.cpp \
 	linwthop.cpp sgmenu.cpp draginfo.cpp filelist.cpp statline.cpp pressure.cpp \
-	penedit.cpp aligndlg.cpp aboutdlg.cpp
+	penedit.cpp aligndlg.cpp aboutdlg.cpp sglayer.cpp sgdrag.cpp sginit.cpp sgtree.cpp \
+	layermgr.cpp layergal.cpp
 AM_CXXFLAGS = $(XARAFLAGS)
Index: Trunk/XaraLX/Kernel/layermgr.cpp
===================================================================
--- Trunk/XaraLX/Kernel/layermgr.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/layermgr.cpp	(revision 801)
@@ -107,7 +107,7 @@
 #include "layermgr.h"
 #include "fixst256.h"
 #include "ensure.h"
-#include "mainfrm.h" 
+//#include "mainfrm.h" 
 #include "infobar.h" 
 //#include "simon.h"
 //#include "mario.h"
@@ -119,6 +119,7 @@
 #include "bubbleid.h"
 //#include "sliceres.h" // for the resource id move to active layer
 #include "objchge.h" // for the allow op flags
+#include "bars.h"
 
 //#include "will2.h"
 #include "selop.h"
@@ -545,7 +546,7 @@
 			return FALSE; 
 		}
 		LayerDet->Status = (Current)->GetLayerStatus(); // record the layer status  
-		LayerDet->Layer = Current; 
+		LayerDet->m_pLayer = Current; 
 		LayerDet->New = FALSE; 
 		LayerDet->Deleted = FALSE; 
 
@@ -589,7 +590,7 @@
 		// We ignore deleted new layers because they don't change anything 
 		if (!(CurrentLyrDet->New && CurrentLyrDet->Deleted)) 	
 		{		
-			if (CurrentLyr != CurrentLyrDet->Layer) // z-order change 
+			if (CurrentLyr != CurrentLyrDet->m_pLayer) // z-order change 
 			{
 				return TRUE; 
 			}									
@@ -1220,7 +1221,8 @@
 			if (pSpread)
 			{
 				pTail = pSpread->FindActiveLayer();
-				AttachNodeDirection TailAttachDirection = LASTCHILD;
+				// AttachNodeDirection TailAttachDirection = LASTCHILD; <--- AMB removed this and inserted the next line 2006-04-10 presuming bug
+				TailAttachDirection = LASTCHILD;
 			}
 			else
 			{
Index: Trunk/XaraLX/Kernel/sgallery.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgallery.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/sgallery.cpp	(revision 801)
@@ -227,6 +227,7 @@
 
 SuperGallery::SuperGallery(CCRuntimeClass *Class): DialogBarOp(Class) 
 {
+	DlgResID = _R(IDD_LAYERSGALLERY);
 	InitData();
 } 
 
@@ -472,7 +473,7 @@
 				// Drop through to LFT_BN_DOWN handler...
 
 			case DIM_LFT_BN_DOWN:
-				if (Msg->GadgetID == GetListGadgetID() && !Msg->DlgMsgParam)
+				if ((Msg->GadgetID == GetListGadgetID()) && Msg->DlgMsgParam)
 				{
 					// Get our kernel-rendered-dlg info, and calculate our virtual coord space
 					ReDrawInfoType *DlgRedrawInfo = (ReDrawInfoType*) Msg->DlgMsgParam;
Index: Trunk/XaraLX/Kernel/sginit.h
===================================================================
--- Trunk/XaraLX/Kernel/sginit.h	(revision 800)
+++ Trunk/XaraLX/Kernel/sginit.h	(revision 801)
@@ -128,7 +128,7 @@
 	static BOOL Init(void);
 	static void DeInit(void);
 
-	static void UpdateGalleryButton(char *OpToken, BOOL IsVisible);
+	static void UpdateGalleryButton(ResourceID OpToken, BOOL IsVisible);
 };
 
 #endif
Index: Trunk/XaraLX/Kernel/sglayer.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sglayer.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/sglayer.cpp	(revision 801)
@@ -137,8 +137,8 @@
 #include "layermsg.h"
 //#include "richard2.h"
 //#include "andy.h"
-#include "sgframe.h"	// SGDisplayFrame
-#include "aprps.h"
+//#include "sgframe.h"	// SGDisplayFrame
+//#include "aprps.h"
 //#include "will2.h"		// for _R(IDS_LAYERGAL_GALLNAME)
 //#include "sliceres.h"
 #include "layermgr.h"
@@ -538,12 +538,13 @@
 
 	RenderRegion *Renderer = RedrawInfo->Renderer;
 
-	INT32 OnePixel  = (INT32) DevicePixels(MiscInfo, 1);
-	INT32 TwoPixels = (INT32) DevicePixels(MiscInfo, 2);
+//	INT32 OnePixel  = (INT32) DevicePixels(MiscInfo, 1);
+//	INT32 TwoPixels = (INT32) DevicePixels(MiscInfo, 2);
 
 	Renderer->SetLineWidth(0);
 	Renderer->SetLineColour(RedrawInfo->Transparent);
-	Renderer->SetFillColour(DocColour(191L, 191L, 191L));
+	DocColour fill(191, 191, 191);
+	Renderer->SetFillColour(fill);
 
 	// Calculate and redraw the buttons
 	// NOTE:
@@ -885,8 +886,8 @@
 
 					// Find out the state of the layer's flags
 					BOOL ActiveAndVisEd = (pLayer->IsActive() && Layer::ActiveLayerVisibleAndEditable);
-					BOOL Visible 		= pLayer->GetVisibleFlagState();
-					BOOL Locked  		= pLayer->GetLockedFlagState();
+//					BOOL Visible 		= pLayer->GetVisibleFlagState();
+//					BOOL Locked  		= pLayer->GetLockedFlagState();
 					BOOL Guide			= pLayer->IsGuide();
 					BOOL PageBackground = pLayer->IsPageBackground();
 
@@ -1217,9 +1218,16 @@
 
 void SGDisplayLayer::MoveLayer(SGDisplayNode *NodeToMove,BOOL Before,BOOL ToggleBackground)
 {
+PORTNOTE("galleries", "disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 	ERROR3IF((!IS_A(NodeToMove,SGDisplayLayer) && !IS_A(NodeToMove,SGDisplayFrame)),"The node to move is not a SGDisplayLayer");
 	if (!IS_A(NodeToMove,SGDisplayLayer) && !IS_A(NodeToMove,SGDisplayFrame))
 		return;
+#else
+	ERROR3IF((!IS_A(NodeToMove,SGDisplayLayer)),"The node to move is not a SGDisplayLayer");
+	if (!IS_A(NodeToMove,SGDisplayLayer))
+		return;
+#endif
 
 	Layer* pLayerToMove = ((SGDisplayLayer*)NodeToMove)->GetDisplayedLayer();
 	Layer* pThisLayer   = GetDisplayedLayer();
@@ -1594,12 +1602,15 @@
 		switch (Msg->DlgMsg)
 		{
 			case DIM_CREATE:
-				SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYLAYERGALLERY, TRUE);
+				SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAYLAYERGALLERY), TRUE);
 				break;
 
 			case DIM_CANCEL:
-				SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYLAYERGALLERY, FALSE);
+				SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAYLAYERGALLERY), FALSE);
 				break;
+
+			default:
+				break;
 		}
 	}
 
@@ -1618,53 +1629,56 @@
 		switch (Msg->DlgMsg)
 		{
 			case DIM_LFT_BN_CLICKED:
+			{
 				//TRACE( _T("Gadget %d clicked
"),Msg->GadgetID);
-				switch(Msg->GadgetID)
+				if (FALSE) {}
+				else if (Msg->GadgetID ==  _R(IDC_BTN_MULTILAYER))
 				{
-					case _R(IDC_BTN_MULTILAYER):
-						state = GetLongGadgetValue(_R(IDC_BTN_MULTILAYER),0,1);
-						DoChangeLayerState(NULL,LAYER_MULTILAYER,state);
-//						DoChangeMultilayer(state);
-//						ForceRedrawOfList();
-						break;
-
-					case _R(IDC_BTN_ALLVISIBLE):
-						state = GetLongGadgetValue(_R(IDC_BTN_ALLVISIBLE),0,1);
-						DoChangeLayerState(NULL,LAYER_ALLVISIBLE,state);
-//						DoChangeAllVisible(state);
-//						ForceRedrawOfList();
-						break;
-
-					case _R(IDC_GALLERY_UPONE):
-						DoMoveLayer(MOVELAYER_UPONE);
-						break;
-
-					case _R(IDC_GALLERY_DOWNONE):
-						DoMoveLayer(MOVELAYER_DOWNONE);
-						break;
-
-//					case _R(IDC_GALLERY_NAME):
-//						DoChangeName();
-//						break;
-
-					case _R(IDC_GALLERY_PROPERTIES):
-						DoLayerProperties();
-						break;
-
-					case _R(IDC_GALLERY_COPY):
-						DoCopyLayer();
-						break;
-
-					case _R(IDC_LAYER_MOVE_TO_ACTIVE):
-						DoMoveSelectionToActiveLayer();
-						break;
-												
+					state = GetLongGadgetValue(_R(IDC_BTN_MULTILAYER),0,1);
+					DoChangeLayerState(NULL,LAYER_MULTILAYER,state);
+					//DoChangeMultilayer(state);
+					//ForceRedrawOfList();
+				}
+				else if (Msg->GadgetID == _R(IDC_BTN_ALLVISIBLE))
+				{
+					state = GetLongGadgetValue(_R(IDC_BTN_ALLVISIBLE),0,1);
+					DoChangeLayerState(NULL,LAYER_ALLVISIBLE,state);
+					//DoChangeAllVisible(state);
+					//ForceRedrawOfList();
+				}
+				else if (Msg->GadgetID == _R(IDC_GALLERY_UPONE))
+				{
+					DoMoveLayer(MOVELAYER_UPONE);
+				}
+				else if (Msg->GadgetID == _R(IDC_GALLERY_DOWNONE))
+				{
+					DoMoveLayer(MOVELAYER_DOWNONE);
+				}
+				else if (Msg->GadgetID ==  _R(IDC_GALLERY_NAME))
+				{
+					//DoChangeName();
+					//break;
+				}
+				else if (Msg->GadgetID == _R(IDC_GALLERY_PROPERTIES))
+				{
+					DoLayerProperties();
+				}
+				else if (Msg->GadgetID == _R(IDC_GALLERY_COPY))
+				{
+					DoCopyLayer();
+				}
+				else if (Msg->GadgetID == _R(IDC_LAYER_MOVE_TO_ACTIVE))
+				{
+					DoMoveSelectionToActiveLayer();
+				}											
 #ifndef WEBSTER
-					case _R(IDC_GALLERY_HELP):		// Show help page
-						HelpUserTopic(_R(IDS_HELPPATH_Gallery_Layer));
-						break;
+				else if (Msg->GadgetID == _R(IDC_GALLERY_HELP))
+				{
+					HelpUserTopic(_R(IDS_HELPPATH_Gallery_Layer));
+				}
 #endif					
-				}
+			}
+			default:
 				break;
 		}
 	}
@@ -1676,6 +1690,8 @@
 			case OpMsg::AFTER_REDO:
 				EnsureSelSpreadSelectionIntegrity();
 				break;
+			default:
+				break;
 		}
 	}
 	else if (MESSAGE_IS_A(Message, SpreadMsg))
@@ -1721,6 +1737,8 @@
 					}
 				}
 				break;
+			default:
+				break;
 		}
 	}
 	else if (MESSAGE_IS_A(Message, DocChangingMsg))
@@ -1728,7 +1746,7 @@
 		DocChangingMsg *Msg = (DocChangingMsg *) Message;
 		switch (Msg->State)
 		{
-				case DocChangingMsg::DocState::TITLECHANGED:
+				case DocChangingMsg::TITLECHANGED:
 // Showstopper removed, Jason, 28/3/96
 // When the doc title changes, we simply need to redraw to update the group titles.
 // Calling CreateNewSubtree will destroy the existing tree - this is really really bad
@@ -1740,13 +1758,13 @@
 				break;
 		
 			// This message is sent when a new or just opened document is stable.
-			case DocChangingMsg::DocState::SELCHANGED:
+			case DocChangingMsg::SELCHANGED:
 			{
 				if (Msg->pNewDoc == NULL)
 				{
 					// No documents around any more, so we must wipe the display tree
 					// The base class will shade the gallery for us.
-					TRACEUSER( "Neville", _T("DocChangingMsg::DocState::SELCHANGED CreateNewSubtree
"));
+					TRACEUSER( "Neville", _T("DocChangingMsg::SELCHANGED CreateNewSubtree
"));
 					CreateNewSubtree(NULL);
 					ForceRedrawOfList();
 				}
@@ -1796,7 +1814,7 @@
 				break;
 			}
 		#ifndef WEBSTER
-			case DocChangingMsg::DocState::BORN:
+			case DocChangingMsg::BORN:
 			{
 				// When a new document is created, a SELCHANGED
 				// message is broadcasted, for Camelot2 frame/layer integration
@@ -1814,11 +1832,11 @@
 				break;
 			}
 
-			case DocChangingMsg::DocState::BORNANDSTABLE:
+			case DocChangingMsg::BORNANDSTABLE:
 			{
 				// flag variables.
 				BOOL LayerMode = FALSE;	
-				BOOL GalleryClosed = FALSE;
+//				BOOL GalleryClosed = FALSE;
 
 				// Get the changing document pointer.
 				Document* pChangingDoc = Msg->pChangingDoc;
@@ -1846,8 +1864,8 @@
 				break;
 			}
 
-			case DocChangingMsg::DocState::KILLED:
-			case DocChangingMsg::DocState::ABOUTTODIE:
+			case DocChangingMsg::KILLED:
+			case DocChangingMsg::ABOUTTODIE:
 			{
 				// The doc. is about to die, therefore, set this falg to false.
 				SetNewDocBorn(FALSE);
@@ -1864,24 +1882,26 @@
 		DocViewMsg *Msg = (DocViewMsg *) Message;
 		switch (Msg->State)
 		{
-			case DocViewMsg::DocViewState::SELABOUTTOCHANGE: 
+			case DocViewMsg::SELABOUTTOCHANGE: 
 				OldGuideLayerState = GetGuideLayerState(Msg->pNewDocView);
 				break;
 
-			case DocViewMsg::DocViewState::SELCHANGED: 
+			case DocViewMsg::SELCHANGED: 
 			{
 				if (IsVisible())
 				{
 					NewGuideLayerState = GetGuideLayerState(Msg->pNewDocView);
 					if (OldGuideLayerState != NewGuideLayerState)
 					{
-						TRACEUSER( "Neville", _T("DocViewMsg::DocViewState::SELCHANGED CreateNewSubtree
"));
+						TRACEUSER( "Neville", _T("DocViewMsg::SELCHANGED CreateNewSubtree
"));
 						CreateNewSubtree(Msg->pNewDocView ? Msg->pNewDocView->GetDoc() : NULL);
 						ForceRedrawOfList();
 					}
 				}
 			}
 			break;
+			default:
+				break;
 		}
 	}
 	else if (MESSAGE_IS_A(Message, LayerMsg))
@@ -1891,7 +1911,7 @@
 		switch ( pMsg->Reason )
 		{
 			// The active layer has changed.
-			case LayerMsg::LayerReason::ACTIVE_LAYER_CHANGED:
+			case LayerMsg::ACTIVE_LAYER_CHANGED:
 			{
 				EnableGadget(_R(IDC_GALLERY_COPY),pMsg->pNewLayer != NULL && !pMsg->pNewLayer->IsGuide()); 
 			}
@@ -1899,14 +1919,14 @@
 
 			// The visibility of a layer has changed, probably by an external source
 			// so update the display
-			case LayerMsg::LayerReason::LAYER_VISIBILITY_CHANGED:
+			case LayerMsg::LAYER_VISIBILITY_CHANGED:
 			{
 				ForceRedrawOfList(); 
 			}
 			break;
 
 			// The active layer has been changed externally to the gallery.
-			case LayerMsg::LayerReason::UPDATE_ACTIVE_LAYER:
+			case LayerMsg::UPDATE_ACTIVE_LAYER:
 			{
 				// We must now check whether the selected layer has been changed externally
 				// to us. May happen if an animated GIF is being loaded onto layers
@@ -1920,12 +1940,12 @@
 						Layer* pNewActiveLayer = pMsg->pNewLayer;
 						// Search for the new display item to match this new active layer 
 						SGDisplayLayer *pWantedDispLayer = NULL;
-						SGDisplayLayer *pDispLayer = ((SGDisplayFrame *) DisplayForeground->GetChild());
+						SGDisplayLayer *pDispLayer = ((SGDisplayLayer *) DisplayForeground->GetChild());
 						while (pDispLayer != NULL)						
 						{
 							if (pDispLayer->GetDisplayedLayer() == pNewActiveLayer)
 								pWantedDispLayer = pDispLayer;
-							pDispLayer = ((SGDisplayFrame *)pDispLayer->GetNext());
+							pDispLayer = (SGDisplayLayer *) pDispLayer->GetNext();
 						}
 						
 						// If we found the required display item then go and select it
@@ -1940,6 +1960,8 @@
 				}
 			}
 			break;
+			default:
+				break;
 		}
 	}
 
@@ -2182,7 +2204,7 @@
 	//ERROR3("LayerSGallery::MakeActiveLayer supressed broadcast - bad !");
 #else
 	if (TellAll)
-		BROADCAST_TO_ALL(LayerMsg(pNewActiveLayer,LayerMsg::LayerReason::ACTIVE_LAYER_CHANGED));
+		BROADCAST_TO_ALL(LayerMsg(pNewActiveLayer,LayerMsg::ACTIVE_LAYER_CHANGED));
 #endif
 }
 
@@ -2476,7 +2498,7 @@
 
 	if (pLayerGalItem != NULL)
 	{
-		if (HasLayerGotChildren(pLayerGalItem->GetDisplayedLayer()) != NULL)
+		if (HasLayerGotChildren(pLayerGalItem->GetDisplayedLayer()) != FALSE)
 		{
 			// If some are in use, determine if the user really wants to delete them
 			INT32 ButtonPressed = AskQuestion(_R(IDS_LAYER_CONSTAINSOBJECTS),
@@ -2646,6 +2668,8 @@
 //#ifdef WEBSTER
 //			GIFAnimationPropertyTabs * pTabHandler = GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertiesTabs();
 //#else
+PORTNOTE("galleries", "Disabled layer properties tab dialog")
+#ifndef EXCLUDE_FROM_XARALX
 			LayerPropertyTabs * pTabHandler = LayerPropertyTabsDlg::GetLayerPropertiesTabs();	
 //#endif // webster -RanbirR
 			if (pTabHandler)
@@ -2654,6 +2678,7 @@
 				if (pDlg != NULL)
 					pDlg->Open();
 			}
+#endif
 		}
 	}
 #endif
@@ -2722,11 +2747,11 @@
 		{
 			pDoc->SetAllVisible(PrevAllVisible);
 			BOOL PrevVisible = pLayer->IsVisible();
-			BOOL PrevLocked  = pLayer->IsLocked();
+//			BOOL PrevLocked  = pLayer->IsLocked();
 
 			pDoc->SetAllVisible(AllVisible);
 			BOOL PostVisible = pLayer->IsVisible();
-			BOOL PostLocked  = pLayer->IsLocked();
+//			BOOL PostLocked  = pLayer->IsLocked();
 
 			if (PrevVisible != PostVisible)
 			{
@@ -2743,7 +2768,7 @@
 	pDoc->SetAllVisible(AllVisible);
 
 	// inform that visible layers have changed
-	BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::LayerReason::LAYER_VISIBILITY_CHANGED));
+	BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::LAYER_VISIBILITY_CHANGED));
 }
 
 
@@ -2832,7 +2857,7 @@
 		LayerSGallery::ForceRedrawLayer(pLayer->FindDocument(), pLayer);
 
 		// inform that visible layers have changed
-		BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::LayerReason::LAYER_VISIBILITY_CHANGED));
+		BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::LAYER_VISIBILITY_CHANGED));
 
 		// If layer has just become invisible, remove the selections on the layer 
 		if (!PostVisible)
@@ -3263,12 +3288,15 @@
 //#ifdef WEBSTER
 //			GIFAnimationPropertyTabs * pTabHandler = GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertiesTabs();
 //#else
+PORTNOTE("galleries", "Disabled layer properties tab dialog")
+#ifndef EXCLUDE_FROM_XARALX
 			LayerPropertyTabs * pTabHandler = LayerPropertyTabsDlg::GetLayerPropertiesTabs();
 //#endif //webster
 			if (pTabHandler)
 			{
 				pTabHandler->SetCurrentLayer(pLayerGalItem->GetDisplayedLayer());
 			}
+#endif
 		}
 #endif
 		ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_New);
@@ -3341,11 +3369,14 @@
 //#ifdef WEBSTR
 //			GIFAnimationPropertyTabs * pTabHandler = GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertiesTabs();
 //#else
+PORTNOTE("galleries", "Disabled layer properties tab dialog")
+#ifndef EXCLUDE_FROM_XARALX
 			LayerPropertyTabs * pTabHandler = LayerPropertyTabsDlg::GetLayerPropertiesTabs();
 //#endif //webster RanbirR
 			if (pTabHandler)
 				State.Greyed = (pTabHandler->GetTabbedDlg() != NULL);
 			else
+#endif
 				State.Greyed = TRUE;	
 		}
 #endif
@@ -3432,8 +3463,10 @@
 	
 	if (pDialogBarOp->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 );
 	}
@@ -3442,7 +3475,7 @@
 		ERROR3("Got the frame gallery but it's not of the LayerSGallery class");
 	}
 
-	SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYLAYERGALLERY, FALSE);
+	SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAYLAYERGALLERY), FALSE);
 
 	// Everything ok.
 	return TRUE;
Index: Trunk/XaraLX/Kernel/rndrgn.h
===================================================================
--- Trunk/XaraLX/Kernel/rndrgn.h	(revision 800)
+++ Trunk/XaraLX/Kernel/rndrgn.h	(revision 801)
@@ -126,8 +126,8 @@
 
 // These constants are WIN32 specific and are used by Windows - only code such as the internet galleries
 // They DO NOT NEED to be redefined for other operating systems as the code using them simply won't exist
+// Well, actually, they do, as CALCRECT (for instance) is used elsewhere
 
-#ifdef _WIN32 
 #define FORMAT_TOP              0x00000000
 #define FORMAT_LEFT             0x00000000
 #define FORMAT_CENTER           0x00000001
@@ -144,9 +144,6 @@
 #define FORMAT_NOPREFIX         0x00000800
 #define FORMAT_INTERNAL         0x00001000
 #define DEFAULT_TEXT_FORMATTING		FORMAT_SINGLELINE | FORMAT_NOPREFIX | FORMAT_VCENTER 
-#else
-#define DEFAULT_TEXT_FORMATTING		NULL
-#endif
 
 
 class Node;
@@ -500,7 +497,7 @@
 	virtual void DrawCross(const DocCoord &Point, const UINT32 Size) = 0;
 
 	virtual void DrawBitmap(const DocCoord &Point, KernelBitmap* pBitmap) = 0;
-	virtual void DrawBitmap(const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID = NULL) = 0;
+	virtual void DrawBitmap(const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID = 0) = 0;
 	virtual BOOL DrawTransformedBitmap(NodeBitmap *pNodeBitmap);
 
 	virtual void DrawBitmapBlob(const DocCoord &Point, KernelBitmap* BlobShape) = 0;
Index: Trunk/XaraLX/Kernel/sgtree.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgtree.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/sgtree.cpp	(revision 801)
@@ -105,18 +105,18 @@
 #include "dragmgr.h"	// Drag manager (DragManagerOp::StartDrag, RedrawStarting etc)
 //#include "galres.h"		// Gallery bitmap resources
 //#include "galstr.h"		// Gallery string resources
-#include "scroller.h"	// For scroll bar width
+//#include "scroller.h"	// For scroll bar width
 #include "sgallery.h"	// SuperGallery definitions
 #include "sgdrag.h"		// Scroll bar drag target/info
 #include "sgtree.h"		// This file's associated header
 #include "sglib.h"		// For virtualising static switch
-#include "sglcart.h"
+//#include "sglcart.h"
 
 #include "ccdc.h"		// For render-into-dialogue support
-#include "sglfills.h"
+//#include "sglfills.h"
 #include "dlgcol.h"
 #include "fillval.h"
-#include "grnddib.h"
+//#include "grnddib.h"
 
 //#include "richard3.h"	// For _R(IDS_GALLERY_PREPARE_FOR_UNFOLD)
 #include "progress.h"
@@ -188,7 +188,7 @@
 SGDisplayNode::~SGDisplayNode()
 {
 	ERROR3IF(Flags.HandleEventCount > 0, "AWOOGA! SGDisplayNode deleted while in its own HandleEvent method - Alert Jason!");
-	ERROR3IF(Flags.HandleEventCount < 0, "Deleted SGDisplayNode had a corrupted HandleEventCount");
+	ERROR3IF(Flags.HandleEventCount != 0, "Deleted SGDisplayNode had a corrupted HandleEventCount");
 
 	if (Parent != NULL || GetChild() != NULL || Next != NULL || Previous != NULL)
 	{
@@ -854,7 +854,7 @@
 {
 	BOOL Handled = FALSE;
 	SGDisplayNode *Ptr = GetChild();
-	SGDisplayNode *NextPtr = NULL;
+//	SGDisplayNode *NextPtr = NULL;
 
 	if (EventType == SGEVENT_FORMAT)
 	{
@@ -1075,7 +1075,7 @@
 		// line is fully redrawn.
 
 		ERROR3IF(FormatInfo->LineHeight != 0,
-			"Sibling Display Item heights are not equal! Jason must upgrade the redraw code")
+			"Sibling Display Item heights are not equal! Jason must upgrade the redraw code");
 
 		FormatInfo->LineHeight = ItemHeight;
 	}
@@ -1112,11 +1112,11 @@
 		{
 			FormatInfo->LastInvalidNode = this;		// We are the last node found to have invalid bounds
 
-			if (FormatInfo->InvalidBounds.hiy > 0)	// If we haven't found an invalid item before
-				FormatInfo->InvalidBounds.hiy = FormatRect.hiy;
+			if (FormatInfo->InvalidBounds.hi.y > 0)	// If we haven't found an invalid item before
+				FormatInfo->InvalidBounds.hi.y = FormatRect.hi.y;
 
-			if (FormatInfo->InvalidBounds.loy > FormatRect.loy)
-				FormatInfo->InvalidBounds.loy = FormatRect.loy;
+			if (FormatInfo->InvalidBounds.lo.y > FormatRect.lo.y)
+				FormatInfo->InvalidBounds.lo.y = FormatRect.lo.y;
 		}
 		else
 		{
@@ -1126,12 +1126,12 @@
 				// invalid bounds, then we extend them to touch the top of us, to include any gap
 				// between them and us.
 
-				ERROR3IF(FormatInfo->InvalidBounds.hiy > 0,
+				ERROR3IF(FormatInfo->InvalidBounds.hi.y > 0,
 							"Gallery display formatting error - LastInvalidNode should be NULL "
 							"if there haven't been any invalid nodes yet");
 
-				if (FormatInfo->InvalidBounds.loy > FormatRect.hiy)
-					FormatInfo->InvalidBounds.loy = FormatRect.hiy;
+				if (FormatInfo->InvalidBounds.lo.y > FormatRect.hi.y)
+					FormatInfo->InvalidBounds.lo.y = FormatRect.hi.y;
 
 				FormatInfo->LastInvalidNode = NULL;		// Reset LastInvalid node so that the next node doesn't extend!
 			}
@@ -1263,6 +1263,8 @@
 		case SGEVENT_BGFLUSH:
 			DeregisterForBGRedraw();
 			break;				// And drop through to flush all children
+		default:
+			break;
 	}
 
 	// And pass all events on to my children
@@ -2324,7 +2326,8 @@
 		// Fill inside the plinth with button-face (grey), and optionally with the glyph bitmap
 		// (We always fill behind the bitmap first in case the bitmap isn't big enough to
 		// fill the entire area)
-		pRender->SetLineColour(DocColour(COLOUR_TRANS));
+		DocColour trans(COLOUR_TRANS);
+		pRender->SetLineColour(trans);
 		pRender->SetFillColour(RedrawColours->ButtonFace());
 		pRender->DrawRect(&InsideRect);
 
@@ -2425,8 +2428,10 @@
 		pRender->SaveContext();
 	
 		pRender->SetLineWidth(0);
-		pRender->SetLineColour(DocColour(COLOUR_TRANS));
-		pRender->SetFillColour(DocColour(COLOUR_BLACK));
+		DocColour trans(COLOUR_TRANS);
+		pRender->SetLineColour(trans);
+		DocColour black(COLOUR_BLACK);
+		pRender->SetFillColour(black);
 
 		DocRect TempRect(*BoundsRect);					// Left
 		TempRect.hi.x = TempRect.lo.x + Width;
@@ -2756,8 +2761,11 @@
 				ParentGallery->SetSystemStateChanged();	// Ensure toolbar button pops out again
 			}
 		}
+PORTNOTE("galleries", "Disabled clipart gallery")
+#ifndef EXCLUDE_FROM_XARALX
 		else if (ParentGallery->IsKindOf(CC_RUNTIME_CLASS(LibFillsSGallery)))
 						 LibClipartSGallery::ImportClipart(TRUE, (LibraryGallery*) ParentGallery);
+#endif
 		else
 			ParentGallery->ApplyAction(SGACTION_APPLY);
 
@@ -2808,13 +2816,15 @@
 #ifdef _DEBUG
 void SGDisplayNode::DumpSubtree(INT32 TreeLevel)
 {
+	PORTNOTETRACE("galleries", "Disabled debug dump");
+#ifndef EXCLUDE_FROM_XARALX
 	if (IsUserName("Matt"/*Jason*/))
 	{
 		// First, dump out myself...
-		char Temp[200];
-		char Msg[200];
-
-		for (INT32 i = 0; i < (TreeLevel * 2) && i < 50; i++)
+		TCHAR Temp[200];
+		TCHAR Msg[200];
+		INT32 i;
+		for (i = 0; i < (TreeLevel * 2) && i < 50; i++)
 		   Msg[i] = ' ';
 
 		Msg[i] = '
@@ -2832,6 +2842,7 @@
 			Ptr = Ptr->Next;
 		}
 	}
+#endif
 }
 #endif
 
@@ -3218,11 +3229,11 @@
 			// invalid bounds, to ensure we don't leave little bits of stuff past the end
 			// of the list if it has got smaller.
 
-			ERROR3IF(FormatInfo->InvalidBounds.hiy > 0,
+			ERROR3IF(FormatInfo->InvalidBounds.hi.y > 0,
 						"Gallery display formatting error - LastInvalidNode should be NULL "
 						"if there haven't been any invalid nodes yet");
 
-			FormatInfo->InvalidBounds.loy = FormatInfo->LinePos - MiscInfo->WindowHeight;
+			FormatInfo->InvalidBounds.lo.y = FormatInfo->LinePos - MiscInfo->WindowHeight;
 		}
 	}
 
@@ -3743,7 +3754,10 @@
 	IndentedButton = IBUTTON_NONE;
 
 	// Read the scroll bar width - use half of the normal scroll bar width (and is an even number)
-	ScrollBarWidth = (CScroller::GetScrollerSize() / 2) & 0xFE;
+PORTNOTE("galleries", "hard wired scrollbar width");
+	ScrollBarWidth = 12;
+//	ScrollBarWidth = (CScroller::GetScrollerSize() / 2) & 0xFE;
+	
 	if (ScrollBarWidth < 10)	// But make sure it lies within a sensible range
 		ScrollBarWidth = 10;
 	if (ScrollBarWidth > 100)
@@ -4185,7 +4199,7 @@
 				DragMessage *Msg = GetDragInfo(EventType, EventInfo);
 
 				// Is it a Drag Started message?
-				if (Msg->State == DragMessage::DragState::DRAGSTARTED)
+				if (Msg->State == DragMessage::DRAGSTARTED)
 				{
 					// Is it a SuperGallery scroll drag?
 					// And is it a scroll drag for THIS display tree?
@@ -4194,13 +4208,17 @@
 					{
 						SuperGallery *ParentGallery = GetParentGallery();						
 
-						SGScrollDragTarget *DragTarget = 
+						// AMB comment out assignment to variable as variable is unused. Can this be right?
+						/* SGScrollDragTarget *DragTarget = */
 								new SGScrollDragTarget(ParentGallery,
 														ParentGallery->GetListGadgetID());
 					}
 				}
 			}
 			break;
+
+			default:
+				break;
 	}
 
 	// And pass the event on to the tree via our base class handler
@@ -4225,7 +4243,7 @@
 		// everything to the very bottom of the list
 		SGFormatInfo *FormatInfo = GetFormatInfo(EventType, EventInfo);
 		if (FormatInfo->AccumulateBounds)
-			FormatInfo->InvalidBounds.loy = min(-OldScrollExtent, -ScrollExtent);
+			FormatInfo->InvalidBounds.lo.y = min(-OldScrollExtent, -ScrollExtent);
 	}
 
 	if (EventType == SGEVENT_REDRAW && HasScrollBar)		// If room for a scrollbar, draw it
@@ -4254,7 +4272,8 @@
 			// We move the left and top/bottom edges by 1 pixel to accomodate
 			// the black border lines that we draw around these areas.
 			Renderer->SetLineWidth(0);
-			Renderer->SetLineColour(DocColour(COLOUR_TRANS));
+			DocColour trans(COLOUR_TRANS);
+			Renderer->SetLineColour(trans);
 			Renderer->SetFillColour(RedrawColours.ButtonFace());
 
 			PageUp.lo.x += PixelSize;
@@ -4271,7 +4290,8 @@
 			// (down left edge and between scroll bar and arrows)
 			// We draw these lines as filled rectangles to avoid the fact that lines
 			// draw in different blimming places in different render regions
-			Renderer->SetFillColour(DocColour(COLOUR_BLACK));
+			DocColour black(COLOUR_BLACK);
+			Renderer->SetFillColour(black);
 
 			Renderer->DrawPixelLine(DocCoord(ScrollRect.lo.x, DownButton.lo.y),
 								DocCoord(ScrollRect.lo.x, UpButton.hi.y));
@@ -4825,6 +4845,8 @@
 		// Truncate the name into our 64-char buffer
 		NewTitle.Left(&TitleText, 63);
 	}
+PORTNOTE("galleries", "disabled folder updated stuff")
+#ifndef EXCLUDE_FROM_XARALX
 	else if (ParentLibrary != NULL)
 	{
 		ParentLibrary->GetLibraryTitle(&TitleText);
@@ -4843,6 +4865,7 @@
 		}
 		//<< webster
 	}
+#endif
 }
 
 
@@ -5316,9 +5339,12 @@
 	if(IsVirtualised())
 		return TRUE;
 
+PORTNOTE("galleries", "Disabled virtualising switch")
+#ifndef EXCLUDE_FROM_XARALX
 	// Virtualisation disabled...
 	if(!SGLibGroup::LibraryVirtualisingEnabled)
 		return FALSE;
+#endif
 
 	DestroySubtree(FALSE);	// Delete all items in the group (but not this one obviously)
 	SetVirtualisedState(TRUE);
Index: Trunk/XaraLX/Kernel/sgdrag.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgdrag.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/sgdrag.cpp	(revision 801)
@@ -350,6 +350,9 @@
 					ScrollBy = ClickScroll;
 			}
 			break;
+
+		default:
+			break;
 	}
 
 	if (Event != DRAGEVENT_DEINITIALISE && ScrollBy != 0)
@@ -481,7 +484,7 @@
 	// Set up a few things about this drag - it does not do solid drag
 	DoesSolidDrag = FALSE;
 	SolidDragOffset.x = SolidDragOffset.y = 0;	// Set up defaults just in case
-	SolidDragSize.cx = SolidDragSize.cy = 1;
+	SolidDragSize.Set(1,1);
 }
 
 
@@ -1098,6 +1101,8 @@
 			// Call a subroutine to work out and set our current cursor shape
 			return(DetermineCursorShape((SuperGallery *) TargetDialog,
 										Info->GetDraggedNode(), pMousePos));
+		default:
+			break;
 	}
 
 	// Otherwise, we aren't interested in the event, so we don't claim it
@@ -1144,20 +1149,18 @@
 {
 	ERROR3IF(TheText == NULL, "Illegal NULL param");
 
-	switch(CurrentCursorID)
+	if (CurrentCursorID == _R(IDC_SGABOVECURSOR))
 	{
-		case _R(IDC_SGABOVECURSOR):
-			TheText->MakeMsg(_R(IDS_SGDRAG_INSABOVE));
-			break;
-
-		case _R(IDC_SGBELOWCURSOR):
-			TheText->MakeMsg(_R(IDS_SGDRAG_INSBELOW));
-			break;
-
-		default:
-			TheText->MakeMsg(_R(IDS_SGDRAG_LISTITEM));
-			break;
+		TheText->MakeMsg(_R(IDS_SGDRAG_INSABOVE));
 	}
+	else if (CurrentCursorID == _R(IDC_SGBELOWCURSOR))
+	{
+		TheText->MakeMsg(_R(IDS_SGDRAG_INSBELOW));
+	}
+	else
+	{
+		TheText->MakeMsg(_R(IDS_SGDRAG_LISTITEM));
+	}
 
 	return(TRUE);
 }
@@ -1228,7 +1231,7 @@
 	// Set up a few things about this drag - it does not do solid drag
 	DoesSolidDrag = FALSE;
 	SolidDragOffset.x = SolidDragOffset.y = 0;	// Set up defaults just in case
-	SolidDragSize.cx = SolidDragSize.cy = 1;
+	SolidDragSize.Set(1,1);
 }
 
 
Index: Trunk/XaraLX/Kernel/main2.cpp
===================================================================
--- Trunk/XaraLX/Kernel/main2.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/main2.cpp	(revision 801)
@@ -304,6 +304,7 @@
 #ifndef STANDALONE
 			ToolbarDlg::Init() &&				// Register "Toolbar..." dialogs
 #endif // STANDALONE
+#endif //EXCLUDE_FROM_XARALX
 
 // WEBSTER - markn 15/1/97
 // Removed these ops as they are not used
@@ -314,6 +315,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
 
Index: Trunk/XaraLX/Kernel/sginit.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sginit.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/sginit.cpp	(revision 801)
@@ -102,23 +102,23 @@
 
 #include "app.h"		// For GetApplication()
 #include "layergal.h"	// For OpDisplayLayerGallery et al
-#include "newcol.h"		// For NewColourDlg
+//#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 "sgfonts.h"	// For OpDisplayFontsGallery
-#include "sglcart.h"	// For OpDisplayLibClipartGallery et al
-#include "sglfills.h"	// For OpDisplayLibFillsGallery
-#include "sgline.h"		// For OpDisplayLineGallery
-#include "ngdialog.h"	// For OpDisplayNameGallery & OpNGPropertyIndexDesc
+//#include "sgbitmap.h"	// For OpDisplayBitmapGallery
+//#include "sgcolour.h"	// For OpDisplayColourGallery && ColourSGallery::Init
+//#include "sgfonts.h"	// For OpDisplayFontsGallery
+//#include "sglcart.h"	// For OpDisplayLibClipartGallery et al
+//#include "sglfills.h"	// For OpDisplayLibFillsGallery
+//#include "sgline.h"		// For OpDisplayLineGallery
+//#include "ngdialog.h"	// For OpDisplayNameGallery & OpNGPropertyIndexDesc
 #include "sgscan.h"		// For Library::InitLibPrefs()
 #include "layerprp.h"	// For LayerPropertiesDlg::Init()
-#include "aprps.h"
-#include "frameops.h"	// OpGrabFrame::Init()
+//#include "aprps.h"
+//#include "frameops.h"	// OpGrabFrame::Init()
 
 // Taken out by vector stroking code Neville 2/10/97
 #ifdef VECTOR_STROKING
-#include "sglinepr.h"	// For SGalleryLinePropertiesDlg::Init()
+//#include "sglinepr.h"	// For SGalleryLinePropertiesDlg::Init()
 #endif
 
 DECLARE_SOURCE("$Revision$");
@@ -160,21 +160,29 @@
 				SGallerySearchDlg::Init()			&&
 				SGallerySortDlg::Init()				&&
 
+PORTNOTE("galleries", "Excluded various galleries")
 #ifndef STANDALONE
+#ifndef EXCLUDE_FROM_XARALX
 				OpDisplayFrameGallery::Init()		&&
+#endif // EXCLUDE_FROM_XARALX
 				OpLayerGalChange::Init()			&&
+#ifndef EXCLUDE_FROM_XARALX
 				OpGrabFrame::Init()					&&
+#endif // EXCLUDE_FROM_XARALX
 // WEBSTER - markn 15/1/97
 // Removed some init functions that no longer exist
 #ifndef WEBSTER
 				OpDisplayLayerGallery::Init()		&&
 				LayerNameDlg::Init()				&&
+#ifndef EXCLUDE_FROM_XARALX
 				LayerPropertyTabsDlg::Init()		&&				
 
 				OpDisplayLineGallery::Init()		&&
 				OpDisplayNameGallery::Init()		&&
+#endif // EXCLUDE_FROM_XARALX
 #endif // WEBSTER				
 // Taken out by vector stroking code Neville 2/10/97
+#ifndef EXCLUDE_FROM_XARALX
 #ifdef VECTOR_STROKING
 				SGalleryLinePropertiesDlg::Init()	&&
 #endif // VECTOR_STROKING				
@@ -186,7 +194,9 @@
 				OpDisplayBitmapGallery::Init()		&&
 
 				OpDisplayFontsGallery::Init()		&&
-#endif
+#endif // EXCLUDE_FROM_XARALX
+#endif // STANDALONE
+#ifndef EXCLUDE_FROM_XARALX
 				LibClipartSGallery::Init()			&&
 				OpDisplayLibClipartGallery::Init()	&&
 
@@ -195,7 +205,9 @@
 				OpDisplayLibFillsGallery::Init()	&&
 #endif
 
-				Library::InitLibPrefs()
+				Library::InitLibPrefs() &&
+#endif // EXCLUDE_FROM_XARALX
+				TRUE
 			);
 	
 	return ok;
@@ -218,13 +230,18 @@
 // Removed some deinit functions that no longer exist
 
 	// Nothing much to deinit as yet
+PORTNOTE("galleries", "disabled various galleries deinit")
 #ifndef STANDALONE
 #ifndef WEBSTER
+#ifndef EXCLUDE_FROM_XARALX
 	LayerPropertyTabsDlg::Deinit();	
+#endif
 #endif	// WEBSTER	
+#ifndef EXCLUDE_FROM_XARALX
 	GIFAnimationPropertyTabsDlg::Deinit();
 	OpGrabFrame::DeInit();
 #endif
+#endif
 }
 
 #endif
@@ -240,7 +257,7 @@
 
 ********************************************************************************************/
 
-void SGInit::UpdateGalleryButton(char *OpToken, BOOL IsVisible)
+void SGInit::UpdateGalleryButton(ResourceID OpToken, BOOL IsVisible)
 {
 	// Update all button controls that invoke this Op
 	OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OpToken);
@@ -256,7 +273,7 @@
 			while (pGadgetItem != NULL)
 			{
 				// Set the gadget
-				pGadgetItem->pDialogBarOp->SetBoolGadgetSelected(pGadgetItem->gidGadgetID,
+				pGadgetItem->pDialogOp->SetBoolGadgetSelected(pGadgetItem->gidGadgetID,
 																	IsVisible);
 				// Find the next gadget
 				pGadgetItem = (GadgetListItem*) Gadgets.GetNext(pGadgetItem);
Index: Trunk/XaraLX/Kernel/sgallery.h
===================================================================
--- Trunk/XaraLX/Kernel/sgallery.h	(revision 800)
+++ Trunk/XaraLX/Kernel/sgallery.h	(revision 801)
@@ -636,6 +636,9 @@
 
 public:		// Global gallery preferences
 	static INT32		UseFixedColourSet;		// TRUE (default) to override Windows colours
+
+public:
+	virtual BOOL IsABar() {return FALSE; } // For now, claim not to be a bar so we get sized right
 };
 
 
Index: Trunk/XaraLX/Kernel/aprps.h
===================================================================
--- Trunk/XaraLX/Kernel/aprps.h	(revision 800)
+++ Trunk/XaraLX/Kernel/aprps.h	(revision 801)
@@ -186,7 +186,7 @@
 	GIFAnimationPropertyTabs();							// Constructor
 
 	static BOOL InitGIFAnimationPropertyTabs();			// set up all option tabs available
-	static DeinitGIFAnimationPropertyTabs();			// remove all option tabs available
+	static void DeinitGIFAnimationPropertyTabs();		// remove all option tabs available
 	static GIFAnimationPropertyTabs *GetFirst();
 	static GIFAnimationPropertyTabs *GetNext(GIFAnimationPropertyTabs*);
 
@@ -381,7 +381,7 @@
 	CC_DECLARE_DYNCREATE( PreviewInBrowserTab )  
 public:
 
-	static Declare();
+	static BOOL Declare();
 
 	PreviewInBrowserTab();
 	~PreviewInBrowserTab();
Index: Trunk/XaraLX/Kernel/layergal.cpp
===================================================================
--- Trunk/XaraLX/Kernel/layergal.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/layergal.cpp	(revision 801)
@@ -122,22 +122,22 @@
 #include "nodetxts.h"
 #include "textops.h"
 #include "bubbleid.h"
-
+#include "ophist.h"
 #include "sglayer.h"		// The LayerSGallery class
 #include "sginit.h"
 
 //#include "will2.h"
 //#include "galstr.h"			// _R(IDS_DELETEPAGEBACKGROUND)
 //#include "prevwres.h"		// _R(IDS_DISPLAY_FRAME_GALLERY) _R(IDD_ANIMATIONBAR) ...
-#include "sgframe.h"		// FrameSGallery
+//#include "sgframe.h"		// FrameSGallery
 
-#include "frameops.h"		// Frame related ops
-#include "aprps.h"
+//#include "frameops.h"		// Frame related ops
+//#include "aprps.h"
 
 #include "nodetxts.h"		//TextStory::SetFocusStory
 
 #include "layermsg.h"		// LayerMsg::LayerReason::REDRAW_LAYER
-#include "xshelpid.h"		//For the help id
+//#include "xshelpid.h"		//For the help id
 
 #define Swap(a,b)       { (a)^=(b), (b)^=(a), (a)^=(b); }
 
@@ -147,7 +147,10 @@
 CC_IMPLEMENT_DYNCREATE(OpDeletePageBackground,OpLayerGalChange);
 CC_IMPLEMENT_DYNCREATE(OpLayerGalChange,UndoableOperation);
 CC_IMPLEMENT_DYNCREATE(OpDisplayLayerGallery,Operation);
+PORTNOTE("galleries", "disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 CC_IMPLEMENT_DYNCREATE(OpDisplayFrameGallery,Operation);
+#endif
 CC_IMPLEMENT_DYNCREATE(LayerNameDlg, DialogOp)   
 CC_IMPLEMENT_DYNCREATE(LayerStateAction,Action)
 			  
@@ -332,6 +335,8 @@
 								)
 			// special frame operations
 								&&
+PORTNOTE("galleries", "Disabled frame stuff")
+#ifndef EXCLUDE_FROM_XARALX
 			RegisterOpDescriptor(
 								0,								// Tool ID 
 	 							_R(IDS_SELECTSTARTFRAME),			// String resource ID
@@ -457,6 +462,9 @@
 								NULL,							// String for one copy only error
 								(DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
 								)
+								&&
+#endif // EXCLUDE_FROM_XARALX
+								TRUE
 			);
 }               
     
@@ -529,8 +537,11 @@
 			if (pLayer == NULL || pLayer->IsActive())
 				goto EndOperation;
 
+PORTNOTE("galleries", "disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 			// Make the layer we have been passed the active one
 			FrameSGallery::MakeActiveLayer(pLayer);
+#endif
 			UndoIDS = _R(IDS_FRAME_UNDO_SELECTNEW);
 			break;
 		//--------------------------------------------------------------------------------------------
@@ -577,9 +588,12 @@
 
 				if (DoInsertNewNode(pLayer, pLastLayer, NEXT, FALSE))
 				{
+PORTNOTE("galleries", "Disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 					if (FrameLayer)
 						FrameSGallery::MakeActiveLayer(pLayer);
 					else
+#endif
 						LayerSGallery::MakeActiveLayer(pLayer);
 
 					// Note the layer inserted so we can clear any selection on the layer when this op is undone
@@ -659,9 +673,12 @@
 
 						if (pNewActiveLayer != NULL)
 						{
+PORTNOTE("galleries", "disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 							if (FrameLayer)
 								FrameSGallery::MakeActiveLayer(pNewActiveLayer);
 							else
+#endif
 								LayerSGallery::MakeActiveLayer(pNewActiveLayer);
 						}
 
@@ -773,7 +790,10 @@
 				// Ensure that the frame layer flag is on
 				pLayer->SetFrame(TRUE);
 				pLayer->SetEdited(TRUE);
+PORTNOTE("galleries", "Disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 				FrameSGallery::MakeActiveLayer(pLayer);
+#endif
 			}
 			else
 				LayerSGallery::MakeActiveLayer(pLayer);
@@ -899,9 +919,12 @@
 				pOpUndoLayer = pCopyOfLayer;
 
 				// Make it the active layer
+PORTNOTE("galleries", "Disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 				if (FrameLayer)
 					FrameSGallery::MakeActiveLayer(pCopyOfLayer);
 				else
+#endif
 					LayerSGallery::MakeActiveLayer(pCopyOfLayer);
 
 				NodeRenderableInk::DeselectAllOnLayer(pLayer);
@@ -1139,6 +1162,9 @@
 			// will broadcast layer changes on undo and redo (hopefully!)
 			BroadcastLayerChanges = FALSE;
 			break;
+
+		default:
+			break;
 	}
 
 	BOOL Result = Operation::Undo(); 
@@ -1153,13 +1179,18 @@
 				GetApplication()->UpdateSelection();
 				if (pOpUndoLayer != NULL)
 				{
+PORTNOTE("galleries", "Disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 					if (Reason == FRAME_MOVE)
 						FrameSGallery::MakeActiveLayer(pOpUndoLayer);
 					else
+#endif
 						LayerSGallery::MakeActiveLayer(pOpUndoLayer);
 					BroadcastLayerChanges = TRUE;
 				}
 				break;
+			default:
+				break;
 		}		
 
 		if (BroadcastLayerChanges)
@@ -1215,6 +1246,9 @@
 			// will broadcast layer changes on undo and redo (hopefully!)
 			BroadcastLayerChanges = FALSE;
 			break;
+
+		default:
+			break;
 	}
 
 	BOOL Result = Operation::Redo(); 
@@ -1229,13 +1263,19 @@
 				GetApplication()->UpdateSelection();
 				if (pOpRedoLayer != NULL)
 				{
+PORTNOTE("galleries", "Disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 					if (Reason == FRAME_MOVE)
 						FrameSGallery::MakeActiveLayer(pOpRedoLayer);
 					else
+#endif
 						LayerSGallery::MakeActiveLayer(pOpRedoLayer);
 					BroadcastLayerChanges = TRUE;
 				}
 				break;
+
+			default:
+				break;
 		}		
 
  		if (BroadcastLayerChanges)
@@ -1359,6 +1399,9 @@
 
 			case DIM_TEXT_CHANGED:
 				break;
+
+			default:
+				break;
 		}
 
 		if (EndDialog)	// Dialog communication over 
@@ -1458,7 +1501,8 @@
 		}
 	}
 	else if (LayerNameDlg::pLayerNameDlg != NULL)
-		SetActiveWindow(LayerNameDlg::pLayerNameDlg->WindowID);
+		LayerNameDlg::pLayerNameDlg->BringToTop();
+		// SetActiveWindow(LayerNameDlg::pLayerNameDlg->WindowID);
 }
 
 	   
@@ -1668,7 +1712,7 @@
 void LayerNameDlg::CommitDialogValues()
 {
 	String_256 NewName;
-	char* pD = NewName;
+//	TCHAR* pD = NewName;
 	BOOL Valid;
 
 	// Get the string from the layer name dialog
@@ -1830,6 +1874,8 @@
 	String_32 Name(_R(IDS_LAYERGAL_GALLNAME));
 	DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name);
 
+	if (!pDialogBarOp) pDialogBarOp = new LayerSGallery;
+
 	if (pDialogBarOp != NULL)
 	{
 		if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(LayerSGallery))
@@ -1842,13 +1888,16 @@
 			ERROR3("Got the layer gallery but it's not of the LayerSGallery class");
 		}
 
-		SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYLAYERGALLERY, pDialogBarOp->IsVisible());
+		SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAYLAYERGALLERY), pDialogBarOp->IsVisible());
 	}
 
 	ERROR3IF(pDialogBarOp == NULL,"Couldn't find the layer gallery bar");
 
 	End();
 }
+
+PORTNOTE("galleries", "disable frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 //-----------------------------------------------------------------------------------------------
 //-----------------------------------------------------------------------------------------------
 //-----------------------------------------------------------------------------------------------
@@ -2008,7 +2057,7 @@
 			ERROR3("Got the frame gallery but it's not of the LayerSGallery class");
 		}
 
-		SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYFRAMEGALLERY, pDialogBarOp->IsVisible());
+		SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAYFRAMEGALLERY), pDialogBarOp->IsVisible());
 
 		GIFAnimationPropertyTabs::SetFrameGalleryOpen(TRUE);
 	}
@@ -2017,6 +2066,7 @@
 
 	End();
 }
+#endif
 
 //-----------------------------------------------------
 //-----------------------------------------------------
@@ -2164,12 +2214,15 @@
 
 				if (Param.pLayer != NULL)
 				{
+PORTNOTE("galleries", "Disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 					FrameSGallery::DoChangeSolid(Param.pLayer,Param.NewState);
+#endif
 					Param.pLayer->SetEdited(TRUE);
 					Param.pLayer->SetFrame(TRUE);	// double check this
 #ifdef _DEBUG
 					// Tell the frame gallery to update its display of the frame
-					BROADCAST_TO_ALL(LayerMsg(Param.pLayer, LayerMsg::LayerReason::REDRAW_LAYER));
+					BROADCAST_TO_ALL(LayerMsg(Param.pLayer, LayerMsg::REDRAW_LAYER));
 #endif
 				}
 				break;
@@ -2179,12 +2232,15 @@
 
 				if (Param.pLayer != NULL)
 				{
+PORTNOTE("galleries", "Disabled frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 					FrameSGallery::DoChangeOverlay(Param.pLayer,Param.NewState);
+#endif
 					Param.pLayer->SetEdited(TRUE);
 					Param.pLayer->SetFrame(TRUE);	// double check this
 #ifdef _DEBUG
 					// Tell the frame gallery to update its display of the frame
-					BROADCAST_TO_ALL(LayerMsg(Param.pLayer, LayerMsg::LayerReason::REDRAW_LAYER));
+					BROADCAST_TO_ALL(LayerMsg(Param.pLayer, LayerMsg::REDRAW_LAYER));
 #endif
 				}
 				break;
@@ -2204,7 +2260,7 @@
 					Param.pLayer->SetActive(Param.NewState);
 
 					// Ensure that the gallery is updated with the new active layer details
-					BROADCAST_TO_ALL(LayerMsg(Param.pLayer, LayerMsg::LayerReason::UPDATE_ACTIVE_LAYER));
+					BROADCAST_TO_ALL(LayerMsg(Param.pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
 				}
 				break;
 
Index: Trunk/XaraLX/Kernel/main.cpp
===================================================================
--- Trunk/XaraLX/Kernel/main.cpp	(revision 800)
+++ Trunk/XaraLX/Kernel/main.cpp	(revision 801)
@@ -356,11 +356,8 @@
 	FontCache::DeInit();
 #endif
 #ifndef EXCLUDE_GALS
-PORTNOTE("dialog","Removed SGInit usage")
-#ifndef EXCLUDE_FROM_XARALX
 	SGInit::DeInit();		// De-init the galleries
 #endif
-#endif
 	View::Deinit();
 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
 	SGLibOil::TidyUp();
Index: Trunk/XaraLX/Kernel/layergal.h
===================================================================
--- Trunk/XaraLX/Kernel/layergal.h	(revision 800)
+++ Trunk/XaraLX/Kernel/layergal.h	(revision 801)
@@ -452,6 +452,8 @@
 
 #define OPTOKEN_DISPLAYFRAMEGALLERY _T("DisplayFrameGallery")	// Optoken for the display frame gallery operation
 
+PORTNOTE("galleries", "Disable frame gallery")
+#ifndef EXCLUDE_FROM_XARALX
 /********************************************************************************************
 
 >	class OpDisplayFrameGallery: public Operation
@@ -472,6 +474,7 @@
 	static OpState	GetState(String_256*, OpDescriptor*);		
     void 			Do(OpDescriptor*);
 };  
+#endif // EXCLUDE_FROM_XARALX
 
 #endif	// INC_LAYERGAL
 


Xara