21 #include <wx/dcprint.h>
38 #include <wx/wfstream.h>
40 #include <wx/stdstream.h>
42 #define CROSS_HAIR_X 300
43 #define CROSS_HAIR_Y 300
49 a2dCursorStack::a2dCursorStack()
57 a2dPushInStack::a2dPushInStack()
64 WX_DEFINE_LIST( a2dUpdateListBase );
67 #ifdef CLASS_MEM_MANAGEMENT
68 a2dMemManager a2dUpdateList::sm_memManager( wxT(
"a2dUpdateList memory manager" ) );
69 #endif //CLASS_MEM_MANAGEMENT
76 Init( x1, y1, x2, y2 );
128 m_tiles.resize( width * height );
136 for ( t = 0; t <
m_tiles.size(); t++ )
139 m_tiles[t].m_rectPrevRow = NULL;
146 for ( t = 0; t <
m_tiles.size(); t++ )
147 if (
m_tiles[t].m_valid ==
true )
162 for ( x = 0; x <
m_width; x++ )
173 for ( x = 0; x <
m_width; x++ )
195 a2dUpdateList::compatibility_iterator nodeb = a2dTiles->GetFirst();
200 int x, y, width, height;
204 height = uobj->height;
208 nodeb = nodeb->GetNext();
212 a2dTiles->DeleteContents(
true );
218 FillTiles( rect.x, rect.y, rect.width, rect.height, expand );
223 int x, y, x1, y1, x2, y2;
228 int widthPix =
m_width * a2d_TILESIZE;
229 int heightPix =
m_height * a2d_TILESIZE;
236 if ( w <= 0 )
return;
243 if ( h <= 0 )
return;
245 if ( xr + w > widthPix )
249 if ( w <= 0 )
return;
251 if ( yr + h > heightPix )
255 if ( h <= 0 )
return;
262 x2 =
toT( xr + w + a2d_TILESIZE );
263 y2 =
toT( yr + h + a2d_TILESIZE );
266 int height = y2 - y1;
268 int tx1, ty1, tx2, ty2;
274 tx2 =
ModT( xr + w );
275 ty2 =
ModT( yr + h );
283 m_tiles[ ti++ ].Expand( tx1, ty1, a2d_TILESIZE - 1, ty2 );
284 for ( x = 1; x < width - 1; x++ )
285 m_tiles[ ti++ ].Expand( 0, ty1, a2d_TILESIZE - 1, ty2 );
286 m_tiles[ ti++ ].Expand( 0, ty1, tx2, ty2 );
293 m_tiles[ x1 + y1 *
m_width ].Expand( tx1, ty1, tx2, a2d_TILESIZE - 1 );
294 for ( y = 1; y < height - 1; y++ )
295 m_tiles[ x1 + ( y1 + y )*
m_width ].Expand( tx1, 0, tx2, a2d_TILESIZE - 1 );
302 m_tiles[ ti++ ].Expand( tx1, ty1, a2d_TILESIZE - 1, a2d_TILESIZE - 1 );
303 for ( x = 1; x < width - 1; x++ )
304 m_tiles[ ti++ ].Expand( 0, ty1, a2d_TILESIZE - 1, a2d_TILESIZE - 1 );
305 m_tiles[ ti++ ].Expand( 0, ty1, tx2, a2d_TILESIZE - 1 );
308 for ( y = 1; y < height - 1; y++ )
310 ti = x1 + ( y1 + y ) * m_width;
311 m_tiles[ ti++ ].Expand( tx1, 0, a2d_TILESIZE - 1, a2d_TILESIZE - 1 );
312 for ( x = 1; x < width - 1; x++ )
313 m_tiles[ ti++ ].Expand( 0, 0, a2d_TILESIZE - 1, a2d_TILESIZE - 1 );
314 m_tiles[ ti++ ].Expand( 0, 0, tx2, a2d_TILESIZE - 1 );
317 ti = x1 + ( y1 + y ) * m_width;
319 m_tiles[ ti++ ].Expand( tx1, 0, a2d_TILESIZE - 1, ty2 );
320 for ( x = 1; x < width - 1; x++ )
321 m_tiles[ ti++ ].Expand( 0, 0, a2d_TILESIZE - 1, ty2 );
322 m_tiles[ ti++ ].Expand( 0, 0, tx2, ty2 );
342 int tilei, lefttilei;
347 for ( x = 0; x <
m_width; x++ )
361 while ( x != m_width - 1 &&
362 tile.
m_x2 == ( a2d_TILESIZE - 1 ) &&
363 m_tiles[tilei + 1].m_x1 == 0 &&
375 if ( ( x1 ^ x2 ) | ( y1 ^ y2 ) )
380 x2 == prevRows->x + prevRows->width &&
381 y1 == prevRows->y + prevRows->height + 1
385 prevRows->height = y2 - prevRows->y;
390 prevRows =
new a2dUpdateArea( x1, y1, x2 - x1, y2 - y1,
id );
391 rects->Append( prevRows );
396 if ( y != m_height - 1 )
408 #ifdef CLASS_MEM_MANAGEMENT
409 a2dMemManager a2dUpdateArea::sm_memManager( wxT(
"a2dUpdateArea memory manager" ) );
410 #endif //CLASS_MEM_MANAGEMENT
412 a2dUpdateArea::a2dUpdateArea(
int x,
int y,
int width,
int height, wxUint8
id ): wxRect( x, y, width, height )
414 m_update_done =
false;
415 m_update_direct =
false;
419 a2dUpdateArea::~a2dUpdateArea()
468 EVT_ENTER_WINDOW( a2dDrawingPart::OnEnter )
469 EVT_IDLE( a2dDrawingPart::OnIdle )
470 EVT_MOUSE_EVENTS( a2dDrawingPart::OnMouseEvent )
471 EVT_CHAR( a2dDrawingPart::OnCharEvent )
476 EVT_DO( a2dDrawingPart::OnDoEvent )
477 EVT_UNDO( a2dDrawingPart::OnUndoEvent )
478 EVT_REDO( a2dDrawingPart::OnRedoEvent )
482 EVT_SET_FOCUS( a2dDrawingPart::OnSetFocus )
483 EVT_KILL_FOCUS( a2dDrawingPart::OnKillFocus )
486 a2dDrawingPart::a2dDrawingPart( const wxSize& size ):
487 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
488 m_initCurrentSmartPointerOwner(
this ),
490 m_tiles( ( size.GetWidth() >> a2d_TILESHIFT ) + 1 , ( size.GetHeight() >> a2d_TILESHIFT ) + 1 ),
491 m_tiles2( ( size.GetWidth() >> a2d_TILESHIFT ) + 1 , ( size.GetHeight() >> a2d_TILESHIFT ) + 1 )
493 m_width = size.GetWidth();
494 m_height = size.GetHeight();
502 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
503 m_initCurrentSmartPointerOwner( this ),
505 m_tiles( ( width >> a2d_TILESHIFT ) + 1 , ( height >> a2d_TILESHIFT ) + 1 ),
506 m_tiles2( ( width >> a2d_TILESHIFT ) + 1 , ( height >> a2d_TILESHIFT ) + 1 )
517 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
518 m_initCurrentSmartPointerOwner( this ),
520 m_tiles( ( width >> a2d_TILESHIFT ) + 1 , ( height >> a2d_TILESHIFT ) + 1 ),
521 m_tiles2( ( width >> a2d_TILESHIFT ) + 1 , ( height >> a2d_TILESHIFT ) + 1 )
533 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
534 m_initCurrentSmartPointerOwner( this ),
536 m_tiles( ( drawer->GetWidth() >> a2d_TILESHIFT ) + 1 , ( drawer->GetHeight() >> a2d_TILESHIFT ) + 1 ),
537 m_tiles2( ( drawer->GetWidth() >> a2d_TILESHIFT ) + 1 , ( drawer->GetHeight() >> a2d_TILESHIFT ) + 1 )
546 void a2dDrawingPart::Init()
558 m_toolWantsIt =
false;
565 m_drawingDisplay = NULL;
574 if ( m_drawer2D && m_drawer2D->
HasAlpha() )
633 m_viewDependentObjects =
false;
635 m_updatesVisible =
false;
647 SetEvtHandlerEnabled(
false );
650 m_drawingDisplay = NULL;
660 m_tiles( ( other.m_width >> a2d_TILESHIFT ) + 1 , ( other.m_height >> a2d_TILESHIFT ) + 1 ),
661 m_tiles2( ( other.m_width >> a2d_TILESHIFT ) + 1 , ( other.m_height >> a2d_TILESHIFT ) + 1 )
662 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
663 , m_initCurrentSmartPointerOwner( this )
719 #if wxUSE_PRINTING_ARCHITECTURE
741 assert( m_drawer2D );
747 m_drawingDisplay = display;
748 if ( m_drawingDisplay )
749 m_drawingDisplay->SetDropTarget(
new a2dDnDCanvasObjectDropTarget(
this ));
759 m_tiles.
SetSize( ( w >> a2d_TILESHIFT ) + 1, ( h >> a2d_TILESHIFT ) + 1 );
760 m_tiles2.
SetSize( ( w >> a2d_TILESHIFT ) + 1, ( h >> a2d_TILESHIFT ) + 1 );
767 if ( noDelete !=
true )
772 m_drawer2D = drawer2d;
797 wxASSERT_MSG( controller->
GetDrawingPart() ==
this, wxT(
"a2dToolContr has different a2dDrawingPart set for it" ) );
805 bool processed =
false;
808 if ( GetEvtHandlerEnabled() )
813 if ( event.GetEventType() == wxEVT_IDLE )
819 processed = a2dObject::ProcessEvent( event );
828 if ( m_drawingDisplay )
830 SetEvtHandlerEnabled(
false );
831 event.ResumePropagation( wxEVENT_PROPAGATE_MAX );
832 m_drawingDisplay->GetEventHandler()->ProcessEvent( event );
833 event.StopPropagation();
834 SetEvtHandlerEnabled(
true );
836 processed = a2dObject::ProcessEvent( event );
837 if ( !processed || m_toolWantsIt )
841 m_toolWantsIt =
false;
849 processed = a2dObject::ProcessEvent( event );
854 if ( !processed || m_toolWantsIt )
857 processed = a2dObject::ProcessEvent( event );
858 m_toolWantsIt =
false;
864 if ( !processed || m_toolWantsIt )
867 processed = a2dObject::ProcessEvent( event );
868 m_toolWantsIt =
false;
874 if ( !processed || m_toolWantsIt )
877 processed = a2dObject::ProcessEvent( event );
878 m_toolWantsIt =
false;
884 if ( !processed || m_toolWantsIt )
887 processed = a2dObject::ProcessEvent( event );
888 m_toolWantsIt =
false;
893 processed = a2dObject::ProcessEvent( event );
902 void a2dDrawingPart::OnEnter( wxMouseEvent& event )
926 AddOverlayAreas(
false );
948 void a2dDrawingPart::AddOverlayAreas(
bool update )
950 if ( m_overlayObjects.size() )
952 a2dCanvasObjectList::iterator iter = m_overlayObjects.begin();
953 for( iter = m_overlayObjects.begin(); iter != m_overlayObjects.end(); ++iter )
955 a2dCanvasObjectList::value_type obj = *iter;
956 if ( obj->GetPending() )
961 obj->SetPending(
false );
976 m_overlayObjects.push_back( obj );
981 a2dCanvasObjectList::iterator iter = m_overlayObjects.begin();
982 for( iter = m_overlayObjects.begin(); iter != m_overlayObjects.end(); ++iter )
984 a2dCanvasObjectList::value_type iobj = *iter;
985 if ( iobj == obj || obj == NULL )
988 m_overlayObjects.erase( iter );
994 void a2dDrawingPart::OnSetFocus( wxFocusEvent& focusevent )
1005 void a2dDrawingPart::OnKillFocus( wxFocusEvent& focusevent )
1046 void a2dDrawingPart::SetCursor(
const wxCursor& cursor )
1048 if ( m_drawingDisplay )
1049 m_drawingDisplay->SetCursor( cursor );
1054 m_cursorStack.push_back( cursor );
1055 if ( m_drawingDisplay )
1056 m_drawingDisplay->SetCursor( cursor );
1061 if ( m_cursorStack.size() )
1063 m_cursorStack.pop_back();
1064 if ( m_drawingDisplay )
1066 if ( m_cursorStack.size() )
1067 m_drawingDisplay->SetCursor( m_cursorStack.back() );
1069 m_drawingDisplay->SetCursor(
a2dCanvasGlobals->GetCursor( a2dCURSOR_ARROW ) );
1076 m_cursorStack.clear();
1077 if ( m_drawingDisplay )
1078 m_drawingDisplay->SetCursor(
a2dCanvasGlobals->GetCursor( a2dCURSOR_ARROW ) );
1107 can->CalcUnscrolledPosition( x, y, &x , &y );
1127 can->CalcScrolledPosition( x, y, &x , &y );
1134 m_mouse_y =
event.GetY();
1305 double x,
double y,
int margin,
1355 bool processed =
false;
1361 m_patToHitPrev = m_patToHitCur;
1362 m_patToHitCur = ic.m_contextListDeep;
1380 icpp.Push( obj, pp->
m_clip );
1391 if ( !found && obj )
1394 wxMouseEvent* mouse =
wxDynamicCast( &event, wxMouseEvent );
1398 obj->ProcessEvent( enter );
1403 icpp.Push( pp->GetLocalTransform(), pp->
m_clip );
1408 while ( riter != m_patToHitCur.rend() && !processed )
1423 if ( obj == receive )
1425 wxMouseEvent* mouse =
wxDynamicCast( &event, wxMouseEvent );
1430 processed = obj->ProcessEvent( CanvasObjectMouseEvent );
1436 processed = obj->ProcessEvent( event );
1441 icpp2.Push( obj, pp->
m_clip );
1444 icpp2.Push( pp->GetLocalTransform(), pp->
m_clip );
1460 icpp3.Push( obj, pp->
m_clip );
1470 if ( !found && obj )
1473 wxMouseEvent* mouse =
wxDynamicCast( &event, wxMouseEvent );
1477 obj->ProcessEvent( leave );
1482 icpp3.Push( pp->GetLocalTransform(), pp->
m_clip );
1492 double x,
double y,
int margin,
1505 event.SetIterC( &ic );
1519 findcorridor.SetSkipNotRenderedInDrawing(
true );
1537 a2dCanvasObjectList::const_iterator iter = corridor.begin();
1538 while( iter != corridor.end() )
1540 a2dCanvasObjectList::value_type obj = *iter;
1541 obj->SetIsOnCorridorPath(
true );
1544 if ( !corridor.empty() )
1560 setflags.SetSkipNotRenderedInDrawing(
true );
1569 bool filterSelectableLayers
1597 bool filterSelectableLayers
1618 m_patToHitCur = m_patToHitPrev;
1619 m_patToHitCur = ic.m_contextList;
1644 for ( j = 0; j < wxMAXLAYER; j++ )
1652 set.SetSkipNotRenderedInDrawing(
true );
1675 if ( GetEvtHandlerEnabled() )
1688 if ( property->GetUint16() != wxLAYER_ALL )
1760 wxASSERT_MSG(
m_top->
GetRoot(), wxT(
"showobject without root set" ) );
1765 if ( !GetEvtHandlerEnabled() )
1770 if ( event.GetUpdateHint() != 0 )
1771 how = event.GetUpdateHint();
1780 for ( j = 0; j < wxMAXLAYER; j++ )
1785 for ( j = 0; j < wxMAXLAYER; j++ )
1797 for ( j = 0; j < wxMAXLAYER; j++ )
1800 for ( j = 0; j < wxMAXLAYER; j++ )
1802 for ( j = 0; j < wxMAXLAYER; j++ )
1857 wxASSERT_MSG(
m_recur ==
false, wxT(
"recursive calls in updating not allowed" ) );
1864 a2dUpdateList::compatibility_iterator nodeb =
m_updateareas.GetFirst();
1881 wxASSERT_MSG(
m_recur ==
false, wxT(
"recursive calls in updating not allowed" ) );
1890 a2dUpdateList::compatibility_iterator nodeb =
m_updateareas.GetFirst();
1895 if ( !uobj->m_update_done )
1901 int x, y, width, height;
1905 width = uobj->width;
1906 height = uobj->height;
1912 uobj->m_update_done =
true;
1918 a2dUpdateList::compatibility_iterator nodeh = nodeb;
1919 nodeb = nodeb->GetNext();
1923 nodeb = nodeb->GetNext();
1926 nodeb = nodeb->GetNext();
1935 bool refresh =
false;
1940 wxASSERT_MSG(
m_recur ==
false, wxT(
"recursive calls in updating not allowed" ) );
1945 a2dUpdateList::compatibility_iterator node =
m_updateareas.GetFirst();
1950 if ( rect->m_update_done )
1952 node = node->GetNext();
1959 a2dUpdateList::compatibility_iterator node =
m_updateareas.GetFirst();
1964 if ( rect->m_update_done )
1968 if ( m_drawingDisplay && m_drawingDisplay->GetChildren().GetCount() )
1970 m_drawingDisplay->Refresh(
false, rect );
1975 a2dUpdateList::compatibility_iterator nodeh = node;
1976 node = node->GetNext();
1980 node = node->GetNext();
2003 wxASSERT_MSG(
GetDrawing() != 0, wxT(
"invalid a2dDrawing in a2dDrawingPart" ) );
2013 if ( width <= 0 )
return;
2020 if ( height <= 0 )
return;
2026 if ( width <= 0 )
return;
2032 if ( height <= 0 )
return;
2104 void a2dDrawingPart::ClearArea(
int x,
int y,
int width,
int height )
2108 wxASSERT_MSG(
GetDrawing() != 0, wxT(
"invalid a2dDrawing in a2dDrawingPart" ) );
2118 if ( width <= 0 )
return;
2125 if ( height <= 0 )
return;
2131 if ( width <= 0 )
return;
2137 if ( height <= 0 )
return;
2168 if ( width <= 0 )
return;
2175 if ( height <= 0 )
return;
2181 if ( width <= 0 )
return;
2187 if ( height <= 0 )
return;
2192 m_drawer2D->
BlitBuffer( x, y, width, height , xbuf, ybuf );
2202 wxASSERT_MSG(
GetDrawing() != 0, wxT(
"invalid a2dDrawing in a2dDrawingPart" ) );
2206 int x, y, width, height;
2215 width = absarea.GetWidth();
2216 height = absarea.GetHeight();
2225 if ( width <= 0 )
return;
2232 if ( height <= 0 )
return;
2238 if ( width <= 0 )
return;
2244 if ( height <= 0 )
return;
2256 ic.SetDisableInvert(
true );
2266 if ( clipparent !=
_OUT )
2268 ic.SetPerLayerMode(
false );
2270 ic.SetLayer( wxLAYER_ALL );
2272 obj->
Render( ic, clipparent );
2290 if ( ! m_viewDependentObjects )
2426 if ( m_overlayObjects.empty() )
2526 a2dCanvasObjectList::iterator iter = m_overlayObjects.begin();
2527 for( iter = m_overlayObjects.begin(); iter != m_overlayObjects.end(); ++iter )
2529 a2dCanvasObjectList::value_type obj = *iter;
2535 obj->Render( ic, clipparent );
2565 if ( clipparent !=
_OUT )
2607 for ( j = 0; j < wxMAXLAYER; j++ )
2617 if ( layerobj == wxNullLayerInfo )
2638 renderLay.SetSkipNotRenderedInDrawing(
true );
2664 for ( j = 0; j < wxMAXLAYER; j++ )
2674 if ( layerobj == wxNullLayerInfo )
2832 wxRect rect( xi, yi + hi, wi, -hi );
2839 wxRect rect( xi, yi, wi, hi );
2859 if ( w <= 0 )
return;
2866 if ( h <= 0 )
return;
2872 if ( w <= 0 )
return;
2878 if ( h <= 0 )
return;
2886 m_tiles2.
FillTiles( x, y, xmax - x, ymax - y,
true );
2893 if ( obj && (
id == 1 ) )
2924 wxASSERT_MSG(
GetDrawing() != 0, wxT(
"invalid a2dCanvasDocument in a2dDrawingPart" ) );
2936 ic.SetUpdateHint( how );
2953 wxASSERT_MSG(
GetDrawing() != 0, wxT(
"invalid a2dCanvasDocument in a2dDrawingPart" ) );
2960 m_cursorStack.clear();
2972 wxASSERT_MSG(
m_top->
GetRoot(),
"root not set on show object" );
3020 m_cursorStack.clear();
3030 wxASSERT_MSG(
m_top->
GetRoot(),
"root not set on show object" );
3066 return (
m_top.Get() != 0 );
3076 m_cursorStack.clear();
3088 wxASSERT_MSG(
m_top->
GetRoot(),
"root not set on show object" );
3110 m_pushInStack.push_back(
m_top );
3116 if ( m_pushInStack.size() )
3120 m_pushInStack.pop_back();
3128 m_pushInStack.clear();
3164 if ( worldw == 0 || worldh == 0 )
3171 double xupp = worldw /
m_width;
3174 if ( yupp == 0 || xupp == 0 )
3182 if ( worldw > yupp *
m_width )
3183 untr.
Translate( ( worldw - yupp * m_width ) / 2.0, 0 );
3188 untr.
Translate( 0, ( worldh - xupp * m_height ) / 2.0 );
3211 m_drawer2D->
DrawLine( x - w, y, w + x, y );
3212 m_drawer2D->
DrawLine( x, y - h, x, y + h );
3222 double min_x, max_x, min_y, max_y;
3268 max_x = ceil( max_x / gridx ) * gridx;
3269 min_x = floor( min_x / gridx ) * gridx;
3270 min_y = floor( min_y / gridy ) * gridy;
3271 max_y = ceil( max_y / gridy ) * gridy;
3277 for ( i = min_x; i < max_x; i += gridx )
3279 for ( j = min_y; j < max_y; j += gridy )
3293 for ( i = min_x; i < max_x; i += gridx )
3299 for ( j = min_y; j < max_y; j += gridy )
3345 if ( m_updatesVisible && !(x==0 && y==0 &&
m_width==width &&
m_height==height) )
3347 wxUint8 range_max = 210;
3348 wxUint8 range_min = 190;
3349 wxUint8 r = double( rand() /
double(RAND_MAX + 1) ) * (range_max - range_min) + range_min;
3350 wxUint8 g = double( rand() /
double(RAND_MAX + 1) ) * (range_max - range_min) + range_min;
3351 wxUint8 b = double( rand() /
double(RAND_MAX + 1) ) * (range_max - range_min) + range_min;
3405 if ( total || gradient )
3411 if ( dxy > 0 && dxy < bh )
3416 else if ( dxy < 0 && dxy > -bh )
3427 if ( total || gradient )
3433 if ( dxy > 0 && dxy < bw )
3438 else if ( dxy < 0 && dxy > -bw )
3454 double xWorldLocal, yWorldLocal;
3460 obj->
Translate( xWorldLocal, yWorldLocal );
3467 #if wxUSE_PRINTING_ARCHITECTURE
3474 wxPrinterBase *a2dPrintFactory::CreatePrinter( wxPrintDialogData *data )
3476 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
3477 return new wxWindowsPrinter( data );
3478 #elif defined(__WXMAC__)
3479 return new wxMacPrinter( data );
3480 #elif defined(__WXPM__)
3481 return new wxOS2Printer( data );
3483 return new wxPostScriptPrinter( data );
3487 wxPrintPreviewBase *a2dPrintFactory::CreatePrintPreview( wxPrintout *preview,
3488 wxPrintout *printout, wxPrintDialogData *data )
3490 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
3491 return new a2dWindowsPrintPreview( preview, printout, data );
3492 #elif defined(__WXMAC__)
3493 return new wxMacPrintPreview( preview, printout, data );
3494 #elif defined(__WXPM__)
3495 return new wxOS2PrintPreview( preview, printout, data );
3497 return new wxPostScriptPrintPreview( preview, printout, data );
3501 wxPrintPreviewBase *a2dPrintFactory::CreatePrintPreview( wxPrintout *preview,
3502 wxPrintout *printout, wxPrintData *data )
3504 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
3505 return new a2dWindowsPrintPreview( preview, printout, data );
3506 #elif defined(__WXMAC__)
3507 return new wxMacPrintPreview( preview, printout, data );
3508 #elif defined(__WXPM__)
3509 return new wxOS2PrintPreview( preview, printout, data );
3511 return new wxPostScriptPrintPreview( preview, printout, data );
3515 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
3521 IMPLEMENT_CLASS( a2dWindowsPrintPreview, wxWindowsPrintPreview )
3523 a2dWindowsPrintPreview::a2dWindowsPrintPreview(wxPrintout *printout,
3524 wxPrintout *printoutForPrinting,
3525 wxPrintDialogData *data)
3526 : wxWindowsPrintPreview(printout, printoutForPrinting, data)
3531 a2dWindowsPrintPreview::a2dWindowsPrintPreview(wxPrintout *printout,
3532 wxPrintout *printoutForPrinting,
3534 : wxWindowsPrintPreview( printout, printoutForPrinting, data)
3539 a2dWindowsPrintPreview::~a2dWindowsPrintPreview()
3543 bool a2dWindowsPrintPreview::RenderPageIntoBitmap(wxBitmap& bmp,
int pageNum)
3545 wxMemoryDC memoryDC;
3546 memoryDC.SelectObject(bmp);
3549 return RenderPageIntoDC(memoryDC, pageNum);
3554 #endif // wxUSE_PRINTING_ARCHITECTURE
3558 #if wxUSE_DRAG_AND_DROP
3564 const wxChar *a2dCanvasObjectFormatId = wxT(
"a2dCanvasObject");
3571 a2dDnDCameleonData::a2dDnDCameleonData(
a2dCanvasObject* canvasobject,
double dragStartX,
double dragStartY, a2dDrawingPart* drawingPart )
3572 : a2dDnDCanvasObjectDataCVG( drawingPart )
3576 a2dDnDCameleonData::~a2dDnDCameleonData()
3580 size_t a2dDnDCameleonData::GetDataSize(
const wxDataFormat& format)
const
3582 if ( format == m_formatShape )
3591 wxString oldLocale = wxSetlocale( LC_NUMERIC, NULL );
3593 wxSetlocale( LC_NUMERIC, wxString( wxT(
"English" ) ) );
3595 wxSetlocale( LC_NUMERIC, wxString( wxT(
"en_US" ) ) );
3604 obj->
Translate( -m_dragStartX, -m_dragStartY);
3616 CVGwriter.
SaveStartAt( m_mem, m_drawing, m_drawing->GetRootObject() );
3618 wxSetlocale( LC_NUMERIC, oldLocale );
3628 return m_mem.str().length()+10;
3632 return a2dDnDCanvasObjectDataCVG::GetDataSize( format );
3636 bool a2dDnDCameleonData::SetData(
const wxDataFormat& format,
size_t len,
const void *buf )
3638 if ( format == m_formatShape )
3641 wxCharBuffer cvgString = wxCharBuffer( (
const char*) buf );
3648 wxString oldLocale = wxSetlocale( LC_NUMERIC, NULL );
3649 wxSetlocale( LC_NUMERIC, wxString( wxT(
"English" ) ) );
3651 #if wxART2D_USE_CVGIO
3652 #if wxUSE_STD_IOSTREAM
3657 #endif // wxUSE_UNICODE
3663 CvgString.
Load( stream, m_drawing, m_drawing->GetRootObject() );
3666 m_hasBitmap =
false;
3669 m_hasMetaFile =
false;
3670 #endif // wxUSE_METAFILE
3674 #endif //wxART2D_USE_CVGIO
3678 a2dDnDCanvasObjectDataCVG::SetData( format, len, buf );
3683 #endif // wxUSE_DRAG_AND_DROP
3689 #if wxUSE_PRINTING_ARCHITECTURE
3695 m_pageSetupData( pageSetupData ),
3720 dc->GetSize( &pw, &ph );
3722 GetPageSizeMM(&mw, &mh);
3723 float mmToDeviceX = float(pw) / mw;
3724 float mmToDeviceY = float(ph) / mh;
3727 wxRect paperRect = wxRect( 0,0,pw,ph);
3730 wxPoint topLeft = m_pageSetupData.GetMarginTopLeft();
3731 wxPoint bottomRight = m_pageSetupData.GetMarginBottomRight();
3734 wxRect pageMarginsRect(
3735 paperRect.x + wxRound(mmToDeviceX * topLeft.x),
3736 paperRect.y + wxRound(mmToDeviceY * topLeft.y),
3737 paperRect.width - wxRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
3738 paperRect.height - wxRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
3741 dc->SetBrush( *wxWHITE_BRUSH );
3742 dc->SetBackground( *wxWHITE_BRUSH );
3744 dc->SetBackgroundMode( wxTRANSPARENT );
3745 dc->SetTextForeground( *wxBLACK );
3746 dc->SetBrush( *wxTRANSPARENT_BRUSH );
3749 int marginX = ( int )( ph * 0.015 );
3750 int marginY = marginX;
3751 int fontMarginYTop = 0;
3752 int fontMarginYBottom = 0;
3753 wxFont fontTitle = wxFont( marginY, wxDEFAULT, wxNORMAL, wxNORMAL );
3754 wxFont fontFilename = wxFont(
int( marginY / 2. + 0.5 ), wxDEFAULT, wxNORMAL, wxNORMAL );
3758 dc->SetFont( fontTitle );
3759 fontMarginYTop += 2 * fontTitle.GetPointSize();
3760 wxCoord xExtent, yExtent;
3761 dc->GetTextExtent(
m_title, &xExtent, &yExtent );
3762 dc->DrawText(
m_title, pw / 2 - xExtent / 2, marginY );
3767 dc->SetFont( fontFilename );
3768 fontMarginYBottom += 2 * fontFilename.GetPointSize();
3769 dc->DrawText(
m_filename, marginX, ph - marginY - fontMarginYBottom );
3773 int widthX = pageMarginsRect.GetWidth();
3774 int widthY = pageMarginsRect.GetHeight();
3775 int orgX = pageMarginsRect.GetTopLeft().x;
3776 int orgY = pageMarginsRect.GetTopLeft().y;
3778 dc->SetBackgroundMode( wxSOLID );
3779 dc->SetFont( wxNullFont );
3818 drawPart->SetEvtHandlerEnabled(
false );
3850 dc->SetDeviceOrigin( orgX, orgY );
3852 drawPart->
UpdateArea( 0, 0, widthX, widthY );
3870 drawPart->
UpdateArea( 0, 0, widthX, widthY );
3877 dcb.SelectObject( buffer );
3878 dc->Blit( orgX, orgY, widthX, widthY, &dcb, 0, 0, wxCOPY,
false );
3879 dcb.SelectObject( wxNullBitmap );
3898 dc->SetDeviceOrigin( 0, 0 );
3899 dc->SetBrush( *wxTRANSPARENT_BRUSH );
3900 dc->SetPen( *wxRED_PEN );
3901 dc->DrawRectangle( orgX, orgY, widthX, widthY );
3902 const wxPen& aPenForFrame = dc->GetPen();
3915 bool a2dDrawingPrintOut::HasPage(
int pageNum )
3917 return ( pageNum == 1 );
3920 bool a2dDrawingPrintOut::OnBeginDocument(
int startPage,
int endPage )
3922 if ( !wxPrintout::OnBeginDocument( startPage, endPage ) )
3928 void a2dDrawingPrintOut::GetPageInfo(
int* minPage,
int* maxPage,
int* selPageFrom,
int* selPageTo )
3936 #endif //wxUSE_PRINTING_ARCHITECTURE
void SetSize(int width, int height)
change tile area
virtual void SetYaxis(bool up)
set if the Yaxis goes up or down
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
void PushCursor(const wxCursor &cursor)
push a cursor on the cursor stack, and set display cursor to new back being cursor.
int WorldToDeviceXRel(double x) const
convert x relative from world to device coordinates
virtual bool ProcessCanvasObjectEvent(a2dIterC &ic, a2dHitEvent &hitEvent)
Hit objects will receive the event.
virtual void PaintBackground(int x, int y, int width, int height)
(re)painting of background
double GetHeight() const
returns height of the boundingbox
void Freeze()
prevent changing the a2dDrawingPart buffer and blitting it to the window
bool m_gridlines
show grid as lines
a2dTileBox is a subarea of a tile.
virtual void Render(a2dIterC &ic, OVERLAP clipparent)
Render this object to the active a2dDrawingPart.
void SetGridFill(const a2dFill &gridfill)
set fill used for grid drawing
(In) Visible property that can be added to Docview Objects.
virtual void RenderOverlay(a2dDocumentRenderStyle drawstyle)
render of overlay objects stored in m_overlayObjects specific to the view
virtual wxPrintout * OnCreatePrintout(a2dPrintWhat typeOfPrint, const wxPageSetupDialogData &pageSetupData)
to create a a2dDrawingPrintOut, used to print a view or its document
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Base class for all types of strokes, understood by a2dDrawer2D classes.
void SetRoot(a2dDrawing *root, bool recurse=true)
Sets this object to a a2dCanvasDocument.
bool SaveStartAt(a2dDocumentOutputStream &stream, const a2dDrawing *drawing, a2dCanvasObject *start)
saves as CVG starting at object start
bool m_frozen
buffer updating activity possible or not
a2dTiles m_tiles
tiles on drawing surface, used to optimize update areas.
int m_crosshairLengthX
crosshair cursor Length in X in pixels
diagram is an appearance for a2dCameleon
void AddPending(a2dIterC &ic)
search objects ( if nested recursive ) that have the pending flag Set
void Clear()
All tiles become empty.
a2dFill m_gridfill
grid fill
mouse event sent from a2dCanvasObject to itself
void ClearCorridorPath(bool uncapture)
Reset all corridor paths and uncapture object.
Simple Memory manager for some objects which often create and destroy to replace OS-system calls...
void SetDrawStyle(a2dDrawStyle drawstyle)
set drawstyle to use for drawing,
int m_y1
y1 in pixel coordinates
int WorldToDeviceY(double y) const
convert y from world to device coordinates
const a2dStroke * a2dBLACK_STROKE
global a2dStroke stock object for BLACK stroking
virtual void PopTransform(void)
Recall the previously saved user-to-world transform off the matrix stack.
const a2dAffineMatrix & GetTransformMatrix() const
get the matrix used to position the object
void OnBusyBegin(a2dCommandProcessorEvent &event)
do this at command start
void SetRealScale(bool realScale)
If true use real scale else different scale by x and y.
void DrawRects(a2dDrawer2D *drawer)
draw optimized rectangles to given view in device coordinates.
double GetVisibleMinX() const
get Minimal X of the visible part in world coordinates
wxUint16 m_gridsize
grid point size
wxUint32 GetDrawStyle()
get drawstyles used for drawing the document
filter for selected a2dCanvasObject's
#define EVT_UPDATE_DRAWING(func)
event from a drawing when updated
wxBitmap GetBuffer() const
Return the buffer as a bitmap.
int m_mouse_x
last mouse position
~a2dDrawingPrintOut(void)
destructor
simple canvas which takes as view the whole of the scrollable area. While a2dCanvas display and draws...
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
const a2dFill * a2dBLACK_FILL
global a2dFill stock object for BLACK filling
int m_x1
x1 in pixel coordinates
void OnIdle(wxIdleEvent &event)
redraw and/or blit pending areas to the device
static a2dPropertyIdVoidPtr * PROPID_ToolObject
set for objects that act as tool object, when a tool is in action.
wxUint32 m_documentDrawStyleRestore
to restore style after a temporary change.
a2dTileBox(int x1=0, int y1=0, int x2=0, int y2=0)
constructor
a2dDrawing * GetRoot() const
get a2dCanvasDocument of the object.
void Enlarge(const double Marge)
enlarge with the given amount
void SetRenderDC(wxDC *dc)
set the DC that is used for rendering
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
double GetHitMarginWorld() const
Get HitMargin used to extend a hittest in world units.
virtual ~a2dDrawingPart()
destructor
virtual void DestroyClippingRegion()=0
set clipping region off
wxUint16 GetHitMarginDevice() const
hit marging in pixels.
Simple canvas using a whole view for all of the scrolled window.
int m_crosshairx
crosshair x
int m_height
device size height
void ConnectEvent(wxEventType type, wxEvtHandler *eventSink)
void OnUpdate(a2dDrawingEvent &event)
depending on the hint value performs specific updating on the view.
void OnBusyEnd(a2dCommandProcessorEvent &event)
do this at command end
bool m_crosshair
is croshair visible
a2dStroke m_gridstroke
grid stroke
void SetDrawerStroke(const a2dStroke &stroke)
Used to set the current stroke.
virtual bool BlitPendingUpdateAreas()
blit pending update areas, that are already updated to the buffer, now to the screen.
virtual void DrawPolygon(a2dVertexArray *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)
Draw polygon in world coordinates using pointarray.
int toP(int tilexy)
convert internal tile to pixel coordinate tiles area
This class implements drawing functions for wxDC based drawing.
virtual void Scroll(int dxy, bool yscroll, bool total)
scroll up down or left right
void OnDrop(wxCoord x, wxCoord y, a2dDrawing *drawing)
used to drop a drawing object on the drawing part during Drag and Drop.
double m_gridx
grid distance in x
void Update(unsigned int how=(a2dCANVIEW_UPDATE_ALL|a2dCANVIEW_UPDATE_BLIT), wxObject *hintObject=NULL)
see OnUpdate
#define EVT_REDO(func)
event sent from a2DocumentCommandProcessor when a command is redone
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
record in update list of a2dDrawingPart.
a2dFill m_backgroundfill
background fill of canvas and background color of background fill in case of mono colour fill ...
bool GetYaxis() const
get y axis orientation
const a2dFill * a2dWHITE_FILL
global a2dFill stock object for WHITE filling
void SetBackgroundFill(const a2dFill &backgroundfill)
background fill for the canvas
bool OnPrintPage(int)
called for every page to print, for a2dDrawing in general just one.
This class implements drawing functions for wxDC based drawing.
void SetGrid(bool grid)
Set grid on/off.
a2dFill m_select2Fill
select style fill
double GetVisibleMinY() const
get Minimal X of the visible part in world coordinates
void Expand(int x1, int y1, int x2, int y2)
expand a tile with this box
bool GetUpdatesPending()
returns true if some objects have changed recently within this document
int toT(int xy)
convert pixel to internal tile coordinate tiles area
void SetDocumentDrawStyle(wxUint32 drawstyle)
set drawstyles to use for drawing the document
int ModT(int xy)
xy modules 256
bool SetCanvasToolContr(a2dToolContr *controller)
set toolcontroller ( reset with NULL )
virtual void UpdateArea(int x, int y, int width, int height, wxUint8 id=0)
update/redraw part of the buffer, using the given a2dDrawing and ShowObject within that root...
vertex array of line and arc segments.
a2dCanvasObject is the base class for Canvas Objects.
static const a2dSignal sig_changedLayerVisibleInView
when one layer is set visible in a2dDrawingPart
a2dAffineMatrix a2dIDENTITY_MATRIX
global a2dAffineMatrix to set/pass the identity matrix.
a2dStroke m_overlayStroke
overlay style stroke
wxString m_title
title put above printout
virtual void SetBufferSize(int w, int h)
sets buffersize ( if used ) for the a2dDrawer2D
static bool m_printAsBitmap
if set print a bitmap that was drawn into
a2dCanvas * GetCanvas() const
Get the Display window of the a2dView. But casted to a a2dCanvas.
int m_crosshairy
crosshair y
bool m_printfittopage
If true, draw a view on all page without real scale.
void PushIn(a2dCanvasObject *pushin)
set given canvasobject as show object, and store the current on the stack
output handler for the CVG format.
#define A2D_PROPID_M(type, classname, propname, defaultval, mptr)
to define a get set property more easily
a2dCanvasObject * GetObject()
Get the current object.
a2dLayers * GetLayerSetup()
Get the layersettings for the canvas.
a2dStroke m_selectStroke
select style stroke
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
a2dCanvas uses a2dCanvasView for displaying a view on a a2dCanvasDocument.
a2dStroke & GetSelect2Stroke()
Get Stroke to use for Selected2 a2dCanvasObject's.
void TransformPoint(double x, double y, double &tx, double &ty) const
Transform a point.
void SetObjectFilter(a2dCanvasObjectFilter *filter)
set object filter class.
OVERLAP m_clip
how far this object in the view being rendered
int m_x2
x2 in pixel coordinates
virtual void BlitBuffer(int x, int y, int width, int height, int xbuf, int ybuf)
blit part of the drawing buffer to the canvas
int m_height
number of vertical tiles
wxUint32 m_documentDrawStyle
drawstyles to use when rendering document
a2dCanvasObjectPtr m_top
top object for drawer object, from here the rendering starts
a2dUpdateArea * m_rectPrevRow
prev row pointer to combine tiles into rectangles
bool m_drawframe
draw a frame around the page
a2dLayerViewList m_layerRenderArray
which layer should be rendered ( visible and/or available )
bool GetVisible()
is the layer visible
static const a2dSignal sig_layersetupChanged
layer info changed id sent around when m_layersetup is changed.
a2dCanvasObject * PopOut()
pop last pushed canvasobject from the stack, now last becomes show object.
set a2dCanvasObjects check flag when in view
void SetReverseOrder(bool revorder)
Set to draw layers in reverse order.
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
a2dStroke m_crosshairStroke
stroke to use for crosshair
filter for selected a2dCanvasObject's
virtual double GetVisibleHeight() const
get Height of visible part in world coordinates
a2dPrintWhat m_typeOfPrint
type of print requested
a2dCanvasObjectPtr m_endCorridorObject
when a corridor is active, this is set.
bool Start(a2dCanvasObject *object)
Start traversing at object, returns true.
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
void SetDrawerFill(const a2dFill &fill)
Used to set the current fill.
void DrawTiles(a2dDrawer2D *drawer)
draw tiles to given view in device coordinates.
int GetMapY() const
Y mapping position in device coordinates.
int WorldToDeviceYRel(double y) const
convert y relative from world to device coordinates
static const a2dSignal sig_changedLayerAvailable
when an object is added to a layer, and therefore makes this layer available.
static const a2dSignal sig_changedLayer
when an object is removed from a layer,
bool m_xyRelToChildren
is set, m_x and m_y are supplied relative to the child objects ( object matrix m_world already applie...
a2dUpdateList * GenerateUpdateRectangles()
generate from files tiles a list of semi optimal covering rectangles
wxUint32 m_option
the way to hit/traverse the document.
bool AddObjectPendingUpdates(a2dCanViewUpdateFlagsMask how=a2dCANVIEW_UPDATE_PENDING)
recursive find pending objects and adds their areas to the updatelist
bool GetIgnorePendingObjects()
get setting of ignore pending objects /sa GetUpdatesPending()
bool m_showorigin
showorigin?
void SetCrossHairStroke(const a2dStroke &stroke)
set stroke for crosshair
#define EVT_BEGINBUSY(func)
event sent from a2DocumentCommandProcessor when a command submit/execute is starting ...
bool Start(a2dObject *object)
object to start the algorithm
virtual void SetDisplayWindow(wxWindow *display)
next to the base its m_display, this also sets m_drawer2d to this display
see a2dCanvasObjectMouseEvent
double DeviceToWorldY(double y) const
convert y from device to world coordinates
const a2dBoundingBox & Translate(a2dPoint2D &)
translate with given vector
double GetMinX() const
get minimum X of the boundingbox
void Init(int x1=0, int y1=0, int x2=0, int y2=0)
Initialize a tile.
virtual void DrawRoundedRectangle(double x, double y, double width, double height, double radius, bool pixelsize=false)
Draw RoundedRectangle in world coordinates.
a2dDrawingPart * m_drawingPart
maping defined by this canvas
void SetDrawStyle(a2dDocumentRenderStyle drawstyle)
set drawstyle used for rendering the document
void AddPendingUpdateArea(a2dCanvasObject *obj, wxUint8 id=0, bool refsalso=true)
add pending update for the area that is the boundingbox of the given object
void SetIgnorePendingObjects(bool onoff)
Switches ignorance of pending objects on and off.
bool m_mouseevents
enable/ disable mouse events handling by canvas
static const a2dSignal sig_changedShowObject
double m_scalelimit
limit scaling to this value (world/pixel)
virtual void ResetStyle()
set a pre-defined style reseting cashed values.
#define forEachIn(listtype, list)
easy iteration for a2dlist
int m_y2
y2 in pixel coordinates
int m_width
device size width
virtual void DrawPoint(double xc, double yc)=0
draw a single point
double m_printscalelimit
Set the scaling limit for printing, so that small stuff is not zoomed to full page.
wxUint16 a2dPrintWhat
defines what to print
a2dHitOption
Enum for hit test options.
a2dCameleonInst to show one appearance of an a2dCameleon.
void AddOverlayObject(a2dCanvasObject *obj)
add to list of overlay objects (must be children of m_top)
void OnComEvent(a2dComEvent &event)
called for a2dComEvent events.
static const a2dCanvasObjectFlagsMask SELECTABLE
void SetHitMarginDevice(int pixels)
used to extend a hittest with the number of pixels.
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
layer settings for a a2dCanvasDocument Holds layers settings classes
int m_width
number of horizontal tiles
void SetAvailable()
check which layers do contain objects as seen from the ShowObject()
virtual double GetVisibleWidth() const
get Width of visible part in world coordinates
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
Drawing context abstraction.
maintains a list of areas on a view to be redrawn.
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
void SetDisableDrawing(bool disableDrawing)
when set, all drawing functions return immediately.
void SetDisableInvert(bool disableInvert)
when true, disable inversion of matrixes
int GetHeight() const
get buffer/device height
void SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which)
set all bit flags in object that or true in mask to true or false
int m_crosshairLengthY
crosshair cursor Length in Y in pixels
void SetMouseEvents(bool onoff)
If not set do not process mouse events.
static const a2dSignal sig_changedLayerInfo
when one layer its a2dLayerInfo has changed ( e.g. visible or order of rendering ) ...
bool HasFilledTiles()
are there filled tiles available?
void SetActiveDrawingPart(a2dDrawingPart *part)
get the drawing part that has the focus/is active in a window.
a2dCameleon * GetCameleon()
get referenced a2dCameleon
void SetPerLayerMode(bool value)
if set the rendering is done layers by layer from the top
void Translate(double x, double y)
relative translate the object to position x,y in world coordinates
virtual void ShiftBuffer(int dxy, bool yshift)
quick scroll over small distance
wxStringInputStream a2dDocumentStringInputStream
string input stream based wxStreams
bool Load(a2dDocumentStringInputStream &stream, a2dDrawing *doc, a2dCanvasObject *parent)
reading a CVG document and add the contents as children to a given a2dCanvasObject parent...
bool m_isHit
in the end if there was a hit (even if not processed event)
Contains graphical drawing context specific classes. a2dDcDrawer and derived classes are used for dra...
void SetShowObjectAndRender(a2dCanvasObject *obj)
Used temporarely in rendering bitmas or in printing, to Set the show object and redraw the whole part...
wxUint16 GetLayer() const
Returns the layer index where this object is drawn upon.
a2dUpdateList m_updateareas
list of rectangles that need to be blited to the screen.
int WorldToDeviceX(double x) const
convert x from world to device coordinates
a2dDrawer2D * GetDrawer2D()
get the internal m_drawer2D that is used for rendering the document
contains the layer properties for one layer,
virtual void DrawLine(double x1, double y1, double x2, double y2)
Draw line in world coordinates.
void DeleteAllPendingAreas()
pending update areas in the update list are deleted.
bool CheckMask(a2dCanvasObjectFlagsMask mask) const
Compares all flags in object to the given mask and return true is the same.
static const a2dCanvasObjectFlagsMask IsOnCorridorPath
bool GetReverseOrder() const
Get Setting for draw layers in reverse order.
find the a2dcanvasObject, and set the corridor flag on the path to it.
void SetLayerCheck(wxUint16 layer)
signals the need to check the given layer for visibility/availibility as seen from this drawing part...
Tappear * GetAppearance(bool autoCreate=false)
Get a specific a2dAppear derived class instance from here.
a2dFill & GetSelect2Fill()
Get Fill to use for Selected2 a2dCanvasObject's.
wxUint16 m_gridthres
threshold for grid.
a2dStroke m_fixStroke
fixed style stroke
void ClearCursorStack()
clear the stack of cursor, and set display cursor ARROW.
Contains a2dDrawing Class to hold a drawing.
a2dFill m_selectFill
select style fill
void ResetFixedStyle()
only way to reset style after SetDrawStyle( a2dFIXED*** );
a2dCanvasObject * IsHitWorldPath(double x, double y, int layer=wxLAYER_ALL, a2dHitOption option=a2dCANOBJHITOPTION_NONE, bool filterSelectableLayers=false)
do a hittest on the view at coordinates x,y
void RedrawPendingUpdateAreas(bool noblit=false)
redraw the pending update areas to the buffer given in device coordinates.
set a2dCanvasObjects flags in a hierarchy of a a2dCanvasDocument
wxUint16 m_border
border zoomout but leaf around a border of this amount of pixels.
corridor as a direct event path to a a2dCanvasObject
void SetDisplay(wxWindow *window)
the display
defines common settinsg for a habitat for a set of a2dCameleons.
a2dCanvasObject * ChildIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent, bool filterSelectableLayers=false)
Do hittest on children.
void Thaw(bool update)
to release Freeze()
double m_gridy
grid distance in y
const a2dPrintWhat a2dPRINT_PreviewDrawingPart
preview print a2dDrawing Part
A 2x3 affine matrix class for 2D transformations.
bool GetResult()
depending upon derived class implementation.
virtual bool HasAlpha()
does a derived drawer have alpha support or not
void OnCharEvent(wxKeyEvent &event)
normally sent from wxWindow containing the view, via its ProcessEvent(wxEvent& event) ...
a2dCanvas is used to display one of the a2dCanvasObjects which are part of a a2dCanvasDocument object...
void Set_UpdateAvailableLayers(bool value)
Sets a flag for updating available layers checking, which makes sure layers will be checked first whe...
void OnPropertyChanged(const a2dPropertyId *id)
This function is called after a property changed.
a2dDocumentRenderStyle m_overlayDrawStyle
drawstyles to use when rendering overlay
a storage for a a tiled area
while iterating a a2dCanvasDocument, this holds the context.
bool m_reverse_order
draw in reverse order if set
int GetWidth() const
get buffer/device width
Contains graphical drawing context specific classes. a2dDrawer2D and derived classes are used for dra...
virtual void PaintGrid(int x, int y, int width, int height)
Function to draw the grid.
static const a2dSignal sig_changedLayers
when more layers changed ( rerendering view is needed).
void UpdateViewDependentObjects(a2dIterC &ic)
update the transform matrix for objects with property 'PROPID_viewDependent'
a2dCanvasObject * GetCaptured() const
are events redirected to a captured corridor? if so return the captured object in it...
struct for how a single object on one layer was hit
vector< a2dTileBox > m_tiles
array of tiles ( normally m_width * m_height )
bool Get_UpdateAvailableLayers() const
update layers available needed?
a2dWalker based algorithms
void MapBbox(const a2dAffineMatrix &matrix)
set layers available in a2dCanvasView as found in document
special a2dCanvasObject to make a multi view hierachy.
a2dStroke & GetSelectStroke()
Get Stroke to use for Selected a2dCanvasObject's.
a2dBoundingBox GetMappedBbox(a2dIterC &ic, bool withExtend=true)
first translate boundingbox with cworld and recalculate at new position
void OnMouseEvent(wxMouseEvent &event)
normally sent from wxWindow containing the view, via its ProcessEvent(wxEvent& event) ...
virtual void SetClippingRegionDev(wxCoord minx, wxCoord miny, wxCoord maxx, wxCoord maxy)=0
set clipping region using x y values in device coordinates
std::vector< a2dLayerInfoPtr > & GetReverseOrderIndex()
return array index on ReverseOrder
a2dSmrtPtr< a2dToolContr > m_toolcontroller
toolscontroller plugged in as first event handler
static const a2dCanvasObjectFlagsMask VISIBLE
void FillTiles(const wxRect &rect, bool expand=true)
fill tiles covering the rect given see FillTiles( int x, int y, int w, int h, bool expand ) ...
void SetGridStroke(const a2dStroke &gridstroke)
set stroke used for grid drawing
void SetPrintMode(bool onOff)
to modify drawing feature when used as context for printing
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
virtual void BeginDraw()=0
start to draw on this context (used to initialize a specific drawer)
double DeviceToWorldX(double x) const
convert x from device to world coordinates
virtual void UpdateCrossHair(int x, int y)
blit old areas to remove last drawn crosshair and draw the cross hair at this new position...
filter for selected a2dCanvasObject's
This is the base class for all kinds of property id's for a2dObject.
double GetWidth() const
returns width of the boundingbox
An object of this class will update a a2dIterC with the required information.
a2dCanvasObject * SetShowObject(const wxString &name)
set object available in the a2dDrawing to be shown on the drawer
wxUint16 m_hitmargin
how close does a hit need to be to the object you are trying to hit.
a2dDocumentRenderStyle GetSelectDrawStyle() const
returns draw style to be used for selected object
void BlitBuffer()
blit whole buffer to device
void SetLayer(wxUint16 layer)
set the layer that is to be rendered
void AddPoint(const a2dPoint2D &point, bool atEnd=true)
add point to end or begin
a2dCanvasObject * IsHitWorld(double x, double y, int layer=wxLAYER_ALL, a2dHitOption option=a2dCANOBJHITOPTION_NONE, bool filterSelectableLayers=false)
do a hittest on the view at coordinates x,y
bool Start(a2dCanvasObject *object, bool setTo)
start removing properties from the object given, and down.
#define EVT_ENDBUSY(func)
event sent from a2DocumentCommandProcessor when a command submit/execute is ending ...
bool m_printtitle
if true, a printout is done with title (document name (description?)), otherwise not ...
const a2dStroke * a2dTRANSPARENT_STROKE
global a2dStroke stock object for TRANSPARENT stroking
A list class for reference counted objects.
Event sent to a2dCommandProcessor.
bool m_gridatfront
grid drawn at front or back
virtual void DrawOrigin()
Function to draw the origin.
virtual bool ProcessCanvasObjectEvent(wxEvent &event, bool &isHit, double x, double y, int margin, int layer=wxLAYER_ALL)
Corridor and captured object event processing.
void RemoveOverlayObject(a2dCanvasObject *obj)
remove from the list of overlay objects (must be children of m_top)
void SetEndCorridorObject(a2dCanvasObject *endCorridorObject)
use in combination with the a2dIterC class to set a corridor path for events.
bool DisconnectEventAll(wxEvtHandler *eventSink)
Remove all dynamic events in classA, going to classB (eventSink)
wxString m_filename
filename put below printout
bool m_printfilename
if true, a printout is done with filename (document file path), otherwise not
bool FindAndSetCorridorPath(a2dCanvasObject *findObject, bool capture)
Find the show-object child object, set the path to the given child object and capture it...
double GetInitialSizeX()
get size for view in userunits, when still empty
bool m_recur
to prevent recursive updates
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
std::vector< a2dLayerInfoPtr > & GetOrderIndex()
return array index on Order
bool Invert(void)
Invert matrix.
a2dDrawingPart(int width=1000, int height=1000)
constructor
void SetCorridorPath(const a2dCorridor &corridor)
find object on the current corridor path.
a2dTileBox tile(int i)
get tile at index i
double GetMinY() const
get minimum Y of the boundingbox
a2dDrawing * GetDrawing() const
get drawing via top object
void UpdateViewDependentObjects()
update the transform matrix for objects with property 'PROPID_viewDependent'
virtual void EndDraw()=0
end drawing on this context (used to reset a specific drawer)
the a2dDrawingPart is a a2dView specially designed for displaying parts of a a2dDrawing. It uses a a2dDrawer2D to actually redraw things from the document, by giving that a2dDrawer2D as drawing context to the document, and telling the document to redraw a certain rectangular area. At that last is what this class is for. It optimizes the areas to be redrawn after object in the document were changed. To do that it combines redraw areas to a minimal set of redrawing areas. All the administration for this and the way things will be redrawn is from this view.
bool AddPendingUpdatesOldNew()
adds current and future boundingbox of the objects with pending flag set, to the pendinglist of all a...
object not fitting the mask are drawn blind.
a2dFill m_highLightFill
highLight style fill
void SetCaptured(a2dCanvasObject *captured)
set the object that is captured for events in the a2dDrawing.
Input handler for the CVG format.
virtual void SetBufferSize(int w, int h)=0
Change the buffer size.
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
virtual void DrawCircle(double x, double y, double radius)
Draw Circle in world coordinates.
a2dStroke m_select2Stroke
select style stroke
#define EVT_UNDO(func)
event sent from a2DocumentCommandProcessor when a command is undone
static a2dPropertyIdBool * PROPID_ToolDecoration
set for objects that act as tool decorations, when a tool is in action.
filter on this layer and mask.
void SetCrossHair(bool onoff)
set enable crosshair cursor
const a2dPrintWhat a2dPRINT_PrintDrawingPart
print a2dDrawing Part
This template class is for property ids with a known data type.
wxUint32 GetDocumentDrawStyle()
get drawstyles used for drawing the document
void Reset()
Reset this object for beeing reused. It will keep the drawer but NULL object infos.
wxRect GetAbsoluteArea(a2dIterC &ic, int inflate=2)
Get absolute occupied area in the device coordinates.
virtual void RenderTopObject(wxUint32 documentDrawStyle, wxUint8 id)
does render the top object in the given style.
bool m_update_available_layers
flag to updatelayers that are available.
void SetShowOrigin(bool show)
Set showorigin on/off.
void SetDrawer2D(a2dDrawer2D *drawer2d, bool noDelete=false)
set the internal m_drawer2D to be used for rendering the document
void Append(a2dCanvasObject *obj)
append a a2dCanvasObject to the childobjects
a2dStroke m_highLightStroke
highLight style stroke
bool m_virtualarea_set
is the virtual area set already (used during startup)
a2dFill & GetSelectFill()
Get Fill to use for Selected a2dCanvasObject's.
a2dTiles(int width, int height)
constructor
a2dDocumentRenderStyle
Define the manner in which a2dCanvasView draws the document to the device.
to print what is displayed on a a2dDrawingPart or the whole document as seen from the showobject of t...
void PopCursor()
pop a cursor from the cursor stack, and set display cursor to back
a2dFill m_fixFill
fixed style fill
wxEvent * m_event
event to process in case of event processing call
const a2dAffineMatrix & GetMappingMatrix()
get the world-to-device (aka mapping) matrix
bool m_printframe
If true, draw a frame around printouts.
void ToolWorldToMouse(double xWorld, double yWorld, int &x, int &y)
a2dCanvasObjectPtr m_capture
object that is receiving events
void MouseToToolWorld(int x, int y, double &xWorldLocal, double &yWorldLocal)
int GetMapX() const
X mapping position in device coordinates.
double DeviceToWorldXRel(double x) const
convert x relative from device to world coordinates
virtual void SetMappingWidthHeight(double vx1, double vy1, double width, double height)
Give the virtual size to be displayed, the mapping matrix will be calculated.
void ClearPushInStack()
mak push in stack empty
double GetInitialSizeY()
get size for view in userunits, when still empty
a2dBoundingBox & GetBbox()
get boundingbox in world coordinates exclusive stroke width relative to its parent ...
structure to give as parameter to member functions of a2dCanvasObject
Contain one drawing as hierarchical tree of a2dCanvasObject's.
void SetMappingShowAll()
use the boundingbox of the ShowObject to set the mapping such that it will be displayed completely on...
virtual void PushIdentityTransform()
push no transform, to draw directly in device coordinates
a2dFill m_overlayFill
overlay style fill
a2dDrawingPrintOut(const wxPageSetupDialogData &pageSetupData, a2dDrawingPart *drawingPart, const wxString &title, const wxString &filename, a2dPrintWhat typeOfPrint, bool drawframe, double scalelimit, bool fitToPage)
initialize mapping based on an existing canvas
static void SetIgnoreAllSetpending(bool value=true)
set static IgnoreAllSetpending flag
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling
general canvas module declarations and classes
virtual bool ProcessEvent(wxEvent &event)
Special event handling for a2dDrawingPart class.
#define a2dREFOBJECTPTR_KEEPALIVE
void GetClippingBox(double &x, double &y, double &w, double &h) const
what is the current clipping region in world coordinates