~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/extension/param/description.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2005-2007 Authors:
 
3
 *   Ted Gould <ted@gould.cx>
 
4
 *   Johan Engelen <johan@shouraizou.nl> *
 
5
 * Released under GNU GPL, read the file 'COPYING' for more information
 
6
 */
 
7
 
 
8
#ifdef linux  // does the dollar sign need escaping when passed as string parameter?
 
9
# define ESCAPE_DOLLAR_COMMANDLINE
 
10
#endif
 
11
 
 
12
#ifdef HAVE_CONFIG_H
 
13
# include "config.h"
 
14
#endif
 
15
 
 
16
 
 
17
#include "description.h"
 
18
 
 
19
#include <gtkmm/adjustment.h>
 
20
#include <gtkmm/box.h>
 
21
#include <gtkmm/spinbutton.h>
 
22
#include <sstream>
 
23
#include <glibmm/i18n.h>
 
24
 
 
25
#include "xml/node.h"
 
26
#include "extension/extension.h"
 
27
 
 
28
namespace Inkscape {
 
29
namespace Extension {
 
30
 
 
31
 
 
32
/** \brief  Initialize the object, to do that, copy the data. */
 
33
ParamDescription::ParamDescription (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) :
 
34
    Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL)
 
35
{
 
36
    // printf("Building Description\n");
 
37
    const char * defaultval = NULL;
 
38
    if (sp_repr_children(xml) != NULL)
 
39
        defaultval = sp_repr_children(xml)->content();
 
40
 
 
41
    if (defaultval != NULL)
 
42
        _value = g_strdup(defaultval);
 
43
 
 
44
    return;
 
45
}
 
46
 
 
47
/** \brief  Create a label for the description */
 
48
Gtk::Widget *
 
49
ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
 
50
{
 
51
        if (_gui_hidden) return NULL;
 
52
 
 
53
    Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_value)));
 
54
    label->set_line_wrap();
 
55
    label->show();
 
56
 
 
57
    Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
 
58
    hbox->pack_start(*label, true, true, 5);
 
59
    hbox->show();
 
60
 
 
61
    return hbox;
 
62
}
 
63
 
 
64
}  /* namespace Extension */
 
65
}  /* namespace Inkscape */