[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : alex
Repository : xara
Revision : 1250
Date : Mon Jun 5 13:06:29 BST 2006
Changed paths:
M /Trunk/XaraLX/wxOil/sgldrag.cpp
M /Trunk/XaraLX/wxOil/sgldrag.h
Fix dragging from line gallery
Diff:
Index: Trunk/XaraLX/wxOil/sgldrag.h
===================================================================
--- Trunk/XaraLX/wxOil/sgldrag.h (revision 1249)
+++ Trunk/XaraLX/wxOil/sgldrag.h (revision 1250)
@@ -140,7 +140,6 @@
virtual INT32 GetDragTransparency();
virtual KernelBitmap* GetSolidDragMask();
- virtual BOOL OnDrawSolidDrag(wxPoint Origin, wxDC * TheDC, DragTarget* pDragTarget);
LineAttrItem* GetDraggedLineAttr() { return(SourceItem); }
Index: Trunk/XaraLX/wxOil/sgldrag.cpp
===================================================================
--- Trunk/XaraLX/wxOil/sgldrag.cpp (revision 1249)
+++ Trunk/XaraLX/wxOil/sgldrag.cpp (revision 1250)
@@ -112,6 +112,7 @@
#include "nodepath.h"
#include "lineattr.h"
#include "sgline.h"
+#include "osrndrgn.h"
//#include "richard2.h" // string resources
@@ -545,9 +546,9 @@
KernelBitmap* GalleryLineDragInfo::GetSolidDragMask()
{
-PORTNOTE("other", "Disabled line gallery drag code")
-#ifndef EXCLUDE_FROM_XARALX
- if (DragMask == NULL)
+ // Note we abuse this call (like our base class abuses this call) to create the bitmap
+ // itself. We don't use DragMask itself anymore (i.e. it stays NULL)
+ if (!DragMask && !TheBitmap)
{
DocView *View = DocView::GetCurrent();
if (View == NULL)
@@ -568,15 +569,13 @@
Matrix ConvertMatrix;
FIXED16 ViewScale = 1;
- CDC DisplayDC;
- DisplayDC.CreateDC("DISPLAY", NULL, NULL, NULL);
+ wxScreenDC DisplayDC;
+ double dpi = (double) OSRenderRegion::GetFixedDCPPI(DisplayDC).GetWidth();
- double dpi = (double) GetDeviceCaps( DisplayDC.m_hDC, LOGPIXELSX );
-
GRenderBitmap* pMaskRegion = new GRenderBitmap(ClipRegion, ConvertMatrix, ViewScale,
- 1, dpi);
+ 32, dpi);
-
+ pMaskRegion->SetDoCompression(TRUE); // misnamed call to indicate we want transparency
pMaskRegion->AttachDevice(View, &DisplayDC, pSpread);
// Make a Mask Bitmap
@@ -585,85 +584,16 @@
pMaskRegion->StopRender();
OILBitmap* pOilMaskBmp = pMaskRegion->ExtractBitmap();
- DragMask = new KernelBitmap(pOilMaskBmp, TRUE);
+ TheBitmap = new KernelBitmap(pOilMaskBmp, TRUE);
delete pMaskRegion;
}
- return DragMask;
-#else
- return NULL;
-#endif
+ return BitmapDragInformation::GetSolidDragMask();
}
/********************************************************************************************
-> BOOL GalleryLineDragInfo::OnDrawSolidDrag(wxPoint Origin, wxDC * TheDC, DragTarget* pDragTarget)
-
- Author: Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
- Created: 10/4/95
- Returns: -
- Purpose: Gets the gallery item to render itself on the first OnDrawSolidDrag call.
- SeeAlso: -
-
-********************************************************************************************/
-
-BOOL GalleryLineDragInfo::OnDrawSolidDrag(wxPoint Origin, wxDC * TheDC, DragTarget* pDragTarget)
-{
-PORTNOTE("other", "Disabled line gallery drag code")
-#ifndef EXCLUDE_FROM_XARALX
- if (TheBitmap == NULL)
- {
- DocView *View = DocView::GetCurrent();
- if (View == NULL)
- {
- return NULL;
- }
-
- Spread *pSpread = View->FindEnclosingSpread(OilCoord(0,0));
- if (pSpread == NULL)
- {
- return NULL;
- }
-
- // Find the size of the rendered item.
-// DocRect ClipRegion;
- DocRect ClipRegion(0,0, 750*100, 750*50);
-// ClipRegion.lo.x = ClipRegion.lo.y = 0;
-// SourceItem->GetSize(c_eLineAttrDragTextPos, &ClipRegion.hi.x, &ClipRegion.hi.y);
- Matrix ConvertMatrix;
- FIXED16 ViewScale = 1;
-
- CDC DisplayDC;
- DisplayDC.CreateDC("DISPLAY", NULL, NULL, NULL);
-
- UINT32 Depth = GetDeviceCaps( DisplayDC.m_hDC, BITSPIXEL ) *
- GetDeviceCaps( DisplayDC.m_hDC, PLANES );
-
- double dpi = (double) GetDeviceCaps( DisplayDC.m_hDC, LOGPIXELSX );
-
- GRenderBitmap* pRegion = new GRenderBitmap(ClipRegion, ConvertMatrix, ViewScale,
- Depth, dpi);
-
- pRegion->AttachDevice(View, &DisplayDC, pSpread);
-
- // Make the Drag Bitmap
- pRegion->StartRender();
- SourceItem->Render(pRegion, ClipRegion, c_eLineAttrDragTextPos);
- pRegion->StopRender();
-
- OILBitmap* pOilDragBmp = pRegion->ExtractBitmap();
- TheBitmap = new KernelBitmap(pOilDragBmp, TRUE);
-
- delete pRegion;
- }
-#endif
- // Call base class to do the actual drawing
- return BitmapDragInformation::OnDrawSolidDrag(Origin, TheDC, pDragTarget);
-}
-
-/********************************************************************************************
-
> BOOL GalleryLineDragInfo::DropStartOrEndArrow(Path* pPathHit, DocCoord DropPos,
BOOL* IsStart)
Xara