X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ab13d1c58fb0fe0306668762aa25ebc470d2f4f4..b008b592cce934305dfa2eaaae0cd824b0d1e1cb:/contrib/utils/wxrcedit/nodehnd.cpp diff --git a/contrib/utils/wxrcedit/nodehnd.cpp b/contrib/utils/wxrcedit/nodehnd.cpp index 6dbe037caa..190cd00f4e 100644 --- a/contrib/utils/wxrcedit/nodehnd.cpp +++ b/contrib/utils/wxrcedit/nodehnd.cpp @@ -44,19 +44,25 @@ void NodeInfo::Read(const wxString& filename) Node.Empty(); wxPathList list; + // if modifying, don't forget to modify it in all places -- + // search for wxINSTALL_PREFIX in editor.cpp list.Add("."); list.Add("./df"); - #ifdef __UNIX__ +#ifdef __UNIX__ list.Add(wxGetHomeDir() + "/.wxrcedit"); + #ifdef wxINSTALL_PREFIX + list.Add(wxINSTALL_PREFIX "/share/wx/wxrcedit"); #endif +#endif wxString path = list.FindValidPath(filename); if (path.IsEmpty()) return; wxTextFile tf; tf.Open(path); - if (!tf.IsOpened()) return; + if (!tf.IsOpened()) return; + for (size_t i = 0; i < tf.GetLineCount(); i++) { if (tf[i].IsEmpty() || tf[i][0] == '#') continue; @@ -96,11 +102,14 @@ void NodeInfo::Read(const wxString& filename) tkn.GetNextToken(); wxString typ = tkn.GetNextToken(); if (tkn.HasMoreTokens()) pi.MoreInfo = tkn.GetNextToken(); + /* ADD NEW PROPERTY TYPES HERE + (search for other occurences of this comment in _all_ files) */ if (typ == "color") pi.Type = PROP_COLOR; 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 == "dimension") pi.Type = PROP_DIMENSION; else if (typ == "not_implemented") pi.Type = PROP_NOT_IMPLEMENTED; else /*if (typ == "text")*/ pi.Type = PROP_TEXT; @@ -189,12 +198,15 @@ NodeHandler::NodeHandler(EditorFrame *frame, NodeInfo *ni) : void NodeHandler::CreatePropHandlers() { + /* ADD NEW PROPERTY TYPES HERE + (search for other occurences of this comment in _all_ files) */ s_PropHandlers[PROP_TEXT] = new TextPropertyHandler; s_PropHandlers[PROP_FLAGS] = new FlagsPropertyHandler; s_PropHandlers[PROP_COLOR] = new TextPropertyHandler; s_PropHandlers[PROP_BOOL] = new BoolPropertyHandler; s_PropHandlers[PROP_INTEGER] = new TextPropertyHandler; s_PropHandlers[PROP_COORD] = new CoordPropertyHandler; + s_PropHandlers[PROP_DIMENSION] = new DimensionPropertyHandler; s_PropHandlers[PROP_NOT_IMPLEMENTED] = new NotImplPropertyHandler; } @@ -357,7 +369,7 @@ void NodeHandlerSizer::InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode parent->AddChild(cnd); } - if (node->GetName() == "spacer") + if (node->GetName() == "spacer" || node->GetName() == "sizeritem") { if (insert_before) cnd->InsertChild(node, insert_before); @@ -466,10 +478,17 @@ void NodeHandlerNotebook::InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNo } { - wxXmlNode *itemnode = new wxXmlNode(wxXML_ELEMENT_NODE, "notebookpage"); - wxXmlNode *winnode = new wxXmlNode(wxXML_ELEMENT_NODE, "window"); - itemnode->AddChild(winnode); - winnode->AddChild(node); + wxXmlNode *itemnode; + + if (node->GetName() == "notebookpage") + itemnode = node; + else + { + 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);