Difference between revisions of "WxFormbuilder"

From HoerupWiki
Jump to: navigation, search
Line 12: Line 12:
 
=Custom properties=
 
=Custom properties=
 
<code>
 
<code>
 
+
Index: output/xml/custom.xml
Index: output/xml/custom.xml
+
===================================================================
===================================================================
+
--- output/xml/custom.xml (revision 0)
--- output/xml/custom.xml (revision 0)
+
+++ output/xml/custom.xml (revision 0)
+++ output/xml/custom.xml (revision 0)
+
@@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
+
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+
+<package name="custom" desc="Custom objects, expand this file to match your own needs">
+<package name="custom" desc="Custom objects, expand this file to match your own needs">
+
+ <objectinfo class="Descriptive" type="custom">
+ <objectinfo class="Descriptive" type="custom">
+
+ <property name="description" type="text"/>
+ <property name="description" type="text"/>
+
+ <property name="designer" type="text"/>
+ <property name="designer" type="text"/>
+
+ <property name="approval" type="text"/>
+ <property name="approval" type="text"/>
+
+ </objectinfo>
+ </objectinfo>
+
+
+
+
+ <objectinfo class="Workflow" type="custom">
+ <objectinfo class="Workflow" type="custom">
+
+ <property name="Design spec." type="text"/>
+ <property name="Design spec." type="text"/>
+
+ <property name="Spec. section" type="text"/>
+ <property name="Spec. section" type="text"/>
+
+ </objectinfo>
+ </objectinfo>
+
+</package>
+</package>
+
Index: output/xml/objtypes.xml
Index: output/xml/objtypes.xml
+
===================================================================
===================================================================
+
--- output/xml/objtypes.xml (revision 1207)
--- output/xml/objtypes.xml (revision 1207)
+
+++ output/xml/objtypes.xml (working copy)
+++ output/xml/objtypes.xml (working copy)
+
@@ -45,6 +45,8 @@
@@ -45,6 +45,8 @@
+
</objtype>
  </objtype>
+
+
<objtype name="interface" />
  <objtype name="interface" />
+
+   
+   
+
+  <objtype name="custom" />
+  <objtype name="custom" />
+
+
<objtype name="form">
  <objtype name="form">
+
<childtype name="sizer" nmax="1" />
    <childtype name="sizer" nmax="1" />
