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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1151
Date       : Mon May 22 11:44:22 BST 2006

Changed paths:
   M /Trunk/XaraLX/Scripts/barconverter
   M /Trunk/XaraLX/wxOil/ccolbar.cpp
   M /Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc

Make colour editor bitmap buttons work properly


Diff:
Index: Trunk/XaraLX/Scripts/barconverter
===================================================================
--- Trunk/XaraLX/Scripts/barconverter	(revision 1150)
+++ Trunk/XaraLX/Scripts/barconverter	(revision 1151)
@@ -193,7 +193,7 @@
 sub IsToggle
 {
     my $name = shift @_;
-    return ($name=~/^(IDC_BTN_MAKECURVE|IDC_BTN_MAKELINE|IDC_BTN_SMOOTHPOINT|IDC_BTN_CUSPPOINT|IDC_BTN_REGSHAPETOOL_RADIUS|IDC_BTN_REGSHAPETOOL_DIAMETER|IDC_BTN_REGSHAPETOOL_BOUNDBOX|IDC_BTN_REGSHAPETOOL_POLYGON|IDC_BTN_REGSHAPETOOL_ELLIPSE|IDC_BTN_REGSHAPETOOL_STELLATION|IDC_BTN_REGSHAPETOOL_CURVATURE|IDC_SEL_SHOWBOUNDSBLOBS|IDC_SEL_SHOWOBJECTBLOBS|IDC_SEL_SHOWFILLBLOBS|IDC_SEL_ROTATEBUTTON|IDC_SEL_SCALELINES|IDC_SEL_PADLOCK|IDC_BTN_MAGNET|IDC_BTN_BLENDDISTANCE|C_BTN_BLENDSTEPS|IDC_BTN_ONETOONE|IDC_BTN_BLENDANTIALIAS|IDC_BTN_DETACHMOULD|IDC_BTN_BEVELOUTER|IDC_BTN_BEVELINNER|IDC_BEVELJOINTYPEMITRE|IDC_BEVELJOINTYPEROUND|IDC_BEVELJOINTYPEBEVEL|IDC_BTN_CONTOURDISTANCE|IDC_BTN_CONTOURSTEPS|IDC_BTN_CONTOUROUTER|IDC_BTN_CONTOURINNER|IDC_CONTOURJOINTYPEMITRE|IDC_CONTOURJOINTYPEROUND|IDC_CONTOURJOINTYPEBEVEL|IDC_BOLDBUTTON|IDC_ITALICBUTTON|IDC_JUSTIFYLEFT|IDC_JUSTIFYCENTRE|IDC_JUSTIFYRIGHT|IDC_JUSTIFYFULL|IDC_SUPERSCRIPT|IDC_SUBSCRIPT|IDC_AUTOKERN|IDC_BTN_NOSHADOW|IDC_BTN_WALLSHADOW|IDC_BTN_FLOORSHADOW|IDC_BTN_GLOWSHADOW|IDC_BTN_ALLVISIBLE|IDC_BTN_MULTILAYER)$/)?1:0;
+    return ($name=~/^(IDC_BTN_MAKECURVE|IDC_BTN_MAKELINE|IDC_BTN_SMOOTHPOINT|IDC_BTN_CUSPPOINT|IDC_BTN_REGSHAPETOOL_RADIUS|IDC_BTN_REGSHAPETOOL_DIAMETER|IDC_BTN_REGSHAPETOOL_BOUNDBOX|IDC_BTN_REGSHAPETOOL_POLYGON|IDC_BTN_REGSHAPETOOL_ELLIPSE|IDC_BTN_REGSHAPETOOL_STELLATION|IDC_BTN_REGSHAPETOOL_CURVATURE|IDC_SEL_SHOWBOUNDSBLOBS|IDC_SEL_SHOWOBJECTBLOBS|IDC_SEL_SHOWFILLBLOBS|IDC_SEL_ROTATEBUTTON|IDC_SEL_SCALELINES|IDC_SEL_PADLOCK|IDC_BTN_MAGNET|IDC_BTN_BLENDDISTANCE|C_BTN_BLENDSTEPS|IDC_BTN_ONETOONE|IDC_BTN_BLENDANTIALIAS|IDC_BTN_DETACHMOULD|IDC_BTN_BEVELOUTER|IDC_BTN_BEVELINNER|IDC_BEVELJOINTYPEMITRE|IDC_BEVELJOINTYPEROUND|IDC_BEVELJOINTYPEBEVEL|IDC_BTN_CONTOURDISTANCE|IDC_BTN_CONTOURSTEPS|IDC_BTN_CONTOUROUTER|IDC_BTN_CONTOURINNER|IDC_CONTOURJOINTYPEMITRE|IDC_CONTOURJOINTYPEROUND|IDC_CONTOURJOINTYPEBEVEL|IDC_BOLDBUTTON|IDC_ITALICBUTTON|IDC_JUSTIFYLEFT|IDC_JUSTIFYCENTRE|IDC_JUSTIFYRIGHT|IDC_JUSTIFYFULL|IDC_SUPERSCRIPT|IDC_SUBSCRIPT|IDC_AUTOKERN|IDC_BTN_NOSHADOW|IDC_BTN_WALLSHADOW|IDC_BTN_FLOORSHADOW|IDC_BTN_GLOWSHADOW|IDC_BTN_ALLVISIBLE|IDC_BTN_MULTILAYER|IDC_COLOUREDITOR)$/)?1:0;
 }
 
 sub ConvertOptoken
