diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-09-01 19:49:18 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-09-01 19:50:16 +0000 |
| commit | 5e8e0a6bdd15427faa16d6432b9fbd7bbe0d6335 (patch) | |
| tree | 37dfb161397255903dd32fe27302fb308e5b9d4a /src/ui | |
| parent | Add 'vector-effect' to CSS and attribute lists. (diff) | |
| parent | Update internal extensions for latest .inx format changes (diff) | |
| download | inkscape-5e8e0a6bdd15427faa16d6432b9fbd7bbe0d6335.tar.gz inkscape-5e8e0a6bdd15427faa16d6432b9fbd7bbe0d6335.zip | |
Extension updates for 1.0 (!808)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/extension-editor.cpp | 8 | ||||
| -rw-r--r-- | src/ui/dialog/extension-editor.h | 8 | ||||
| -rw-r--r-- | src/ui/dialog/filedialogimpl-gtkmm.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/filedialogimpl-win32.cpp | 41 | ||||
| -rw-r--r-- | src/ui/dialog/template-load-tab.cpp | 61 | ||||
| -rw-r--r-- | src/ui/dialog/template-load-tab.h | 41 | ||||
| -rw-r--r-- | src/ui/dialog/template-widget.cpp | 50 | ||||
| -rw-r--r-- | src/ui/selected-color.h | 2 |
8 files changed, 121 insertions, 100 deletions
diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index e324afcc7..1852010a0 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -41,7 +41,6 @@ ExtensionEditor::ExtensionEditor() : UI::Widget::Panel("/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 @@ -73,7 +72,6 @@ ExtensionEditor::ExtensionEditor() hbox_list_page->pack_start(*vbox_page, true, true, 0); 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); @@ -140,19 +138,16 @@ void ExtensionEditor::on_pagelist_selection_changed() /* 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 widgets */ Gtk::Widget * info = nullptr; - Gtk::Widget * help = nullptr; Gtk::Widget * params = nullptr; if (ext != nullptr) { info = ext->get_info_widget(); - help = ext->get_help_widget(); params = ext->get_params_widget(); } @@ -160,9 +155,6 @@ void ExtensionEditor::on_pagelist_selection_changed() if (info != nullptr) { _notebook_info.add(*info); } - if (help != nullptr) { - _notebook_help.add(*help); - } if (params != nullptr) { _notebook_params.add(*params); } diff --git a/src/ui/dialog/extension-editor.h b/src/ui/dialog/extension-editor.h index e9c45e209..403ee1fb5 100644 --- a/src/ui/dialog/extension-editor.h +++ b/src/ui/dialog/extension-editor.h @@ -33,8 +33,6 @@ public: static ExtensionEditor &getInstance() { return *new ExtensionEditor(); } - static void show_help (gchar const * extension_id); - protected: /** \brief The view of the list of extensions on the left of the dialog */ Gtk::TreeView _page_list; @@ -42,8 +40,6 @@ protected: Glib::RefPtr<Gtk::TreeStore> _page_list_model; /** \brief The notebook page that contains information */ Gtk::ScrolledWindow _notebook_info; - /** \brief The notebook page that contains help info */ - Gtk::ScrolledWindow _notebook_help; /** \brief The notebook page that holds all the parameters */ Gtk::ScrolledWindow _notebook_params; @@ -68,8 +64,8 @@ private: an item in the extension list */ Glib::ustring _selection_search; - ExtensionEditor(ExtensionEditor const &d); - ExtensionEditor& operator=(ExtensionEditor const &d); + ExtensionEditor(ExtensionEditor const &d) = delete; + ExtensionEditor& operator=(ExtensionEditor const &d) = delete; void on_pagelist_selection_changed(); static void dbfunc (Inkscape::Extension::Extension * in_plug, gpointer in_data); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index de6b18489..5874cac19 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -330,7 +330,7 @@ void FileOpenDialogImplGtk::createFilterMenu() Glib::ustring extension = imod->get_extension(); fileDialogExtensionToPattern(upattern, extension); - Glib::ustring uname(_(imod->get_filetypename())); + Glib::ustring uname(imod->get_filetypename(true)); auto filter = Gtk::FileFilter::create(); filter->set_name(uname); @@ -624,10 +624,10 @@ void FileSaveDialogImplGtk::fileTypeChangedCallback() auto filter = Gtk::FileFilter::create(); filter->add_pattern(type.pattern); set_filter(filter); - + if (fromCB) { //do not update if called from a name change - fromCB = false; + fromCB = false; return; } @@ -642,7 +642,7 @@ void FileSaveDialogImplGtk::fileNameChanged() { if (extension && Glib::ustring(dynamic_cast<Inkscape::Extension::Output *>(extension)->get_extension()).casefold() == ext ) return; if (knownExtensions.find(ext) == knownExtensions.end()) return; fromCB = true; - fileTypeComboBox.set_active_text(_(knownExtensions[ext]->get_filetypename())); + fileTypeComboBox.set_active_text(knownExtensions[ext]->get_filetypename(true)); } void FileSaveDialogImplGtk::addFileType(Glib::ustring name, Glib::ustring pattern) @@ -672,7 +672,7 @@ void FileSaveDialogImplGtk::createFileTypeMenu() continue; FileType type; - type.name = (_(omod->get_filetypename())); + type.name = omod->get_filetypename(true); type.pattern = "*"; Glib::ustring extension = omod->get_extension(); knownExtensions.insert(std::pair<Glib::ustring, Inkscape::Extension::Output*>(extension.casefold(), omod)); diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 3964091cc..bd66b2d40 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -247,7 +247,7 @@ void FileOpenDialogImplWin32::createFilterMenu() int extension_index = 0; int filter_length = 1; - + if (dialogType == CUSTOM_TYPE) { return; } @@ -281,13 +281,11 @@ void FileOpenDialogImplWin32::createFilterMenu() if (imod->deactivated()) continue; // Type - filter.name = g_utf8_to_utf16(_(imod->get_filetypename()), - -1, NULL, &filter.name_length, NULL); + filter.name = g_utf8_to_utf16(imod->get_filetypename(true), -1, NULL, &filter.name_length, NULL); // Extension const gchar *file_extension_name = imod->get_extension(); - filter.filter = g_utf8_to_utf16(file_extension_name, - -1, NULL, &filter.filter_length, NULL); + filter.filter = g_utf8_to_utf16(file_extension_name, -1, NULL, &filter.filter_length, NULL); filter.mod = imod; filter_list.push_back(filter); @@ -309,7 +307,7 @@ void FileOpenDialogImplWin32::createFilterMenu() // I don't know of any other way to define "bitmap" formats other than by listing them // if you change it here, do the same change in filedialogimpl-gtkmm - if ( + if ( strncmp("image/png", imod->get_mimetype(), 9)==0 || strncmp("image/jpeg", imod->get_mimetype(), 10)==0 || strncmp("image/gif", imod->get_mimetype(), 9)==0 || @@ -322,7 +320,7 @@ void FileOpenDialogImplWin32::createFilterMenu() strncmp("image/tiff", imod->get_mimetype(), 10)==0 || strncmp("image/x-xbitmap", imod->get_mimetype(), 15)==0 || strncmp("image/x-tga", imod->get_mimetype(), 11)==0 || - strncmp("image/x-pcx", imod->get_mimetype(), 11)==0 + strncmp("image/x-pcx", imod->get_mimetype(), 11)==0 ) { if(all_bitmaps_filter.length() > 0) all_bitmaps_filter += ";*"; @@ -396,12 +394,12 @@ void FileOpenDialogImplWin32::createFilterMenu() const gchar *all_files_filter_name = _("All Files"); const gchar *all_exe_files_filter_name = _("All Executable Files"); - + // Calculate the amount of memory required int filter_count = 2; // 2 - All Files and All Executable Files - + _extension_map = new Inkscape::Extension::Extension*[filter_count]; - + // Filter Executable Files all_exe_files.name = g_utf8_to_utf16(all_exe_files_filter_name, -1, NULL, &all_exe_files.name_length, NULL); @@ -417,14 +415,14 @@ void FileOpenDialogImplWin32::createFilterMenu() all_files.filter_length = 0; all_files.mod = NULL; filter_list.push_front(all_files); - + filter_length += all_files.name_length + 3 + all_exe_files.filter_length + all_exe_files.name_length + 3 + 1; // Add 3 for 2*2 \0s and a *, and 1 for a trailing \0 } - + _filter = new wchar_t[filter_length]; wchar_t *filterptr = _filter; @@ -546,11 +544,11 @@ UINT_PTR CALLBACK FileOpenDialogImplWin32::GetOpenFileName_hookproc( SetWindowLongPtr(hdlg, GWLP_USERDATA, ofn->lCustData); SetWindowLongPtr(hParentWnd, GWLP_USERDATA, ofn->lCustData); pImpl = reinterpret_cast<FileOpenDialogImplWin32*>(ofn->lCustData); - + // Make the window a bit wider RECT rcRect; GetWindowRect(hParentWnd, &rcRect); - + // Don't show the preview when opening executable files if ( pImpl->dialogType == EXE_TYPES) { MoveWindow(hParentWnd, rcRect.left, rcRect.top, @@ -577,7 +575,7 @@ UINT_PTR CALLBACK FileOpenDialogImplWin32::GetOpenFileName_hookproc( TBADDBITMAP tbAddBitmap = {NULL, reinterpret_cast<UINT_PTR>(pImpl->_show_preview_button_bitmap)}; const int iBitmapIndex = SendMessage(pImpl->_toolbar_wnd, TB_ADDBITMAP, 1, (LPARAM)&tbAddBitmap); - + TBBUTTON tbButton; memset(&tbButton, 0, sizeof(TBBUTTON)); @@ -604,7 +602,7 @@ UINT_PTR CALLBACK FileOpenDialogImplWin32::GetOpenFileName_hookproc( 0, 0, 100, 100, hParentWnd, NULL, hInstance, NULL); SetWindowLongPtr(pImpl->_preview_wnd, GWLP_USERDATA, ofn->lCustData); } - + pImpl->_mutex->unlock(); pImpl->layout_dialog(); @@ -727,7 +725,7 @@ LRESULT CALLBACK FileOpenDialogImplWin32::preview_wnd_proc(HWND hwnd, UINT uMsg, WCHAR* noFileText=(WCHAR*)g_utf8_to_utf16(_("No file selected"), -1, NULL, NULL, NULL); FillRect(dc, &rcClient, reinterpret_cast<HBRUSH>(COLOR_3DFACE + 1)); - DrawTextW(dc, noFileText, -1, &rcClient, + DrawTextW(dc, noFileText, -1, &rcClient, DT_CENTER | DT_VCENTER | DT_NOPREFIX); g_free(noFileText); } @@ -1592,7 +1590,7 @@ FileSaveDialogImplWin32::FileSaveDialogImplWin32(Gtk::Window &parent, size_t last_slash_index = udir.find_last_of( '\\' ); size_t last_period_index = udir.find_last_of( '.' ); if (last_period_index > last_slash_index) { - myFilename = udir.substr(0, last_period_index ); + myFilename = udir.substr(0, last_period_index ); } } @@ -1638,8 +1636,7 @@ void FileSaveDialogImplWin32::createFilterMenu() knownExtensions.insert(std::pair<Glib::ustring, Inkscape::Extension::Output*>(Glib::ustring(filter_extension).casefold(), omod)); // Type - filter.name = g_utf8_to_utf16( - _(omod->get_filetypename()), -1, NULL, &filter.name_length, NULL); + filter.name = g_utf8_to_utf16(omod->get_filetypename(true), -1, NULL, &filter.name_length, NULL); filter.mod = omod; @@ -1705,7 +1702,7 @@ void FileSaveDialogImplWin32::addFileType(Glib::ustring name, Glib::ustring patt -1, NULL, &all_exe_files.filter_length, NULL); all_exe_files.mod = NULL; filter_list.push_front(all_exe_files); - + filter_length = all_exe_files.name_length + all_exe_files.filter_length + 3; // Add 3 for two \0s and a * knownExtensions.insert(std::pair<Glib::ustring, Inkscape::Extension::Output*>(Glib::ustring(all_exe_files_filter).casefold(), NULL)); @@ -1883,7 +1880,7 @@ UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc( CW_USEDEFAULT, CW_USEDEFAULT, rCB1.left-rST.left, rST.bottom-rST.top, hParentWnd, NULL, hInstance, NULL); g_free(title_label_str); - + if(pImpl->_title_label) { if(dlgFont) SendMessage(pImpl->_title_label, WM_SETFONT, (WPARAM)dlgFont, MAKELPARAM(FALSE, 0)); SetWindowPos(pImpl->_title_label, NULL, rST.left-rROOT.left, rST.top+ydelta-rROOT.top, diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp index 6c17a9a96..f290dcab7 100644 --- a/src/ui/dialog/template-load-tab.cpp +++ b/src/ui/dialog/template-load-tab.cpp @@ -19,6 +19,7 @@ #include <gtkmm/scrolledwindow.h> #include <iostream> +#include "extension/extension.h" #include "extension/db.h" #include "inkscape.h" #include "file.h" @@ -170,8 +171,7 @@ void TemplateLoadTab::_refreshTemplatesList() if (it.second.keywords.count(_current_keyword.lowercase()) != 0 || it.second.display_name.lowercase().find(_current_keyword.lowercase()) != Glib::ustring::npos || it.second.author.lowercase().find(_current_keyword.lowercase()) != Glib::ustring::npos || - it.second.short_description.lowercase().find(_current_keyword.lowercase()) != Glib::ustring::npos || - it.second.long_description.lowercase().find(_current_keyword.lowercase()) != Glib::ustring::npos ) + it.second.short_description.lowercase().find(_current_keyword.lowercase()) != Glib::ustring::npos) { Gtk::TreeModel::iterator iter = _tlist_store->append(); Gtk::TreeModel::Row row = *iter; @@ -236,16 +236,19 @@ TemplateLoadTab::TemplateData TemplateLoadTab::_processTemplateFile(const std::s Inkscape::XML::Document *rdoc = sp_repr_read_file(path.data(), SP_SVG_NS_URI); if (rdoc){ - Inkscape::XML::Node *myRoot = rdoc->root(); - if (strcmp(myRoot->name(), "svg:svg") != 0){ // Wrong file format + Inkscape::XML::Node *root = rdoc->root(); + if (strcmp(root->name(), "svg:svg") != 0){ // Wrong file format return result; } - myRoot = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + Inkscape::XML::Node *templateinfo = sp_repr_lookup_name(root, "inkscape:templateinfo"); + if (!templateinfo) { + templateinfo = sp_repr_lookup_name(root, "inkscape:_templateinfo"); // backwards-compatibility + } - if (myRoot == nullptr) // No template info + if (templateinfo == nullptr) // No template info return result; - _getDataFromNode(myRoot, result); + _getDataFromNode(templateinfo, result); } return result; @@ -258,43 +261,61 @@ void TemplateLoadTab::_getProceduralTemplates() std::list<Inkscape::Extension::Effect *>::iterator it = effects.begin(); while (it != effects.end()){ - Inkscape::XML::Node *myRoot; - myRoot = (*it)->get_repr(); - myRoot = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + Inkscape::XML::Node *repr = (*it)->get_repr(); + Inkscape::XML::Node *templateinfo = sp_repr_lookup_name(repr, "inkscape:templateinfo"); + if (!templateinfo) { + templateinfo = sp_repr_lookup_name(repr, "inkscape:_templateinfo"); // backwards-compatibility + } - if (myRoot){ + if (templateinfo){ TemplateData result; result.display_name = (*it)->get_name(); result.is_procedural = true; result.path = ""; result.tpl_effect = *it; - _getDataFromNode(myRoot, result); + _getDataFromNode(templateinfo, result, *it); _tdata[result.display_name] = result; } ++it; } } +// if the template data comes from a procedural template (aka Effect extension), +// attempt to translate within the extension's context (which might use a different gettext textdomain) +const char *_translate(const char* msgid, Extension::Extension *extension) +{ + if (extension) { + return extension->get_translation(msgid); + } else { + return _(msgid); + } +} -void TemplateLoadTab::_getDataFromNode(Inkscape::XML::Node *dataNode, TemplateData &data) +void TemplateLoadTab::_getDataFromNode(Inkscape::XML::Node *dataNode, TemplateData &data, Extension::Extension *extension) { Inkscape::XML::Node *currentData; - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_name")) != nullptr) - data.display_name = _(currentData->firstChild()->content()); + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:name")) != nullptr) + data.display_name = _translate(currentData->firstChild()->content(), extension); + else if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_name")) != nullptr) // backwards-compatibility + data.display_name = _translate(currentData->firstChild()->content(), extension); + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:author")) != nullptr) data.author = currentData->firstChild()->content(); - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_shortdesc")) != nullptr) - data.short_description = _( currentData->firstChild()->content()); - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_long") )!= nullptr) - data.long_description = _(currentData->firstChild()->content()); + + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:shortdesc")) != nullptr) + data.short_description = _translate(currentData->firstChild()->content(), extension); + else if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_shortdesc")) != nullptr) // backwards-compatibility + data.short_description = _translate(currentData->firstChild()->content(), extension); + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:preview")) != nullptr) data.preview_name = currentData->firstChild()->content(); + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:date")) != nullptr) data.creation_date = currentData->firstChild()->content(); if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_keywords")) != nullptr){ - Glib::ustring tplKeywords = _(currentData->firstChild()->content()); + Glib::ustring tplKeywords = _translate(currentData->firstChild()->content(), extension); while (!tplKeywords.empty()){ std::size_t pos = tplKeywords.find_first_of(" "); if (pos == Glib::ustring::npos) diff --git a/src/ui/dialog/template-load-tab.h b/src/ui/dialog/template-load-tab.h index 037d7782c..2b8f98f12 100644 --- a/src/ui/dialog/template-load-tab.h +++ b/src/ui/dialog/template-load-tab.h @@ -27,11 +27,16 @@ namespace Inkscape { + +namespace Extension { +class Extension; +} + namespace UI { class TemplateWidget; class NewFromTemplate; - + class TemplateLoadTab : public Gtk::HBox { @@ -43,18 +48,18 @@ public: Glib::ustring display_name; Glib::ustring author; Glib::ustring short_description; - Glib::ustring long_description; + Glib::ustring long_description; // unused Glib::ustring preview_name; Glib::ustring creation_date; std::set<Glib::ustring> keywords; Inkscape::Extension::Effect *tpl_effect; }; - + TemplateLoadTab(NewFromTemplate* parent); ~TemplateLoadTab() override; virtual void createTemplate(); -protected: +protected: class StringModelColumns : public Gtk::TreeModelColumnRecord { public: @@ -62,32 +67,32 @@ protected: { add(textValue); } - + Gtk::TreeModelColumn<Glib::ustring> textValue; }; - + Glib::ustring _current_keyword; Glib::ustring _current_template; std::map<Glib::ustring, TemplateData> _tdata; std::set<Glib::ustring> _keywords; - - + + virtual void _displayTemplateInfo(); virtual void _initKeywordsList(); virtual void _refreshTemplatesList(); void _loadTemplates(); void _initLists(); - + Gtk::VBox _tlist_box; Gtk::HBox _search_box; TemplateWidget *_info_widget; - + Gtk::ComboBoxText _keywords_combo; - + Gtk::TreeView _tlist_view; Glib::RefPtr<Gtk::ListStore> _tlist_store; - StringModelColumns _columns; - + StringModelColumns _columns; + private: enum SearchType { @@ -95,16 +100,16 @@ private: USER_SPECIFIED, ALL }; - + SearchType _current_search_type; NewFromTemplate* _parent_widget; - - void _getDataFromNode(Inkscape::XML::Node *, TemplateData &); + + void _getDataFromNode(Inkscape::XML::Node *, TemplateData &, Extension::Extension *extension=nullptr); void _getProceduralTemplates(); void _getTemplatesFromDomain(Inkscape::IO::Resource::Domain domain); - void _keywordSelected(); + void _keywordSelected(); TemplateData _processTemplateFile(const std::string &); - + void _onRowActivated(const Gtk::TreeModel::Path &, Gtk::TreeViewColumn*); }; diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index be94b79c0..e5adaf9e1 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -26,7 +26,7 @@ namespace Inkscape { namespace UI { - + TemplateWidget::TemplateWidget() : _more_info_button(_("More info")) @@ -36,18 +36,18 @@ TemplateWidget::TemplateWidget() { pack_start(_template_name_label, Gtk::PACK_SHRINK, 10); pack_start(_preview_box, Gtk::PACK_SHRINK, 0); - + _preview_box.pack_start(_preview_image, Gtk::PACK_EXPAND_PADDING, 15); _preview_box.pack_start(_preview_render, Gtk::PACK_EXPAND_PADDING, 10); - + _short_description_label.set_line_wrap(true); _more_info_button.set_halign(Gtk::ALIGN_END); _more_info_button.set_valign(Gtk::ALIGN_CENTER); pack_end(_more_info_button, Gtk::PACK_SHRINK); - + pack_end(_short_description_label, Gtk::PACK_SHRINK, 5); - + _more_info_button.signal_clicked().connect( sigc::mem_fun(*this, &TemplateWidget::_displayTemplateDetails)); _more_info_button.set_sensitive(false); @@ -58,7 +58,7 @@ void TemplateWidget::create() { if (_current_template.display_name == "") return; - + if (_current_template.is_procedural){ SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPDesktop *desc = sp_file_new_default(); @@ -98,7 +98,7 @@ void TemplateWidget::display(TemplateLoadTab::TemplateData data) } if (data.is_procedural){ - _effect_prefs = data.tpl_effect->get_imp()->prefs_effect(data.tpl_effect, SP_ACTIVE_DESKTOP, nullptr, nullptr); + _effect_prefs = data.tpl_effect->get_imp()->prefs_effect(data.tpl_effect, SP_ACTIVE_DESKTOP, nullptr, nullptr); pack_start(*_effect_prefs); } _more_info_button.set_sensitive(true); @@ -118,24 +118,32 @@ void TemplateWidget::clear() } void TemplateWidget::_displayTemplateDetails() -{ +{ Glib::ustring message = _current_template.display_name + "\n\n"; - - if (_current_template.path != "") - message += _("Path: ") + _current_template.path + "\n\n"; - - if (_current_template.long_description != "") - message += _("Description: ") + _current_template.long_description + "\n\n"; + + if (!_current_template.author.empty()) { + message += _("Author"); + message += ": "; + message += _current_template.author + " " + _current_template.creation_date + "\n\n"; + } + if (!_current_template.keywords.empty()){ - message += _("Keywords: "); - for (const auto & keyword : _current_template.keywords) - message += keyword + " "; + message += _("Keywords"); + message += ":"; + for (const auto & keyword : _current_template.keywords) { + message += " "; + message += keyword; + } message += "\n\n"; } - - if (_current_template.author != "") - message += _("By: ") + _current_template.author + " " + _current_template.creation_date + "\n\n"; - + + if (!_current_template.path.empty()) { + message += _("Path"); + message += ": "; + message += _current_template.path; + message += "\n\n"; + } + Gtk::MessageDialog dl(message, false, Gtk::MESSAGE_OTHER); dl.run(); } diff --git a/src/ui/selected-color.h b/src/ui/selected-color.h index 6bb426b7f..1a00fc5cf 100644 --- a/src/ui/selected-color.h +++ b/src/ui/selected-color.h @@ -14,7 +14,9 @@ #ifndef SEEN_SELECTED_COLOR #define SEEN_SELECTED_COLOR +#include <glib.h> #include <sigc++/signal.h> + #include "color.h" namespace Gtk |
