[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : gerry
Repository : xara
Revision : 802
Date : Tue Apr 11 14:46:47 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/Makefile.am
M /Trunk/XaraLX/Kernel/backgrnd.cpp
M /Trunk/XaraLX/Kernel/main2.cpp
M /Trunk/XaraLX/wxOil/camview.cpp
M /Trunk/XaraLX/wxOil/dragmgr.cpp
Renabled ctrl-drop of colour onto page to set page colour
Diff:
Index: Trunk/XaraLX/Kernel/backgrnd.cpp
===================================================================
--- Trunk/XaraLX/Kernel/backgrnd.cpp (revision 801)
+++ Trunk/XaraLX/Kernel/backgrnd.cpp (revision 802)
@@ -192,12 +192,14 @@
{
ERROR3IF(pParam == NULL,"pParam is NULL");
+ TRACEUSER("Gerry", _T("OpBackground::DoWithParam"));
+
if (pParam != NULL)
{
BOOL ok = TRUE;
OpBackgroundParam* pOpBackgroundParam = (OpBackgroundParam*)pParam;
- Document * pDoc = pOpBackgroundParam->pDoc;
+// Document * pDoc = pOpBackgroundParam->pDoc;
Spread * pSpread = pOpBackgroundParam->pSpread;
DocColour * pDocColour = pOpBackgroundParam->pDocColour;
KernelBitmap * pBitmap = pOpBackgroundParam->pBitmap;
@@ -301,6 +303,8 @@
BOOL OpBackground::DoMakePageBackground(UndoableOperation * pOp, Spread * pSpread, KernelBitmap * pBitmap,
DocColour * pDocColour)
{
+ TRACEUSER("Gerry", _T("OpBackground::DoMakePageBackground"));
+
// Our inputs are actually set up in the class variables, so check them
ERROR2IF(pSpread == NULL || pOp == NULL,FALSE,"DoMakePageBackground Bad params!");
ERROR2IF(pDocColour == NULL && pBitmap == NULL,FALSE,"DoMakePageBackground Bad params!");
@@ -317,6 +321,7 @@
// Attempt to remove the old background layer.
if ( pOldLayer != NULL )
{
+ TRACEUSER("Gerry", _T("Removing old background"));
if ( !pOp->DoHideNode(pOldLayer, TRUE ) )
{
// Something went wrong, so handle the error.
@@ -330,6 +335,7 @@
// Otherwise create a new background layer.
else
{
+ TRACEUSER("Gerry", _T("Creating new background"));
Layer* pBackgroundLayer = DoCreateBackgroundLayer(pOp, pSpread);
if (pBackgroundLayer == NULL)
@@ -484,10 +490,10 @@
// The bounding rect should be roughly what we want
rect = pRegNode->GetBoundingRect(TRUE, FALSE);
if (
- (PagesRect.lox > rect.lox - delta) && (PagesRect.lox < rect.lox + delta) &&
- (PagesRect.hix > rect.hix - delta) && (PagesRect.hix < rect.hix + delta) &&
- (PagesRect.loy > rect.loy - delta) && (PagesRect.loy < rect.loy + delta) &&
- (PagesRect.hiy > rect.hiy - delta) && (PagesRect.hiy < rect.hiy + delta)
+ (PagesRect.lo.x > rect.lo.x - delta) && (PagesRect.lo.x < rect.lo.x + delta) &&
+ (PagesRect.hi.x > rect.hi.x - delta) && (PagesRect.hi.x < rect.hi.x + delta) &&
+ (PagesRect.lo.y > rect.lo.y - delta) && (PagesRect.lo.y < rect.lo.y + delta) &&
+ (PagesRect.hi.y > rect.hi.y - delta) && (PagesRect.hi.y < rect.hi.y + delta)
)
{
pShape = pRegNode;
@@ -531,6 +537,13 @@
{
BOOL ok = pShape->SetUpShape();
+ if (!ok)
+ {
+ // Do something sensible in here
+ delete pShape;
+ return NULL;
+ }
+
// We want to make the rectangle the same size as the current union of
// all the pages on the current spread
DocRect Rect;
@@ -546,8 +559,8 @@
if (pShape->MakeRectangle(Rect.Width(), Rect.Height(), CornerRadius))
{
// Translate centre from 0,0 to required position relative to page
- INT32 XTrans = Rect.lox + (Rect.Width()/2);
- INT32 YTrans = Rect.loy + (Rect.Height()/2);
+ INT32 XTrans = Rect.lo.x + (Rect.Width()/2);
+ INT32 YTrans = Rect.lo.y + (Rect.Height()/2);
Trans2DMatrix Trans(XTrans, YTrans);
pShape->Transform(Trans);
@@ -577,7 +590,7 @@
BOOL OpBackground::ApplyDocColour(DocColour * pColourToApply, NodeRegularShape * pShape)
{
- ERROR2IF(pColourToApply == NULL || pShape == NULL,FALSE,"OpBackground::ApplyDocColour Bar params!")
+ ERROR2IF(pColourToApply == NULL || pShape == NULL,FALSE,"OpBackground::ApplyDocColour Bar params!");
// Set up a fill colour attribute
AttrFlatColourFill *pFillColAttr = new AttrFlatColourFill();
@@ -614,7 +627,7 @@
BOOL OpBackground::ApplyBitmap(KernelBitmap * pBitmapToApply, NodeRegularShape * pShape)
{
- ERROR2IF(pBitmapToApply == NULL || pShape == NULL,FALSE,"OpBackground::ApplyBitmap Bar params!")
+ ERROR2IF(pBitmapToApply == NULL || pShape == NULL,FALSE,"OpBackground::ApplyBitmap Bar params!");
// Set up a fill colour attribute
AttrBitmapColourFill *pBitmapFillAttr = new AttrBitmapColourFill();
@@ -639,15 +652,15 @@
// The End2 should be centre and top but needs to be top left.
// We want the start point to be half the height of the bitmap below this
- //DocCoord Start(Rect.lox + Width/2, Rect.hiy - Height/2);
- DocCoord Start(Rect.lox, Rect.hiy - Height);
+ //DocCoord Start(Rect.lo.x + Width/2, Rect.hi.y - Height/2);
+ DocCoord Start(Rect.lo.x, Rect.hi.y - Height);
// We want the other end point to be same height as the centre point
// but on the far right of the rectangle i.e the full width across
- //DocCoord End(Rect.lox + Width, Rect.hiy - Height/2);
- DocCoord End(Rect.lox + Width, Rect.hiy - Height);
+ //DocCoord End(Rect.lo.x + Width, Rect.hi.y - Height/2);
+ DocCoord End(Rect.lo.x + Width, Rect.hi.y - Height);
// We want the end point to be middle and top of the rectangle
- //DocCoord End2(Rect.lox + Width/2, Rect.hiy);
- DocCoord End2(Rect.lox, Rect.hiy);
+ //DocCoord End2(Rect.lo.x + Width/2, Rect.hi.y);
+ DocCoord End2(Rect.lo.x, Rect.hi.y);
((AttrFillGeometry*)pBitmapFillAttr)->SetStartPoint(&Start);
((AttrFillGeometry*)pBitmapFillAttr)->SetEndPoint(&End);
@@ -688,7 +701,7 @@
BOOL OpBackground::ApplyDefaultAttributes(NodeRegularShape * pShape)
{
- ERROR2IF(pShape == NULL,FALSE,"OpBackground::ApplyDefaultAttributes Bar params!")
+ ERROR2IF(pShape == NULL,FALSE,"OpBackground::ApplyDefaultAttributes Bar params!");
// *****
// Set up a no colour line colour
@@ -699,7 +712,8 @@
return(FALSE);
}
- ((AttrFillGeometry*)pLineColAttr)->SetStartColour(&DocColour(COLOUR_NONE));
+ DocColour ColNone(COLOUR_NONE);
+ ((AttrFillGeometry*)pLineColAttr)->SetStartColour(&ColNone);
// And now insert it as a child of the regular shape
// Factoring should be ok as the Regular Shape is assumed to be the child of
// layer
@@ -790,7 +804,7 @@
if (pLastPage && pOp->DoInsertNewNode(pNewLayer, pLastPage, NEXT, FALSE,FALSE,FALSE,FALSE))
{
pNewLayer->EnsureUniqueLayerID();
- BROADCAST_TO_ALL(SpreadMsg(pSpread, SpreadMsg::SpreadReason::LAYERCHANGES));
+ BROADCAST_TO_ALL(SpreadMsg(pSpread, SpreadMsg::LAYERCHANGES));
}
else
{
@@ -881,8 +895,8 @@
if (pShape->MakeRectangle(NewPagesRect.Width(), NewPagesRect.Height(), CornerRadius))
{
// Translate centre from 0,0 to required position relative to page
- INT32 XTrans = NewPagesRect.lox + (NewPagesRect.Width()/2);
- INT32 YTrans = NewPagesRect.loy + (NewPagesRect.Height()/2);
+ INT32 XTrans = NewPagesRect.lo.x + (NewPagesRect.Width()/2);
+ INT32 YTrans = NewPagesRect.lo.y + (NewPagesRect.Height()/2);
Trans2DMatrix Trans(XTrans, YTrans);
pShape->Transform(Trans);
@@ -917,15 +931,15 @@
// The End2 should be centre and top but needs to be top left.
// We want the start point to be half the height of the bitmap below this
- //DocCoord Start(Rect.lox + Width/2, Rect.hiy - Height/2);
- DocCoord Start(Rect.lox, Rect.hiy - Height);
+ //DocCoord Start(Rect.lo.x + Width/2, Rect.hi.y - Height/2);
+ DocCoord Start(Rect.lo.x, Rect.hi.y - Height);
// We want the other end point to be same height as the centre point
// but on the far right of the rectangle i.e the full width across
- //DocCoord End(Rect.lox + Width, Rect.hiy - Height/2);
- DocCoord End(Rect.lox + Width, Rect.hiy - Height);
+ //DocCoord End(Rect.lo.x + Width, Rect.hi.y - Height/2);
+ DocCoord End(Rect.lo.x + Width, Rect.hi.y - Height);
// We want the end point to be middle and top of the rectangle
- //DocCoord End2(Rect.lox + Width/2, Rect.hiy);
- DocCoord End2(Rect.lox, Rect.hiy);
+ //DocCoord End2(Rect.lo.x + Width/2, Rect.hi.y);
+ DocCoord End2(Rect.lo.x, Rect.hi.y);
((AttrFillGeometry*)pBitmapFillAttr)->SetStartPoint(&Start);
((AttrFillGeometry*)pBitmapFillAttr)->SetEndPoint(&End);
Index: Trunk/XaraLX/Kernel/Makefile.am
===================================================================
--- Trunk/XaraLX/Kernel/Makefile.am (revision 801)
+++ Trunk/XaraLX/Kernel/Makefile.am (revision 802)
@@ -59,5 +59,6 @@
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 sglayer.cpp sgdrag.cpp sginit.cpp sgtree.cpp \
- layermgr.cpp layergal.cpp
+ layermgr.cpp layergal.cpp backgrnd.cpp
+
AM_CXXFLAGS = $(XARAFLAGS)
Index: Trunk/XaraLX/Kernel/main2.cpp
===================================================================
--- Trunk/XaraLX/Kernel/main2.cpp (revision 801)
+++ Trunk/XaraLX/Kernel/main2.cpp (revision 802)
@@ -181,6 +181,7 @@
#include "nodeliveeffect.h"
#include "stdbars.h"
#include "rendwnd.h"
+#include "backgrnd.h"
#if XAR_TREE_DIALOG
#include "cxftree.h"
#endif
@@ -319,6 +320,9 @@
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() &&
+
// WEBSTER - markn 15/1/97
// Removed these ops as they are not used
#ifndef WEBSTER
Index: Trunk/XaraLX/wxOil/camview.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camview.cpp (revision 801)
+++ Trunk/XaraLX/wxOil/camview.cpp (revision 802)
@@ -172,6 +172,8 @@
CCamView::CCamView()
{
+ TRACEUSER("Gerry", _T("Creating CCamView at 0x%08x
"), this);
+
// No child windows or connections yet.
pDocView = NULL;
pPrintView = NULL;
@@ -273,6 +275,8 @@
// windows for displaying the view.
bool CCamView::OnCreate( wxDocument *pDoc, /* TYPENOTE: Correct */ long flags )
{
+ TRACEUSER("Gerry", _T("CCamView::OnCreate at 0x%08x
"), this);
+
// Construct the (C++) child windows.
PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller / ruler usage")
RenderWindow = new CRenderWnd(this);
@@ -385,6 +389,8 @@
m_pFrame->Show(true);
Activate(true);
+ TRACEUSER("Gerry", _T("Leaving CCamView::OnCreate at 0x%08x
"), this);
+
return true;
}
@@ -393,7 +399,7 @@
// Clean up windows used for displaying the view.
bool CCamView::OnClose( bool fDeleteWindow /*= TRUE*/ )
{
- TRACEUSER("Gerry", _T("Closing CCamView at 0x%08x
"), this);
+ TRACEUSER("Gerry", _T("CCamView::OnClose at 0x%08x
"), this);
if( !GetDocument()->Close() )
return false;
@@ -1402,11 +1408,11 @@
void CCamView::OnActivateView( bool bActivate, wxView* pActiveView, wxView* pDeactiveView )
{
-// TRACEUSER("Gerry", _T("ScreenView::OnActivateView - %s
"), bActivate ? _T("true") : _T("false"));
+ TRACEUSER("Gerry", _T("CCamView::OnActivateView(%s) - 0x%08x
"), bActivate ? _T("true") : _T("false"), this);
if ( !pDocView )
{
- TRACE( _T("ScreenView::OnActivateView - Warning: pDocView uninitialised
") );
+ TRACE( _T("CCamView::OnActivateView - Warning: pDocView is NULL
") );
return;
}
@@ -1435,11 +1441,18 @@
}
else
{
-// TRACEUSER("Gerry", _T("Deactivating the view
"));
-
- // Lets just try setting no selected for the time being
- PORTNOTE("other", "CCamView::OnActivateView(false) now setting no selected doc and view")
- Document::SetNoSelectedViewAndSpread();
+ TRACEUSER("Gerry", _T("Deactivating the view
"));
+/*
+ // Lets just try setting no selected for the time being but only if this view is the selected one
+ if (DocView::GetSelected() == pDocView)
+ {
+ PORTNOTE("other", "CCamView::OnActivateView(false) now setting no selected doc and view")
+ Document::SetNoSelectedViewAndSpread();
+ }
+ else
+ {
+ TRACEUSER("Gerry", _T("Not the selected view
"));
+ }*/
}
}
Index: Trunk/XaraLX/wxOil/dragmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dragmgr.cpp (revision 801)
+++ Trunk/XaraLX/wxOil/dragmgr.cpp (revision 802)
@@ -154,7 +154,7 @@
CaptureWnd::CaptureWnd()
{
- TRACEUSER("Gerry", _T("CaptureWnd::CaptureWnd"));
+// TRACEUSER("Gerry", _T("CaptureWnd::CaptureWnd"));
pDisplayDC = NULL;
BackBitmap = NULL;
MaskBitmap = NULL;
@@ -173,7 +173,7 @@
CaptureWnd::~CaptureWnd()
{
- TRACEUSER("Gerry", _T("CaptureWnd::~CaptureWnd"));
+// TRACEUSER("Gerry", _T("CaptureWnd::~CaptureWnd"));
// // Need to clean up all the pointers here...
}
@@ -192,7 +192,7 @@
BOOL CaptureWnd::Create()
{
- TRACEUSER("Gerry", _T("CaptureWnd::Create"));
+// TRACEUSER("Gerry", _T("CaptureWnd::Create"));
BOOL WindowCreated = FALSE;
WindowCreated = wxFrame::Create(NULL, wxID_ANY, wxString(_T("")), wxPoint(0, 0), wxSize(20, 20), 0);
@@ -225,7 +225,7 @@
void CaptureWnd::OnWindowCreate(wxWindowCreateEvent &event)
{
- TRACEUSER("Gerry", _T("CaptureWnd::OnWindowCreate"));
+// TRACEUSER("Gerry", _T("CaptureWnd::OnWindowCreate"));
CaptureMouse();
event.Skip();
}
@@ -432,27 +432,34 @@
{
TRACEUSER("Gerry", _T("CleanUpSolidDrag"));
- if(!DragManagerOp::CurrentManager->CurrentDragInfo->DoesSolidDrag)
+ if (DragManagerOp::CurrentManager == NULL)
+ return(FALSE);
+
+ if (DragManagerOp::CurrentManager->CurrentDragInfo &&
+ !DragManagerOp::CurrentManager->CurrentDragInfo->DoesSolidDrag)
return TRUE;
if (pDisplayDC == NULL)
return FALSE;
- wxMemoryDC BackGroundDC;
+ if (BackBitmap)
+ {
+ wxMemoryDC BackGroundDC;
- // select bitmap into the dc
- BackGroundDC.SelectObject(*BackBitmap);
+ // select bitmap into the dc
+ BackGroundDC.SelectObject(*BackBitmap);
- // remove the last drag draw (only if we drew something)
- if (!DragManagerOp::CurrentManager->DragPending)
- {
- pDisplayDC->Blit(DragRect.x,DragRect.y,DragRect.width, DragRect.height,&BackGroundDC,0,0);
+ // remove the last drag draw (only if we drew something)
+ if (!DragManagerOp::CurrentManager->DragPending)
+ {
+ pDisplayDC->Blit(DragRect.x,DragRect.y,DragRect.width, DragRect.height,&BackGroundDC,0,0);
+ }
+
+ // clean up and delete the DC's
+ BackGroundDC.SelectObject(wxNullBitmap);
}
-
- // clean up and delete the DC's
- BackGroundDC.SelectObject(wxNullBitmap);
-
- if (pDisplayDC)
+
+ if (pDisplayDC)
{
delete pDisplayDC;
pDisplayDC = NULL;
@@ -501,7 +508,7 @@
BOOL CaptureWnd::CleanUpSolidDragInScreenArea(const wxRect& Area)
{
- TRACEUSER("Gerry", _T("CleanUpSolidDragInScreenArea"));
+// TRACEUSER("Gerry", _T("CleanUpSolidDragInScreenArea"));
// No solid drag, so no need to do anything
if (!DragManagerOp::CurrentManager->CurrentDragInfo->DoesSolidDrag)
@@ -577,17 +584,8 @@
BOOL CaptureWnd::DrawSolidDrag(wxPoint point)
{
- TRACEUSER("Gerry", _T("DrawSolidDrag(%d, %d)"), point.x, point.y);
+// TRACEUSER("Gerry", _T("DrawSolidDrag(%d, %d)"), point.x, point.y);
- if (HasCapture())
- {
- TRACEUSER("Gerry", _T("Has got capture"));
- }
- else
- {
- TRACEUSER("Gerry", _T("Hasn't got capture"));
- }
-
ERROR2IF(DragManagerOp::CurrentManager == NULL ||
DragManagerOp::CurrentManager->CurrentDragInfo == NULL,
FALSE,
@@ -689,7 +687,7 @@
BOOL CaptureWnd::DrawTransparentDrag(wxPoint point, INT32 Transparency)
{
- TRACEUSER("Gerry", _T("DrawTransparentDrag(%d, %d, %d)"), point.x, point.y, Transparency);
+// TRACEUSER("Gerry", _T("DrawTransparentDrag(%d, %d, %d)"), point.x, point.y, Transparency);
// offset mouse pos by drag offset
point += DragManagerOp::CurrentManager->CurrentDragInfo->SolidDragOffset;
@@ -792,7 +790,7 @@
********************************************************************************************/
void CaptureWnd::OnRButtonUp(wxMouseEvent& event)
{
- TRACEUSER("Gerry", _T("CaptureWnd::OnRButtonUp"));
+// TRACEUSER("Gerry", _T("CaptureWnd::OnRButtonUp"));
DragManagerOp::EndDrag(-1);// -1 == Right click for now
event.Skip();
}
@@ -1043,7 +1041,7 @@
if (pNewManager != NULL && TheCaptureWindow != NULL)
{
- DragPending = TRUE;
+ DragPending = TRUE;
// Remember where the mouse is at the start of the drag
pNewManager->CurrentMousePos = wxGetMousePosition();
@@ -1106,7 +1104,14 @@
// clean up
if (TheCaptureWindow != NULL)
+ {
+// If you get a nasty crash in, or otherwise need to debug, the dropping code then
+// you might want to kill the capture here or the debugger wont work very well and
+// you'll need to kill the process
+// GetMainFrame()->EndDragManagerDrag(TheCaptureWindow);
+
TheCaptureWindow->CleanUpSolidDrag();
+ }
if(DragPending) // not a drag - user intended a click
{
@@ -1114,7 +1119,7 @@
wxPoint StartMouse;
StartMouse.x = CurrentManager->InitialMousePos.x;
StartMouse.y = CurrentManager->InitialMousePos.y;
- CurrentManager->CurrentDragInfo->OnClick(Flags,StartMouse);
+ CurrentManager->CurrentDragInfo->OnClick(Flags,StartMouse);
}
else // this is a genuine end of drag
{
Xara