11 #include "wxartbaseprec.h"
18 #include <wx/tokenzr.h>
27 #endif //wxART2D_USE_CVGIO
30 #if defined(__WXMSW__) && defined(__MEMDEBUG__)
31 #include <wx/msw/msvcrt.h>
55 a2dVersNo::a2dVersNo(
const wxString& versionString)
57 long major=0, minor=0, micro=0;
58 wxStringTokenizer tokenizer( versionString,
".");
59 if ( tokenizer.HasMoreTokens() )
60 tokenizer.GetNextToken().ToLong( &major );
61 if ( tokenizer.HasMoreTokens() )
62 tokenizer.GetNextToken().ToLong( &minor );
63 if ( tokenizer.HasMoreTokens() )
64 tokenizer.GetNextToken().ToLong( µ );
70 bool a2dVersNo::operator==(
const a2dVersNo& rhs )
const
72 return (m_major == rhs.m_major) && (m_minor == rhs.m_minor) && (m_micro == rhs.m_micro);
75 bool a2dVersNo::operator>(
const a2dVersNo& rhs )
const
77 return (m_major > rhs.m_major) ||
78 ((m_major == rhs.m_major) && (m_minor > rhs.m_minor)) ||
79 ((m_major == rhs.m_major) && (m_minor == rhs.m_minor) && (m_micro > rhs.m_micro));
82 bool a2dVersNo::operator>=(
const a2dVersNo& rhs )
const
84 return (m_major > rhs.m_major) ||
85 ((m_major == rhs.m_major) && (m_minor > rhs.m_minor)) ||
86 ((m_major == rhs.m_major) && (m_minor == rhs.m_minor) && (m_micro >= rhs.m_micro));
90 static int wxGenIdCount = 0;
94 return ++ wxGenIdCount;
115 const a2dError a2dError_LoadFile( wxT(
"a2dError_LoadFile" ), wxTRANSLATE(
"Sorry, could not load file into document" ) );
118 const a2dError a2dError_IOHandler( wxT(
"a2dError_IOHandler" ), wxTRANSLATE(
"suitable template I/O handler for loading not available in document templates" ) );
128 const a2dError a2dError_NoDocument( wxT(
"a2dError_NoDocument" ), wxTRANSLATE(
"No document set for a2dCanvasView in a2dCentralCanvasCommandProcessor::SetShowObject()" ) );
143 a2dErrorHash& a2dError::GetHashMap()
146 static a2dErrorHash ms_Name2Id;
151 #if (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
154 #pragma warning(disable: 4660)
159 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
171 #pragma warning(default: 4660)
174 #endif // (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
176 IMPLEMENT_ABSTRACT_CLASS(
a2dObject, wxObject )
178 IMPLEMENT_DYNAMIC_CLASS( a2dProperty, a2dNamedProperty )
179 IMPLEMENT_DYNAMIC_CLASS( a2dAutoZeroProperty, a2dNamedProperty )
200 WX_DEFINE_LIST( a2dResolveIdList );
213 case mode_a2dObjectSmrtPtr:
219 case mode_a2dObjectAutoZeroPtr:
226 return m_storedHere.m_link->LinkReference( ptr );
229 m_storedHere.m_inform->ResolveInform();
242 #ifdef WXVALIDEVENTENTRY
244 bool a2dObject::SearchDynamicEventTable( wxEvent& event )
246 wxCHECK_MSG( m_dynamicEvents,
false,
247 wxT(
"caller should check that we have dynamic events" ) );
249 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
252 wxDynamicEventTableEntry* entry = ( wxDynamicEventTableEntry* )node->GetData();
253 wxList::compatibility_iterator nodeerase = node;
254 node = node->GetNext();
255 if ( entry->m_disconnect )
258 #if wxCHECK_VERSION(2,9,0)
259 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
260 if ( eventSink && eventSink !=
this )
262 wxEventConnectionRef* evtConnRef = FindRefInTrackerList( eventSink );
264 evtConnRef->DecRef();
267 if ( entry->m_callbackUserData )
268 delete entry->m_callbackUserData;
269 m_dynamicEvents->Erase( nodeerase );
273 entry->m_inIteration =
true;
277 node = m_dynamicEvents->GetFirst();
280 wxDynamicEventTableEntry* entry = ( wxDynamicEventTableEntry* )node->GetData();
281 wxList::compatibility_iterator nodeerase = node;
282 node = node->GetNext();
283 #if wxCHECK_VERSION(2,9,0)
284 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
286 wxEvtHandler* eventSink = entry->m_eventSink;
288 if ( eventSink && eventSink !=
this )
296 node = m_dynamicEvents->GetFirst();
299 #if WXWIN_COMPATIBILITY_EVENT_TYPES
300 wxEventTableEntry* entry = ( wxEventTableEntry* )node->GetData();
301 #else // !WXWIN_COMPATIBILITY_EVENT_TYPES
302 wxDynamicEventTableEntry* entry = ( wxDynamicEventTableEntry* )node->GetData();
303 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
307 wxList::compatibility_iterator nodeerase = node;
308 node = node->GetNext();
310 if ( !entry->m_disconnect )
312 #if !wxCHECK_VERSION(2,9,0)
313 if ( ( event.GetEventType() == entry->m_eventType ) && ( entry->m_fn != 0 ) )
315 wxEvtHandler* handler =
316 #if !WXWIN_COMPATIBILITY_EVENT_TYPES
317 entry->m_eventSink ? entry->m_eventSink
322 if ( ProcessEventIfMatches( *entry, handler, event ) )
328 if ( event.GetEventType() == entry->m_eventType )
330 wxEvtHandler* handler = entry->m_fn->GetEvtHandler();
333 if ( ProcessEventIfMatchesId( *entry, handler, event ) )
341 node = m_dynamicEvents->GetFirst();
344 wxDynamicEventTableEntry* entry = ( wxDynamicEventTableEntry* )node->GetData();
345 wxList::compatibility_iterator nodeerase = node;
346 node = node->GetNext();
348 #if wxCHECK_VERSION(2,9,0)
349 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
351 wxEvtHandler* eventSink = entry->m_eventSink;
353 if ( eventSink && eventSink !=
this )
357 yes->SmrtPtrRelease();
364 node = m_dynamicEvents->GetFirst();
367 wxDynamicEventTableEntry* entry = ( wxDynamicEventTableEntry* )node->GetData();
368 wxList::compatibility_iterator nodeerase = node;
369 node = node->GetNext();
370 if ( entry->m_disconnect )
372 #if wxCHECK_VERSION(2,9,0)
374 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
375 if ( eventSink && eventSink !=
this )
377 wxEventConnectionRef* evtConnRef = FindRefInTrackerList( eventSink );
379 evtConnRef->DecRef();
382 if ( entry->m_callbackUserData )
383 delete entry->m_callbackUserData;
384 m_dynamicEvents->Erase( nodeerase );
388 entry->m_inIteration =
false;
394 #else //WXVALIDEVENTENTRY
396 #if !wxCHECK_VERSION(2,9,0)
398 bool a2dObject::ProcessEvent( wxEvent& event )
403 int rc = wxTheApp->FilterEvent( event );
406 wxASSERT_MSG( rc == 1 || rc == 0,
407 _T(
"unexpected wxApp::FilterEvent return value" ) );
415 if ( GetEvtHandlerEnabled() )
419 if ( TryValidator( event ) )
423 if ( m_dynamicEvents && SearchDynamicEventTable( event ) )
427 if ( GetEventHashTable().HandleEvent( event,
this ) )
432 if ( GetNextHandler() )
434 if ( GetNextHandler()->ProcessEvent( event ) )
440 return TryParent( event );
444 bool a2dObject::ProcessEventLocally( wxEvent& event )
450 return TryBeforeAndHere( event ) || DoTryChain( event );
453 bool a2dObject::DoTryChain( wxEvent& event )
455 for ( wxEvtHandler* h = GetNextHandler(); h; h = h->GetNextHandler() )
457 wxEventProcessInHandlerOnly processInHandlerOnly( event, h );
458 if ( h->ProcessEvent( event ) )
465 if ( !event.ShouldProcessOnlyIn( h ) )
477 bool a2dObject::TryHereOnly( wxEvent& event )
480 if ( !GetEvtHandlerEnabled() )
484 if ( m_dynamicEvents && SearchDynamicEventTable( event ) )
488 if ( GetEventHashTable().HandleEvent( event,
this ) )
495 bool a2dObject::ProcessEvent( wxEvent& event )
503 if ( !event.WasProcessed() )
507 int rc = wxTheApp->FilterEvent( event );
510 wxASSERT_MSG( rc == 1 || rc == 0,
511 "unexpected wxApp::FilterEvent return value" );
521 if ( event.ShouldProcessOnlyIn(
this ) )
522 return TryBeforeAndHere( event );
526 if ( ProcessEventLocally( event ) )
534 return !
event.GetSkipped();
539 if ( TryAfter( event ) )
548 bool a2dObject::SearchDynamicEventTable( wxEvent& event )
550 wxCHECK_MSG( m_dynamicEvents,
false,
551 wxT(
"caller should check that we have dynamic events" ) );
553 bool returnval =
false;
554 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
585 node = m_dynamicEvents->GetFirst();
589 wxList::compatibility_iterator nodeerase = node;
590 node = node->GetNext();
591 #if wxCHECK_VERSION(2,9,0)
592 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
594 wxEvtHandler* eventSink = entry->m_eventSink;
596 if ( eventSink && eventSink !=
this )
605 node = m_dynamicEvents->GetFirst();
608 #if WXWIN_COMPATIBILITY_EVENT_TYPES
609 wxEventTableEntry* entry = ( wxEventTableEntry* )node->GetData();
610 #else // !WXWIN_COMPATIBILITY_EVENT_TYPES
612 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
616 wxList::compatibility_iterator nodeerase = node;
617 node = node->GetNext();
619 if ( !entry->m_disconnect )
621 #if !wxCHECK_VERSION(2,9,0)
622 if ( ( event.GetEventType() == entry->m_eventType ) && ( entry->m_fn != 0 ) )
624 wxEvtHandler* handler =
625 #if !WXWIN_COMPATIBILITY_EVENT_TYPES
626 entry->m_eventSink ? entry->m_eventSink
631 if ( ProcessEventIfMatches( *entry, handler, event ) )
638 if ( event.GetEventType() == entry->m_eventType )
640 wxEvtHandler* handler = entry->m_fn->GetEvtHandler();
643 if ( ProcessEventIfMatchesId( *entry, handler, event ) )
655 node = m_dynamicEvents->GetFirst();
659 wxList::compatibility_iterator nodeerase = node;
660 node = node->GetNext();
662 #if wxCHECK_VERSION(2,9,0)
663 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
665 wxEvtHandler* eventSink = entry->m_eventSink;
667 if ( eventSink && eventSink !=
this )
671 yes->SmrtPtrRelease();
678 if ( !m_iteratorCount && m_pendingDisconnects )
680 node = m_dynamicEvents->GetFirst();
684 wxList::compatibility_iterator nodeerase = node;
685 node = node->GetNext();
686 if ( entry->m_disconnect )
688 #if wxCHECK_VERSION(2,9,0)
690 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
691 if ( eventSink && eventSink !=
this )
693 wxEventConnectionRef* evtConnRef = FindRefInTrackerList( eventSink );
695 evtConnRef->DecRef();
698 if ( entry->m_callbackUserData )
699 delete entry->m_callbackUserData;
700 m_dynamicEvents->Erase( nodeerase );
704 m_pendingDisconnects =
false;
710 #if !wxCHECK_VERSION(2,9,0)
712 void a2dObject::Connect(
int id,
int lastId,
714 wxObjectEventFunction func,
716 wxEvtHandler* eventSink )
718 #if WXWIN_COMPATIBILITY_EVENT_TYPES
719 wxEventTableEntry* entry =
new wxEventTableEntry;
720 entry->m_eventType = eventType;
722 entry->m_lastId = lastId;
724 entry->m_callbackUserData = userData;
725 #else // !WXWIN_COMPATIBILITY_EVENT_TYPES
728 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
730 if ( !m_dynamicEvents )
731 m_dynamicEvents =
new wxList;
734 m_dynamicEvents->Insert( ( wxObject* ) entry );
737 bool a2dObject::Disconnect(
int id,
int lastId, wxEventType eventType,
738 wxObjectEventFunction func,
740 wxEvtHandler* eventSink )
742 if ( !m_dynamicEvents )
745 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
748 #if WXWIN_COMPATIBILITY_EVENT_TYPES
749 wxEventTableEntry* entry = ( wxEventTableEntry* )node->GetData();
750 #else // !WXWIN_COMPATIBILITY_EVENT_TYPES
752 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
754 wxList::compatibility_iterator nodeerase = node;
755 node = node->GetNext();
756 if ( ( entry->m_id ==
id ) &&
757 ( ( entry->m_lastId == lastId ) || ( lastId == wxID_ANY ) ) &&
758 ( ( entry->m_eventType == eventType ) || ( eventType == wxEVT_NULL ) ) &&
759 ( ( entry->m_fn == func ) || ( func == ( wxObjectEventFunction )NULL ) ) &&
760 ( ( entry->m_eventSink == eventSink ) || ( eventSink == ( wxEvtHandler* )NULL ) ) &&
761 ( ( entry->m_callbackUserData == userData ) || ( userData == ( wxObject* )NULL ) ) )
763 entry->m_disconnect =
true;
765 if ( !m_iteratorCount )
767 #if wxCHECK_VERSION(2,9,0)
769 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
770 if ( eventSink && eventSink !=
this )
772 wxEventConnectionRef* evtConnRef = FindRefInTrackerList( eventSink );
774 evtConnRef->DecRef();
777 if ( entry->m_callbackUserData )
778 delete entry->m_callbackUserData;
779 m_dynamicEvents->Erase( nodeerase );
783 m_pendingDisconnects =
true;
793 void a2dObject::DoBind(
int id,
795 wxEventType eventType,
796 wxEventFunctor* func,
802 if ( !m_dynamicEvents )
803 m_dynamicEvents =
new wxList;
806 m_dynamicEvents->Insert( ( wxObject* ) entry );
809 wxEvtHandler* eventSink = func->GetEvtHandler();
810 if ( eventSink && eventSink !=
this )
812 wxEventConnectionRef* evtConnRef = FindRefInTrackerList( eventSink );
814 evtConnRef->IncRef( );
816 new wxEventConnectionRef(
this, eventSink );
821 a2dObject::DoUnbind(
int id,
823 wxEventType eventType,
824 const wxEventFunctor& func,
827 if ( !m_dynamicEvents )
830 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
835 if ( ( entry->m_id ==
id ) &&
836 ( ( entry->m_lastId == lastId ) || ( lastId == wxID_ANY ) ) &&
837 ( ( entry->m_eventType == eventType ) || ( eventType == wxEVT_NULL ) ) &&
838 entry->m_fn->IsMatching( func ) &&
839 ( ( entry->m_callbackUserData == userData ) || !userData ) )
841 entry->m_disconnect =
true;
842 m_pendingDisconnects =
true;
845 node = node->GetNext();
852 #endif //WXVALIDEVENTENTRY
858 wxLogDebug( wxT(
"connect event: id: %d, type: %d on classname = %s" ),
event.GetId(),
event.GetEventType(), GetClassInfo()->GetClassName() );
859 if ( ProcessEvent( event ) )
868 wxLogDebug( wxT(
" event processed: id: %d, type: %d on classname = %s" ),
event.GetId(),
event.GetEventType(), GetClassInfo()->GetClassName() );
872 wxLogDebug( wxT(
" event not processed: id: %d, type: %d on classname = %s" ),
event.GetId(),
event.GetEventType(), GetClassInfo()->GetClassName() );
880 if ( m_dynamicEvents )
882 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
885 wxDynamicEventTableEntry* entry = ( wxDynamicEventTableEntry* )node->GetData();
886 if ( ( ( entry->m_eventType == type ) || ( type == wxEVT_NULL ) ) &&
887 #
if !wxCHECK_VERSION(2,9,0)
888 ( ( entry->m_eventSink == eventSink ) || ( eventSink == ( wxEvtHandler* )NULL ) ) )
890 ( eventSink == entry->m_fn->GetEvtHandler() || ( eventSink == ( wxEvtHandler* )NULL ) ) )
893 node = node->GetNext();
901 #if !wxCHECK_VERSION(2,9,0)
904 if ( !m_dynamicEvents )
908 int lastId = wxID_ANY;
910 wxObject* userData = 0;
912 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
915 #ifdef WXVALIDEVENTENTRY
917 #if WXWIN_COMPATIBILITY_EVENT_TYPES
918 wxEventTableEntry* entry = ( wxEventTableEntry* )node->GetData();
919 #else // !WXWIN_COMPATIBILITY_EVENT_TYPES
920 wxDynamicEventTableEntry* entry = ( wxDynamicEventTableEntry* )node->GetData();
921 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
923 #else //WXVALIDEVENTENTRY
925 #if WXWIN_COMPATIBILITY_EVENT_TYPES
926 wxEventTableEntry* entry = ( wxEventTableEntry* )node->GetData();
927 #else // !WXWIN_COMPATIBILITY_EVENT_TYPES
929 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
931 #endif //WXVALIDEVENTENTRY
933 wxList::compatibility_iterator nodeerase = node;
934 node = node->GetNext();
935 if ( ( entry->m_id ==
id ) &&
936 ( ( entry->m_lastId == lastId ) || ( lastId == wxID_ANY ) ) &&
937 ( ( entry->m_eventType == eventType ) || ( eventType == wxEVT_NULL ) ) &&
938 ( ( entry->m_fn == func ) || ( func == ( wxObjectEventFunction )NULL ) ) &&
939 ( ( entry->m_eventSink == eventSink ) || ( eventSink == ( wxEvtHandler* )NULL ) ) &&
940 ( ( entry->m_callbackUserData == userData ) || ( userData == ( wxObject* )NULL ) ) )
942 entry->m_disconnect =
true;
944 if ( !m_iteratorCount )
946 #if wxCHECK_VERSION(2,9,0)
948 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
949 if ( eventSink && eventSink !=
this )
951 wxEventConnectionRef* evtConnRef = FindRefInTrackerList( eventSink );
953 evtConnRef->DecRef();
956 if ( entry->m_callbackUserData )
957 delete entry->m_callbackUserData;
958 m_dynamicEvents->Erase( nodeerase );
962 m_pendingDisconnects =
true;
971 bool a2dObject::DisconnectEvent( wxEventType eventType, wxEvtHandler* eventSink )
973 if ( !m_dynamicEvents )
977 int lastId = wxID_ANY;
979 wxObject* userData = 0;
981 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst(), node_nxt;
985 node_nxt = node->GetNext();
987 if ( ( entry->m_id ==
id ) &&
988 ( ( entry->m_lastId == lastId ) || ( lastId == wxID_ANY ) ) &&
989 ( ( entry->m_eventType == eventType ) || ( eventType == wxEVT_NULL ) ) &&
990 entry->m_fn->IsMatching( func ) &&
991 ( ( entry->m_callbackUserData == userData ) || !userData ) )
993 entry->m_disconnect =
true;
994 if ( !m_iteratorCount )
996 #if wxCHECK_VERSION(2,9,0)
998 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
999 if ( eventSink && eventSink !=
this )
1001 wxEventConnectionRef* evtConnRef = FindRefInTrackerList( eventSink );
1003 evtConnRef->DecRef();
1006 if ( entry->m_callbackUserData )
1007 delete entry->m_callbackUserData;
1008 m_dynamicEvents->Erase( node );
1012 m_pendingDisconnects =
true;
1023 if ( !m_dynamicEvents )
1026 #ifdef WXVALIDEVENTENTRY
1029 #if !wxCHECK_VERSION(2,9,0)
1030 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
1033 #if WXWIN_COMPATIBILITY_EVENT_TYPES
1034 wxEventTableEntry* entry = ( wxEventTableEntry* )node->GetData();
1035 #else // !WXWIN_COMPATIBILITY_EVENT_TYPES
1036 wxDynamicEventTableEntry* entry = ( wxDynamicEventTableEntry* )node->GetData();
1037 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
1039 if ( ( entry->m_eventSink == eventSink ) || ( eventSink == ( wxEvtHandler* )NULL ) )
1041 entry->m_disconnect =
true;
1044 node = node->GetNext();
1047 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst(), node_nxt;
1050 wxDynamicEventTableEntry* entry = ( wxDynamicEventTableEntry* )node->GetData();
1051 node_nxt = node->GetNext();
1053 if ( entry->m_fn->GetEvtHandler() == eventSink )
1055 entry->m_disconnect =
true;
1062 #else //WXVALIDEVENTENTRY
1065 #if !wxCHECK_VERSION(2,9,0)
1066 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
1069 #if WXWIN_COMPATIBILITY_EVENT_TYPES
1070 wxEventTableEntry* entry = ( wxEventTableEntry* )node->GetData();
1071 #else // !WXWIN_COMPATIBILITY_EVENT_TYPES
1073 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
1075 wxList::compatibility_iterator nodeerase = node;
1076 node = node->GetNext();
1077 if ( ( entry->m_eventSink == eventSink ) || ( eventSink == ( wxEvtHandler* )NULL ) )
1079 entry->m_disconnect =
true;
1080 if ( !m_iteratorCount )
1082 #if wxCHECK_VERSION(2,9,0)
1084 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
1085 if ( eventSink && eventSink !=
this )
1087 wxEventConnectionRef* evtConnRef = FindRefInTrackerList( eventSink );
1089 evtConnRef->DecRef();
1092 if ( entry->m_callbackUserData )
1093 delete entry->m_callbackUserData;
1094 m_dynamicEvents->Erase( nodeerase );
1098 m_pendingDisconnects =
true;
1104 wxList::compatibility_iterator node = m_dynamicEvents->GetFirst(), node_nxt;
1108 wxList::compatibility_iterator nodeerase = node;
1109 node_nxt = node->GetNext();
1111 if ( entry->m_fn->GetEvtHandler() == eventSink )
1113 entry->m_disconnect =
true;
1114 if ( !m_iteratorCount )
1116 #if wxCHECK_VERSION(2,9,0)
1118 wxEvtHandler* eventSink = entry->m_fn->GetEvtHandler();
1119 if ( eventSink && eventSink !=
this )
1121 wxEventConnectionRef* evtConnRef = FindRefInTrackerList( eventSink );
1123 evtConnRef->DecRef();
1126 if ( entry->m_callbackUserData )
1127 delete entry->m_callbackUserData;
1128 m_dynamicEvents->Erase( node );
1132 m_pendingDisconnects =
true;
1139 #endif //WXVALIDEVENTENTRY
1150 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1151 A2DGENERALDLLEXP_DATA ( wxObject* ) CurrentSmartPointerOwner = 0;
1162 AddPropertyId( PROPID_Check );
1191 m_iteratorCount = 0;
1192 m_pendingDisconnects =
false;
1193 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1195 CurrentSmartPointerOwner =
this;
1204 wxASSERT(
id != 0 );
1205 wxString resolveKey;
1208 a2dHashMapIntToObject::iterator obj = refs->
GetObjectHashMap().find( resolveKey );
1212 a2dObject* clone = DoClone( options, refs );
1220 return DoClone( options, refs );
1231 m_iteratorCount = 0;
1233 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1235 CurrentSmartPointerOwner =
this;
1238 a2dNamedPropertyList::const_iterator iter;
1241 const a2dNamedProperty* prop = *iter;
1246 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1248 CurrentSmartPointerOwner =
this;
1255 wxASSERT_MSG(
m_refcount == 0 ||
m_refcount == refcount_nondynamic, wxT(
"deleting a2dObject while referenced" ) );
1273 #if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT)
1274 void a2dObject::Dump( wxSTD ostream& str )
1286 bool a2dObject::SmrtPtrRelease()
1289 wxASSERT_MSG(
m_refcount >= 0, wxT(
"a2dObject Own/Release not matched (extra Release calls)" ) );
1300 wxASSERT_MSG(
m_refcount == 0, wxT(
"Setting a referenced a2dObject to non-dynamic" ) );
1319 #if wxART2D_USE_CVGIO
1329 towrite.push_back(
this );
1330 a2dObjectList::iterator iter = towrite.begin();
1331 while ( towrite.size() )
1334 obj->
Save(
this, out, &towrite );
1335 towrite.erase( iter );
1336 iter = towrite.begin();
1350 out.WriteAttribute( wxT(
"classname" ), GetClassInfo()->GetClassName() );
1361 out.WriteAttribute( wxT(
"classname" ), GetClassInfo()->GetClassName() );
1372 out.WriteAttribute( wxT(
"name" ),
GetName() );
1375 DoSave( parent, out, a2dXmlSer_attrib, towrite );
1379 DoSave( parent, out, a2dXmlSer_Content, towrite );
1391 Load(
this, parser );
1408 wxString resolveKey;
1409 resolveKey << refId;
1434 wxASSERT(
id != 0 );
1435 wxString resolveKey;
1440 DoLoad( parent, parser, a2dXmlSer_attrib );
1443 DoLoad( parent, parser, a2dXmlSer_Content );
1448 #endif //wxART2D_USE_CVGIO
1452 return ( ( wxInt64 )
this ) >> 3;
1508 event.SetEventObject(
this );
1511 ProcessEvent( event );
1513 if ( event.
GetEdited() && !allprops.empty() )
1516 a2dNamedPropertyList::iterator iter;
1517 for( iter = allprops.begin(); iter != allprops.end(); ++iter )
1519 a2dNamedProperty* prop = *iter;
1535 a2dNamedProperty*
property = from->
GetProperty(
id );
1549 a2dNamedPropertyList::iterator iter;
1552 a2dNamedProperty* prop = *iter;
1562 a2dNamedPropertyList::const_iterator iter;
1565 const a2dNamedProperty* prop = *iter;
1596 CollectProperties2( &props, propertyId, flags );
1598 if( props.begin() != props.end() )
1599 returnproperty = *props.begin();
1601 returnproperty = NULL;
1602 return returnproperty;
1623 if ( ! HasPropertyId(
id ) )
1628 if ( prop && ! stringvalue.IsEmpty() )
1631 ret = prop.Get() != NULL;
1640 event.SetEventObject(
this );
1641 this->ProcessEvent( event );
1655 #if wxART2D_USE_CVGIO
1659 if ( xmlparts == a2dXmlSer_attrib )
1666 bool onlyTemp =
true;
1667 a2dNamedPropertyList::iterator iter;
1670 a2dNamedProperty* prop = *iter;
1681 a2dNamedPropertyList::iterator iter;
1684 a2dNamedProperty* prop = *iter;
1688 prop->Save(
this, out, towrite );
1701 if ( xmlparts == a2dXmlSer_attrib )
1706 if ( parser.
GetTagName() == wxT(
"properties" ) )
1724 property->Load(
this, parser );
1725 property->SetToObject(
this );
1735 #endif //wxART2D_USE_CVGIO
1741 static int _debug_cnt;
1744 #ifdef CLASS_MEM_MANAGEMENT
1745 a2dMemManager a2dNamedProperty::sm_memManager( wxT(
"a2dNamedProperty memory manager" ) );
1746 #endif //CLASS_MEM_MANAGEMENT
1751 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1758 _debug_id = _debug_cnt++;
1762 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1763 CurrentSmartPointerOwner =
this;
1770 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1776 _debug_id = _debug_cnt++;
1780 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1781 CurrentSmartPointerOwner =
this;
1786 : wxObject( other ), m_refcount( 0 )
1788 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1794 _debug_id = _debug_cnt++;
1798 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1799 CurrentSmartPointerOwner =
this;
1813 error.Printf( wxT(
"Property with name: %s has no internal a2dPropertyId, binding this name to an internal property" ), name.c_str() );
1833 return DoClone( options, refs );
1836 #if wxART2D_USE_CVGIO
1843 out.WriteAttribute( wxT(
"classname" ), GetClassInfo()->GetClassName() );
1844 out.WriteAttribute( wxT(
"name" ),
m_id->
GetName() );
1846 DoSave( parent, out, a2dXmlSer_attrib, towrite );
1850 DoSave( parent, out, a2dXmlSer_Content, towrite );
1877 DoLoad( parent, parser, a2dXmlSer_attrib );
1881 DoLoad( parent, parser, a2dXmlSer_Content );
1886 #endif //wxART2D_USE_CVGIO
1888 #if wxART2D_USE_CVGIO
1889 void a2dNamedProperty::DoSave( wxObject* WXUNUSED( parent ),
a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ),
a2dObjectList* WXUNUSED( towrite ) )
1893 void a2dNamedProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
1895 if ( xmlparts == a2dXmlSer_attrib )
1904 #endif //wxART2D_USE_CVGIO
1912 DoWalker( parent, handler );
1918 void a2dNamedProperty::DoWalker( wxObject* parent,
a2dWalkerIOHandler& WXUNUSED( handler ) )
1924 wxASSERT_MSG( 0, wxT(
"Not derived from a2dStringProperty" ) );
1930 wxASSERT_MSG( 0, wxT(
"Not derived from a2dDoubleProperty" ) );
1936 wxASSERT_MSG( 0, wxT(
"Not derived from a2dFloatProperty" ) );
1942 wxASSERT_MSG( 0, wxT(
"Not derived from a2dBoolProperty" ) );
1948 wxASSERT_MSG( 0, wxT(
"Not derived from a2dInt16Property" ) );
1954 wxASSERT_MSG( 0, wxT(
"Not derived from a2dUint16Property" ) );
1960 wxASSERT_MSG( 0, wxT(
"Not derived from a2dInt32Property" ) );
1966 wxASSERT_MSG( 0, wxT(
"Not derived from a2dUint32Property" ) );
1972 wxASSERT_MSG( 0, wxT(
"Not derived from a2dVoidPtrProperty" ) );
1978 wxASSERT_MSG( 0, wxT(
"Not derived from a2dProperty" ) );
1991 const wxChar* start = buffer + position;
1993 double val = wxStrtod( start, &end );
1994 position = end - buffer;
2012 case wxT(
',' ):
case 0x20:
case 0x09:
case 0x0D:
case 0x0A:
2029 case 0x20:
case 0x09:
case 0x0D:
case 0x0A:
2044 a2dNamedPropertyList::const_iterator iter;
2045 for( iter = other.begin(); iter != other.end(); ++iter )
2047 a2dNamedProperty* obj = *iter;
2048 push_back( obj->
Clone( a2dObject::clone_flat ) );
2061 a2dNamedPropertyList::iterator iter = begin();
2062 while( iter != end() )
2064 a2dNamedProperty* prop = *iter;
2065 if ( prop->
GetId() == id )
2067 iter = erase( iter );
2083 a2dNamedPropertyList::iterator iter = begin();
2084 while( iter != end() )
2086 a2dNamedProperty* prop = *iter;
2089 iter = erase( iter );
2100 a2dNamedPropertyList::iterator iter = begin();
2102 while( iter != end() )
2104 a2dNamedProperty* prop = *iter;
2105 prop->
Walker( parent, handler );
2116 a2dBoolProperty::a2dBoolProperty(): a2dNamedProperty()
2122 : a2dNamedProperty( id )
2127 a2dBoolProperty::~a2dBoolProperty()
2132 : a2dNamedProperty( other )
2134 m_value = other.m_value;
2139 return new a2dBoolProperty( *
this, options );
2144 a2dBoolProperty* propcast =
wxStaticCast( &other, a2dBoolProperty );
2145 m_value = propcast->m_value;
2151 wxString lower = value.Lower().Trim(
true ).Trim(
false );
2153 bool val = ( lower == wxT(
"true" ) ) || ( lower == wxT(
"yes" ) ) || ( lower == wxT(
"y" ) ) || ( lower == wxT(
"1" ) ) || ( lower == _(
"yes" ) );
2155 return new a2dBoolProperty(
id, val );
2165 parent->AddPropertyId( propid );
2170 #if wxART2D_USE_CVGIO
2173 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
2174 if ( xmlparts == a2dXmlSer_attrib )
2176 out.WriteAttribute( wxT(
"value" ), m_value );
2183 void a2dBoolProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
2185 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
2186 if ( xmlparts == a2dXmlSer_attrib )
2194 #endif //wxART2D_USE_CVGIO
2196 void a2dBoolProperty::SetValue(
bool value )
2203 return m_value ==
true ?
GetName() + wxT(
"true" ) :
GetName() + wxT(
"false" );
2208 return m_value ==
true ? wxT(
"true" ) : wxT(
"false" );
2215 a2dStringProperty::a2dStringProperty(): a2dNamedProperty()
2217 m_value = wxT(
"" );
2220 a2dStringProperty::a2dStringProperty(
const a2dPropertyIdString*
id,
const wxString& value )
2221 : a2dNamedProperty( id )
2226 a2dStringProperty::~a2dStringProperty()
2230 a2dStringProperty::a2dStringProperty(
const a2dStringProperty& other,
a2dObject::CloneOptions WXUNUSED( options ) )
2231 : a2dNamedProperty( other )
2233 m_value = other.m_value;
2238 return new a2dStringProperty( *
this, options );
2243 a2dStringProperty* propcast =
wxStaticCast( &other, a2dStringProperty );
2244 m_value = propcast->m_value;
2249 return new a2dStringProperty(
id, value );
2252 #if wxART2D_USE_CVGIO
2255 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
2256 if ( xmlparts == a2dXmlSer_attrib )
2258 out.WriteAttribute( wxT(
"value" ), m_value );
2265 void a2dStringProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
2267 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
2268 if ( xmlparts == a2dXmlSer_attrib )
2276 #endif //wxART2D_USE_CVGIO
2278 void a2dStringProperty::SetValue(
const wxString& value )
2289 parent->AddPropertyId( propid );
2298 a2dObjectProperty::a2dObjectProperty(): a2dNamedProperty()
2302 a2dObjectProperty::a2dObjectProperty(
const a2dPropertyIdObject*
id,
const wxObject& value )
2303 : a2dNamedProperty( id )
2308 a2dObjectProperty::~a2dObjectProperty()
2312 a2dObjectProperty::a2dObjectProperty(
const a2dObjectProperty& other )
2313 : a2dNamedProperty( other )
2315 m_value = other.m_value;
2320 return new a2dObjectProperty( *
this );
2325 a2dObjectProperty* propcast =
wxStaticCast( &other, a2dObjectProperty );
2326 m_value = propcast->m_value;
2329 void a2dObjectProperty::SetValue(
const wxObject& value )
2338 a2dVoidPtrProperty::a2dVoidPtrProperty(): a2dNamedProperty()
2344 : a2dNamedProperty( id )
2349 a2dVoidPtrProperty::~a2dVoidPtrProperty()
2353 a2dVoidPtrProperty::a2dVoidPtrProperty(
const a2dVoidPtrProperty& other )
2354 : a2dNamedProperty( other )
2356 m_value = other.m_value;
2361 return new a2dVoidPtrProperty( *
this );
2366 a2dVoidPtrProperty* propcast =
wxStaticCast( &other, a2dVoidPtrProperty );
2367 m_value = propcast->m_value;
2375 #if wxART2D_USE_CVGIO
2378 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
2379 if ( xmlparts == a2dXmlSer_attrib )
2381 out.WriteAttribute( wxT(
"value" ), wxT(
"VOID" ) );
2388 void a2dVoidPtrProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
2390 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
2391 if ( xmlparts == a2dXmlSer_attrib )
2399 #endif //wxART2D_USE_CVGIO
2401 void a2dVoidPtrProperty::SetValue(
void* value )
2408 return m_value == 0 ?
GetName() + wxT(
"NULL" ) :
GetName() + wxT(
"VOID" );
2413 return m_value == 0 ? wxT(
"NULL" ) : wxT(
"VOID" );
2420 a2dProperty::a2dProperty(): a2dNamedProperty()
2426 : a2dNamedProperty( id )
2431 a2dProperty::~a2dProperty()
2436 : a2dNamedProperty( other )
2440 if ( other.m_value )
2441 m_value = other.m_value->
Clone( options );
2444 m_value = other.m_value;
2446 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
2448 CurrentSmartPointerOwner =
this;
2454 return new a2dProperty( *
this, options );
2459 a2dProperty* propcast =
wxStaticCast( &other, a2dProperty );
2460 m_value = propcast->m_value;
2468 #if wxART2D_USE_CVGIO
2471 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
2472 if ( xmlparts == a2dXmlSer_attrib )
2478 m_value->
Save( parent, out, towrite );
2482 void a2dProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
2484 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
2485 if ( xmlparts == a2dXmlSer_attrib )
2509 m_value->
Load(
this, parser );
2516 #endif //wxART2D_USE_CVGIO
2518 void a2dProperty::SetValue(
a2dObject* value )
2525 return m_value ?
GetName() + wxT(
"NULL" ) :
GetName() + wxT(
"RefObject" );
2530 return m_value ? wxT(
"NULL" ) : wxT(
"RefObject" );
2537 a2dAutoZeroProperty::a2dAutoZeroProperty(): a2dNamedProperty()
2543 : a2dNamedProperty( id )
2548 a2dAutoZeroProperty::~a2dAutoZeroProperty()
2553 : a2dNamedProperty( other )
2557 if ( other.m_value )
2558 m_value = other.m_value->
Clone( options );
2561 m_value = other.m_value;
2563 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
2565 CurrentSmartPointerOwner =
this;
2571 return new a2dAutoZeroProperty( *
this, options );
2576 a2dAutoZeroProperty* propcast =
wxStaticCast( &other, a2dAutoZeroProperty );
2577 m_value = propcast->m_value;
2585 #if wxART2D_USE_CVGIO
2588 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
2589 if ( xmlparts == a2dXmlSer_attrib )
2595 m_value->
Save( parent, out, towrite );
2599 void a2dAutoZeroProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
2601 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
2602 if ( xmlparts == a2dXmlSer_attrib )
2624 m_value->
Load(
this, parser );
2631 #endif //wxART2D_USE_CVGIO
2633 void a2dAutoZeroProperty::SetValue(
a2dObject* value )
2640 return m_value ?
GetName() + wxT(
"NULL" ) :
GetName() + wxT(
"RefObject" );
2645 return m_value ? wxT(
"NULL" ) : wxT(
"RefObject" );
2652 a2dInt16Property::a2dInt16Property(): a2dNamedProperty()
2658 : a2dNamedProperty( id )
2663 a2dInt16Property::~a2dInt16Property()
2667 a2dInt16Property::a2dInt16Property(
const a2dInt16Property& other )
2668 : a2dNamedProperty( other )
2670 m_value = other.m_value;
2675 return new a2dInt16Property( *
this );
2680 a2dInt16Property* propcast =
wxStaticCast( &other, a2dInt16Property );
2681 m_value = propcast->m_value;
2687 value.ToLong( &intval , 10 );
2688 return new a2dInt16Property(
id, intval );
2691 #if wxART2D_USE_CVGIO
2694 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
2695 if ( xmlparts == a2dXmlSer_attrib )
2697 out.WriteAttribute( wxT(
"value" ), m_value );
2704 void a2dInt16Property::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
2706 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
2707 if ( xmlparts == a2dXmlSer_attrib )
2709 m_value = parser. GetAttributeValueInt( wxT(
"value" ), 0 );
2715 #endif //wxART2D_USE_CVGIO
2717 void a2dInt16Property::SetValue( wxInt16 value )
2725 form.Printf( wxT(
"%s = %d" ),
GetName().c_str(), m_value );
2732 form.Printf( wxT(
"%d" ), m_value );
2740 a2dUint16Property::a2dUint16Property(): a2dNamedProperty()
2746 : a2dNamedProperty( id )
2751 a2dUint16Property::~a2dUint16Property()
2755 a2dUint16Property::a2dUint16Property(
const a2dUint16Property& other )
2756 : a2dNamedProperty( other )
2758 m_value = other.m_value;
2763 return new a2dUint16Property( *
this );
2768 a2dUint16Property* propcast =
wxStaticCast( &other, a2dUint16Property );
2769 m_value = propcast->m_value;
2774 unsigned long intval;
2775 value.ToULong( &intval , 10 );
2776 return new a2dUint16Property(
id, intval );
2779 #if wxART2D_USE_CVGIO
2782 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
2783 if ( xmlparts == a2dXmlSer_attrib )
2785 out.WriteAttribute( wxT(
"value" ), m_value );
2792 void a2dUint16Property::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
2794 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
2795 if ( xmlparts == a2dXmlSer_attrib )
2797 m_value = parser. GetAttributeValueInt( wxT(
"value" ), 0 );
2803 #endif //wxART2D_USE_CVGIO
2805 void a2dUint16Property::SetValue( wxUint16 value )
2813 form.Printf( wxT(
"%s = %d" ),
GetName().c_str(), m_value );
2820 form.Printf( wxT(
"%d" ), m_value );
2828 a2dInt32Property::a2dInt32Property(): a2dNamedProperty()
2834 : a2dNamedProperty( id )
2839 a2dInt32Property::~a2dInt32Property()
2843 a2dInt32Property::a2dInt32Property(
const a2dInt32Property& other )
2844 : a2dNamedProperty( other )
2846 m_value = other.m_value;
2851 return new a2dInt32Property( *
this );
2856 a2dInt32Property* propcast =
wxStaticCast( &other, a2dInt32Property );
2857 m_value = propcast->m_value;
2863 value.ToLong( &intval , 10 );
2864 return new a2dInt32Property(
id, intval );
2867 #if wxART2D_USE_CVGIO
2870 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
2871 if ( xmlparts == a2dXmlSer_attrib )
2873 out.WriteAttribute( wxT(
"value" ), m_value );
2880 void a2dInt32Property::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
2882 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
2883 if ( xmlparts == a2dXmlSer_attrib )
2885 m_value = parser. GetAttributeValueInt( wxT(
"value" ), 0 );
2891 #endif //wxART2D_USE_CVGIO
2893 void a2dInt32Property::SetValue( wxInt32 value )
2901 form.Printf( wxT(
"%s = %d" ),
GetName().c_str(), m_value );
2908 form.Printf( wxT(
"%d" ), m_value );
2918 parent->AddPropertyId( propid );
2927 a2dUint32Property::a2dUint32Property(): a2dNamedProperty()
2933 : a2dNamedProperty( id )
2938 a2dUint32Property::~a2dUint32Property()
2942 a2dUint32Property::a2dUint32Property(
const a2dUint32Property& other )
2943 : a2dNamedProperty( other )
2945 m_value = other.m_value;
2950 return new a2dUint32Property( *
this );
2955 a2dUint32Property* propcast =
wxStaticCast( &other, a2dUint32Property );
2956 m_value = propcast->m_value;
2961 unsigned long intval;
2962 value.ToULong( &intval , 10 );
2963 return new a2dUint32Property(
id, intval );
2966 #if wxART2D_USE_CVGIO
2969 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
2970 if ( xmlparts == a2dXmlSer_attrib )
2972 out.WriteAttribute( wxT(
"value" ), m_value );
2979 void a2dUint32Property::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
2981 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
2982 if ( xmlparts == a2dXmlSer_attrib )
2984 m_value = parser. GetAttributeValueInt( wxT(
"value" ), 0 );
2990 #endif //wxART2D_USE_CVGIO
2992 void a2dUint32Property::SetValue( wxUint32 value )
3000 form.Printf( wxT(
"%s = %d" ),
GetName().c_str(), m_value );
3007 form.Printf( wxT(
"%d" ), m_value );
3015 a2dDoubleProperty::a2dDoubleProperty(): a2dNamedProperty()
3021 : a2dNamedProperty( id )
3026 a2dDoubleProperty::~a2dDoubleProperty()
3030 a2dDoubleProperty::a2dDoubleProperty(
const a2dDoubleProperty& other )
3031 : a2dNamedProperty( other )
3033 m_value = other.m_value;
3038 return new a2dDoubleProperty( *
this );
3043 a2dDoubleProperty* propcast =
wxStaticCast( &other, a2dDoubleProperty );
3044 m_value = propcast->m_value;
3050 value.ToDouble( &doubleval );
3051 return new a2dDoubleProperty(
id, doubleval );
3054 #if wxART2D_USE_CVGIO
3057 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3058 if ( xmlparts == a2dXmlSer_attrib )
3060 out.WriteAttribute( wxT(
"value" ), m_value );
3067 void a2dDoubleProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
3069 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3070 if ( xmlparts == a2dXmlSer_attrib )
3072 m_value = parser. GetAttributeValueDouble( wxT(
"value" ), 0 );
3078 #endif //wxART2D_USE_CVGIO
3080 void a2dDoubleProperty::SetValue(
double value )
3088 form.Printf( wxT(
"%s = %6.3f" ),
GetName().c_str(), m_value );
3096 form.Printf( wxT(
"%g" ), m_value );
3104 a2dFloatProperty::a2dFloatProperty(): a2dNamedProperty()
3110 : a2dNamedProperty( id )
3115 a2dFloatProperty::~a2dFloatProperty()
3119 a2dFloatProperty::a2dFloatProperty(
const a2dFloatProperty& other )
3120 : a2dNamedProperty( other )
3122 m_value = other.m_value;
3127 return new a2dFloatProperty( *
this );
3132 a2dFloatProperty* propcast =
wxStaticCast( &other, a2dFloatProperty );
3133 m_value = propcast->m_value;
3139 value.ToDouble( &doubleval );
3140 return new a2dFloatProperty(
id, (
float ) doubleval );
3143 #if wxART2D_USE_CVGIO
3146 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3147 if ( xmlparts == a2dXmlSer_attrib )
3149 out.WriteAttribute( wxT(
"value" ), m_value );
3156 void a2dFloatProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
3158 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3159 if ( xmlparts == a2dXmlSer_attrib )
3161 m_value = parser. GetAttributeValueDouble( wxT(
"value" ), 0 );
3167 #endif //wxART2D_USE_CVGIO
3169 void a2dFloatProperty::SetValue(
float value )
3177 form.Printf( wxT(
"%s = %6.3f" ),
GetName().c_str(), m_value );
3185 form.Printf( wxT(
"%g" ), m_value );
3193 a2dArrayStringProperty::a2dArrayStringProperty(): a2dNamedProperty()
3195 m_value = wxArrayString();
3199 : a2dNamedProperty( id )
3205 : a2dNamedProperty( id )
3207 wxStringTokenizer args( value, wxT(
"," ) );
3208 while ( args.HasMoreTokens() )
3210 m_value.Add( args.GetNextToken() );
3214 a2dArrayStringProperty::~a2dArrayStringProperty()
3218 a2dArrayStringProperty::a2dArrayStringProperty(
const a2dArrayStringProperty& other )
3219 : a2dNamedProperty( other )
3221 m_value = other.m_value;
3226 return new a2dArrayStringProperty( *
this );
3231 a2dArrayStringProperty* propcast =
wxStaticCast( &other, a2dArrayStringProperty );
3232 m_value = propcast->m_value;
3237 wxArrayString valuenew;
3238 wxStringTokenizer args( value );
3239 while ( args.HasMoreTokens() )
3241 valuenew.Add( args.GetNextToken() );
3243 return new a2dArrayStringProperty(
id, valuenew );
3246 #if wxART2D_USE_CVGIO
3249 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3250 if ( xmlparts == a2dXmlSer_attrib )
3254 for ( j = 0; j < m_value.GetCount(); j++ )
3256 attrib += m_value.Item( j );
3259 out.WriteAttribute( wxT(
"value" ), attrib );
3266 void a2dArrayStringProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
3268 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3269 if ( xmlparts == a2dXmlSer_attrib )
3271 wxStringTokenizer args( parser.
GetAttributeValue( wxT(
"value" ) ), wxT(
"," ) );
3272 while ( args.HasMoreTokens() )
3274 m_value.Add( args.GetNextToken() );
3281 #endif //wxART2D_USE_CVGIO
3283 void a2dArrayStringProperty::SetValue(
const wxArrayString& value )
3288 void a2dArrayStringProperty::Add(
const wxString& value )
3290 m_value.Add( value );
3297 for ( j = 0; j < m_value.GetCount(); j++ )
3299 attrib += m_value.Item( j );
3303 form.Printf( wxT(
"%s = %s" ),
GetName().c_str(), attrib.c_str() );
3311 for ( j = 0; j < m_value.GetCount(); j++ )
3313 attrib += m_value.Item( j );
3317 form.Printf( wxT(
"%s" ), attrib.c_str() );
3325 a2dFileNameProperty::a2dFileNameProperty(): a2dNamedProperty()
3327 m_filenameObject = wxT(
"" );
3330 a2dFileNameProperty::a2dFileNameProperty(
const a2dPropertyIdFileName*
id,
const wxFileName& filename )
3331 : a2dNamedProperty( id )
3333 m_filenameObject = filename;
3336 a2dFileNameProperty::~a2dFileNameProperty()
3340 a2dFileNameProperty::a2dFileNameProperty(
const a2dFileNameProperty& other )
3341 : a2dNamedProperty( other )
3343 m_filenameObject = other.m_filenameObject;
3348 return new a2dFileNameProperty( *
this );
3353 a2dFileNameProperty* propcast =
wxStaticCast( &other, a2dFileNameProperty );
3354 m_filenameObject = propcast->m_filenameObject;
3359 wxFileName filenameval( value );
3360 return new a2dFileNameProperty(
id, filenameval );
3363 #if wxART2D_USE_CVGIO
3366 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3367 if ( xmlparts == a2dXmlSer_attrib )
3370 out.WriteAttribute( wxT(
"fullfilename" ), m_filenameObject.GetFullPath() );
3379 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3380 if ( xmlparts == a2dXmlSer_attrib )
3382 m_filenameObject = parser.
GetAttributeValue( wxT(
"fullfilename" ), wxT(
"" ) );
3390 #endif //wxART2D_USE_CVGIO
3392 void a2dFileNameProperty::SetValue(
const wxFileName& filenameObject )
3394 m_filenameObject = filenameObject;
3397 void a2dFileNameProperty::SetFileName(
const wxFileName& filenameObject )
3399 m_filenameObject = filenameObject;
3405 form.Printf( wxT(
"%s = %s" ),
GetName().c_str(), m_filenameObject.GetFullPath().c_str() );
3412 form.Printf( wxT(
"%s" ), m_filenameObject.GetFullPath().c_str() );
3420 a2dDateTimeProperty::a2dDateTimeProperty(): a2dNamedProperty()
3422 m_datetimeObject = wxDefaultDateTime;
3425 a2dDateTimeProperty::a2dDateTimeProperty(
const a2dPropertyIdDateTime*
id,
const wxDateTime& datetime )
3426 : a2dNamedProperty( id )
3428 m_datetimeObject = datetime;
3431 a2dDateTimeProperty::~a2dDateTimeProperty()
3435 a2dDateTimeProperty::a2dDateTimeProperty(
const a2dDateTimeProperty& other )
3436 : a2dNamedProperty( other )
3438 m_datetimeObject = other.m_datetimeObject;
3443 return new a2dDateTimeProperty( *
this );
3448 a2dDateTimeProperty* propcast =
wxStaticCast( &other, a2dDateTimeProperty );
3449 m_datetimeObject = propcast->m_datetimeObject;
3454 wxDateTime datetimeval;
3456 datetimeval.ParseFormat( value, wxDefaultDateTimeFormat );
3457 return new a2dDateTimeProperty(
id, datetimeval );
3460 #if wxART2D_USE_CVGIO
3463 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3464 if ( xmlparts == a2dXmlSer_attrib )
3467 out.WriteAttribute( wxT(
"datetime" ), m_datetimeObject.Format() );
3476 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3477 if ( xmlparts == a2dXmlSer_attrib )
3481 m_datetimeObject.ParseFormat( dateTime, wxDefaultDateTimeFormat );
3489 #endif //wxART2D_USE_CVGIO
3491 void a2dDateTimeProperty::SetValue(
const wxDateTime& datetimeObject )
3493 m_datetimeObject = datetimeObject;
3496 void a2dDateTimeProperty::SetDateTime(
const wxDateTime& datetimeObject )
3498 m_datetimeObject = datetimeObject;
3504 form.Printf( wxT(
"%s = %s" ),
GetName().c_str(), m_datetimeObject.Format().c_str() );
3511 form.Printf( wxT(
"%s" ), m_datetimeObject.Format().c_str() );
3519 a2dMenuProperty::a2dMenuProperty(): a2dNamedProperty()
3525 : a2dNamedProperty( id )
3530 a2dMenuProperty::~a2dMenuProperty()
3534 a2dMenuProperty::a2dMenuProperty(
const a2dMenuProperty& other )
3535 : a2dNamedProperty( other )
3537 m_menu = other.m_menu;
3542 return new a2dMenuProperty( *
this );
3547 a2dMenuProperty* propcast =
wxStaticCast( &other, a2dMenuProperty );
3548 m_menu = propcast->m_menu;
3551 #if wxART2D_USE_CVGIO
3554 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3555 if ( xmlparts == a2dXmlSer_attrib )
3565 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3566 if ( xmlparts == a2dXmlSer_attrib )
3575 #endif //wxART2D_USE_CVGIO
3577 void a2dMenuProperty::SetValue( wxMenu* menu )
3591 a2dWindowProperty::a2dWindowProperty(): a2dNamedProperty()
3597 : a2dNamedProperty( id )
3602 a2dWindowProperty::~a2dWindowProperty()
3608 a2dWindowProperty::a2dWindowProperty(
const a2dWindowProperty& other )
3609 : a2dNamedProperty( other )
3611 m_window = other.m_window;
3616 return new a2dWindowProperty( *
this );
3621 a2dWindowProperty* propcast =
wxStaticCast( &other, a2dWindowProperty );
3622 m_window = propcast->m_window;
3625 #if wxART2D_USE_CVGIO
3628 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3629 if ( xmlparts == a2dXmlSer_attrib )
3639 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3640 if ( xmlparts == a2dXmlSer_attrib )
3649 #endif //wxART2D_USE_CVGIO
3651 void a2dWindowProperty::SetValue( wxWindow* window )
3665 a2dTipWindowProperty::a2dTipWindowProperty(): a2dWindowProperty()
3667 m_rectStay = wxRect( -20, -20, 40 , 40 );
3670 a2dTipWindowProperty::a2dTipWindowProperty(
const a2dPropertyIdWindow*
id, wxTipWindow* window,
const wxString& tipstring,
bool useObjRect )
3671 : a2dWindowProperty( id, window )
3673 m_useObjRect = useObjRect;
3674 m_tipstring = tipstring;
3677 a2dTipWindowProperty::a2dTipWindowProperty(
const a2dPropertyIdWindow*
id, wxTipWindow* window,
const wxString& tipstring,
const wxRect& rect )
3678 : a2dWindowProperty( id, window )
3681 m_useObjRect =
false;
3682 m_tipstring = tipstring;
3685 a2dTipWindowProperty::~a2dTipWindowProperty()
3689 wxTipWindow* tipwindow =
wxDynamicCast( m_window, wxTipWindow );
3691 tipwindow->SetTipWindowPtr( NULL );
3695 a2dTipWindowProperty::a2dTipWindowProperty(
const a2dTipWindowProperty& other )
3696 : a2dWindowProperty( other )
3698 m_tipstring = other.m_tipstring;
3703 return new a2dTipWindowProperty( *
this );
3708 a2dTipWindowProperty* propcast =
wxStaticCast( &other, a2dTipWindowProperty );
3709 m_window = propcast->m_window;
3710 m_tipstring = propcast->m_tipstring;
3713 #if wxART2D_USE_CVGIO
3716 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3717 if ( xmlparts == a2dXmlSer_attrib )
3727 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3728 if ( xmlparts == a2dXmlSer_attrib )
3737 #endif //wxART2D_USE_CVGIO
3739 void a2dTipWindowProperty::SetString(
const wxString& tipstring )
3741 m_tipstring = tipstring;
3753 a2dPathListProperty::a2dPathListProperty(): a2dNamedProperty()
3759 : a2dNamedProperty( id )
3761 m_pathlistObject = pathlist;
3764 a2dPathListProperty::~a2dPathListProperty()
3768 a2dPathListProperty::a2dPathListProperty(
const a2dPathListProperty& other )
3769 : a2dNamedProperty( other )
3771 m_pathlistObject = other.m_pathlistObject;
3776 return new a2dPathListProperty( *
this );
3781 a2dPathListProperty* propcast =
wxStaticCast( &other, a2dPathListProperty );
3782 m_pathlistObject = propcast->m_pathlistObject;
3789 return new a2dPathListProperty(
id, a );
3792 #if wxART2D_USE_CVGIO
3795 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3796 if ( xmlparts == a2dXmlSer_attrib )
3808 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3809 if ( xmlparts == a2dXmlSer_attrib )
3819 #endif //wxART2D_USE_CVGIO
3821 void a2dPathListProperty::SetValue(
const a2dPathList& pathlistObject )
3823 m_pathlistObject = pathlistObject;
3826 void a2dPathListProperty::SetFileName(
const a2dPathList& pathlistObject )
3828 m_pathlistObject = pathlistObject;
3849 A2DGENERALDLLEXP wxColour ParseSvgColour( wxString value )
3852 value.Trim(
false ).Trim();
3853 if ( value.GetChar( 0 ) == _T(
'#' ) )
3857 else if ( value.Mid( 0, 4 ).Lower() == _T(
"rgb(" ) )
3859 long red, green, blue;
3860 value = value.Mid( 4 );
3861 value = value.BeforeLast( _T(
')' ) );
3863 wxStringTokenizer rgb( value, _T(
"," ) );
3864 if ( rgb.CountTokens() != 3 )
3865 wxLogWarning( _(
"Invalid RGB value" ) );
3866 if ( !rgb.GetNextToken().ToLong( &red ) )
3867 wxLogWarning( _(
"Invalid RGB value" ) );
3868 if ( !rgb.GetNextToken().ToLong( &green ) )
3869 wxLogWarning( _(
"Invalid RGB value" ) );
3870 if ( !rgb.GetNextToken().ToLong( &blue ) )
3871 wxLogWarning( _(
"Invalid RGB value" ) );
3873 colour.Set( red, green, blue );
3878 bool ishex = ( value.Length() == 6 );
3879 for (
int i = 0; ishex && i < 6; i++ )
3880 ishex = ( wxIsxdigit( value.GetChar( i ) ) != 0 );
3886 unsigned long red, green, blue;
3887 bool commavalue =
true;
3888 wxStringTokenizer rgbcomma( value, _T(
"," ), wxTOKEN_RET_EMPTY );
3889 if ( rgbcomma.CountTokens() != 3 )
3891 if ( !rgbcomma.GetNextToken().ToULong( &red ) )
3893 if ( !rgbcomma.GetNextToken().ToULong( &green ) )
3895 if ( !rgbcomma.GetNextToken().ToULong( &blue ) )
3901 wxStringTokenizer rgbspace( value, _T(
" " ) );
3902 if ( rgbspace.CountTokens() != 3 )
3904 if ( !rgbspace.GetNextToken().ToULong( &red ) )
3906 if ( !rgbspace.GetNextToken().ToULong( &green ) )
3908 if ( !rgbspace.GetNextToken().ToULong( &blue ) )
3912 colour.Set( red, green, blue );
3916 colour = wxTheColourDatabase->FindName( value );
3923 a2dColourProperty::a2dColourProperty(): a2dNamedProperty()
3925 m_colour = wxT(
"" );
3928 a2dColourProperty::a2dColourProperty(
const a2dPropertyIdColour*
id,
const wxColour& colour )
3929 : a2dNamedProperty( id )
3934 a2dColourProperty::~a2dColourProperty()
3938 a2dColourProperty::a2dColourProperty(
const a2dColourProperty& other )
3939 : a2dNamedProperty( other )
3941 m_colour = other.m_colour;
3946 return new a2dColourProperty( *
this );
3951 a2dColourProperty* propcast =
wxStaticCast( &other, a2dColourProperty );
3952 m_colour = propcast->m_colour;
3957 return new a2dColourProperty(
id, ParseSvgColour( value ) );
3960 #if wxART2D_USE_CVGIO
3963 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
3964 if ( xmlparts == a2dXmlSer_attrib )
3968 form.Printf( wxT(
"%d %d %d" ), m_colour.Red(), m_colour.Green(), m_colour.Blue() );
3969 out.WriteAttribute( wxT(
"colour" ), form );
3978 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
3979 if ( xmlparts == a2dXmlSer_attrib )
3982 m_colour = ParseSvgColour( colstr );
3990 #endif //wxART2D_USE_CVGIO
3992 void a2dColourProperty::SetValue(
const wxColour& colour )
3997 void a2dColourProperty::SetColour(
const wxColour& colour )
4005 form.Printf( wxT(
"%s = {%d %d %d}" ),
GetName().c_str(), m_colour.Red(), m_colour.Green(), m_colour.Blue() );
4013 form.Printf( wxT(
"{%d %d %d}" ), m_colour.Red(), m_colour.Green(), m_colour.Blue() );
4021 a2dUriProperty::a2dUriProperty(): a2dNamedProperty()
4025 a2dUriProperty::a2dUriProperty(
const a2dPropertyIdUri*
id,
const wxURI& uri )
4026 : a2dNamedProperty( id )
4031 a2dUriProperty::~a2dUriProperty()
4035 a2dUriProperty::a2dUriProperty(
const a2dUriProperty& other )
4036 : a2dNamedProperty( other )
4038 m_uri = other.m_uri;
4043 return new a2dUriProperty( *
this );
4048 a2dUriProperty* propcast =
wxStaticCast( &other, a2dUriProperty );
4049 m_uri = propcast->m_uri;
4052 #if wxART2D_USE_CVGIO
4055 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
4056 if ( xmlparts == a2dXmlSer_attrib )
4059 wxString uri = m_uri.BuildURI();
4060 out.WriteAttribute( wxT(
"uri" ), uri );
4069 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
4070 if ( xmlparts == a2dXmlSer_attrib )
4073 m_uri = wxURI( uri );
4081 #endif //wxART2D_USE_CVGIO
4083 void a2dUriProperty::SetValue(
const wxURI& uri )
4090 return new a2dUriProperty(
id, wxURI( value ) );
4096 A2DGENERALDLLEXP_DATA(
a2dObjectList* ) wxNullRefObjectList = 0;
4104 a2dObjectList::~a2dObjectList()
4110 for( a2dObjectList::iterator iter = begin(); iter != end(); ++iter )
4115 *iter = obj->
Clone( a2dObject::clone_flat );
4123 if (
this == wxNullRefObjectList )
4124 return wxNullRefObjectList;
4133 a2dObjectList::iterator iter = begin();
4134 while ( iter != end() )
4137 if ( classname.IsEmpty() || obj->GetClassInfo()->GetClassName() == classname )
4140 iter = erase( iter );
4153 for( a2dObjectList::iterator iter = begin(); iter != end(); ++iter )
4158 ( classname.IsEmpty() || cobj->GetClassInfo()->GetClassName() == classname ) &&
4159 ( name.IsEmpty() || cobj->
GetName() == name )
4172 for( a2dObjectList::iterator iter = begin(); iter != end(); ++iter )
4176 if ( ( classname.IsEmpty() || cobj->GetClassInfo()->GetClassName() == classname ) &&
4177 ( propertyNameFilter.IsEmpty() || ( cobj->
GetName().Matches( propertyNameFilter ) ) )
4180 if ( total && total != wxNullRefObjectList )
4181 total->push_back( cobj );
4203 for( i = begin(); i != end(); ++i )
4205 i->second = i->second->Clone( a2dObject::clone_flat );
4211 a2dVariablesHashBase::operator = ( other );
4214 for( i = begin(); i != end(); ++i )
4216 i->second = i->second->Clone( a2dObject::clone_flat );
4223 for( i = begin(); i != end(); ++i )
4231 iterator iter = find( variableName );
4234 delete iter->second;
4237 ( *this )[ variableName ] = property;
4239 return iter != end();
4244 iterator iter = find( variableName );
4247 delete iter->second;
4252 return iter != end();
4257 iterator iter = find( variableName );
4260 delete iter->second;
4265 return iter != end();
4270 iterator iter = find( variableName );
4273 delete iter->second;
4278 return iter != end();
4283 iterator iter = find( variableName );
4286 delete iter->second;
4291 return iter != end();
4296 iterator iter = find( variableName );
4300 return iter->second;
4305 iterator iter = find( variableName );
4309 return iter->second->Clone( a2dObject::clone_flat );
4314 iterator iter = find( variableName );
4318 return iter->second->GetRefObjectNA();
4323 iterator iter = find( variableName );
4327 a2dStringProperty* prop =
wxDynamicCast( iter->second, a2dStringProperty );
4329 return prop->GetValuePtr();
4344 for(
int i = 0; i < 100; i++ )
4401 wxASSERT( index < m_nelements && index >= 0 );
4407 wxASSERT( index < m_nelements && index >= 0 );
4413 wxASSERT( index < m_nelements && index >= 0 );
4419 wxASSERT( index < m_nelements && index >= 0 );
4425 wxASSERT( index < m_nelements && index >= 0 );
4438 a2dNamedProperty** newdata =
new a2dNamedProperty*[
m_melements];
4456 #define PATHLENGTH 255 * 4
4459 static wxChar wxFileFunctionsBuffer[PATHLENGTH];
4461 a2dPathList::a2dPathList()
4465 a2dPathList::~a2dPathList()
4474 #if wxCHECK_VERSION(2,7,0)
4475 for ( wxPathList::iterator node = begin(); node != end(); node++ )
4477 for ( wxStringList::compatibility_iterator node = GetFirst(); node; node = node->GetNext() )
4480 wxString path = node->GetData();
4481 ret += wxPATH_SEP + path;
4488 wxFileName ffile( filename );
4489 wxString filefull = ffile.GetFullPath();
4491 if ( ExpandPath( filefull ) && wxFileExists( filefull ) )
4492 return wxString( m_b );
4494 wxFileName fileobj = wxFileName( filefull );
4497 wxString filenamefull = fileobj.IsAbsolute() ? fileobj.GetFullName() : fileobj.GetFullPath();
4499 #if wxCHECK_VERSION(2,7,0)
4500 for ( wxPathList::iterator node = begin(); node != end(); node++ )
4502 for ( wxStringList::compatibility_iterator node = GetFirst(); node; node = node->GetNext() )
4505 wxFileName filep( node->GetData() );
4506 wxString path = filep.GetFullPath();
4507 if ( !path.IsEmpty() )
4509 wxChar ch = path[wxStrlen( path ) - 1];
4510 if ( ch != wxFileName::GetPathSeparator() )
4511 path += wxFileName::GetPathSeparator(wxPATH_UNIX);
4513 path += filenamefull;
4515 if ( ExpandPath( path ) && wxFileExists( path ) )
4516 return wxString( m_b );
4544 return wxEmptyString;
4550 if ( f.empty() || wxIsAbsolutePath( f ) )
4553 wxString buf = wxGetCwd();
4555 if ( !wxEndsWithPathSeparator( buf ) )
4557 buf += wxFileName::GetPathSeparator();
4564 void a2dPathList::IncC()
4569 m_c = m_path.c_str();
4573 if ( *m_c != wxT(
'\0' ) )
4581 bool a2dPathList::Name()
4584 if ( !( wxIsalnum( a ) || a == wxT(
'_' ) || a == wxT(
'-' ) ) )
4586 m_error_mes = wxT(
"wrong name" );
4591 while( wxIsalnum( a ) || a == wxT(
'_' ) )
4600 bool a2dPathList::ExpandPath( wxString& pathToExpand, wxPathFormat format )
4603 m_path = pathToExpand;
4605 m_b.Alloc( PATHLENGTH );
4613 m_error_mes.Clear();
4618 while( a != wxT(
'\t' ) && a != wxT(
'\0' ) && a != wxT(
'\n' ) && a != wxT(
';' ) )
4635 if ( ( a == wxT(
'$' ) ) || ( a == wxT(
'%' ) ) || ( a == wxT(
'@' ) ) )
4651 wxFileName ffile( m_b );
4652 pathToExpand = ffile.GetFullPath( format );
4661 bool a2dPathList::VarRef( wxChar type )
4665 m_error_mes = wxT(
"wrong environment $ or % or @ missing" );
4670 if( a == wxT(
'{' ) )
4677 m_error_mes = wxT(
"wrong environment name, end brace missing" );
4689 if ( type == wxT(
'$' ) )
4691 if ( m_varref.Len() == 0 )
4694 if( !wxGetEnv( m_varref, &evaluated ) )
4696 m_error_mes = wxT(
"wrong environment Variable, environment does not exist" );
4703 const a2dNamedProperty* prop =
a2dGeneralGlobals->GetVariablesHash().GetVariable( m_varref );
4706 m_error_mes = wxT(
"wrong Variable name, Variable does not exist" );
4723 m_lastObjectId.Empty();
4728 wxASSERT_MSG(
m_refcount == 0, wxT(
"deleting a2dDocument while referenced" ) );
4732 m_lastObjectId.Empty();
4735 a2dObject* a2dRefMap::DoClone( CloneOptions WXUNUSED( options ),
a2dRefMap* refs )
const
4737 wxFAIL_MSG( wxT(
"cannot clone a2dRefMap" ) );
4741 #if wxART2D_USE_CVGIO
4742 void a2dRefMap::DoSave( wxObject* WXUNUSED( parent ),
a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ),
a2dObjectList* WXUNUSED( towrite ) )
4744 wxFAIL_MSG( wxT(
"cannot Save a2dRefMap" ) );
4747 void a2dRefMap::DoLoad( wxObject* WXUNUSED( parent ),
a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) )
4749 wxFAIL_MSG( wxT(
"cannot Load a2dRefMap" ) );
4751 #endif //wxART2D_USE_CVGIO
4757 m_lastObjectId.Empty();
4762 if ( storedHere && ( !
id.IsEmpty() || !m_lastObjectId.IsEmpty() ) )
4764 a2dHashMapIntToObject::iterator obj =
m_objecthashmap.find(
id.IsEmpty() ? m_lastObjectId :
id );
4771 m_lastObjectId.Empty();
4778 m_lastObjectId.Empty();
4786 if ( storedHere && ( !
id.IsEmpty() || !m_lastObjectId.IsEmpty() ) )
4788 a2dHashMapIntToObject::iterator obj =
m_objecthashmap.find(
id.IsEmpty() ? m_lastObjectId :
id );
4795 m_lastObjectId.Empty();
4802 m_lastObjectId.Empty();
4810 if ( owner && ( !
id.IsEmpty() || !m_lastObjectId.IsEmpty() ) )
4812 a2dHashMapIntToObject::iterator obj =
m_objecthashmap.find(
id.IsEmpty() ? m_lastObjectId :
id );
4819 m_lastObjectId.Empty();
4826 m_lastObjectId.Empty();
4840 wxASSERT_MSG( m_lastObjectId.IsEmpty(), wxT(
"last refid not resolved" ) );
4841 m_lastObjectId = lastid;
4846 a2dResolveIdList::compatibility_iterator node =
m_toResolve.GetFirst();
4849 a2dResolveIdList::compatibility_iterator delnode = node;
4850 node = node->GetNext();
4852 wxString toLinkName = linkinfo->m_idStr;
4853 if( toLinkName == idToRemove )
4864 a2dResolveIdList::compatibility_iterator node =
m_toResolve.GetFirst();
4867 a2dResolveIdList::compatibility_iterator delnode = node;
4868 node = node->GetNext();
4870 wxString toLinkName = linkinfo->m_idStr;
4871 a2dHashMapIntToObject::iterator obj =
m_objecthashmap.find( toLinkName );
4874 delnode->GetData()->Assign( obj->second );
4877 else if ( !ignoreNonResolved )
4879 if ( linkinfo->m_mode == a2dResolveIdInfo::mode_a2dObjectSmrtPtr )
4881 a2dSmrtPtr<a2dObject>* poin = linkinfo->m_storedHere.m_a2dObjectSmrtPtr;
4883 wxLogWarning( wxT(
"%s %s %s" ), _(
"Reference not resolved: " ), (*poin)->GetClassInfo()->GetClassName(), toLinkName );
4885 wxLogWarning( wxT(
"%s%s" ), _(
"Reference not resolved: " ), toLinkName );
4887 else if ( linkinfo->m_mode == a2dResolveIdInfo::mode_link )
4889 a2dObject* poin = linkinfo->m_storedHere.m_link;
4890 wxLogWarning( wxT(
"%s %s %s" ), _(
"Reference not resolved: " ), poin->GetClassInfo()->GetClassName(), toLinkName );
4893 wxLogWarning( wxT(
"%s%s" ), _(
"Reference not resolved: " ), toLinkName );
4907 m_lastObjectId.Empty();
4912 wxASSERT_MSG(
m_refcount == 0, wxT(
"deleting a2dDocument while referenced" ) );
4916 m_lastObjectId.Empty();
4919 a2dObject* a2dIOHandler::DoClone( CloneOptions WXUNUSED( options ),
a2dRefMap* refs )
const
4921 wxFAIL_MSG( wxT(
"cannot clone a2dIOHandler" ) );
4925 #if wxART2D_USE_CVGIO
4926 void a2dIOHandler::DoSave( wxObject* WXUNUSED( parent ),
a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ),
a2dObjectList* WXUNUSED( towrite ) )
4928 wxFAIL_MSG( wxT(
"cannot Save a2dIOHandler" ) );
4931 void a2dIOHandler::DoLoad( wxObject* WXUNUSED( parent ),
a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) )
4933 wxFAIL_MSG( wxT(
"cannot Load a2dIOHandler" ) );
4935 #endif //wxART2D_USE_CVGIO
4939 a2dHashMapCreateObject::iterator obj =
m_objectCreate.find( symbolicName );
4943 return wxCreateDynamicObject( symbolicName );
4945 return wxCreateDynamicObject( obj->second );
4954 if (
m_mode == wxEOL_NATIVE )
4956 #if defined(__WXMSW__) || defined(__WXPM__)
4958 #elif defined(__WXMAC__) && !defined(__DARWIN__)
4968 wxASSERT_MSG(
m_refcount == 0, wxT(
"deleting a2dDocument while referenced" ) );
4985 #if wxUSE_STD_IOSTREAM
4994 #if wxUSE_STD_IOSTREAM
5001 bool a2dIOHandlerStrIn::Eof()
const
5003 #if wxUSE_STD_IOSTREAM
5012 bool a2dIOHandlerStrIn::IsOk()
const
5014 #if wxUSE_STD_IOSTREAM
5023 #if wxUSE_STD_IOSTREAM
5025 m_streami->seekg( pos, wxSTD ios::beg );
5045 size_t a2dIOHandlerStrIn::Read(
char* buffer,
size_t size )
5047 #if wxUSE_STD_IOSTREAM
5051 size_t len =
m_streami->Read( buffer, size ).LastRead();
5060 if (
m_mode == wxEOL_NATIVE )
5062 #if defined(__WXMSW__) || defined(__WXPM__)
5064 #elif defined(__WXMAC__) && !defined(__DARWIN__)
5077 m_filename = wxFileName(
"" );
5079 if (
m_mode == wxEOL_NATIVE )
5081 #if defined(__WXMSW__) || defined(__WXPM__)
5083 #elif defined(__WXMAC__) && !defined(__DARWIN__)
5109 size_t len =
string.length();
5114 if (
m_mode != wxEOL_UNIX )
5116 for (
size_t i = 0; i < len; i++ )
5118 const wxChar c =
string[i];
5119 if ( c == wxT(
'\n' ) )
5124 out << _T(
"\r\n" );
5132 wxFAIL_MSG( _T(
"unknown EOL mode in a2dIOHandlerStrOut" ) );
5147 #if wxUSE_STD_IOSTREAM
5152 wxCharBuffer buffer =
m_conv.cWC2MB( out );
5153 m_streamo->write( (
const char* ) buffer, strlen( (
const char* ) buffer ) );
5158 m_streamo->write( out.c_str(), out.length() );
5164 wxCharBuffer buffer =
m_conv.cWC2MB( out );
5165 m_streamo->Write( (
const char* ) buffer, strlen( (
const char* ) buffer ) );
5168 wxString str2( out.wc_str( wxConvLocal ),
m_conv );
5169 m_streamo->Write( str2.mb_str(), str2.Len() );
5178 str.Printf( wxT(
"%u" ), i );
5186 str.Printf( wxT(
"%u" ), i );
5194 str.Printf( wxT(
"%u" ), i );
5203 str.Printf( wxT(
"%f" ), d );
5209 #if wxUSE_STD_IOSTREAM
5248 m_depthFirst =
false;
5249 m_skipNotRenderedInDrawing =
false;
5271 ( *function )( parent, object, event );
5281 if ( hex.Length() == 6 )
5285 hex.Mid( 0, 2 ).ToLong( &r, 16 );
5286 hex.Mid( 2, 2 ).ToLong( &g, 16 );
5287 hex.Mid( 4, 2 ).ToLong( &b, 16 );
5288 return wxColour( r, g, b );
5291 return wxColour( 0, 0, 0 );
5298 unsigned int red = colour.Red();
5299 unsigned int green = colour.Green();
5300 unsigned int blue = colour.Blue();
5302 wxDecToHex( red, buf );
5303 wxDecToHex( green, buf + 2 );
5304 wxDecToHex( blue, buf + 4 );
5306 return wxString( buf );
5319 DEFINE_EVENT_TYPE( a2dEVT_COM_EVENT )
5322 : wxEvent(
id, a2dEVT_COM_EVENT )
5324 SetEventObject( sender );
5327 m_comReturn = sm_non;
5332 : wxEvent( id, a2dEVT_COM_EVENT )
5334 SetEventObject( sender );
5342 : wxEvent( id, a2dEVT_COM_EVENT )
5344 SetEventObject( sender );
5346 m_property =
property->
Clone( a2dObject::clone_flat );
5348 m_property = property;
5349 m_ownProp = ownProp;
5355 : wxEvent( id, a2dEVT_COM_EVENT )
5357 SetEventObject( sender );
5358 m_property =
property.
Clone( a2dObject::clone_flat );
5365 : wxEvent( id, a2dEVT_COM_EVENT )
5367 SetEventObject( sender );
5375 : wxEvent( id, a2dEVT_COM_EVENT )
5377 SetEventObject( sender );
5378 m_property =
new a2dProperty( propId, refObject );
5385 : wxEvent( id, a2dEVT_COM_EVENT )
5387 SetEventObject( sender );
5388 m_property =
new a2dBoolProperty( propId, propertyValue );
5395 : wxEvent( id, a2dEVT_COM_EVENT )
5397 SetEventObject( sender );
5398 m_property =
new a2dUint16Property( propId, propertyValue );
5405 : wxEvent( id, a2dEVT_COM_EVENT )
5407 SetEventObject( sender );
5408 m_property =
new a2dInt32Property( propId, propertyValue );
5415 : wxEvent( id, a2dEVT_COM_EVENT )
5417 SetEventObject( sender );
5418 m_property =
new a2dDoubleProperty( propId, propertyValue );
5425 : wxEvent( id, a2dEVT_COM_EVENT )
5427 SetEventObject( sender );
5428 m_property =
new a2dStringProperty( propId, propertyValue );
5435 : wxEvent( id, a2dEVT_COM_EVENT )
5437 SetEventObject( sender );
5445 : wxEvent( id, a2dEVT_COM_EVENT )
5447 SetEventObject( sender );
5455 : wxEvent( id, a2dEVT_COM_EVENT )
5457 SetEventObject( sender );
5465 : wxEvent( id, a2dEVT_COM_EVENT )
5467 SetEventObject( sender );
5475 : wxEvent( id, a2dEVT_COM_EVENT )
5477 SetEventObject( sender );
5485 : wxEvent( id, a2dEVT_COM_EVENT )
5487 SetEventObject( sender );
5495 : wxEvent( id, a2dEVT_COM_EVENT )
5497 SetEventObject( sender );
5504 a2dComEvent::a2dComEvent()
5505 : wxEvent( sm_non, a2dEVT_COM_EVENT )
5507 SetEventObject( 0 );
5513 a2dComEvent::~a2dComEvent()
5515 wxASSERT_MSG( m_refcount == 0, wxT(
"deleting a2dComEvent while referenced" ) );
5523 m_property = other.m_property ? other.m_property->
Clone( a2dObject::clone_flat ) : 0;
5525 m_comReturn = other.m_comReturn;
5527 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
5529 CurrentSmartPointerOwner =
this;
5534 wxEvent* a2dComEvent::Clone(
void )
const
5541 return m_property ? m_property->
GetId() : 0;
virtual double GetDouble() const
when a2dDoubleProperty, return its value else assert
bool GetAttributeValueBool(const wxString &attrib, bool defaultv=false)
Returns the boolean value of an attribute.
bool m_result
result of walk, set false at start, use at will.
a2dHashMapCreateObject m_objectCreate
This is used to find a classname using a symbolic name.
a2dNamedProperty * GetVariableClone(const wxString &variableName)
get an existing variable of unknown type (cloned)
const a2dError a2dError_LinkRef
property to hold an unsigned 4 byte integer type variable to be associated with a a2dObject ...
void SetLastError(a2dError error)
set last error encountered
a2dIOHandler()
constructor
(In) Visible property that can be added to Docview Objects.
virtual wxString GetString() const
when a2dStringProperty, return its value else assert
A2DGENERALDLLEXP long wxGenNewId()
This function is like wxNewId, but it has its own ID set.
virtual wxString StringRepresentation() const
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
bool m_check
used for linking multiple referenced objects when serializing
~a2dNamedPropertyList()
Destructor.
virtual wxString StringRepresentation() const
static a2dArrayStringProperty * CreatePropertyFromString(const a2dPropertyIdArrayString *id, const wxString &value)
~a2dIOHandlerStrIn()
destructor
static a2dDateTimeProperty * CreatePropertyFromString(const a2dPropertyIdDateTime *id, const wxString &value)
static const a2dSignal sm_Edit_properties
edit properties event, see EditProperties()
const a2dError a2dError_CommandError
void SaveAsDocument(a2dIOHandlerXmlSerOut &out)
Save this object and all below as an XML document.
void SetURI(const wxURI &url)
quickly set a property PROPID_URI
const a2dError a2dError_NoDocTemplateRef
bool HasAttribute(const wxString &attrib)
Does the current tag have this attribute?
virtual void InitializeLoad()
Inits the handler for reading.
static const a2dSignal sm_changedProperty
wxColour A2DGENERALDLLEXP HexToColour(const wxString &hex)
3-digit hex to wxColour
virtual bool HasProperty(const a2dPropertyId *id, const wxString &stringvalue=wxEmptyString) const
Check if the object has a property with given id and string representation.
static a2dVoidPtrProperty * CreatePropertyFromString(const a2dPropertyIdVoidPtr *id, const wxString &value)
a2dComEvent(wxObject *sender, a2dSignal id)
for sending just an event id, m_property is not set
Simple Memory manager for some objects which often create and destroy to replace OS-system calls...
virtual wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
fundamental classes used by all other modules.
virtual bool IsTemporary_DontSave() const
Check if this is a temporary object, which should not be saved.
wxString FindValidPath(const wxString &filename, bool reportError=true)
Find the first full path for which the file exists.
property to hold a a2dObject pointer type variable to be associated with a a2dObject ...
XMLeventType Next()
Walks to next element and returns event type.
const a2dError a2dError_GetVar
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
bool ResolveOrAdd(a2dSmrtPtr< a2dObject > *storedHere, const wxString &id=wxT(""))
try to resolve the object that is in storedHere when it is a reference.
class to map references to objects stored in XML, in order to make the connection later on...
wxString GetVariableString(int index)
get an existing wxString variable
static a2dUint16Property * CreatePropertyFromString(const a2dPropertyIdUint16 *id, const wxString &value)
virtual wxInt32 GetInt32() const
when a2dInt32Property, return its value else assert
virtual wxString GetName() const
Get the ids print and serialization name.
see a2dCommandProcessorEvent
void RemoveTemporaryProperties()
remove all temporary properties
void Walker(wxObject *parent, a2dWalkerIOHandler &handler)
walk a list of properties
void DecCurrentDepth()
Decrement recursion depth.
a2dPropertyIdTyped< wxString, a2dStringProperty > a2dPropertyIdString
property of this type
static a2dPropertyIdBool * PROPID_Check
used for linking multiple referenced objects when serializing
a2dAutoZeroPtr< a2dObject > * m_autozeroptrlist
this is a list of all a2dAutoZeroPtr object pointing to this object
bool m_recursion_active
this is used as a recursion stopper
const a2dError a2dError_CouldNotEvaluatePath
virtual wxString StringValueRepresentation() const
static a2dPropertyIdTyped< basetype, proptype > * GetDummy()
returns a dummy property id of this type, that can be used in non-id applications ...
virtual void InitializeSave()
Inits the handler for writing.
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
const a2dPropertyId * m_id
The property id object identifying this property.
void LoadFromDocument(a2dIOHandlerXmlSerIn &parser)
Load this object and all below from an XML document.
virtual void ResetSave()
Reset the object after saving.
virtual wxString StringRepresentation() const
void WriteStartElementAttributes(const wxString &name, bool newLine=true)
Writes start tag which has attributes.
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
virtual wxString StringRepresentation() const
Flags
Flags for property ids.
virtual wxString StringRepresentation() const
~a2dVariablesArray()
destructor
const a2dError a2dError_NoError
a2dIOHandler takes care of loading and/or saving data.
a2dObject * Clone(CloneOptions options, a2dRefMap *refs=NULL) const
create an exact copy of this property
virtual bool AlwaysWriteSerializationId() const
If true, always write an id.
virtual void SetNamedPropertyToObject(a2dObject *obj, a2dNamedProperty *nprop, SetFlags setflags=set_none) const
Set the property in obj to value (not cloning value)
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
property to hold a double type variable to be associated with a a2dObject
void DeleteAll()
delete all variables in the array
virtual int GetCurrentLineNumber()
where in the input was line the current tag
void ConnectEvent(wxEventType type, wxEvtHandler *eventSink)
a2dDocumentInputStream * m_streami
file or other string stream containing the format to parse.
int GetAttributeValueInt(const wxString &attrib, int defaultv=0)
Returns the integer value of an attribute.
a2dPropertyIdTyped< wxInt32, a2dInt32Property > a2dPropertyIdInt32
property of this type
property to hold a bool type variable to be associated with a a2dObject
void IncCurrentDepth()
Increment recursion depth.
const a2dError a2dError_FileCouldNotOpen
bool IsCloneDeep() const
Test if this id identifies a property that needs to be cloned deep.
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
Input and output handler for the XmlSer format.
a2dNamedPropertyList m_propertylist
properties
wxString A2DGENERALDLLEXP ColourToHex(const wxColour &colour)
RGB to 3-digit hex.
virtual wxUint32 GetUint32() const
when a2dUint32Property, return its value else assert
A2DGENERALDLLEXP void wxGenRegisterId(long id)
see wxGenNewId(), use this to resrve a specific id
bool SetVariableRefObject(const wxString &variableName, a2dObject *value)
set a new or replace an existing a2dObject variable
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dNamedPropertyEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
const a2dError a2dError_NoTool
virtual void Initialize()
initialize mapping tables
a2dResolveIdList m_toResolve
refernces to object which have not bin resolved yet ( e.g not read yet, but already referenced ) ...
virtual wxString StringRepresentation() const
a2dPropertyIdTyped< bool, a2dBoolProperty > a2dPropertyIdBool
property of this type
property to hold a wxURI type variable to be associated with a a2dObject
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dNamedPropertyListStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dNamedProperty * GetProperty(const a2dPropertyId *propertyId, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const
get property on this object
const a2dError a2dError_DocumentsOpened
void Write8(wxUint8 i)
write a 8 bits integer
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectPreChild
id for a2dWalkEvent issued from within a2dWalkerIOHandler
using a file stream for input, stream the file into a a2dDocument or other object ...
virtual void * GetVoidPtr() const
when a2dVoidPtrProperty, return its value else assert
wxEOL m_mode
end of line mode
wxString GetName() const
Get the name of the a2dPropertyId object.
list of a2dNamedProperty objects
void CheckReferences()
Check zero reference count and delete if count is 0.
a2dIOHandlerStrOut & PutChar(wxChar c)
write on character
void Walker(wxObject *parent, a2dWalkerIOHandler &handler)
This is used to recursively walk through an object tree.
int m_nelements
number of used elements in m_properties
bool IsTemporary() const
Test if this id identifies a temporary property.
~a2dWalkerIOHandler()
destructor
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
virtual const a2dPropertyId * CreateId(a2dObject *parent, const wxString &name)
creates an a2dPropertyId for this property, if it is not available.
property to hold a window type variable (for example wxTipWindow) to be associated with a a2dObject ...
const a2dError a2dError_LoadFile
wxEOL m_mode
end of line mode
property to hold a FileName type variable to be associated with a a2dObject
class A2DGENERALDLLEXP a2dVariablesHashBase
wxString keys plus a2dObject pointers
property to hold a a2dObjectPtr smart pointer type variable to be associated with a a2dObject ...
property to hold a wxArrayString type variable to be associated with a a2dObject
bool RemoveReference(const wxString &idToRemove)
remove given reference if from reference map.
static a2dPropertyIdUri * PROPID_URI
attach an URL to the object
void SetMinSize(int size)
set the minimum size for the array
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
void TakeOverProperties(a2dObject *from, a2dPropertyIdList *listOfIds)
Properties in the id list are taken from the given object, en set to this.
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
virtual a2dObject * GetRefObject() const
when a2dProperty, return its value else assert
bool m_stopWalking
quit the iteration
virtual wxObject * CreateObject(const wxString &symbolicName)
Creates an specific object by name.
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
a2dObject * GetVariableRefObject(int index)
get an existing a2dObject variable
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dNamedPropertyStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
void Write16(wxUint16 i)
write a 16 bits integer
virtual wxString StringRepresentation() const
virtual void SetName(const wxString &name)
Creates the a2dStringProperty PROPID_Name.
void AppendVariableInt(int value)
add a new int variable
virtual wxString StringValueRepresentation() const
void WriteEndElement(bool newLine=true)
Writes correspondending end tag for the current start tag.
const a2dNamedProperty * GetVariable(const wxString &variableName)
get an existing variable of unknown type (not cloned)
a2dObject * Find(const wxString &classname=wxT(""), const wxString &name=wxT(""))
Find object within the given property name and classname.
void AppendVariableRefObject(a2dObject *value)
add a new a2dObject variable
virtual wxString StringValueRepresentation() const
static a2dColourProperty * CreatePropertyFromString(const a2dPropertyIdColour *id, const wxString &value)
Construct a new property object from a string.
void SetProperty(a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
Set the property to the this object.
const a2dError a2dError_FileHistory
const a2dError a2dError_CanceledFileDialog
const a2dError a2dError_IOHandler
void WriteStartDocument(const wxString &version, const wxString &encoding, bool standalone)
Writes the XML header declaration.
bool m_release
when set object is treated as being deleted, and wil be deleted in idle time.
static a2dBoolProperty * CreatePropertyFromString(const a2dPropertyIdBool *id, const wxString &value)
Construct a new property object from a string.
const a2dNamedProperty & GetVariable(int index)
get an existing variable of unknown type (not cloned)
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectPostChild
id for a2dWalkEvent issued from within a2dWalkerIOHandler
const a2dError a2dError_CouldNotCreateDocument
static a2dStringProperty * CreatePropertyFromString(const a2dPropertyIdString *id, const wxString &value)
XML I/O classes which is Pull parser based for reading XML files.
const a2dError a2dError_NoSelection
void AppendVariableDouble(double value)
add a new double variable
property to hold a wxDateTime type variable to be associated with a a2dObject
virtual void OnPropertyChanged(const a2dPropertyId *id)
This function is called after a property changed.
a2dHashMapIntToObject m_objecthashmap
This is used to find multiple referenced objects by id.
SetFlags
Flags used for manipulating the way a property is set to a2dObject.
Io handler to iterate through a a2dDocument.
a2dIOHandlerStrIn & SeekI(wxFileOffset pos)
set stream at a position
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
bool GetCheck() const
general flag use at will.
bool SetVariable(const wxString &variableName, a2dNamedProperty *property)
set a new or replace an existing variable of arbitrary type
wxObject * m_currentParent
parent object of current object
void RemoveTemporary()
Remove all temporrary properties from the list.
void WriteNewLine()
Writes a new line and takes care of indentation.
bool SetVariableDouble(const wxString &variableName, double value)
set a new or replace an existing double variable
a2dIOHandlerStrIn(wxMBConv &conv=wxConvUTF8)
constructor
A property id for a property which is editable.
bool(* a2dObjectIOFn)(wxObject *parent, wxObject *object, a2dWalkEvent)
a functions to store in a hash table
virtual bool EditProperties(const a2dPropertyId *id, bool withUndo=true)
edit properties of the object
const a2dError a2dError_SaveFile
static a2dFileNameProperty * CreatePropertyFromString(const a2dPropertyIdFileName *id, const wxString &value)
bool CheckFlags(Flags flags) const
check a flag mask (all given flags must be set)
void SkipSpaces(unsigned int &position)
parse whitespace and skip it form teh value string
virtual wxString StringRepresentation() const
#define forEachIn(listtype, list)
easy iteration for a2dlist
void SkipSubTree()
Skips all child elements / tags of current element / tag.
static a2dInt16Property * CreatePropertyFromString(const a2dPropertyIdInt16 *id, const wxString &value)
virtual wxString StringValueRepresentation() const
void SetPropertyToObject(a2dObject *obj, const basetype &value, SetFlags setflags=set_none) const
Set the property in obj to value.
void SetLastObjectLoadedId(const wxString &lastid)
set by RefObject when finding a reference id during loading.
void Walker(wxObject *parent, a2dWalkerIOHandler &handler)
This is used to recursively walk through an object tree.
virtual wxString StringRepresentation() const
static a2dTipWindowProperty * CreatePropertyFromString(const a2dPropertyIdWindow *id, const wxString &value)
a2dNamedPropertyList()
Default constructor.
virtual ~a2dObject()
destructor
const a2dError a2dError_XMLparse
const a2dError a2dError_NoWrapper
virtual bool GetBool() const
when a2dBoolProperty, return its value else assert
const a2dError a2dError_canvasObjectRelease
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
const a2dError a2dError_CouldNotLoad
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Save settings.
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
const a2dError a2dError_LinkPin
const a2dError a2dError_FileVersion
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dNamedPropertyListEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
A2DGENERALDLLEXP a2dSmrtPtr< a2dGeneralGlobal > a2dGeneralGlobals
a global pointer to get to global instance of important classes.
static const a2dSignal sm_non
a2dNamedProperty * Clone(a2dObject::CloneOptions options, a2dRefMap *refs=NULL) const
Virtual copy constructor.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectProperties
id for a2dWalkEvent issued from within a2dWalkerIOHandler
virtual wxString StringRepresentation() const
const a2dPropertyId * GetId() const
Get the a2dPropertyId object identifying this property.
Holds internal variables to be used whereever needed.
a2dVariablesHash()
constructor
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
const a2dError a2dError_LoadObject
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
Input and output handler for the XmlSer format.
const a2dError a2dError_SetEnv
static a2dUriProperty * CreatePropertyFromString(const a2dPropertyIdUri *id, const wxString &value)
a2dIOHandlerStrOut(wxMBConv &conv=wxConvUTF8)
constructor
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
virtual wxUint16 GetUint16() const
when a2dUint16Property, return its value else assert
void Write32(wxUint32 i)
write a 32 bits integer
bool IsOk() const
is the stream Oke to write
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
bool GetEdited()
when properties where edited, this must become true
static const a2dSignal sm_changedRefObject
virtual ~a2dNamedProperty()
Destructor.
wxString RequireAttributeValue(const wxString &attrib)
Forces an attribute and returns its string value.
the property is temporary and never saved
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dPropertyStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dHashMapIntToObject & GetObjectHashMap()
This is used to find multiple referenced objects by id.
void WriteEndAttributes(bool close=false)
"Closes" the start tag after writing all attributes (writes the ">" or "/>" bracket).
wxURI GetURI() const
quick way to get to PROPID_URI property
wxString * GetVariableString(const wxString &variableName)
get an existing wxString variable
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
static a2dInt32Property * CreatePropertyFromString(const a2dPropertyIdInt32 *id, const wxString &value)
int m_refcount
how many references to this object do exist
property to hold a tip window type variable to be associated with a a2dObject
void SetCheck(bool check)
general flag use at will.
property to hold a wxString type variable to be associated with a a2dObject
wxString FindAbsoluteValidPath(const wxString &filename)
virtual wxString StringValueRepresentation() const
bool GetUseCheck()
see SetUseCheck
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
a2dObjectList * Clone(a2dObject::CloneOptions options, a2dRefMap *refs=NULL) const
Clone everything ( Clones objects also) in a new created list.
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
static a2dPropertyIdString * PROPID_Name
Name property, to return name of this object.
double ParseDouble(unsigned int &position)
parse a double from the value string
using a file stream for output, stream a a2dDocument or other wxObject into a stream.
A pointer class, that is automatically set to 0 if the target is deleted.
const a2dError a2dError_SaveObject
virtual a2dObject * GetRefObjectNA() const
when a2dProperty, return its value else return NULL
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
virtual wxString StringValueRepresentation() const
const a2dError a2dError_ImportObject
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
int m_currentDepth
contour to be used by algorithm, to decide on how deep recursing is to be.
virtual wxString StringValueRepresentation() const
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
virtual wxString StringRepresentation() const
const a2dError a2dError_Canceled
virtual wxString StringValueRepresentation() const
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
Load settings.
const a2dError a2dError_NoPinClass
virtual wxString StringValueRepresentation() const
virtual const a2dPropertyId * CreateId(a2dObject *parent, const wxString &name)
creates an a2dPropertyId for this property, if it is not available.
virtual wxString StringValueRepresentation() const
static a2dWindowProperty * CreatePropertyFromString(const a2dPropertyIdWindow *id, const wxString &value)
virtual float GetFloat() const
when a2dFloatProperty, return its value else assert
virtual a2dObject * SetNonDynamic()
Call to mark this object as non-dynamic (static/local/auto)
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
class used in a2dResolveIdList to resolve references to other objects while readin in a file...
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
virtual const a2dPropertyId * CreateId(a2dObject *parent, const wxString &name)
creates an a2dPropertyId for this property, if it is not available.
virtual wxInt16 GetInt16() const
when a2dInt16Property, return its value else assert
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
void ProcessConnectedEvent(wxEvent &event)
wxCHECK_VERSION(2,9,0)
property to hold a FileName type variable to be associated with a a2dObject
static a2dProperty * CreatePropertyFromString(const a2dPropertyIdRefObject *id, const wxString &value)
virtual void Load(wxObject *parent, a2dIOHandlerXmlSerIn &parser)
load object from CVG file
property to hold a void pointer type variable to be associated with a a2dObject
wxString GetAttributeValue(const wxString &attrib, const wxString &defaultv=wxT(""))
Returns the value of an attribute.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dPropertyEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
const a2dError a2dError_NoView
virtual wxString StringRepresentation() const
int GetOwnedBy()
like it to be protected, but this does not work with wxList macros
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
bool SetVariableInt(const wxString &variableName, int value)
set a new or replace an existing int variable
virtual wxString StringValueRepresentation() const
static a2dFloatProperty * CreatePropertyFromString(const a2dPropertyIdFloat *id, const wxString &value)
a2dNamedProperty()
Default constructor.
virtual wxString StringValueRepresentation() const
void WriteEndDocument()
Checks if all open tags are closed.
virtual bool AddProperty(a2dNamedProperty *property)
This function is called by a2dPropertyId to add a property to the list.
virtual void ResolveInform()
inform an object that reference resolution was done
This is the base class for all kinds of property id's for a2dObject.
bool SetVariableString(const wxString &variableName, const wxString &value)
set a new or replace an existing wxString variable
XMLeventType GetEventType()
Returns the type of current event.
void Require(const XMLeventType &type, wxString name)
Forces a special tag.
const a2dError a2dError_LoadLayers
const a2dError a2dError_ImportFile
bool Release(const wxString &classname=wxT(""), bool all=false)
wxString GetTagName()
Returns name of the current XML tag.
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
if set, clone properties (e.g. fill style), otherwise ref-copy them
static a2dUint32Property * CreatePropertyFromString(const a2dPropertyIdUint32 *id, const wxString &value)
void SetToObject(a2dObject *obj, a2dPropertyId::SetFlags setflags=a2dPropertyId::set_none)
Set this property to an object.
const a2dError a2dError_GetEnv
wxString GetVariableAsString(int index)
get an existing variable of any type as String
property to hold a wxObject variable to be associated with a a2dObject
a2dObject * GetVariableRefObject(const wxString &variableName)
get an existing a2dObject variable
virtual bool LinkReference(a2dObject *other)
link a reference in the object to the given value
command processor and intializing and event handling classes specific for wxDocview.
int CollectObjects(a2dObjectList *total, const wxString &propertyNameFilter=wxT(""), const wxString &classname=wxT(""))
Copy objects fitting the given filter to the total list.
virtual wxString StringRepresentation() const
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
const a2dError a2dError_NotSpecified
virtual const a2dPropertyId * CreateId(a2dObject *parent, const wxString &name)
creates an a2dPropertyId for this property, if it is not available.
void SetMode(wxEOL mode=wxEOL_NATIVE)
define the line end mode for textual files
const a2dError a2dError_property
virtual wxString StringValueRepresentation() const
bool DisconnectEventAll(wxEvtHandler *eventSink)
Remove all dynamic events in classA, going to classB (eventSink)
static a2dDoubleProperty * CreatePropertyFromString(const a2dPropertyIdDouble *id, const wxString &value)
virtual wxString StringValueRepresentation() const
const a2dError a2dError_ToManyOpen
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
bool Remove(const a2dPropertyId *id, bool all=true)
Remove first/all properties with given id from the list.
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
const a2dError a2dError_ExportFile
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
const a2dError a2dError_NoDocument
virtual wxString StringRepresentation() const
virtual bool RemoveProperty(const a2dPropertyId *id, bool all=true)
This function is called by a2dPropertyId to remove a property from the list.
when set this type of property has no influence on rendering
virtual void Initialize()
to initialize a walker class, default does nothing.
A property id defined by user.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dObject's and derived classes
wxString GetAsString()
Get all search paths as one string.
void operator=(const a2dVariablesHash &other)
assignment operator
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
int m_melements
number of elements in m_properties
virtual void Save(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite)
write all needed to an XML type of file called the CVG format
virtual a2dNamedProperty * FindProperty(const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none)
Find a dynamic property with given id in the property list.
void SkipCommaSpaces(unsigned int &position)
parse comma, whitespace and skip it form teh value string
a2dNamedProperty * GetVariableClone(int index)
get an existing variable of unknown type (cloned)
bool GetStopWalking()
check for stop
This template class is for property ids with a known data type.
void operator=(const a2dObject &other)
assignment operator
void AppendVariable(a2dNamedProperty *property)
add a new variable of arbitrary type
wxMBConv & m_conv
unicode conversion
bool CheckCollect(const a2dPropertyId *id, Flags flags) const
check a property id and flags to see if the property shall be collected
virtual wxString StringRepresentation() const
a2dVariablesArray()
constructor
virtual void WriteDouble(double d)
write a double
const a2dError a2dError_NoController
If a property with this id has changed its parent/holder will be notified.
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
a2dIOHandlerCoupleHash m_register
coupling function to event and classname
a2dNamedProperty ** m_properties
this is the array of properties
property to hold a FileName type variable to be associated with a a2dObject
static a2dAutoZeroProperty * CreatePropertyFromString(const a2dPropertyIdRefObjectAutoZero *id, const wxString &value)
virtual wxString StringValueRepresentation() const
virtual wxString StringValueRepresentation() const
static a2dPathListProperty * CreatePropertyFromString(const a2dPropertyIdPathList *id, const wxString &value)
void AppendVariableString(const wxString &value)
add a new wxString variable
virtual bool LinkReferences(bool ignoreNonResolved=false)
link references to their destination
property to hold a float type variable to be associated with a a2dObject
a2dDocumentOutputStream * m_streamo
file or other string stream containing the format to output to.
~a2dVariablesHash()
destructor
virtual void WriteString(const wxString &string)
write a string
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
CloneOptions
options for cloning
bool DisconnectEvent(wxEventType type, wxEvtHandler *eventSink)
virtual void ResetLoad()
Reset the handler after loading.
bool ResolveOrAddLink(a2dObject *obj, const wxString &id=wxT(""))
try to resolve an object referenced by obj using the LinkReference function
~a2dIOHandler()
destructor
wxInt64 GetUniqueSerializationId() const
return a unique id for this object
property to hold an unsigned 2 byte integer type variable to be associated with a a2dObject ...
~a2dIOHandlerStrOut()
destructor
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
#define A2D_PROPID_D_F(type, propname, defaultval, flags)
to define a get set property more easily
void WriteStartElement(const wxString &name, bool newLine=true)
Writes start tag which has no attributes.
void MakeUnique()
all with reference count > 1 are cloned.