summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2017-10-22 17:19:10 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2017-10-22 17:19:10 +0000
commitb3ec9c94c752d13f1cfeb6bea51c9e5e43fc6eec (patch)
tree008ad9c97a1ee764c4a43ca1347b9d704b948a05 /src/ui
parentAdded some improvements discused in MR (diff)
parentPreferences: cleanup (diff)
downloadinkscape-b3ec9c94c752d13f1cfeb6bea51c9e5e43fc6eec.tar.gz
inkscape-b3ec9c94c752d13f1cfeb6bea51c9e5e43fc6eec.zip
Merge branch 'master' into SymbolsSearch
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp125
-rw-r--r--src/ui/dialog/inkscape-preferences.h3
-rw-r--r--src/ui/widget/preferences-widget.cpp31
-rw-r--r--src/ui/widget/preferences-widget.h12
4 files changed, 104 insertions, 67 deletions
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index d87a3d94a..09ba06720 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -460,11 +460,20 @@ void InkscapePreferences::initPageTools()
_page_text.add_group_header( _("Text units"));
_font_unit_type.init( "/options/font/unitType", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), SP_CSS_UNIT_PT );
- _page_text.add_line( false, _("Text size unit type:"), _font_unit_type, "",
+ _page_text.add_line( true, _("Text size unit type:"), _font_unit_type, "",
_("Set the type of unit used in the text toolbar and text dialogs"), false);
_font_output_px.init ( _("Always output text size in pixels (px)"), "/options/font/textOutputPx", true);
// _page_text.add_line( false, "", _font_output_px, "", _("Always convert the text size units above into pixels (px) before saving to file"));
+ _page_text.add_group_header( _("Font directories"));
+ _font_fontsdir_system.init( _("Use Inkscape's fonts directory"), "/options/font/use_fontsdir_system", true);
+ _page_text.add_line( true, "", _font_fontsdir_system, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's global \"share\" directory"));
+ _font_fontsdir_user.init( _("Use user's fonts directory"), "/options/font/use_fontsdir_user", true);
+ _page_text.add_line( true, "", _font_fontsdir_user, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's user configuration directory"));
+ _font_fontdirs_custom.init("/options/font/custom_fontdirs", 50);
+ _page_text.add_line(true, _("Additional font directories"), _font_fontdirs_custom, "", _("Load additional fonts from custom locations (one path per line)"), true);
+
+
this->AddNewObjectsStyle(_page_text, "/tools/text");
//Spray
@@ -1921,12 +1930,7 @@ void InkscapePreferences::initPageSpellcheck()
static void appendList( Glib::ustring& tmp, const gchar* const*listing )
{
- bool first = true;
for (const gchar* const* ptr = listing; *ptr; ptr++) {
- if (!first) {
- tmp += " ";
- }
- first = false;
tmp += *ptr;
tmp += "\n";
}
@@ -1942,77 +1946,64 @@ void InkscapePreferences::initPageSystem()
_page_system.add_line( false, "", _misc_namedicon_delay, "",
_("When on, named icons will be rendered before displaying the ui. This is for working around bugs in GTK+ named icon notification"), true);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- {
- // TRANSLATORS: following strings are paths in Inkscape preferences - Misc - System info
-
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
-
- _page_system.add_group_header( _("System info"));
-
- _sys_user_config.set_text((char const *)Inkscape::IO::Resource::profile_path(""));
- _sys_user_config.set_editable(false);
- _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true);
-
- _sys_user_prefs.set_text(prefs->getPrefsFilename());
- _sys_user_prefs.set_editable(false);
- _page_system.add_line(true, _("User preferences: "), _sys_user_prefs, "", _("Location of the users preferences file"), true);
+ _page_system.add_group_header( _("System info"));
- _sys_user_extension_dir.set_text((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, ""));
- _sys_user_extension_dir.set_editable(false);
- _page_system.add_line(true, _("User extensions: "), _sys_user_extension_dir, "", _("Location of the users extensions"), true);
+ _sys_user_config.set_text((char const *)Inkscape::IO::Resource::profile_path(""));
+ _sys_user_config.set_editable(false);
+ _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true);
- _sys_user_cache.set_text(g_get_user_cache_dir());
- _sys_user_cache.set_editable(false);
- _page_system.add_line(true, _("User cache: "), _sys_user_cache, "", _("Location of users cache"), true);
+ _sys_user_prefs.set_text(prefs->getPrefsFilename());
+ _sys_user_prefs.set_editable(false);
+ _page_system.add_line(true, _("User preferences: "), _sys_user_prefs, "", _("Location of the users preferences file"), true);
- Glib::ustring tmp_dir = prefs->getString("/options/autosave/path");
- if (tmp_dir.empty()) {
- tmp_dir = Glib::get_tmp_dir();
- }
- _sys_tmp_files.set_text(tmp_dir);
- _sys_tmp_files.set_editable(false);
- _page_system.add_line(true, _("Temporary files: "), _sys_tmp_files, "", _("Location of the temporary files used for autosave"), true);
-
- _sys_data.set_text( INKSCAPE_DATADIR );
- _sys_data.set_editable(false);
- _page_system.add_line(true, _("Inkscape data: "), _sys_data, "", _("Location of Inkscape data"), true);
-
- _sys_extension_dir.set_text(INKSCAPE_EXTENSIONDIR);
- _sys_extension_dir.set_editable(false);
- _page_system.add_line(true, _("Inkscape extensions: "), _sys_extension_dir, "", _("Location of the Inkscape extensions"), true);
-
- Glib::ustring tmp;
- appendList( tmp, g_get_system_data_dirs() );
- _sys_systemdata.get_buffer()->insert(_sys_systemdata.get_buffer()->end(), tmp);
- _sys_systemdata.set_editable(false);
- _sys_systemdata_scroll.add(_sys_systemdata);
- _sys_systemdata_scroll.set_size_request(0, 80);
- _sys_systemdata_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true);
+ _sys_user_extension_dir.set_text((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, ""));
+ _sys_user_extension_dir.set_editable(false);
+ _page_system.add_line(true, _("User extensions: "), _sys_user_extension_dir, "", _("Location of the users extensions"), true);
- {
- tmp = "";
- gchar** paths = 0;
- gint count = 0;
- gtk_icon_theme_get_search_path(gtk_icon_theme_get_default(), &paths, &count);
- if (count > 0) {
- tmp += paths[0];
- tmp += "\n";
- for (int i = 1; i < count; i++) {
- tmp += " ";
- tmp += paths[i];
- tmp += "\n";
- }
- }
- }
+ _sys_user_cache.set_text(g_get_user_cache_dir());
+ _sys_user_cache.set_editable(false);
+ _page_system.add_line(true, _("User cache: "), _sys_user_cache, "", _("Location of users cache"), true);
- _sys_icon.get_buffer()->insert(_sys_icon.get_buffer()->end(), tmp);
+ Glib::ustring tmp_dir = prefs->getString("/options/autosave/path");
+ if (tmp_dir.empty()) {
+ tmp_dir = Glib::get_tmp_dir();
}
+ _sys_tmp_files.set_text(tmp_dir);
+ _sys_tmp_files.set_editable(false);
+ _page_system.add_line(true, _("Temporary files: "), _sys_tmp_files, "", _("Location of the temporary files used for autosave"), true);
+
+ _sys_data.set_text( INKSCAPE_DATADIR );
+ _sys_data.set_editable(false);
+ _page_system.add_line(true, _("Inkscape data: "), _sys_data, "", _("Location of Inkscape data"), true);
+
+ _sys_extension_dir.set_text(INKSCAPE_EXTENSIONDIR);
+ _sys_extension_dir.set_editable(false);
+ _page_system.add_line(true, _("Inkscape extensions: "), _sys_extension_dir, "", _("Location of the Inkscape extensions"), true);
+
+ Glib::ustring tmp;
+ appendList( tmp, g_get_system_data_dirs() );
+ _sys_systemdata.get_buffer()->insert(_sys_systemdata.get_buffer()->end(), tmp);
+ _sys_systemdata.set_editable(false);
+ _sys_systemdata_scroll.add(_sys_systemdata);
+ _sys_systemdata_scroll.set_size_request(100, 80);
+ _sys_systemdata_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ _sys_systemdata_scroll.set_shadow_type(Gtk::SHADOW_IN);
+ _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true);
+
+ tmp = "";
+ gchar** paths = 0;
+ gint count = 0;
+ gtk_icon_theme_get_search_path(gtk_icon_theme_get_default(), &paths, &count);
+ appendList( tmp, paths );
+ g_strfreev(paths);
+ _sys_icon.get_buffer()->insert(_sys_icon.get_buffer()->end(), tmp);
_sys_icon.set_editable(false);
_sys_icon_scroll.add(_sys_icon);
- _sys_icon_scroll.set_size_request(0, 80);
+ _sys_icon_scroll.set_size_request(100, 80);
_sys_icon_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ _sys_icon_scroll.set_shadow_type(Gtk::SHADOW_IN);
_page_system.add_line(true, _("Icon theme: "), _sys_icon_scroll, "", _("Locations of icon themes"), true);
this->AddPage(_page_system, _("System"), PREFS_PAGE_SYSTEM);
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index e6ba4e4b2..531533cee 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -328,6 +328,9 @@ protected:
UI::Widget::PrefCheckButton _font_dialog;
UI::Widget::PrefCombo _font_unit_type;
UI::Widget::PrefCheckButton _font_output_px;
+ UI::Widget::PrefCheckButton _font_fontsdir_system;
+ UI::Widget::PrefCheckButton _font_fontsdir_user;
+ UI::Widget::PrefMultiEntry _font_fontdirs_custom;
UI::Widget::PrefCheckButton _misc_comment;
UI::Widget::PrefCheckButton _misc_default_metadata;
diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp
index 2981316c0..8b8e663a5 100644
--- a/src/ui/widget/preferences-widget.cpp
+++ b/src/ui/widget/preferences-widget.cpp
@@ -34,6 +34,7 @@
#include <glibmm/i18n.h>
#include <glibmm/convert.h>
+#include <glibmm/regex.h>
#ifdef WIN32
#include <windows.h>
@@ -78,6 +79,7 @@ void DialogPage::add_line(bool indent,
auto hb = Gtk::manage(new Gtk::Box());
hb->set_spacing(12);
+ hb->set_hexpand(true);
hb->pack_start(widget, expand_widget, expand_widget);
// Pack an additional widget into a box with the widget if desired
@@ -859,6 +861,35 @@ void PrefEntry::on_changed()
}
}
+void PrefMultiEntry::init(Glib::ustring const &prefs_path, int height)
+{
+ // TODO: Figure out if there's a way to specify height in lines instead of px
+ // and how to obtain a reasonable default width if 'expand_widget' is not used
+ set_size_request(100, height);
+ set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ set_shadow_type(Gtk::SHADOW_IN);
+
+ add(_text);
+
+ _prefs_path = prefs_path;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ Glib::ustring value = prefs->getString(_prefs_path);
+ value = Glib::Regex::create("\\|")->replace_literal(value, 0, "\n", (Glib::RegexMatchFlags)0);
+ _text.get_buffer()->set_text(value);
+ _text.get_buffer()->signal_changed().connect(sigc::mem_fun(*this, &PrefMultiEntry::on_changed));
+}
+
+void PrefMultiEntry::on_changed()
+{
+ if (get_visible()) //only take action if user changed value
+ {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ Glib::ustring value = _text.get_buffer()->get_text();
+ value = Glib::Regex::create("\\n")->replace_literal(value, 0, "|", (Glib::RegexMatchFlags)0);
+ prefs->setString(_prefs_path, value);
+ }
+}
+
void PrefColorPicker::init(Glib::ustring const &label, Glib::ustring const &prefs_path,
guint32 default_rgba)
{
diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h
index 142793509..2578be533 100644
--- a/src/ui/widget/preferences-widget.h
+++ b/src/ui/widget/preferences-widget.h
@@ -28,6 +28,8 @@
#include <sigc++/sigc++.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/radiobutton.h>
+#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/textview.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm/grid.h>
@@ -195,6 +197,16 @@ protected:
void on_changed();
};
+class PrefMultiEntry : public Gtk::ScrolledWindow
+{
+public:
+ void init(Glib::ustring const &prefs_path, int height);
+protected:
+ Glib::ustring _prefs_path;
+ Gtk::TextView _text;
+ void on_changed();
+};
+
class PrefEntryButtonHBox : public Gtk::HBox
{
public: