X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Fdialog%2Fextension-editor.cpp;h=3a62cb14481b317edda67427a18685b570c273f0;hb=11a7559367dd1824198fe3b75e6d6ceb208ea1b7;hp=e20ac4592f496416bfff8c4c228e90c5f094abea;hpb=c47db518665af33740abca94a7ed735a4b4d8222;p=inkscape.git diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index e20ac4592..3a62cb144 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -14,13 +14,17 @@ # include #endif +#include + #include #include #include +#include #include "extension-editor.h" #include "verbs.h" #include "prefs-utils.h" +#include "interface.h" #include "extension/extension.h" #include "extension/db.h" @@ -38,9 +42,12 @@ namespace Dialog { about the selected extension. A handler is set up so that when a new extension is selected, the notebooks are changed appropriately. */ -ExtensionEditor::ExtensionEditor() - : Dialog ("dialogs.extensioneditor", SP_VERB_DIALOG_EXTENSIONEDITOR) +ExtensionEditor::ExtensionEditor(Behavior::BehaviorFactory behavior_factory) + : Dialog (behavior_factory, "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()); @@ -68,13 +75,12 @@ ExtensionEditor::ExtensionEditor() //Pages Gtk::VBox* vbox_page = Gtk::manage(new Gtk::VBox()); - Gtk::Frame* title_frame = Gtk::manage(new Gtk::Frame()); hbox_list_page->pack_start(*vbox_page, true, true, 0); - title_frame->add(_page_title); - vbox_page->pack_start(*title_frame, false, false, 0); - vbox_page->pack_start(_page_frame, true, true, 0); - _page_frame.set_shadow_type(Gtk::SHADOW_IN); - title_frame->set_shadow_type(Gtk::SHADOW_IN); + Gtk::Notebook * notebook = Gtk::manage(new Gtk::Notebook()); + notebook->append_page(_notebook_info, *Gtk::manage(new Gtk::Label(_("Information")))); + notebook->append_page(_notebook_help, *Gtk::manage(new Gtk::Label(_("Help")))); + notebook->append_page(_notebook_params, *Gtk::manage(new Gtk::Label(_("Parameters")))); + vbox_page->pack_start(*notebook, true, true, 0); Inkscape::Extension::db.foreach(dbfunc, this); @@ -123,14 +129,49 @@ 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(); + + Inkscape::Extension::Extension * ext = Inkscape::Extension::db.get(id.c_str()); + + /* Make sure we have all the widges */ + Gtk::Widget * info = NULL; + Gtk::Widget * help = NULL; + Gtk::Widget * params = NULL; + + if (ext != NULL) { + info = ext->get_info_widget(); + help = ext->get_help_widget(); + params = ext->get_params_widget(); + } + + /* 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; @@ -150,7 +191,7 @@ ExtensionEditor::on_pagelist_selection_changed (void) void ExtensionEditor::dbfunc (Inkscape::Extension::Extension * in_plug, gpointer in_data) { - ExtensionEditor * ee = reinterpret_cast(in_data); + ExtensionEditor * ee = static_cast(in_data); ee->add_extension(in_plug); return; } @@ -172,7 +213,6 @@ 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; return iter; }