summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2012-10-08 18:55:32 +0000
committer~suv <suv-sf@users.sourceforge.net>2012-10-08 18:55:32 +0000
commit823318895dfecc05e8376e557543ea9e89c362b2 (patch)
treed8a7b66f0ede52e0bc5415eb103e7e89ea436953 /src/ui
parentchanges_2012_10_04b.patch: fixes one small memory issue (bytes allocated and ... (diff)
parentGerman translation update 93% (diff)
downloadinkscape-823318895dfecc05e8376e557543ea9e89c362b2.tar.gz
inkscape-823318895dfecc05e8376e557543ea9e89c362b2.zip
merge from trunk (r11760)
(bzr r11668.1.25)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp12
-rw-r--r--src/ui/dialog/swatches.cpp47
-rw-r--r--src/ui/widget/panel.cpp1
3 files changed, 40 insertions, 20 deletions
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index fbaebfbec..2731b6174 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -480,7 +480,7 @@ void InkscapePreferences::initPageTools()
_misc_gradientangle.init("/dialogs/gradienteditor/angle", -359, 359, 1, 90, 0, false, false);
_page_gradient.add_line( false, _("Linear gradient _angle:"), _misc_gradientangle, "",
- _("Default angle of new linear gradients in degrees (clockwise from horizontal"), false);
+ _("Default angle of new linear gradients in degrees (clockwise from horizontal)"), false);
//Dropper
@@ -811,7 +811,7 @@ void InkscapePreferences::initPageIO()
_("Maximum mouse drag (in screen pixels) which is considered a click, not a drag"), false);
_mouse_grabsize.init("/options/grabsize/value", 1, 7, 1, 2, 3, 0);
- _page_mouse.add_line(false, _("_Handle size"), _mouse_grabsize, "",
+ _page_mouse.add_line(false, _("_Handle size:"), _mouse_grabsize, "",
_("Set the relative size of node handles"), true);
_mouse_use_ext_input.init( _("Use pressure-sensitive tablet (requires restart)"), "/options/useextinput/value", true);
@@ -1041,10 +1041,14 @@ void InkscapePreferences::initPageIO()
// Autosave options
_save_autosave_enable.init( _("Enable autosave (requires restart)"), "/options/autosave/enable", false);
_page_autosave.add_line(false, "", _save_autosave_enable, "", _("Automatically save the current document(s) at a given interval, thus minimizing loss in case of a crash"), false);
+ _save_autosave_path.init("/options/autosave/path", true);
+ if (prefs->getString("/options/autosave/path").empty()) {
+ // Show the default fallback "tmp dir" if autosave path is not set.
+ _save_autosave_path.set_text(Glib::get_tmp_dir());
+ }
+ _page_autosave.add_line(false, C_("Filesystem", "Autosave _directory:"), _save_autosave_path, "", _("The directory where autosaves will be written. This should be an absolute path (starts with / on UNIX or a drive letter such as C: on Windows). "), false);
_save_autosave_interval.init("/options/autosave/interval", 1.0, 10800.0, 1.0, 10.0, 10.0, true, false);
_page_autosave.add_line(false, _("_Interval (in minutes):"), _save_autosave_interval, "", _("Interval (in minutes) at which document will be autosaved"), false);
- _save_autosave_path.init("/options/autosave/path", true);
- _page_autosave.add_line(false, C_("Filesystem", "_Path:"), _save_autosave_path, "", _("The directory where autosaves will be written"), false);
_save_autosave_max.init("/options/autosave/max", 1.0, 100.0, 1.0, 10.0, 10.0, true, false);
_page_autosave.add_line(false, _("_Maximum number of autosaves:"), _save_autosave_max, "", _("Maximum number of autosaved files; use this to limit the storage space used"), false);
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 3baba3460..9d5a2ac28 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -62,10 +62,10 @@ namespace Dialogs {
#define VBLOCK 16
#define PREVIEW_PIXBUF_WIDTH 128
-void _loadPaletteFile( gchar const *filename );
+void _loadPaletteFile( gchar const *filename, gboolean user=FALSE );
-
-std::vector<SwatchPage*> possible;
+std::list<SwatchPage*> userSwatchPages;
+std::list<SwatchPage*> systemSwatchPages;
static std::map<SPDocument*, SwatchPage*> docPalettes;
static std::vector<DocTrack*> docTrackings;
static std::map<SwatchesPanel*, SPDocument*> docPerPanel;
@@ -391,7 +391,7 @@ static bool parseNum( char*& str, int& val ) {
}
-void _loadPaletteFile( gchar const *filename )
+void _loadPaletteFile( gchar const *filename, gboolean user/*=FALSE*/ )
{
char block[1024];
FILE *f = Inkscape::IO::fopen_utf8name( filename, "r" );
@@ -493,7 +493,10 @@ void _loadPaletteFile( gchar const *filename )
}
} while ( result && !hasErr );
if ( !hasErr ) {
- possible.push_back(onceMore);
+ if (user)
+ userSwatchPages.push_back(onceMore);
+ else
+ systemSwatchPages.push_back(onceMore);
#if ENABLE_MAGIC_COLORS
ColorItem::_wireMagicColors( onceMore );
#endif // ENABLE_MAGIC_COLORS
@@ -507,9 +510,16 @@ void _loadPaletteFile( gchar const *filename )
}
}
+static bool
+compare_swatch_names(SwatchPage const *a, SwatchPage const *b) {
+
+ return g_utf8_collate(a->_name.c_str(), b->_name.c_str()) < 0;
+}
+
static void loadEmUp()
{
static bool beenHere = false;
+ gboolean userPalete = true;
if ( !beenHere ) {
beenHere = true;
@@ -521,7 +531,6 @@ static void loadEmUp()
// Use this loop to iterate through a list of possible document locations.
while (!sources.empty()) {
gchar *dirname = sources.front();
-
if ( Inkscape::IO::file_test( dirname, G_FILE_TEST_EXISTS )
&& Inkscape::IO::file_test( dirname, G_FILE_TEST_IS_DIR )) {
GError *err = 0;
@@ -535,11 +544,13 @@ static void loadEmUp()
while ((filename = (gchar *)g_dir_read_name(directory)) != NULL) {
gchar* lower = g_ascii_strdown( filename, -1 );
// if ( g_str_has_suffix(lower, ".gpl") ) {
+ if ( !g_str_has_suffix(lower, "~") ) {
gchar* full = g_build_filename(dirname, filename, NULL);
if ( !Inkscape::IO::file_test( full, G_FILE_TEST_IS_DIR ) ) {
- _loadPaletteFile(full);
+ _loadPaletteFile(full, userPalete);
}
g_free(full);
+ }
// }
g_free(lower);
}
@@ -550,15 +561,15 @@ static void loadEmUp()
// toss the dirname
g_free(dirname);
sources.pop_front();
+ userPalete = false;
}
}
-}
-
-
-
-
+ // Sort the list of swatches by name, grouped by user/system
+ userSwatchPages.sort(compare_swatch_names);
+ systemSwatchPages.sort(compare_swatch_names);
+}
@@ -592,7 +603,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) :
}
loadEmUp();
- if ( !possible.empty() ) {
+ if ( !systemSwatchPages.empty() ) {
SwatchPage* first = 0;
int index = 0;
Glib::ustring targetName;
@@ -603,8 +614,9 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) :
if (targetName == "Auto") {
first = docPalettes[0];
} else {
- index++;
- for ( std::vector<SwatchPage*>::iterator iter = possible.begin(); iter != possible.end(); ++iter ) {
+ //index++;
+ std::vector<SwatchPage*> pages = _getSwatchSets();
+ for ( std::vector<SwatchPage*>::iterator iter = pages.begin(); iter != pages.end(); ++iter ) {
if ( (*iter)->_name == targetName ) {
first = *iter;
break;
@@ -635,6 +647,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) :
hotItem = single;
}
_regItem( single, 3, i );
+
i++;
}
}
@@ -1027,6 +1040,7 @@ void SwatchesPanel::handleDefsModified(SPDocument *document)
}
}
+
std::vector<SwatchPage*> SwatchesPanel::_getSwatchSets() const
{
std::vector<SwatchPage*> tmp;
@@ -1034,7 +1048,8 @@ std::vector<SwatchPage*> SwatchesPanel::_getSwatchSets() const
tmp.push_back(docPalettes[_currentDocument]);
}
- tmp.insert(tmp.end(), possible.begin(), possible.end());
+ tmp.insert(tmp.end(), userSwatchPages.begin(), userSwatchPages.end());
+ tmp.insert(tmp.end(), systemSwatchPages.begin(), systemSwatchPages.end());
return tmp;
}
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index 42435f298..dcf5956bf 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -560,6 +560,7 @@ void Panel::_regItem(Gtk::MenuItem* item, int group, int id)
_menu->append(*item);
item->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), group + PANEL_SETTING_NEXTFREE, id));
item->show();
+
}
void Panel::_handleAction(int /*set_id*/, int /*item_id*/)