Index: Trunk/XaraLX/wxOil/ccolbar.cpp
===================================================================
--- Trunk/XaraLX/wxOil/ccolbar.cpp	(revision 1150)
+++ Trunk/XaraLX/wxOil/ccolbar.cpp	(revision 1151)
@@ -146,6 +146,7 @@
 //#include "resource.h"		// For push tool cursor
 #include "sgcolour.h"		// For AutoScroll preference
 #include "statline.h"
+#include "cartprov.h"
 
 // define this to disable use of DragManagerOp to drag colours
 //#define DISABLE_COLOUR_DRAGS
@@ -1800,74 +1801,32 @@
 	pDC->SetBrush(wxNullBrush);
 	pDC->SetPen(wxNullPen);
 
-PORTNOTE("other","Removed bitmap plotting in PaintEditOrNewButton")
-#if FALSE
-// Replace this with new alpha channel buttons and simple rendering code
+	ResourceID bitmap = 0;
 
-	wxBitmap SrcBmp;
 	INT32 BmpSize = (CellSize > 15) ? 12 : 8;			// size of glyph bitmaps (8x8 and 12x12)
 		
 	if (IsEditButton)								// Load appropriate glyph bitmap
 	{
 		if (CellSize > 15)
-			SrcBmp.LoadBitmap(_R(IDB_LEDITCOL));		// 12x12 Edit glyph
+			bitmap=_R(IDB_LEDITCOL);		// 12x12 Edit glyph
 		else
-			SrcBmp.LoadBitmap(_R(IDB_EDITCOL));			// 8x8 Edit glyph
+			bitmap=_R(IDB_EDITCOL);			// 8x8 Edit glyph
 	}
 	else
 	{
 		if (CellSize > 15)
-			SrcBmp.LoadBitmap(_R(IDB_LNEWCOL));			// 12x12 New glyph
+			bitmap=_R(IDB_LNEWCOL);			// 12x12 New glyph
 		else
-			SrcBmp.LoadBitmap(_R(IDB_NEWCOL));			// 8x8 New glyph
+			bitmap=_R(IDB_NEWCOL);			// 8x8 New glyph
 	}
-		
-	wxDC SrcDC;					  					// Create source DC for glyph bitmap
-	SrcDC.CreateCompatibleDC(pDC);
 
-	wxBitmap *OldBmp = SrcDC.SelectObject(&SrcBmp);	// Select in our glyph bitmap
-	
-													// Plot the glyph, centered in button
-	TheRect.InflateRect((BmpSize - TheRect.Width())/2, (BmpSize - TheRect.Height())/2);
+	wxBitmap * pBitmap = CamArtProvider::Get()->FindBitmap(bitmap);
 
-	// Now plot the glyph bitmap. It is a masked plot - all the light grey pixels
-	// are plotted using the system COLOR_BTNFACE colour.
-	wxDC MonoDC;
-	MonoDC.CreateCompatibleDC(NULL);
+	TheRect.Inflate((BmpSize - TheRect.GetWidth())/2, (BmpSize - TheRect.GetHeight())/2);
 
-	// ...Now create a mono bitmap for the mask
-	wxBitmap MonoBitmap;
-	MonoBitmap.CreateBitmap(BmpSize, BmpSize, 1, 1, NULL);
-
-	wxBitmap *OldMonoBitmap = MonoDC.SelectObject(&MonoBitmap);
-
-	// Plot all light grey pixels in the glyph as black in our mask, while other pixels are white
-	MonoDC.PatBlt(0, 0, BmpSize, BmpSize, WHITENESS);
-	SrcDC.SetBkColor(RGB(192,192,192));
-	MonoDC.BitBlt(0, 0, BmpSize, BmpSize, &SrcDC, 0, 0, SRCCOPY);
-
-	pDC->SetTextColor(0L);                  // 0's in mono -> 0 (for ROP)
-	pDC->SetBkColor((COLORREF)0x00FFFFFFL); // 1's in mono -> 1
-
 	// Blit the glyph to screen, including its grey mask areas
-	pDC->BitBlt(TheRect.left, TheRect.top, BmpSize, BmpSize, &SrcDC, 0, 0, SRCCOPY);
-
-	// And then blit the mask shape over the top, using the correct button face colour
-	// (The areas not in the mask will not be plotted, so we are rendering the mask area only)
-	wxBrush HighlightBrush;
-	HighlightBrush.CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
-
-	wxBrush *OldBrush = pDC->SelectObject(&HighlightBrush);
-
-	// draw highlight color where we have 0's in the mask, using a special RasterOp code (DSPDxax)
-	pDC->BitBlt(TheRect.left, TheRect.top, BmpSize, BmpSize,  &MonoDC, 0, 0, 0x00E20746L);
-
-	pDC->SelectObject(OldBrush);
-
-	MonoDC.SelectObject(OldMonoBitmap);
-
-	SrcDC.SelectObject(OldBmp);						// Re-select old bitmap
-#endif
+	if (pBitmap)
+		pDC->DrawBitmap(*pBitmap, TheRect.GetLeft(), TheRect.GetTop(), TRUE);
 }
 
 
Index: Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc	(revision 1150)
+++ Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc	(revision 1151)
@@ -11,7 +11,7 @@
                 <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                 <border>1</border>
                 <object class="wxCamArtControl" name="IDC_COLOUREDITOR">
-                    <camartstyle>wxCACS_PUSHBUTTON|wxCACS_ALLOWHOVER</camartstyle>
+                    <camartstyle>wxCACS_PUSHBUTTON|wxCACS_ALLOWHOVER|wxCACS_TOGGLEBUTTON</camartstyle>
                     <optoken>ColourPicker</optoken>
                 </object>
             </object>


Xara