+
Index: src/model/database.cpp
Index: src/model/database.cpp
+
===================================================================
===================================================================
+
--- src/model/database.cpp (revision 1207)
--- src/model/database.cpp (revision 1207)
+
+++ src/model/database.cpp (working copy)
+++ src/model/database.cpp (working copy)
+
@@ -534,6 +534,8 @@
@@ -534,6 +534,8 @@
+
LoadPackage( m_xmlPath + wxT("default.xml"), m_iconPath );
LoadPackage( m_xmlPath + wxT("default.xml"), m_iconPath );
+
LoadCodeGen( m_xmlPath + wxT("default.cppcode") );
LoadCodeGen( m_xmlPath + wxT("default.cppcode") );
+
+
+ LoadPackage( m_xmlPath + wxT("custom.xml"), m_iconPath );
+ LoadPackage( m_xmlPath + wxT("custom.xml"), m_iconPath );
+
+
+
+
// Map to temporarily hold plugins.
// Map to temporarily hold plugins.
+
// Used to both set page order and to prevent two plugins with the same name.
// Used to both set page order and to prevent two plugins with the same name.
+
typedef std::map< wxString, PObjectPackage > PackageMap;
typedef std::map< wxString, PObjectPackage > PackageMap;
+
@@ -741,6 +743,10 @@
@@ -741,6 +743,10 @@
+
}
}
+
}
}
+
+
+ // Append Custom properties
+ // Append Custom properties
+
+ if (HasCustomProperties(typeName))
+ if (HasCustomProperties(typeName))
+
+ AppendCustomProperties(class_info);
+ AppendCustomProperties(class_info);
+
+
+
+
elem_obj = elem_obj->NextSiblingElement( OBJINFO_TAG, false );
elem_obj = elem_obj->NextSiblingElement( OBJINFO_TAG, false );
+
}
}
+
}
}
+
@@ -750,6 +756,24 @@
@@ -750,6 +756,24 @@
+
}
}
+
}
}
+
+
+
+
+
+void ObjectDatabase::AppendCustomProperties(PObjectInfo class_info)
+void ObjectDatabase::AppendCustomProperties(PObjectInfo class_info)
+
+{
+{
+
+ for (std::map< wxString, PObjectInfo >::iterator it = m_objs.begin(); it != m_objs.end(); it++)
+ for (std::map< wxString, PObjectInfo >::iterator it = m_objs.begin(); it != m_objs.end(); it++)
+
+ {
+ {
+
+ if ( (*it).second->GetObjectTypeName() == wxT("custom"))
+ if ( (*it).second->GetObjectTypeName() == wxT("custom"))
+
+ {
+ {
+
+ class_info->AddBaseClass( (*it).second );
+ class_info->AddBaseClass( (*it).second );
+
+ }  
+ }  
+
+ }
+ }
+
+}
+}
+
+
+
+
+bool ObjectDatabase::HasCustomProperties(wxString type)
+bool ObjectDatabase::HasCustomProperties(wxString type)
+
+{
+{
+
+ return (HasCppProperties(type) ||
+ return (HasCppProperties(type) ||
+
+ type == wxT("form"));
+ type == wxT("form"));
+
+}
+}
+
+
+
+
bool ObjectDatabase::HasCppProperties(wxString type)
bool ObjectDatabase::HasCppProperties(wxString type)
+
{
{
+
return (type == wxT("notebook") ||
return (type == wxT("notebook") ||
+
Index: src/model/database.h
Index: src/model/database.h
+
===================================================================
===================================================================
+
--- src/model/database.h (revision 1207)
--- src/model/database.h (revision 1207)
+
+++ src/model/database.h (working copy)
+++ src/model/database.h (working copy)
+
@@ -186,6 +186,9 @@
@@ -186,6 +186,9 @@
+
+
void SetDefaultLayoutProperties(PObjectBase obj);
  void SetDefaultLayoutProperties(PObjectBase obj);
+
+
+  bool HasCustomProperties(wxString type);  
+  bool HasCustomProperties(wxString type);  
+
+  void AppendCustomProperties(PObjectInfo class_info);
+  void AppendCustomProperties(PObjectInfo class_info);
+
+
+
+
public:
  public:
+
ObjectDatabase();
  ObjectDatabase();
+
~ObjectDatabase();
  ~ObjectDatabase();
+
Index: src/rad/inspector/objinspect2.cpp
Index: src/rad/inspector/objinspect2.cpp
+
===================================================================
===================================================================
+
--- src/rad/inspector/objinspect2.cpp (revision 1207)
--- src/rad/inspector/objinspect2.cpp (revision 1207)
+
+++ src/rad/inspector/objinspect2.cpp (working copy)
+++ src/rad/inspector/objinspect2.cpp (working copy)
+
@@ -994,6 +994,8 @@
@@ -994,6 +994,8 @@
+
m_pg->SetPropertyColour(id,wxColour(255,255,205)); // yellow
m_pg->SetPropertyColour(id,wxColour(255,255,205)); // yellow
+
else if (name == wxT("sizeritem") || name == wxT("gbsizeritem") || name == wxT("sizeritembase") )
else if (name == wxT("sizeritem") || name == wxT("gbsizeritem") || name == wxT("sizeritembase") )
+
m_pg->SetPropertyColour(id,wxColour(220,255,255)); // cyan
m_pg->SetPropertyColour(id,wxColour(220,255,255)); // cyan
+
+ else if (obj_info->GetObjectTypeName() == wxT("custom"))
+ else if (obj_info->GetObjectTypeName() == wxT("custom"))
+
+ m_pg->SetPropertyColour(id,wxColour(0xEE,0x82,0xEE)); //violet
+ m_pg->SetPropertyColour(id,wxColour(0xEE,0x82,0xEE)); //violet
+
}
}
+
+
ExpandMap::iterator it = m_isExpanded.find( propName );
ExpandMap::iterator it = m_isExpanded.find( propName );
 
 
 
 
 
  
  
 
</code>
 
</code>

Revision as of 16:09, 26 August 2007

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 );