parameter.cpp revision bb62b737388ed0e8c6adbf93a224d25df4197d32
/** @file
* Parameters for extensions.
*/
/* Author:
* Ted Gould <ted@gould.cx>
* Johan Engelen <johan@shouraizou.nl>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2005-2007 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef linux // does the dollar sign need escaping when passed as string parameter?
# define ESCAPE_DOLLAR_COMMANDLINE
#endif
#include <cstring>
#include "ui/widget/color-notebook.h"
#include <extension/extension.h>
#include "document-private.h"
#include "sp-object.h"
#include <color.h>
#include "parameter.h"
#include "bool.h"
#include "color.h"
#include "description.h"
#include "enum.h"
#include "float.h"
#include "int.h"
#include "notebook.h"
#include "radiobutton.h"
#include "string.h"
namespace Inkscape {
namespace Extension {
{
// In this case we just don't have enough information
return NULL;
}
}
}
}
bool gui_hidden = false;
{
gui_hidden = true;
}
/* else stays false */
}
}
{
}
}
}
param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::FULL);
} else {
param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::MINIMAL);
}
param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::FULL);
} else {
param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::MINIMAL);
}
if (max_length != NULL) {
}
param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamDescription::HEADER);
} else {
param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamDescription::DESC);
}
param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamRadioButton::MINIMAL);
} else {
param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamRadioButton::FULL);
}
}
// Note: param could equal NULL
return param;
}
{
if (!boolpntr) {
throw Extension::param_not_bool_param();
}
}
{
if (!intpntr) {
throw Extension::param_not_int_param();
}
}
{
if (!floatpntr) {
throw Extension::param_not_float_param();
}
}
{
if (!stringpntr) {
throw Extension::param_not_string_param();
}
}
{
if (!param) {
throw Extension::param_not_enum_param();
}
}
bool Parameter::get_enum_contains(gchar const * value, SPDocument const *doc, Inkscape::XML::Node const *node) const
{
if (!param) {
throw Extension::param_not_enum_param();
}
}
gchar const *Parameter::get_optiongroup(SPDocument const *doc, Inkscape::XML::Node const * node) const
{
if (!param) {
throw Extension::param_not_optiongroup_param();
}
}
{
if (!param) {
throw Extension::param_not_color_param();
}
}
{
throw Extension::param_not_bool_param();
}
{
throw Extension::param_not_int_param();
}
/** Wrapper to cast to the object and use it's function. */
float
{
floatpntr = dynamic_cast<ParamFloat *>(this);
throw Extension::param_not_float_param();
}
/** Wrapper to cast to the object and use it's function. */
gchar const *
{
if (stringpntr == NULL)
throw Extension::param_not_string_param();
}
gchar const * Parameter::set_optiongroup( gchar const * in, SPDocument * doc, Inkscape::XML::Node * node )
{
if (!param) {
throw Extension::param_not_optiongroup_param();
}
}
{
if (!param) {
throw Extension::param_not_enum_param();
}
}
/** Wrapper to cast to the object and use it's function. */
{
throw Extension::param_not_color_param();
}
/** Oop, now that we need a parameter, we need it's name. */
Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, const Parameter::_scope_t scope, bool gui_hidden, gchar const * gui_tip, Inkscape::Extension::Extension * ext) :
_desc(0),
_text(0),
_gui_tip(0),
_name(0)
{
}
// printf("Adding description: '%s' on '%s'\n", _desc, _name);
}
}
} else {
}
return;
}
/** Oop, now that we need a parameter, we need it's name. */
Parameter::Parameter (gchar const * name, gchar const * guitext, Inkscape::Extension::Extension * ext) :
_desc(0),
_text(0),
_gui_hidden(false),
_gui_tip(0),
_name(0)
{
}
} else {
}
return;
}
{
_name = 0;
_text = 0;
_gui_tip = 0;
_desc = 0;
}
{
}
{
}
{
return retval;
}
{
break;
}
}
}
return params;
}
/** Basically, if there is no widget pass a NULL. */
Parameter::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
{
return NULL;
}
/** If I'm not sure which it is, just don't return a value. */
{
// TODO investigate clearing the target string.
}
{
final += "--";
final += "=";
}
}
{
return NULL;
}
} // 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 :