/** \file
* Notebook and NotebookPage parameters for extensions.
*/
/*
* Authors:
* Johan Engelen <johan@shouraizou.nl>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2006 Author
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gtkmm/adjustment.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/notebook.h>
#include <extension/extension.h>
#include "preferences.h"
#include "document-private.h"
#include "sp-object.h"
#include "notebook.h"
/**
* The root directory in the preferences database for extension
* related parameters.
*/
namespace Inkscape {
namespace Extension {
/**
* A class to represent the pages of a notebookparameter of an extension.
*/
private:
This only gets created if there are parameters on this
page */
public:
static ParamNotebookPage * makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext);
ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
~ParamNotebookPage(void);
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
}; /* class ParamNotebookPage */
ParamNotebookPage::ParamNotebookPage (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
{
parameters = NULL;
// Read XML to build page
while (child_repr != NULL) {
}
chname++;
}
}
}
}
ParamNotebookPage::~ParamNotebookPage (void)
{
//destroy parameters
delete param;
}
}
/** Return the value as a string. */
{
}
}
/**
\return None
\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
\todo the 'gui-hidden' attribute is read but not used!
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.
*/
ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext)
{
const char * name;
const char * guitext;
const char * desc;
const char * scope_str;
bool gui_hidden = false;
const char * gui_hide;
const char * gui_tip;
gui_hidden = true;
}
/* else stays false */
}
/* In this case we just don't have enough information */
return NULL;
}
}
}
ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
/* Note: page could equal NULL */
return page;
}
/**
* Creates a notebookpage widget for a notebook.
*
* Builds a notebook page (a vbox) and puts parameters on it.
*/
Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
if (_gui_hidden) {
return NULL;
}
// add parameters onto page (if any)
if (widg) {
// printf("Tip: '%s'\n", tip);
if (tip) {
} else {
widg->set_has_tooltip(false);
}
}
}
}
ParamNotebook::ParamNotebook (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
{
// Read XML tree to add pages:
while (child_repr != NULL) {
}
chname++;
}
}
}
// Initialize _value with the current page
// set first page as default
}
if (defaultval != NULL)
}
ParamNotebook::~ParamNotebook (void)
{
//destroy pages
delete page;
}
}
/**
* A function to set the \c _value.
*
* 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().
*
* @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.
*/
{
int i = 0;
i++;
}
return _value;
}
{
param_string += "--";
param_string += name();
param_string += "=";
param_string += "\"";
param_string += "\"";
}
}
/** A special category of Gtk::Notebook to handle notebook parameters. */
private:
public:
/**
* Build a notebookpage preference for the given parameter.
* @param pref Where to get the string (pagename) from, and where to put it
* when it changes.
*/
// don't have to set the correct page: this is done in ParamNotebook::get_widget.
// hook function
};
#if WITH_GTKMM_3_0
#else
#endif
bool activated;
};
/**
* 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.
*/
#if WITH_GTKMM_3_0
#else
#endif
{
if (get_visible()) {
}
}
/** Search the parameter's name in the notebook content. */
{
throw Extension::param_not_exist();
}
if (subparam) {
return subparam;
}
}
return NULL;
}
/** Search the parameter's name in the page content. */
{
throw Extension::param_not_exist();
}
if (this->parameters == NULL) {
// the list of parameters is empty
throw Extension::param_not_exist();
}
return param;
}
}
return NULL;
}
/**
* Creates a Notebook widget for a notebook parameter.
*
* Builds a notebook and puts pages in it.
*/
Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
if (_gui_hidden) {
return NULL;
}
// add pages (if any)
int i = -1;
int pagenr = i;
i++;
pagenr = i; // this is the page to be displayed?
}
}
}
} // namespace Extension
} // namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :