~inkscape.dev/inkscape/lpeUpdDefaultParams

« back to all changes in this revision

Viewing changes to src/extension/param/notebook.cpp

  • Committer: jabiertxof
  • Date: 2017-04-26 09:16:33 UTC
  • mfrom: (15620.1.25 inkscape)
  • Revision ID: info@marker.es-20170426091633-woqwltm0wwbup0if
Update to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
    static ParamNotebookPage * makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext);
56
56
 
57
57
    ParamNotebookPage(const gchar * name,
58
 
                      const gchar * guitext,
59
 
                      const gchar * desc,
60
 
                      const Parameter::_scope_t scope,
61
 
                      bool gui_hidden,
62
 
                      const gchar * gui_tip,
 
58
                      const gchar * text,
 
59
                      const gchar * description,
 
60
                      bool hidden,
63
61
                      Inkscape::Extension::Extension * ext,
64
62
                      Inkscape::XML::Node * xml);
65
63
    ~ParamNotebookPage(void);
66
64
 
67
65
    Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
68
66
    void paramString (std::list <std::string> &list);
69
 
    gchar * get_guitext (void) {return _text;};
 
67
    gchar * get_text (void) {return _text;};
70
68
    Parameter * get_param (const gchar * name);
71
69
}; /* class ParamNotebookPage */
72
70
 
73
71
 
74
72
ParamNotebookPage::ParamNotebookPage(const gchar * name,
75
 
                                     const gchar * guitext,
76
 
                                     const gchar * desc,
77
 
                                     const Parameter::_scope_t scope,
78
 
                                     bool gui_hidden,
79
 
                                     const gchar * gui_tip,
 
73
                                     const gchar * text,
 
74
                                     const gchar * description,
 
75
                                     bool hidden,
80
76
                                     Inkscape::Extension::Extension * ext,
81
77
                                     Inkscape::XML::Node * xml)
82
 
    : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, /*indent*/ 0, ext)
 
78
    : Parameter(name, text, description, hidden, /*indent*/ 0, ext)
83
79
{
84
80
    parameters = NULL;
85
81
 
151
147
ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext)
152
148
{
153
149
    const char * name;
154
 
    const char * guitext;
155
 
    const char * desc;
156
 
    const char * scope_str;
157
 
    Parameter::_scope_t scope = Parameter::SCOPE_USER;
158
 
    bool gui_hidden = false;
159
 
    const char * gui_hide;
160
 
    const char * gui_tip;
 
150
    const char * text;
 
151
    const char * description;
 
152
    bool hidden = false;
 
153
    const char * hide;
161
154
 
162
155
    name = in_repr->attribute("name");
163
 
    guitext = in_repr->attribute("gui-text");
164
 
    if (guitext == NULL)
165
 
        guitext = in_repr->attribute("_gui-text");
166
 
    gui_tip = in_repr->attribute("gui-tip");
167
 
    if (gui_tip == NULL)
168
 
        gui_tip = in_repr->attribute("_gui-tip");
169
 
    desc = in_repr->attribute("gui-description");
170
 
    if (desc == NULL)
171
 
        desc = in_repr->attribute("_gui-description");
172
 
    scope_str = in_repr->attribute("scope");
173
 
    gui_hide = in_repr->attribute("gui-hidden");
174
 
    if (gui_hide != NULL) {
175
 
        if (strcmp(gui_hide, "1") == 0 ||
176
 
            strcmp(gui_hide, "true") == 0) {
177
 
                gui_hidden = true;
 
156
    text = in_repr->attribute("gui-text");
 
157
    if (text == NULL)
 
158
        text = in_repr->attribute("_gui-text");
 
159
    description = in_repr->attribute("gui-description");
 
160
    if (description == NULL)
 
161
        description = in_repr->attribute("_gui-description");
 
162
    hide = in_repr->attribute("gui-hidden");
 
163
    if (hide != NULL) {
 
164
        if (strcmp(hide, "1") == 0 ||
 
165
            strcmp(hide, "true") == 0) {
 
166
                hidden = true;
178
167
        }
179
168
        /* else stays false */
180
169
    }
184
173
        return NULL;
185
174
    }
186
175
 
187
 
    if (scope_str != NULL) {
188
 
        if (!strcmp(scope_str, "user")) {
189
 
            scope = Parameter::SCOPE_USER;
190
 
        } else if (!strcmp(scope_str, "document")) {
191
 
            scope = Parameter::SCOPE_DOCUMENT;
192
 
        } else if (!strcmp(scope_str, "node")) {
193
 
            scope = Parameter::SCOPE_NODE;
194
 
        }
195
 
    }
196
 
 
197
 
    ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
 
176
    ParamNotebookPage * page = new ParamNotebookPage(name, text, description, hidden, in_ext, in_repr);
198
177
 
199
178
    /* Note: page could equal NULL */
200
179
    return page;
209
188
 */
210
189
Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
211
190
{
212
 
    if (_gui_hidden) {
 
191
    if (_hidden) {
213
192
        return NULL;
214
193
    }
215
194
 
232
211
 
233
212
            gchar const * tip = param->get_tooltip();
234
213
            if (tip) {
235
 
                widg->set_tooltip_text(_(tip));
 
214
                widg->set_tooltip_text(tip);
236
215
            } else {
237
216
                widg->set_tooltip_text("");
238
217
                widg->set_has_tooltip(false);
247
226
 
248
227
 
249
228
ParamNotebook::ParamNotebook(const gchar * name,
250
 
                             const gchar * guitext,
251
 
                             const gchar * desc,
252
 
                             const Parameter::_scope_t scope,
253
 
                             bool gui_hidden,
254
 
                             const gchar * gui_tip,
 
229
                             const gchar * text,
 
230
                             const gchar * description,
 
231
                             bool hidden,
255
232
                             int indent,
256
233
                             Inkscape::Extension::Extension * ext,
257
234
                             Inkscape::XML::Node * xml)
258
 
    : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
 
235
    : Parameter(name, text, description, hidden, indent, ext)
259
236
{
260
237
    pages = NULL;
261
238
 
446
423
 */
447
424
Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
448
425
{
449
 
    if (_gui_hidden) {
 
426
    if (_hidden) {
450
427
        return NULL;
451
428
    }
452
429
 
459
436
        i++;
460
437
        ParamNotebookPage * page = reinterpret_cast<ParamNotebookPage *>(list->data);
461
438
        Gtk::Widget * widg = page->get_widget(doc, node, changeSignal);
462
 
        nb->append_page(*widg, _(page->get_guitext()));
 
439
        nb->append_page(*widg, _(page->get_text()));
463
440
        if (!strcmp(_value, page->name())) {
464
441
            pagenr = i; // this is the page to be displayed?
465
442
        }