From fdb68963cec5ddbd3eef111f4c95b7e049aa839c Mon Sep 17 00:00:00 2001 From: Slagvi Public Date: Tue, 2 Jul 2013 17:37:42 +0200 Subject: Adding NewFromTemplate to the Inkscape menu (bzr r12379.2.5) --- src/templates/new-from-template.cpp | 42 ----------- src/templates/new-from-template.h | 31 --------- src/templates/static-template-load-tab.cpp | 47 ------------- src/templates/static-template-load-tab.h | 33 --------- src/templates/template-load-tab.cpp | 107 ----------------------------- src/templates/template-load-tab.h | 59 ---------------- 6 files changed, 319 deletions(-) delete mode 100644 src/templates/new-from-template.cpp delete mode 100644 src/templates/new-from-template.h delete mode 100644 src/templates/static-template-load-tab.cpp delete mode 100644 src/templates/static-template-load-tab.h delete mode 100644 src/templates/template-load-tab.cpp delete mode 100644 src/templates/template-load-tab.h (limited to 'src/templates') diff --git a/src/templates/new-from-template.cpp b/src/templates/new-from-template.cpp deleted file mode 100644 index fc590d199..000000000 --- a/src/templates/new-from-template.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "new-from-template.h" -#include "gtkmm/alignment.h" - -namespace Inkscape { -namespace UI { - - -NewFromTemplate::NewFromTemplate() - : _create_template_button("Create from template") -{ - set_title("New From Template"); - resize(400, 250); - - get_vbox()->pack_start(_main_widget); - _main_widget.append_page(_tab1, "Static Templates"); - _main_widget.append_page(_tab2, "Procedural Templates"); - - Gtk::Alignment *align; - align = manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0)); - get_vbox()->pack_end(*align, Gtk::PACK_SHRINK, 5); - align->add(_create_template_button); - - _create_template_button.signal_pressed().connect( - sigc::mem_fun(*this, &NewFromTemplate::_createFromTemplate)); - - show_all(); -} - - -void NewFromTemplate::_createFromTemplate() -{ - if ( _main_widget.get_current_page() == 0 ) { - _tab1.createTemplate(); - } else { - _tab2.createTemplate(); - } - - response(0); -} - -} -} diff --git a/src/templates/new-from-template.h b/src/templates/new-from-template.h deleted file mode 100644 index ef3cbce18..000000000 --- a/src/templates/new-from-template.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef INKSCAPE_SEEN_UI_DIALOG_NEW_FROM_TEMPLATE_H -#define INKSCAPE_SEEN_UI_DIALOG_NEW_FROM_TEMPLATE_H - -#include -#include -#include - -#include "template-load-tab.h" -#include "static-template-load-tab.h" - -namespace Inkscape { -namespace UI { - - -class NewFromTemplate : public Gtk::Dialog -{ -public: - NewFromTemplate(); - -private: - Gtk::Notebook _main_widget; - Gtk::Button _create_template_button; - StaticTemplateLoadTab _tab1; - TemplateLoadTab _tab2; - - void _createFromTemplate(); -}; - -} -} -#endif diff --git a/src/templates/static-template-load-tab.cpp b/src/templates/static-template-load-tab.cpp deleted file mode 100644 index 83ff32e52..000000000 --- a/src/templates/static-template-load-tab.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include -#include - -#include "static-template-load-tab.h" - -namespace Inkscape { -namespace UI { - - -StaticTemplateLoadTab::StaticTemplateLoadTab() - : _more_info_button("More info") - , _preview_image("preview.png") - , _short_description_label("Short description - I like trains. ad asda asd asdweqe gdfg") - , _template_name_label("Template_name") - , _template_author_label("by template_author") -{ - _template_info_column.pack_start(_template_name_label, Gtk::PACK_SHRINK, 4); - _template_info_column.pack_start(_template_author_label, Gtk::PACK_SHRINK, 0); - _template_info_column.pack_start(_preview_image, Gtk::PACK_SHRINK, 15); - _template_info_column.pack_start(_short_description_label, Gtk::PACK_SHRINK, 4); - - _short_description_label.set_line_wrap(true); - _short_description_label.set_size_request(200); - - Gtk::Alignment *align; - align = manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0)); - _template_info_column.pack_start(*align, Gtk::PACK_SHRINK, 5); - align->add(_more_info_button); -} - - -void StaticTemplateLoadTab::createTemplate() -{ - std::cout << "Static template\n"; -} - - -void StaticTemplateLoadTab::_displayTemplateInfo() -{ - TemplateLoadTab::_displayTemplateInfo(); - _template_name_label.set_text(_current_template); -} - -} -} diff --git a/src/templates/static-template-load-tab.h b/src/templates/static-template-load-tab.h deleted file mode 100644 index 651f146a0..000000000 --- a/src/templates/static-template-load-tab.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef INKSCAPE_SEEN_UI_DIALOG_STATIC_TEMPLATE_LOAD_TAB_H -#define INKSCAPE_SEEN_UI_DIALOG_STATIC_TEMPLATE_LOAD_TAB_H - -#include -#include -#include - -#include "template-load-tab.h" - -namespace Inkscape { -namespace UI { - - -class StaticTemplateLoadTab : public TemplateLoadTab -{ -public: - StaticTemplateLoadTab(); - virtual void createTemplate(); - -protected: - virtual void _displayTemplateInfo(); - - Gtk::Button _more_info_button; - Gtk::Label _short_description_label; - Gtk::Label _template_author_label; - Gtk::Label _template_name_label; - Gtk::Image _preview_image; -}; - -} -} - -#endif diff --git a/src/templates/template-load-tab.cpp b/src/templates/template-load-tab.cpp deleted file mode 100644 index a7b5e63f3..000000000 --- a/src/templates/template-load-tab.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include -#include - -#include "template-load-tab.h" - -namespace Inkscape { -namespace UI { - - -TemplateLoadTab::TemplateLoadTab() - : _keywords_combo(true) -{ - set_border_width(10); - - Gtk::Label *title; - title = manage(new Gtk::Label("Search Tags:")); - _templates_column.pack_start(*title, Gtk::PACK_SHRINK, 10); - - _templates_column.pack_start(_keywords_combo, Gtk::PACK_SHRINK, 0); - - title = manage(new Gtk::Label("Templates")); - _templates_column.pack_start(*title, Gtk::PACK_SHRINK, 10); - - title = manage(new Gtk::Label("Selected template")); - _template_info_column.pack_start(*title, Gtk::PACK_SHRINK, 10); - - _initLists(); - - add(_main_box); - _main_box.pack_start(_templates_column, Gtk::PACK_SHRINK, 20); - _main_box.pack_start(_template_info_column, Gtk::PACK_EXPAND_WIDGET, 10); - - _templates_column.pack_start(_templates_view, Gtk::PACK_SHRINK, 5); - - Glib::RefPtr templateSelectionRef = - _templates_view.get_selection(); - - templateSelectionRef->signal_changed().connect( - sigc::mem_fun(*this, &TemplateLoadTab::_displayTemplateInfo)); - - _keywords_combo.signal_changed().connect( - sigc::mem_fun(*this, &TemplateLoadTab::_keywordSelected)); - this->show_all(); -} - - -TemplateLoadTab::~TemplateLoadTab() -{ -} - - -void TemplateLoadTab::createTemplate() -{ - std::cout << "Default Template Tab" << std::endl; -} - - -void TemplateLoadTab::_displayTemplateInfo() -{ - Glib::RefPtr templateSelectionRef = _templates_view.get_selection(); - if (templateSelectionRef->get_selected()) { - _current_template = (*templateSelectionRef->get_selected())[_templates_columns.textValue]; - } -} - - -void TemplateLoadTab::_initKeywordsList() -{ - _keywords_combo.append_text("All"); - - for (int i = 0 ; i < 10 ; ++i) { - _keywords_combo.append_text( "Keyword" + Glib::ustring::format(i)); - } -} - - -void TemplateLoadTab::_initLists() -{ - _templates_ref = Gtk::ListStore::create(_templates_columns); - _templates_view.set_model(_templates_ref); - _templates_view.append_column("", _templates_columns.textValue); - _templates_view.set_headers_visible(false); - - _initKeywordsList(); - _refreshTemplatesList(); -} - - -void TemplateLoadTab::_keywordSelected() -{ - _current_keyword = _keywords_combo.get_active_text(); - _refreshTemplatesList(); -} - - -void TemplateLoadTab::_refreshTemplatesList() -{ - _templates_ref->clear(); - for (int i = 0 ; i < 7 ; ++i) { - Gtk::TreeModel::iterator iter = _templates_ref->append(); - Gtk::TreeModel::Row row = *iter; - row[_templates_columns.textValue] = "Template" + Glib::ustring::format(i); - } -} - -} -} diff --git a/src/templates/template-load-tab.h b/src/templates/template-load-tab.h deleted file mode 100644 index a9fa7c313..000000000 --- a/src/templates/template-load-tab.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef INKSCAPE_SEEN_UI_DIALOG_TEMPLATE_LOAD_TAB_H -#define INKSCAPE_SEEN_UI_DIALOG_TEMPLATE_LOAD_TAB_H - -#include -#include -#include -#include -#include - -namespace Inkscape { -namespace UI { - - -class TemplateLoadTab : public Gtk::Frame -{ - -public: - TemplateLoadTab(); - virtual ~TemplateLoadTab(); - virtual void createTemplate(); - -protected: - class StringModelColumns : public Gtk::TreeModelColumnRecord - { - public: - StringModelColumns() - { - add(textValue); - } - - Gtk::TreeModelColumn textValue; - }; - - Glib::ustring _current_keyword; - Glib::ustring _current_template; - - virtual void _displayTemplateInfo(); - virtual void _initKeywordsList(); - virtual void _refreshTemplatesList(); - - void _initLists(); - void _keywordSelected(); - - Gtk::HBox _main_box; - Gtk::VBox _templates_column; - Gtk::VBox _template_info_column; - - Gtk::ComboBoxText _keywords_combo; - - Gtk::TreeView _templates_view; - Glib::RefPtr _templates_ref; - StringModelColumns _templates_columns; - -}; - -} -} - -#endif -- cgit v1.2.3