added notebooks support; added not_supported variable type
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7881 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
45a248176c
commit
ab13d1c58f
@ -9,14 +9,45 @@ PROGRAM=wxrcedit
|
||||
OBJECTS=edapp.o editor.o nodehnd.o prophnd.o xmlhelpr.o
|
||||
|
||||
DATADIRS = df
|
||||
DATAFILES = df/boxsizer.df df/break.df df/button.df df/checkbox.df \
|
||||
df/control.df df/dialog.df df/gauge.df df/htmlwindow.df \
|
||||
df/menu.df df/menu_item.df df/menubar.df df/menuitem.df \
|
||||
df/panel.df df/panel_item.df df/panelbase.df df/radiobutton.df \
|
||||
df/separator.df df/sizer_item.df df/sizeritem.df df/slider.df \
|
||||
df/spacer.df df/staticbitmap.df df/staticboxsizer.df \
|
||||
df/statictext.df df/textctrl.df df/toolbar_item.df df/window.df \
|
||||
df/gridsizer.df df/flexgridsizer.df
|
||||
DATAFILES = \
|
||||
df/boxsizer.df \
|
||||
df/break.df \
|
||||
df/button.df \
|
||||
df/checkbox.df \
|
||||
df/checklist.df \
|
||||
df/choice.df \
|
||||
df/combobox.df \
|
||||
df/control.df \
|
||||
df/dialog.df \
|
||||
df/flexgridsizer.df \
|
||||
df/gauge.df \
|
||||
df/gridsizer.df \
|
||||
df/htmlwindow.df \
|
||||
df/menu.df \
|
||||
df/menu_item.df \
|
||||
df/menubar.df \
|
||||
df/menuitem.df \
|
||||
df/notebook.df \
|
||||
df/notebookpage.df \
|
||||
df/panel.df \
|
||||
df/panel_item.df \
|
||||
df/panelbase.df \
|
||||
df/radiobox.df \
|
||||
df/radiobutton.df \
|
||||
df/separator.df \
|
||||
df/sizer_item.df \
|
||||
df/sizeritem.df \
|
||||
df/slider.df \
|
||||
df/spacer.df \
|
||||
df/spinbutton.df \
|
||||
df/spinctrl.df \
|
||||
df/staticbitmap.df \
|
||||
df/staticboxsizer.df \
|
||||
df/statictext.df \
|
||||
df/textctrl.df \
|
||||
df/toolbar_item.df \
|
||||
df/window.df
|
||||
|
||||
|
||||
APPEXTRALIBS=$(top_builddir)/lib/libwxxml.@WX_TARGET_LIBRARY_TYPE@
|
||||
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
|
||||
|
@ -85,6 +85,8 @@ void NodeInfo::Read(const wxString& filename)
|
||||
if (s == "sizer") tp = HANDLER_SIZER;
|
||||
else if (s == "sizeritem") tp = HANDLER_SIZERITEM;
|
||||
else if (s == "panel") tp = HANDLER_PANEL;
|
||||
else if (s == "notebook") tp = HANDLER_NOTEBOOK;
|
||||
else if (s == "notebookpage") tp = HANDLER_NOTEBOOKPAGE;
|
||||
else /*if (s == "normal")*/ tp = HANDLER_NORMAL;
|
||||
}
|
||||
else if (s == "var")
|
||||
@ -98,7 +100,8 @@ void NodeInfo::Read(const wxString& filename)
|
||||
else if (typ == "flags") pi.Type = PROP_FLAGS;
|
||||
else if (typ == "bool") pi.Type = PROP_BOOL;
|
||||
else if (typ == "integer") pi.Type = PROP_INTEGER;
|
||||
else if (typ == "coord") pi.Type = PROP_COORD;
|
||||
else if (typ == "coord") pi.Type = PROP_COORD;
|
||||
else if (typ == "not_implemented") pi.Type = PROP_NOT_IMPLEMENTED;
|
||||
else /*if (typ == "text")*/ pi.Type = PROP_TEXT;
|
||||
|
||||
bool fnd = FALSE;
|
||||
@ -153,6 +156,12 @@ NodeHandler *NodeHandler::CreateFromFile(const wxString& filename, EditorFrame *
|
||||
case HANDLER_SIZERITEM:
|
||||
hnd = new NodeHandlerSizerItem(frame, ni);
|
||||
break;
|
||||
case HANDLER_NOTEBOOK:
|
||||
hnd = new NodeHandlerNotebook(frame, ni);
|
||||
break;
|
||||
case HANDLER_NOTEBOOKPAGE:
|
||||
hnd = new NodeHandlerNotebookPage(frame, ni);
|
||||
break;
|
||||
default:
|
||||
hnd = new NodeHandler(frame, ni);
|
||||
break;
|
||||
@ -186,6 +195,7 @@ void NodeHandler::CreatePropHandlers()
|
||||
s_PropHandlers[PROP_BOOL] = new BoolPropertyHandler;
|
||||
s_PropHandlers[PROP_INTEGER] = new TextPropertyHandler;
|
||||
s_PropHandlers[PROP_COORD] = new CoordPropertyHandler;
|
||||
s_PropHandlers[PROP_NOT_IMPLEMENTED] = new NotImplPropertyHandler;
|
||||
}
|
||||
|
||||
|
||||
@ -373,8 +383,13 @@ void NodeHandlerSizer::InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode
|
||||
|
||||
int NodeHandlerSizer::GetTreeIcon(wxXmlNode *node)
|
||||
{
|
||||
if (XmlReadValue(node, "orient") == "wxVERTICAL") return 2;
|
||||
else return 3;
|
||||
int orig = NodeHandler::GetTreeIcon(node);
|
||||
if (orig == 0)
|
||||
{
|
||||
if (XmlReadValue(node, "orient") == "wxVERTICAL") return 2;
|
||||
else return 3;
|
||||
}
|
||||
else return orig;
|
||||
}
|
||||
|
||||
|
||||
@ -435,3 +450,31 @@ wxXmlNode *NodeHandlerSizerItem::GetRealNode(wxXmlNode *node)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void NodeHandlerNotebook::InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before)
|
||||
{
|
||||
wxXmlNode *cnd = XmlFindNode(parent, "children");
|
||||
if (cnd == NULL)
|
||||
{
|
||||
cnd = new wxXmlNode(wxXML_ELEMENT_NODE, "children");
|
||||
parent->AddChild(cnd);
|
||||
}
|
||||
|
||||
{
|
||||
wxXmlNode *itemnode = new wxXmlNode(wxXML_ELEMENT_NODE, "notebookpage");
|
||||
wxXmlNode *winnode = new wxXmlNode(wxXML_ELEMENT_NODE, "window");
|
||||
itemnode->AddChild(winnode);
|
||||
winnode->AddChild(node);
|
||||
|
||||
if (insert_before)
|
||||
cnd->InsertChild(itemnode, insert_before);
|
||||
else
|
||||
cnd->AddChild(itemnode);
|
||||
}
|
||||
EditorFrame::Get()->NotifyChanged(CHANGED_TREE);
|
||||
}
|
||||
|
@ -33,7 +33,9 @@ enum HandlerType
|
||||
HANDLER_PANEL = 1,
|
||||
HANDLER_NORMAL,
|
||||
HANDLER_SIZER,
|
||||
HANDLER_SIZERITEM
|
||||
HANDLER_SIZERITEM,
|
||||
HANDLER_NOTEBOOK,
|
||||
HANDLER_NOTEBOOKPAGE
|
||||
};
|
||||
|
||||
|
||||
@ -125,6 +127,26 @@ class NodeHandlerSizerItem : public NodeHandler
|
||||
|
||||
|
||||
|
||||
// wxNotebook handler
|
||||
class NodeHandlerNotebook : public NodeHandlerPanel
|
||||
{
|
||||
public:
|
||||
NodeHandlerNotebook(EditorFrame *frame, NodeInfo *ni) : NodeHandlerPanel(frame, ni) {}
|
||||
|
||||
virtual void InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before = NULL);
|
||||
};
|
||||
|
||||
|
||||
// notebook page handler
|
||||
class NodeHandlerNotebookPage : public NodeHandlerSizerItem
|
||||
{
|
||||
public:
|
||||
NodeHandlerNotebookPage(EditorFrame *frame, NodeInfo *ni) :
|
||||
NodeHandlerSizerItem(frame, ni) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Generic handler which handles everything
|
||||
class NodeHandlerUnknown : public NodeHandler
|
||||
{
|
||||
|
@ -331,3 +331,17 @@ wxPanel *FlagsPropertyHandler::CreateEditPanel(wxWindow *parent, PropsListInfo *
|
||||
{
|
||||
return new FlagsPropPanel(parent, this, pli);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
wxPanel *NotImplPropertyHandler::CreateEditPanel(wxWindow *parent, PropsListInfo *pli)
|
||||
{
|
||||
wxPanel *p = new wxPanel(parent);
|
||||
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(new wxStaticText(p, -1, _("Sorry, this is not supported.\nYou have to edit XML code directly.")), 1, wxEXPAND|wxALL, 5);
|
||||
p->SetAutoLayout(TRUE);
|
||||
p->SetSizer(sizer);
|
||||
p->Layout();
|
||||
return p;
|
||||
}
|
||||
|
@ -31,9 +31,10 @@ enum PropertyType
|
||||
PROP_COLOR = 2,
|
||||
PROP_BOOL = 3,
|
||||
PROP_INTEGER = 4,
|
||||
PROP_COORD = 5
|
||||
PROP_COORD = 5,
|
||||
PROP_NOT_IMPLEMENTED = 6,
|
||||
};
|
||||
#define PROP_TYPES_CNT 6
|
||||
#define PROP_TYPES_CNT 7
|
||||
|
||||
class PropertyInfo
|
||||
{
|
||||
@ -113,4 +114,13 @@ class FlagsPropertyHandler : public PropertyHandler
|
||||
};
|
||||
|
||||
|
||||
|
||||
class NotImplPropertyHandler : public PropertyHandler
|
||||
{
|
||||
public:
|
||||
NotImplPropertyHandler() {}
|
||||
virtual wxPanel *CreateEditPanel(wxWindow *parent, PropsListInfo *pli);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user