WxFormbuilder

From HoerupWiki
Revision as of 16:09, 26 August 2007 by 192.168.10.10 (talk)
Jump to: navigation, search

Noter omkring wxFormbuilder, for at få den til at opføre sig som vi har behov for i MSI / PC Tool gruppen

ToDo

  • Tilføj "custom" property type - som bliver tilføjet alle objecter.

Fixed position

For at få editoren til at kunne arbejde med faste xy Koordinator skal man åbne objtypes.xml ogt tilføje linien <childtype name="widget"/> i form sektionen.

Men fixed position er stadig lidt besværlig at arbejde med da man manuelt skal indtaste x og y værdierne i property editoren. (kan man ikke lave en IntPropertyEditor der bruger en wxSpinCtrl?)

Custom properties

Index: output/xml/custom.xml =================================================================== --- output/xml/custom.xml (revision 0) +++ output/xml/custom.xml (revision 0) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<package name="custom" desc="Custom objects, expand this file to match your own needs"> + <objectinfo class="Descriptive" type="custom"> + <property name="description" type="text"/> + <property name="designer" type="text"/> + <property name="approval" type="text"/> + </objectinfo> + + <objectinfo class="Workflow" type="custom"> + <property name="Design spec." type="text"/> + <property name="Spec. section" type="text"/> + </objectinfo> +</package> Index: output/xml/objtypes.xml =================================================================== --- output/xml/objtypes.xml (revision 1207) +++ output/xml/objtypes.xml (working copy) @@ -45,6 +45,8 @@ </objtype>

<objtype name="interface" /> + + <objtype name="custom" />

<objtype name="form"> <childtype name="sizer" nmax="1" /> Index: src/model/database.cpp =================================================================== --- src/model/database.cpp (revision 1207) +++ src/model/database.cpp (working copy) @@ -534,6 +534,8 @@ LoadPackage( m_xmlPath + wxT("default.xml"), m_iconPath ); LoadCodeGen( m_xmlPath + wxT("default.cppcode") );

+ LoadPackage( m_xmlPath + wxT("custom.xml"), m_iconPath ); + // Map to temporarily hold plugins. // Used to both set page order and to prevent two plugins with the same name. typedef std::map< wxString, PObjectPackage > PackageMap; @@ -741,6 +743,10 @@ } }

+ // Append Custom properties + if (HasCustomProperties(typeName)) + AppendCustomProperties(class_info); + elem_obj = elem_obj->NextSiblingElement( OBJINFO_TAG, false ); } } @@ -750,6 +756,24 @@ } }

+ +void ObjectDatabase::AppendCustomProperties(PObjectInfo class_info) +{ + for (std::map< wxString, PObjectInfo >::iterator it = m_objs.begin(); it != m_objs.end(); it++) + { + if ( (*it).second->GetObjectTypeName() == wxT("custom")) + { + class_info->AddBaseClass( (*it).second ); + } + } +} + +bool ObjectDatabase::HasCustomProperties(wxString type) +{ + return (HasCppProperties(type) || + type == wxT("form")); +} + bool ObjectDatabase::HasCppProperties(wxString type) { return (type == wxT("notebook") || Index: src/model/database.h =================================================================== --- src/model/database.h (revision 1207) +++ src/model/database.h (working copy) @@ -186,6 +186,9 @@

void SetDefaultLayoutProperties(PObjectBase obj);

+ bool HasCustomProperties(wxString type); + void AppendCustomProperties(PObjectInfo class_info); + public: ObjectDatabase(); ~ObjectDatabase(); Index: src/rad/inspector/objinspect2.cpp =================================================================== --- src/rad/inspector/objinspect2.cpp (revision 1207) +++ src/rad/inspector/objinspect2.cpp (working copy) @@ -994,6 +994,8 @@ m_pg->SetPropertyColour(id,wxColour(255,255,205)); // yellow else if (name == wxT("sizeritem") || name == wxT("gbsizeritem") || name == wxT("sizeritembase") ) m_pg->SetPropertyColour(id,wxColour(220,255,255)); // cyan + else if (obj_info->GetObjectTypeName() == wxT("custom")) + m_pg->SetPropertyColour(id,wxColour(0xEE,0x82,0xEE)); //violet }

ExpandMap::iterator it = m_isExpanded.find( propName );