00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "a2dprec.h"
00012
00013 #ifdef __BORLANDC__
00014 #pragma hdrstop
00015 #endif
00016
00017 #ifndef WX_PRECOMP
00018 #include "wx/wx.h"
00019 #endif
00020
00021 #include "wx/canvas/recur.h"
00022 #include "wx/canvas/objlist.h"
00023 #include "wx/canvas/candoc.h"
00024 #include "wx/canvas/drawer.h"
00025
00026 #include <wx/wfstream.h>
00027 #include <math.h>
00028
00029
00030
00031
00032 IMPLEMENT_DYNAMIC_CLASS(a2dCanvasObjectReference, a2dCanvasObject)
00033 IMPLEMENT_DYNAMIC_CLASS(a2dCanvasObjectArrayReference, a2dCanvasObjectReference)
00034 IMPLEMENT_DYNAMIC_CLASS(a2dLibraryReference, a2dText)
00035 IMPLEMENT_DYNAMIC_CLASS(a2dNameReference, a2dText)
00036 IMPLEMENT_DYNAMIC_CLASS(a2dExternalReference, a2dText)
00037 IMPLEMENT_DYNAMIC_CLASS(a2dCanvasDocumentReference, a2dLibraryReference)
00038
00039
00040
00041
00042
00043
00044 const a2dPropertyIdCanvasObject a2dCanvasObjectReference::PROPID_refobject( wxT("refobject"), a2dPropertyId::flag_transfer|a2dPropertyId::flag_onlymemberhint, 0 );
00045
00046 a2dCanvasObjectReference::a2dCanvasObjectReference()
00047 : a2dCanvasObject()
00048 {
00049 m_object = 0;
00050 m_flags.m_ignoreLayer = true;
00051 }
00052
00053 a2dCanvasObjectReference::a2dCanvasObjectReference(double x, double y, a2dCanvasObject* obj)
00054 : a2dCanvasObject()
00055 {
00056 m_lworld.Translate(x,y);
00057 m_object = obj;
00058 m_flags.m_ignoreLayer = true;
00059 }
00060
00061 a2dCanvasObjectReference::~a2dCanvasObjectReference()
00062 {
00063 }
00064
00065 a2dObject* a2dCanvasObjectReference::Clone( CloneOptions options ) const
00066 {
00067 return new a2dCanvasObjectReference( *this, options );
00068 };
00069
00070 a2dCanvasObjectReference::a2dCanvasObjectReference( const a2dCanvasObjectReference &other, CloneOptions options )
00071 : a2dCanvasObject(other, options)
00072 {
00073 if ( options & clone_members && other.m_object)
00074 m_object = other.m_object->TClone( CloneOptions( options & ~ clone_seteditcopy ) );
00075 else
00076 m_object = other.m_object;
00077 }
00078
00079 void a2dCanvasObjectReference::DoAddPending( a2dIterC& ic )
00080 {
00081 if ( m_object )
00082 m_object->AddPending( ic );
00083 }
00084
00085 bool a2dCanvasObjectReference::LinkReference( a2dObject *other )
00086 {
00087 if(!other)
00088 return false;
00089
00090 #if defined(_DEBUG)
00091 wxString name = other->GetName();
00092 #endif
00093
00094 if ( m_object.Get() )
00095 return false;
00096
00097 m_object = wxStaticCast( other, a2dCanvasObject );
00098 m_object->SetCheck( true );
00099 return true;
00100 }
00101
00102 a2dCanvasObject* a2dCanvasObjectReference::GetCanvasObject()
00103 {
00104 return m_object;
00105 }
00106
00107 void a2dCanvasObjectReference::SetCanvasObject( a2dCanvasObject* object )
00108 {
00109 m_object = object;
00110 }
00111
00112 void a2dCanvasObjectReference::MakeReferencesUnique()
00113 {
00114 if ( m_object && m_object->GetOwnedBy() > 1 )
00115 {
00116 m_object = wxStaticCast( m_object->Clone( a2dObject::clone_flat ), a2dCanvasObject );
00117 }
00118 a2dCanvasObject::MakeReferencesUnique();
00119 }
00120
00121 void a2dCanvasObjectReference::DoWalker( wxObject* parent, a2dWalkerIOHandler& handler )
00122 {
00123 if ( m_object.Get() )
00124 m_object->Walker( this, handler );
00125
00126 a2dCanvasObject::DoWalker( parent, handler );
00127 }
00128
00129 a2dBoundingBox a2dCanvasObjectReference::DoGetUnTransformedBbox( a2dBboxFlags WXUNUSED(flags) ) const
00130 {
00131 a2dBoundingBox bbox;
00132 if ( m_object )
00133 bbox.Expand( m_object->GetBbox() );
00134 else
00135 bbox.Expand( 0,0 );
00136 return bbox;
00137 }
00138
00139 bool a2dCanvasObjectReference::DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox )
00140 {
00141 bool calc = false;
00142 if ( m_object )
00143 {
00144 calc = m_object->Update( mode );
00145 }
00146
00147 if ( !m_bbox.GetValid() || calc )
00148 {
00149 m_bbox = DoGetUnTransformedBbox();
00150 m_bbox.MapBbox(m_lworld);
00151 return true;
00152 }
00153 return false;
00154 }
00155
00156 void a2dCanvasObjectReference::DoRender( a2dIterC& ic, OVERLAP clipparent )
00157 {
00158 if ( !m_object )
00159 {
00160 double x1;
00161 double y1;
00162 ic.GetTransform().TransformPoint( 0, 0, x1, y1 );
00163 int dx = ic.GetDrawer2D()->WorldToDeviceX(x1);
00164 int dy = ic.GetDrawer2D()->WorldToDeviceY(y1);
00165
00166 ic.GetDrawer2D()->PushIdentityTransform();
00167 ic.GetDrawer2D()->DrawLine( dx - 3, dy, dx + 4, dy);
00168 ic.GetDrawer2D()->DrawLine( dx, dy + 3, dx, dy - 4);
00169 ic.GetDrawer2D()->PopTransform();
00170 return;
00171 }
00172
00173 if ( !ic.GetRenderChildDerived() )
00174 return;
00175
00176 OVERLAP childclip = _IN;
00177 if ( clipparent != _IN )
00178 childclip = m_object->GetClipStatus( ic, clipparent );
00179
00180 if ( childclip != _OUT )
00181 {
00182
00183 m_object->Render( ic, childclip );
00184 }
00185 }
00186
00187 void a2dCanvasObjectReference::DoWalkerWithContext( a2dIterC& ic, wxObject *parent, a2dWalkerIOHandlerWithContext& handler )
00188 {
00189 if ( !m_object )
00190 return;
00191
00192 a2dCanvasObject::DoWalkerWithContext( ic, parent, handler );
00193
00194 m_object->WalkerWithContext( ic, this, handler );
00195 }
00196
00197 #if wxART2D_USE_CVGIO
00198 void a2dCanvasObjectReference::DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite )
00199 {
00200 a2dCanvasObject::DoSave( parent, out, xmlparts, towrite );
00201 if ( xmlparts == a2dXmlSer_attrib )
00202 {
00203 if ( m_object )
00204 out.WriteAttribute( wxT("object"), m_object->GetUniqueSerializationId() );
00205 }
00206 else
00207 {
00208
00209 if ( m_object && !m_object->GetCheck() )
00210 {
00211
00212 a2dCanvasObjectPtr multiRef = m_object;
00213
00214 out.WriteStartElement( wxT("derived") );
00215 m_object->Save( this, out, towrite);
00216 out.WriteEndElement();
00217 }
00218 }
00219 }
00220
00221 void a2dCanvasObjectReference::DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
00222 {
00223 a2dCanvasObject::DoLoad( parent, parser, xmlparts );
00224 if ( xmlparts == a2dXmlSer_attrib )
00225 {
00226 if ( parser.HasAttribute( wxT("object") ) )
00227 {
00228 parser.ResolveOrAdd( (a2dSmrtPtr<class a2dObject>*) &m_object, parser.GetAttributeValue( wxT("object") ) );
00229 }
00230 }
00231 else
00232 {
00233 if ( parser.GetTagName() != wxT("derived") )
00234 return;
00235
00236 parser.Require( START_TAG, wxT("derived") );
00237 parser.Next();
00238
00239 DoLoadOneObject( this, parser, xmlparts );
00240
00241 parser.Require( END_TAG, wxT("derived") );
00242 parser.Next();
00243 }
00244 }
00245 #endif //wxART2D_USE_CVGIO
00246
00247 bool a2dCanvasObjectReference::DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent )
00248 {
00249 if ( !m_object )
00250 return false;
00251 return m_object->IsHitWorld( ic, hitEvent ) != 0;
00252 }
00253
00254 void a2dCanvasObjectReference::RemoveHierarchy()
00255 {
00256 if ( m_object && !m_object->GetRelease() )
00257 {
00258 CreateChildObjectList()->push_front( m_object );
00259 }
00260
00261 m_object = NULL;
00262
00263 a2dCanvasObject::RemoveHierarchy();
00264 }
00265
00266
00267
00268
00269
00270 a2dCanvasObjectArrayReference::a2dCanvasObjectArrayReference()
00271 : a2dCanvasObjectReference()
00272 {
00273 }
00274
00275 a2dCanvasObjectArrayReference::a2dCanvasObjectArrayReference( double x, double y, int rows, int columns, double horzSpace, double vertSpace, a2dCanvasObject* obj )
00276 : a2dCanvasObjectReference( x, y, obj )
00277 {
00278 m_horzSpace = horzSpace;
00279 m_vertSpace = vertSpace;
00280 m_rows = rows;
00281 m_columns = columns;
00282 }
00283
00284 a2dCanvasObjectArrayReference::~a2dCanvasObjectArrayReference()
00285 {
00286 }
00287
00288 a2dObject* a2dCanvasObjectArrayReference::Clone( CloneOptions options ) const
00289 {
00290 return new a2dCanvasObjectArrayReference( *this, options );
00291 };
00292
00293 a2dCanvasObjectArrayReference::a2dCanvasObjectArrayReference( const a2dCanvasObjectArrayReference &other, CloneOptions options )
00294 : a2dCanvasObjectReference(other, options)
00295 {
00296 m_horzSpace = other.m_horzSpace;
00297 m_vertSpace = other.m_vertSpace;
00298 m_rows = other.m_rows;
00299 m_columns = other.m_columns;
00300 }
00301
00302 a2dBoundingBox a2dCanvasObjectArrayReference::DoGetUnTransformedBbox( a2dBboxFlags WXUNUSED(flags) ) const
00303 {
00304 a2dBoundingBox tmp;
00305
00306 if ( m_object )
00307 tmp = m_object->GetBbox();
00308 else
00309 tmp.Expand ( 0, 0);
00310
00311 a2dBoundingBox bbox;
00312 bbox.Expand( tmp );
00313
00314 tmp.Translate( (m_columns-1)*m_horzSpace, 0 );
00315 bbox.Expand( tmp );
00316
00317 tmp.Translate( 0, (m_rows-1)*m_vertSpace );
00318 bbox.Expand( tmp );
00319
00320 tmp.Translate( -(m_columns-1)*m_horzSpace, 0 );
00321 bbox.Expand( tmp );
00322 return bbox;
00323 }
00324
00325 bool a2dCanvasObjectArrayReference::DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox )
00326 {
00327 if ( !m_bbox.GetValid())
00328 {
00329 m_bbox = DoGetUnTransformedBbox();
00330 m_bbox.MapBbox(m_lworld);
00331 return true;
00332 }
00333 return false;
00334 }
00335
00336 void a2dCanvasObjectArrayReference::DoRender( a2dIterC& ic, OVERLAP clipparent )
00337 {
00338 if ( !m_object )
00339 return;
00340
00341 a2dAffineMatrix offsetXY;
00342
00343 int i,j;
00344 for ( i = 0 ; i < m_rows; i++)
00345 {
00346 for ( j = 0 ; j < m_columns; j++)
00347 {
00348 a2dIterCU cu( ic, offsetXY );
00349
00350 OVERLAP childclip = _IN;
00351 if ( clipparent != _IN )
00352 childclip = m_object->GetClipStatus( ic, clipparent );
00353
00354 if ( childclip != _OUT )
00355 {
00356
00357 m_object->Render( ic, childclip );
00358 }
00359
00360 offsetXY.Translate( m_horzSpace, 0 );
00361 }
00362
00363 offsetXY.Translate( -m_horzSpace*m_columns, m_vertSpace );
00364 }
00365 }
00366
00367 #if wxART2D_USE_CVGIO
00368 void a2dCanvasObjectArrayReference::DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite )
00369 {
00370 a2dCanvasObjectReference::DoSave( parent, out, xmlparts, towrite );
00371 if ( xmlparts == a2dXmlSer_attrib )
00372 {
00373 out.WriteAttribute( wxT("columns"), m_columns );
00374 out.WriteAttribute( wxT("rows"), m_rows );
00375 out.WriteAttribute( wxT("horzspace"), m_horzSpace );
00376 out.WriteAttribute( wxT("vertspace"), m_vertSpace );
00377 out.WriteNewLine();
00378 }
00379 else
00380 {
00381 }
00382 }
00383
00384 void a2dCanvasObjectArrayReference::DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
00385 {
00386 a2dCanvasObjectReference::DoLoad( parent, parser, xmlparts );
00387 if ( xmlparts == a2dXmlSer_attrib )
00388 {
00389 m_columns = parser.RequireAttributeValueInt( wxT("columns") );
00390 m_rows = parser.RequireAttributeValueInt( wxT("rows") );
00391 m_horzSpace = parser.RequireAttributeValueDouble( wxT("horzspace") );
00392 m_vertSpace = parser.RequireAttributeValueDouble( wxT("vertspace") );
00393 }
00394 else
00395 {
00396 }
00397 }
00398 #endif //wxART2D_USE_CVGIO
00399
00400 bool a2dCanvasObjectArrayReference::DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent )
00401 {
00402 if ( !m_object )
00403 return false;
00404
00405 double pw = ic.GetTransformedHitMargin();
00406 double margin = ic.GetTransformedHitMargin();
00407
00408 a2dBoundingBox tmp = DoGetUnTransformedBbox();
00409
00410 double xmin = tmp.GetMinX();
00411 double ymin = tmp.GetMinY();
00412 double xmax = tmp.GetMaxX();
00413 double ymax = tmp.GetMaxY();
00414
00415 hitEvent.m_how = HitTestRectangle( hitEvent.m_relx, hitEvent.m_rely, xmin, ymin, xmax, ymax, pw+margin );
00416 return hitEvent.m_how.IsHit();
00417 }
00418
00419 void a2dCanvasObjectArrayReference::RemoveHierarchy()
00420 {
00421 if ( m_object && !m_object->GetRelease() )
00422 {
00423 a2dCanvasObjectPtr cobj;
00424
00425 a2dAffineMatrix currentWorld = a2dIDENTITY_MATRIX;
00426 a2dAffineMatrix offsetXY;
00427
00428 int i,j;
00429 for ( i = 0 ; i < GetRows(); i++)
00430 {
00431 for ( j = 0 ; j < GetColumns(); j++)
00432 {
00433 a2dAffineMatrix tworld = offsetXY;
00434 tworld *= m_lworld;
00435
00436 cobj = (a2dCanvasObject*) m_object->Clone( clone_deep );
00437
00438
00439 cobj->SetTransformMatrix( tworld );
00440 cobj->SetRelease( false );
00441
00442 CreateChildObjectList()->push_back( cobj );
00443
00444 offsetXY.Translate( GetHorzSpace(), 0 );
00445 }
00446
00447 offsetXY.Translate( -GetHorzSpace()*GetColumns(), GetVertSpace() );
00448 }
00449 m_object = NULL;
00450 }
00451
00452 a2dCanvasObject::RemoveHierarchy();
00453 }
00454
00455
00456
00457
00458
00459
00460 a2dLibraryReference::a2dLibraryReference()
00461 : a2dImage()
00462 {
00463 m_layer = wxLAYER_SYMBOL;
00464 SetName( wxT("libraryref") );
00465 m_symbol = 0;
00466
00467 m_height = 100;
00468 m_width = 0;
00469
00470 m_text = new a2dText( wxT("libraryref"), -m_height/2 ,-m_height/2 -m_height/5, a2dFont( m_height/5, wxSWISS ) );
00471
00472 m_object = 0;
00473 }
00474
00475
00476 a2dLibraryReference::a2dLibraryReference( double x, double y, a2dCanvasObject* obj, const wxString &name,
00477 double totalheight, a2dCanvasObject* symbol,
00478 const a2dFont& font, int imagew, int imageh )
00479
00480 : a2dImage( wxImage(imagew, imageh), x, y, totalheight, totalheight )
00481 {
00482 m_object = obj;
00483 m_symbol = symbol;
00484
00485 m_layer = wxLAYER_SYMBOL;
00486
00487 RenderObject( symbol ? symbol: obj, imagew, imageh );
00488
00489 SetName( name );
00490
00491 if ( !name.IsEmpty() )
00492 {
00493 a2dFont lfont = font;
00494 lfont.SetSize( totalheight / 5.0 );
00495 m_text = new a2dText( name, -totalheight/2, -totalheight/2 -totalheight/5, lfont );
00496 m_text->SetStroke( *a2dBLACK_STROKE );
00497 m_text->SetFill( *a2dTRANSPARENT_FILL );
00498 m_text->SetLayer( wxLAYER_SYMBOL );
00499 }
00500 else
00501 {
00502 m_text = 0;
00503 }
00504
00505 m_flags.m_visiblechilds = false;
00506
00507 m_height = totalheight;
00508 m_width = totalheight;
00509
00510 SetFill( *a2dTRANSPARENT_FILL );
00511 }
00512
00513 a2dLibraryReference::a2dLibraryReference( const a2dLibraryReference& other, CloneOptions options )
00514 : a2dImage( other, options )
00515 {
00516 m_object = other.m_object;
00517
00518 m_height = other.m_height;
00519 m_width = other.m_width;
00520 m_description = other.m_description;
00521 m_text = (a2dText*)other.m_text->Clone( clone_deep );
00522 m_symbol = other.m_symbol;
00523 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
00524
00525 CurrentSmartPointerOwner = this;
00526 #endif
00527 }
00528
00529 a2dLibraryReference::~a2dLibraryReference()
00530 {
00531 }
00532
00533 void a2dLibraryReference::DoWalker( wxObject *parent, a2dWalkerIOHandler& handler )
00534 {
00535 a2dCanvasObject::DoWalker( parent, handler );
00536 if (m_symbol)
00537 m_symbol->Walker( this, handler );
00538
00539 if ( m_text )
00540 m_text->Walker( this, handler );
00541 }
00542
00543 a2dCanvasObject* a2dLibraryReference::GetCanvasObject()
00544 {
00545 return m_object;
00546 }
00547
00548 void a2dLibraryReference::SetCanvasObject( a2dCanvasObject* object )
00549 {
00550 m_object = object;
00551 }
00552
00553
00554 void a2dLibraryReference::SetSymbol( a2dCanvasObject* symbol )
00555 {
00556 SetPending(true);
00557 m_symbol = symbol;
00558 if (m_symbol && m_root )
00559 m_symbol->SetCanvasDocument( m_root );
00560
00561 RenderObject( m_symbol? m_symbol.Get() : GetCanvasObject() );
00562
00563 }
00564
00565 a2dCanvasObject* a2dLibraryReference::GetSymbol()
00566 {
00567 return m_symbol;
00568 }
00569
00570 a2dObject* a2dLibraryReference::Clone( CloneOptions options ) const
00571 {
00572 return new a2dLibraryReference(*this, options);
00573 }
00574
00575 a2dBoundingBox a2dLibraryReference::DoGetUnTransformedBbox( a2dBboxFlags flags ) const
00576 {
00577 a2dBoundingBox bbox = a2dImage::DoGetUnTransformedBbox( flags );
00578
00579 bbox.Expand( m_text->GetUnTransformedBbox() );
00580 return bbox;
00581 }
00582
00583 bool a2dLibraryReference::DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox )
00584 {
00585 if ( !m_bbox.GetValid())
00586 {
00587 RenderObject( m_symbol? m_symbol: m_object, (int) m_width, (int) m_height );
00588
00589 a2dImage::DoUpdate( mode, childbox, clipbox, propbox );
00590 if ( m_text )
00591 {
00592 a2dBoundingBox tbbox;
00593 m_text->Update( mode );
00594 tbbox.Expand( m_text->GetBbox() );
00595 tbbox.MapBbox(m_lworld);
00596 m_bbox.Expand( tbbox );
00597 }
00598
00599 m_width = m_bbox.GetWidth();
00600
00601 return true;
00602 }
00603 return false;
00604 }
00605
00606 void a2dLibraryReference::DoRender( a2dIterC& ic, OVERLAP clipparent )
00607 {
00608 a2dImage::DoRender( ic, clipparent );
00609 if ( m_text )
00610 m_text->Render( ic, clipparent );
00611 }
00612
00613 #if wxART2D_USE_CVGIO
00614 void a2dLibraryReference::DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite )
00615 {
00616 a2dImage::DoSave( parent, out, xmlparts, towrite );
00617 }
00618
00619 void a2dLibraryReference::DoLoad( wxObject* WXUNUSED(parent), a2dIOHandlerXmlSerIn& WXUNUSED(parser), a2dXmlSer_flag WXUNUSED(xmlparts) )
00620 {
00621 }
00622 #endif //wxART2D_USE_CVGIO
00623
00624 bool a2dLibraryReference::DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent )
00625 {
00626 if ( m_text && m_text->IsHitWorld( ic, hitEvent ) )
00627 return true;
00628
00629 return a2dImage::DoIsHitWorld( ic, hitEvent );
00630 }
00631
00632
00633
00634
00635
00636 a2dExternalReference::a2dExternalReference()
00637 : a2dText( wxT("") , 0, 0 )
00638 {
00639 m_text = wxT("nameref");
00640 m_object = 0;
00641 }
00642
00643 a2dExternalReference::a2dExternalReference( double x, double y, a2dCanvasObject* obj, const wxString &text, double angle, const a2dFont& font )
00644 : a2dText( text, x, y, font, angle )
00645 {
00646 if ( m_text.IsEmpty() && obj )
00647 m_text = obj->GetName();
00648 else
00649 m_text = text;
00650
00651 m_object = obj;
00652 }
00653
00654 a2dExternalReference::a2dExternalReference( const a2dExternalReference& other, CloneOptions options )
00655 : a2dText( other, options )
00656 {
00657 m_object = other.m_object;
00658 }
00659
00660 a2dExternalReference::~a2dExternalReference()
00661 {
00662 }
00663
00664 void a2dExternalReference::DoWalker( wxObject *parent, a2dWalkerIOHandler& handler )
00665 {
00666 a2dCanvasObject::DoWalker( parent, handler );
00667 }
00668
00669 a2dCanvasObject* a2dExternalReference::GetCanvasObject()
00670 {
00671 return m_object;
00672 }
00673
00674 void a2dExternalReference::SetCanvasObject( a2dCanvasObject* object )
00675 {
00676 m_object = object;
00677 }
00678
00679 a2dObject* a2dExternalReference::Clone( CloneOptions options ) const
00680 {
00681 return new a2dExternalReference( *this, options );
00682 };
00683
00684
00685
00686
00687 a2dNameReference::a2dNameReference()
00688 : a2dText( wxT("") , 0, 0 )
00689 {
00690 m_text = wxT("nameref");
00691 }
00692
00693 a2dNameReference::a2dNameReference( double x, double y, a2dCanvasObject* obj, const wxString &text, double angle, const a2dFont& font )
00694 : a2dText( text, x, y, font, angle )
00695 {
00696 if ( m_text.IsEmpty() && obj )
00697 m_text = obj->GetName();
00698 else
00699 m_text = text;
00700
00701 m_objectRef = obj;
00702 }
00703
00704 a2dNameReference::a2dNameReference( const a2dNameReference &other, CloneOptions options )
00705 : a2dText( other, options )
00706 {
00707 }
00708
00709 a2dNameReference::~a2dNameReference()
00710 {
00711 }
00712
00713 a2dCanvasObject* a2dNameReference::GetCanvasObject()
00714 {
00715 return m_objectRef;
00716 }
00717
00718 void a2dNameReference::SetCanvasObject( a2dCanvasObject* object )
00719 {
00720 m_objectRef = object;
00721 }
00722
00723 a2dObject* a2dNameReference::Clone( CloneOptions options ) const
00724 {
00725 return new a2dNameReference( *this, options );
00726 }
00727
00728
00729
00730
00731
00732
00733 a2dCanvasDocumentReference::a2dCanvasDocumentReference( double x, double y, a2dCanvasDocument* doc, double totalheight,
00734 const a2dFont& font, int imagew, int imageh, a2dCanvasObject* symbol )
00735 :a2dLibraryReference( x, y, doc->GetRootObject() ,
00736 doc->GetFilename().GetFullName() != wxT( "" )? doc->GetFilename().GetFullName(): doc->GetPrintableName(),
00737 totalheight, symbol, font, imagew, imageh )
00738 {
00739
00740 SetObjectTip( doc->GetFilename().GetFullPath(), m_height/2 , 0, m_height/5 );
00741
00742 m_doc = doc;
00743 }
00744
00745 a2dCanvasDocumentReference::~a2dCanvasDocumentReference()
00746 {
00747 }
00748
00749 void a2dCanvasDocumentReference::DependencyPending(a2dWalkerIOHandler* WXUNUSED(handler))
00750 {
00751 if ( !m_flags.m_pending && m_doc->GetRootObject()->GetPending() )
00752 SetPending(true);
00753 }