paramnotebook.cpp revision 282963165a505f1e709cf741fb2825b6a78cdd6c
* Notebook and NotebookPage parameters for extensions. * Johan Engelen <johan@shouraizou.nl> * Copyright (C) 2006 Author * Released under GNU GPL, read the file 'COPYING' for more information /** \brief The root directory in the preferences database for extension // \brief A class to represent the pages of a notebookparameter of an extension This only gets created if there are parameters on this };
/* class ParamNotebookPage */ // Read XML to build page if (
chname[0] ==
'_')
// Allow _ for translation of tags \brief A function to get the subparameters in a string form \return An array with all the subparameters in it. Look how this closely resembles Extension::paramListString \brief This function creates a page that can be used later. This is typically done in the creation of the notebook and defined in the XML file describing the extension (it's private so people have to use the system) :) \param in_repr The XML describing the page This function first grabs all of the data out of the Repr and puts it into local variables. Actually, these are just pointers, and the data is not duplicated so we need to be careful with it. If there isn't a name in the XML, then no page is created as the function just returns. From this point on, we're pretty committed as we've allocated an object and we're starting to fill it. The name is set first, and is created with a strdup to actually allocate memory for it. Then there is a case statement (roughly because strcmp requires 'ifs') based on what type of parameter this is. Depending which type it is, the value is interpreted differently, but they are relatively straight forward. In all cases the value is set to the default value from the XML and the type is set to the interpreted type. /* In this case we just don't have enough information */ /* Note: page could equal NULL */ \brief Creates a notebookpage widget for a notebook Builds a notebook page (a vbox) and puts parameters on it. // add parameters onto page (if any) // Read XML tree to add pages: if (
chname[0] ==
'_')
// Allow _ for translation of tags // Initialize _value with the current page // set first page as default /** \brief A function to set the \c _value \param in The number of the page which value must be set \param doc A document that should be used to set the value. \param node The node where the value may be placed This function sets the internal value, but it also sets the value in the preferences structure. To put it in the right place, \c PREF_DIR and \c pref_name() are used. To copy the data into _value the old memory must be free'd first. It is important to note that \c g_free handles \c NULL just fine. Then the passed in value is duplicated using \c g_strdup(). \brief A function to get the currentpage in a string form \return A string with the 'value' \brief A function to get the subparameters in a string form \return An array with all the subparameters in it. /** \brief A special category of Gtk::Notebook to handle notebook parameters */ /** \brief Build a notebookpage preference for the given parameter \param pref Where to get the string (pagename) from, and where to put it // don't have to set the correct page: this is done in ParamNotebook::get_widget. /** \brief Respond to the selected page of notebook changing This function responds to the changing by reporting it to ParamNotebook. The change is only reported when the notebook is actually visible. This to exclude 'fake' changes when the notebookpages are added or removed. \brief Creates a Notebook widget for a notebook parameter Builds a notebook and puts pages in it. pagenr = i;
// this is the page to be displayed? }
/* namespace Extension */}
/* namespace Inkscape */ c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :