summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es>2018-01-03 18:25:45 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-01-05 10:39:12 +0000
commitb6a5453f83f0258933fd86ae328e41216eaea5a8 (patch)
treeb69fde97f695ef293fcd820f225e921e0d31adc4 /src
parentAdd title to symbols dropdown (diff)
downloadinkscape-b6a5453f83f0258933fd86ae328e41216eaea5a8.tar.gz
inkscape-b6a5453f83f0258933fd86ae328e41216eaea5a8.zip
Add suport to noty titled symbols sets with filename
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/symbols.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index ca4488f2d..8f2e19978 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -823,6 +823,14 @@ void SymbolsDialog::getSymbolsTitle() {
}
std::string::size_type position_exit = line.find ("<defs");
if (position_exit != std::string::npos) {
+ std::size_t found = filename.find_last_of("/\\");
+ filename = filename.substr(found+1);
+ title = filename.erase(filename.rfind('.'));
+ if(title.empty()) {
+ title = _("Unnamed Symbols");
+ }
+ symbol_sets[title]= NULL;
+ ++number_docs;
break;
}
}
@@ -860,8 +868,16 @@ SymbolsDialog::getSymbolsSet(Glib::ustring title)
std::string line;
while (std::getline(infile, line)) {
std::string title_res = std::regex_replace (line, matchtitle,"$1",std::regex_constants::format_no_copy);
- new_title = ellipsize(Glib::ustring(title_res), 33);
- if (!title_res.empty() && title == new_title) {
+ if (!title_res.empty()) {
+ new_title = ellipsize(Glib::ustring(title_res), 33);
+ }
+ std::size_t pos = filename.find_last_of("/\\");
+ Glib::ustring filename_short = "";
+ if (pos != std::string::npos) {
+ filename_short = filename.substr(pos+1);
+ }
+ if (title == new_title || filename_short == title + ".svg") {
+ new_title = title;
if(Glib::str_has_suffix(filename, ".svg")) {
symbol_doc = SPDocument::createNewDoc(filename.c_str(), FALSE);
}