diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-09-07 23:12:15 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2019-09-28 15:42:34 +0000 |
| commit | 5b7b8889dc2b3dbdbbbe8876649989370e431c8d (patch) | |
| tree | 827ad1773522a98838924275a8800333aff1c6ff /src/libnrtype | |
| parent | Fix issue https://gitlab.com/inkscape/inkscape/issues/246 LPE Perspective/Env... (diff) | |
| download | inkscape-5b7b8889dc2b3dbdbbbe8876649989370e431c8d.tar.gz inkscape-5b7b8889dc2b3dbdbbbe8876649989370e431c8d.zip | |
Dis allow to emit once instead 3 time on font change
Diffstat (limited to 'src/libnrtype')
| -rw-r--r-- | src/libnrtype/font-lister.cpp | 25 | ||||
| -rw-r--r-- | src/libnrtype/font-lister.h | 6 |
2 files changed, 16 insertions, 15 deletions
diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index 701c5c3d6..4aedd1641 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -572,7 +572,7 @@ std::pair<Glib::ustring, Glib::ustring> FontLister::selection_update() } std::pair<Glib::ustring, Glib::ustring> ui = ui_from_fontspec(fontspec); - set_font_family(ui.first); + (ui.first); set_font_style(ui.second); #ifdef DEBUG_FONT @@ -601,8 +601,8 @@ void FontLister::set_fontspec(Glib::ustring new_fontspec, bool /*check*/) << " style:" << new_style << std::endl; #endif - set_font_family(new_family, false); - set_font_style(new_style); + set_font_family(new_family, false, false); + set_font_style(new_style, false); emit_update(); } @@ -678,7 +678,7 @@ std::pair<Glib::ustring, Glib::ustring> FontLister::new_font_family(Glib::ustrin return std::make_pair(new_family, best_style); } -std::pair<Glib::ustring, Glib::ustring> FontLister::set_font_family(Glib::ustring new_family, bool check_style) +std::pair<Glib::ustring, Glib::ustring> FontLister::set_font_family(Glib::ustring new_family, bool check_style, bool emit) { #ifdef DEBUG_FONT @@ -697,14 +697,14 @@ std::pair<Glib::ustring, Glib::ustring> FontLister::set_font_family(Glib::ustrin std::cout << "FontLister::set_font_family: end" << std::endl; std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" << std::endl; #endif - - emit_update(); - + if (emit) { + emit_update(); + } return ui; } -std::pair<Glib::ustring, Glib::ustring> FontLister::set_font_family(int row, bool check_style) +std::pair<Glib::ustring, Glib::ustring> FontLister::set_font_family(int row, bool check_style, bool emit) { #ifdef DEBUG_FONT @@ -721,7 +721,7 @@ std::pair<Glib::ustring, Glib::ustring> FontLister::set_font_family(int row, boo new_family = (*iter)[FontList.family]; } - std::pair<Glib::ustring, Glib::ustring> ui = set_font_family(new_family, check_style); + std::pair<Glib::ustring, Glib::ustring> ui = set_font_family(new_family, check_style, emit); #ifdef DEBUG_FONT std::cout << "FontLister::set_font_family( row ): end" << std::endl; @@ -731,7 +731,7 @@ std::pair<Glib::ustring, Glib::ustring> FontLister::set_font_family(int row, boo } -void FontLister::set_font_style(Glib::ustring new_style) +void FontLister::set_font_style(Glib::ustring new_style, bool emit) { // TODO: Validate input using Pango. If Pango doesn't recognize a style it will @@ -749,8 +749,9 @@ void FontLister::set_font_style(Glib::ustring new_style) std::cout << "FontLister::set_font_style: end" << std::endl; std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" << std::endl; #endif - - emit_update(); + if (emit) { + emit_update(); + } } diff --git a/src/libnrtype/font-lister.h b/src/libnrtype/font-lister.h index 16c34d94c..1a0a47b15 100644 --- a/src/libnrtype/font-lister.h +++ b/src/libnrtype/font-lister.h @@ -217,7 +217,7 @@ public: * Calls new_font_family(). * (For use in text-toolbar where update is immediate.) */ - std::pair<Glib::ustring, Glib::ustring> set_font_family(Glib::ustring family, bool check_style = true); + std::pair<Glib::ustring, Glib::ustring> set_font_family(Glib::ustring family, bool check_style = true, bool emit = true); /** * Sets font-family from row in list store. @@ -227,7 +227,7 @@ public: * font-family list correctly. * Calls set_font_family(). */ - std::pair<Glib::ustring, Glib::ustring> set_font_family(int row, bool check_style = true); + std::pair<Glib::ustring, Glib::ustring> set_font_family(int row, bool check_style = true, bool emit = true); Glib::ustring get_font_family() { @@ -242,7 +242,7 @@ public: /** * Sets style. Does not validate style for family. */ - void set_font_style(Glib::ustring style); + void set_font_style(Glib::ustring style, bool emit = true); Glib::ustring get_font_style() { |
