summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2006-03-29 05:40:43 +0000
committergouldtj <gouldtj@users.sourceforge.net>2006-03-29 05:40:43 +0000
commit6350381229a57e761b97703d411b9697d2934e61 (patch)
treeced84a8633864031017208c75a41a087202e3c4c /src/ui
parentr10952@tres: ted | 2006-02-16 09:17:08 -0800 (diff)
downloadinkscape-6350381229a57e761b97703d411b9697d2934e61.tar.gz
inkscape-6350381229a57e761b97703d411b9697d2934e61.zip
r10953@tres: ted | 2006-02-16 19:24:44 -0800
Making it so that the list of extensions gets into the dialog through a few functions. Now it will list them all, and handle changes. Getting there. (bzr r343)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/extension-editor.cpp85
-rw-r--r--src/ui/dialog/extension-editor.h7
2 files changed, 89 insertions, 3 deletions
diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp
index aca41f6f6..fb8284e63 100644
--- a/src/ui/dialog/extension-editor.cpp
+++ b/src/ui/dialog/extension-editor.cpp
@@ -1,5 +1,5 @@
/**
- * \brief Extension editor
+ * \brief Extension editor dialog
*
* Authors:
* Bryce W. Harrington <bryce@bryceharrington.org>
@@ -20,11 +20,24 @@
#include "extension-editor.h"
#include "verbs.h"
+#include "prefs-utils.h"
+
+#include "extension/extension.h"
+#include "extension/db.h"
namespace Inkscape {
namespace UI {
namespace Dialog {
+/** \brief Create a new ExtensionEditor dialog
+ \return None
+
+ This function creates a new extension editor dialog. The dialog
+ consists of two basic areas. The left side is a tree widget, which
+ is only used as a list. And the right side is a notebook of information
+ 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)
{
@@ -63,14 +76,84 @@ ExtensionEditor::ExtensionEditor()
_page_frame.set_shadow_type(Gtk::SHADOW_IN);
title_frame->set_shadow_type(Gtk::SHADOW_IN);
+ Inkscape::Extension::db.foreach(dbfunc, this);
show_all_children();
}
+/** \brief Destroys the extension editor dialog
+ \return None
+*/
ExtensionEditor::~ExtensionEditor()
{
}
+/** \brief Called every time a new extention is selected
+ \return None
+
+ This function is set up to handle the signal for a changed extension
+ from the tree view in the left pane. It figure out which extension
+ is selected and updates the widgets to have data for that extension.
+*/
+void
+ExtensionEditor::on_pagelist_selection_changed (void)
+{
+ Glib::RefPtr<Gtk::TreeSelection> selection = _page_list.get_selection();
+ Gtk::TreeModel::iterator iter = selection->get_selected();
+ if (iter) {
+ _page_frame.remove();
+ Gtk::TreeModel::Row row = *iter;
+ // _current_page = row[_page_list_columns._col_page];
+ // prefs_set_string_attribute("dialogs.extensioneditor", "selected", row[_page_list_columns._col_id].c_str());
+ _page_title.set_markup("<span size='large'><b>" + row[_page_list_columns._col_name] + "</b></span>");
+ // _page_frame.add(*_current_page);
+ // _current_page->show();
+ }
+
+ return;
+}
+
+/** \brief A function to pass to the iterator in the Extensions Database
+ \param in_plug The extension to evaluate
+ \param in_data A pointer to the Extension Editor class
+ \return None
+
+ This function is a static function with the prototype required for
+ the Extension Database's foreach function. It will get called for
+ every extension in the database, and will then turn around and
+ call the more object oriented function \c add_extension in the
+ ExtensionEditor.
+*/
+void
+ExtensionEditor::dbfunc (Inkscape::Extension::Extension * in_plug, gpointer in_data)
+{
+ ExtensionEditor * ee = reinterpret_cast<ExtensionEditor *>(in_data);
+ ee->add_extension(in_plug);
+ return;
+}
+
+/** \brief Adds an extension into the tree model
+ \param ext The extension to add
+ \return The iterator representing the location in the tree model
+
+ This function takes the data out of the extension and puts it
+ into the tree model for the dialog.
+*/
+Gtk::TreeModel::iterator
+ExtensionEditor::add_extension (Inkscape::Extension::Extension * ext)
+{
+ Gtk::TreeModel::iterator iter;
+
+ iter = _page_list_model->append();
+
+ 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;
+}
+
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
diff --git a/src/ui/dialog/extension-editor.h b/src/ui/dialog/extension-editor.h
index 70825d193..81dd2c563 100644
--- a/src/ui/dialog/extension-editor.h
+++ b/src/ui/dialog/extension-editor.h
@@ -22,6 +22,7 @@
#include <gtkmm/label.h>
#include <gtkmm/frame.h>
+#include "extension/extension.h"
namespace Inkscape {
namespace UI {
@@ -51,7 +52,7 @@ protected:
Gtk::TreeModelColumnRecord::add(_col_id);
}
Gtk::TreeModelColumn<Glib::ustring> _col_name;
- Gtk::TreeModelColumn<gchar const *> _col_id;
+ Gtk::TreeModelColumn<Glib::ustring> _col_id;
Gtk::TreeModelColumn<Gtk::Widget *> _col_page;
};
PageListModelColumns _page_list_columns;
@@ -63,7 +64,9 @@ private:
ExtensionEditor(ExtensionEditor const &d);
ExtensionEditor& operator=(ExtensionEditor const &d);
- void on_pagelist_selection_changed();
+ void on_pagelist_selection_changed(void);
+ static void dbfunc (Inkscape::Extension::Extension * in_plug, gpointer in_data);
+ Gtk::TreeModel::iterator add_extension (Inkscape::Extension::Extension * ext);
};
} // namespace Dialog