From 7e206f11b47463901c9b952cfe766566d1a3acc3 Mon Sep 17 00:00:00 2001 From: gouldtj Date: Wed, 29 Mar 2006 05:42:22 +0000 Subject: [PATCH] r10987@tres: ted | 2006-02-28 01:06:37 -0800 The leg bone is connected to the knee bone The extension bone is connected to the extension-editor bone --- src/extension/extension.cpp | 27 +++++++++++++ src/extension/extension.h | 7 ++++ src/ui/dialog/extension-editor.cpp | 65 +++++++++++++++++++++++++++--- src/ui/dialog/extension-editor.h | 22 +++++++--- 4 files changed, 110 insertions(+), 11 deletions(-) diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 62f590be3..03b12e0a1 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -23,6 +23,7 @@ #include #include +#include #include "inkscape.h" #include "extension/implementation/implementation.h" @@ -624,6 +625,32 @@ Extension::paramString (void) return param_string; } +/* Extension editor dialog stuff */ + +Gtk::Widget * +Extension::get_info_widget(void) +{ + Gtk::Widget * retval = Gtk::manage(new Gtk::Label("Info")); + retval->show(); + return retval; +} + +Gtk::Widget * +Extension::get_help_widget(void) +{ + Gtk::Widget * retval = Gtk::manage(new Gtk::Label("Help")); + retval->show(); + return retval; +} + +Gtk::Widget * +Extension::get_params_widget(void) +{ + Gtk::Widget * retval = Gtk::manage(new Gtk::Label("Params")); + retval->show(); + return retval; +} + } /* namespace Extension */ } /* namespace Inkscape */ diff --git a/src/extension/extension.h b/src/extension/extension.h index b4e730452..62d455fcf 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -169,6 +169,13 @@ public: public: Gtk::Widget * autogui (void); Glib::ustring * paramString (void); + + /* Extension editor dialog stuff */ +public: + Gtk::Widget * get_info_widget(void); + Gtk::Widget * get_help_widget(void); + Gtk::Widget * get_params_widget(void); + }; diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index 7cbde9e1f..ed9d020c7 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -24,6 +24,7 @@ #include "extension-editor.h" #include "verbs.h" #include "prefs-utils.h" +#include "interface.h" #include "extension/extension.h" #include "extension/db.h" @@ -44,6 +45,9 @@ namespace Dialog { ExtensionEditor::ExtensionEditor() : Dialog ("dialogs.extensioneditor", SP_VERB_DIALOG_EXTENSIONEDITOR) { + _notebook_info.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + _notebook_help.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + _notebook_params.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); //Main HBox Gtk::HBox* hbox_list_page = Gtk::manage(new Gtk::HBox()); @@ -125,14 +129,61 @@ ExtensionEditor::on_pagelist_selection_changed (void) Glib::RefPtr selection = _page_list.get_selection(); Gtk::TreeModel::iterator iter = selection->get_selected(); if (iter) { - // _page_frame.remove(); + /* Get the row info */ Gtk::TreeModel::Row row = *iter; - // _current_page = row[_page_list_columns._col_page]; - // _page_title.set_markup("" + row[_page_list_columns._col_name] + ""); - // _page_frame.add(*_current_page); - // _current_page->show(); Glib::ustring id = row[_page_list_columns._col_id]; + Glib::ustring name = row[_page_list_columns._col_name]; + + /* Set the selection in the preferences */ prefs_set_string_attribute("dialogs.extensioneditor", "selected-extension", id.c_str()); + + /* Adjust the dialog's title */ + gchar title[500]; + sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_EXTENSIONEDITOR), title); + Glib::ustring utitle(title); + set_title(utitle + ": " + name); + + /* Clear the notbook pages */ + _notebook_info.remove(); + _notebook_help.remove(); + _notebook_params.remove(); + + /* Make sure we have all the widges */ + Gtk::Widget * info; + info = row[_page_list_columns._col_info]; + if (info == NULL) { + info = Inkscape::Extension::db.get(id.c_str())->get_info_widget(); + row[_page_list_columns._col_info] = info; + //info->ref(); + } + + Gtk::Widget * help; + help = row[_page_list_columns._col_help]; + if (help == NULL) { + help = Inkscape::Extension::db.get(id.c_str())->get_help_widget(); + row[_page_list_columns._col_help] = help; + //help->ref(); + } + + Gtk::Widget * params; + params = row[_page_list_columns._col_params]; + if (params == NULL) { + params = Inkscape::Extension::db.get(id.c_str())->get_params_widget(); + row[_page_list_columns._col_params] = params; + //params->ref(); + } + + /* Place them in the pages */ + if (info != NULL) { + _notebook_info.add(*info); + } + if (help != NULL) { + _notebook_help.add(*help); + } + if (params != NULL) { + _notebook_params.add(*params); + } + } return; @@ -174,7 +225,9 @@ ExtensionEditor::add_extension (Inkscape::Extension::Extension * ext) Gtk::TreeModel::Row row = *iter; row[_page_list_columns._col_name] = ext->get_name(); row[_page_list_columns._col_id] = ext->get_id(); - row[_page_list_columns._col_page] = NULL; + row[_page_list_columns._col_info] = NULL; + row[_page_list_columns._col_help] = NULL; + row[_page_list_columns._col_params] = NULL; return iter; } diff --git a/src/ui/dialog/extension-editor.h b/src/ui/dialog/extension-editor.h index 65eb0c97e..7fb6e87a5 100644 --- a/src/ui/dialog/extension-editor.h +++ b/src/ui/dialog/extension-editor.h @@ -21,6 +21,7 @@ #include #include #include +#include #include "extension/extension.h" @@ -43,23 +44,34 @@ protected: /** \brief The model for the list of extensions */ Glib::RefPtr _page_list_model; /** \brief The notebook page that contains information */ - Gtk::VBox _notebook_info; + Gtk::ScrolledWindow _notebook_info; /** \brief The notebook page that contains help info */ - Gtk::VBox _notebook_help; + Gtk::ScrolledWindow _notebook_help; /** \brief The notebook page that holds all the parameters */ - Gtk::VBox _notebook_params; + Gtk::ScrolledWindow _notebook_params; //Pagelist model columns: class PageListModelColumns : public Gtk::TreeModel::ColumnRecord { public: + /** \brief Creates the Page List model by adding all of the + members of the class as column records. */ PageListModelColumns() { Gtk::TreeModelColumnRecord::add(_col_name); - Gtk::TreeModelColumnRecord::add(_col_page); Gtk::TreeModelColumnRecord::add(_col_id); + Gtk::TreeModelColumnRecord::add(_col_info); + Gtk::TreeModelColumnRecord::add(_col_help); + Gtk::TreeModelColumnRecord::add(_col_params); } + /** \brief Name of the extension */ Gtk::TreeModelColumn _col_name; + /** \brief ID of the extension */ Gtk::TreeModelColumn _col_id; - Gtk::TreeModelColumn _col_page; + /** \brief Info widget for the extension (NULL if unset) */ + Gtk::TreeModelColumn _col_info; + /** \brief Help widget for the extension (NULL if unset) */ + Gtk::TreeModelColumn _col_help; + /** \brief Parameters list of the extension (NULL if unset) */ + Gtk::TreeModelColumn _col_params; }; PageListModelColumns _page_list_columns; -- 2.30.2