diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2017-06-06 17:15:26 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2017-06-06 17:15:26 +0000 |
| commit | 0cbf1e83f2a78036ae473b0a173d416acf52efd8 (patch) | |
| tree | 7353975af4ca1b881ac61bc482046549d1ffcc42 /src/ui | |
| parent | Remove silly code ;) (diff) | |
| parent | Fix build with versions of Harfbuzz prior to 1.2.3. (Visualization of alterna... (diff) | |
| download | inkscape-0cbf1e83f2a78036ae473b0a173d416acf52efd8.tar.gz inkscape-0cbf1e83f2a78036ae473b0a173d416acf52efd8.zip | |
Update to trunk
(bzr r15715)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/interface.cpp | 85 | ||||
| -rw-r--r-- | src/ui/interface.h | 4 | ||||
| -rw-r--r-- | src/ui/tools/measure-tool.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/font-variants.cpp | 91 | ||||
| -rw-r--r-- | src/ui/widget/font-variants.h | 4 |
5 files changed, 159 insertions, 27 deletions
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 5e85065d1..33e98a81c 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -1438,13 +1438,58 @@ ContextMenu::ContextMenu(SPDesktop *desktop, SPItem *item) : AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_DELETE)); positionOfLastDialog = 10; // 9 in front + 1 for the separator in the next if; used to position the dialog menu entries below each other + Geom::Rect b(_desktop->point(),_desktop->point() + Geom::Point(1,1)); + std::vector< SPItem * > down_items = _desktop->getDocument()->getItemsPartiallyInBox( _desktop->dkey, b, true, true); + bool has_down_hidden = false; + bool has_down_locked = false; + for(std::vector< SPItem * >::iterator down = down_items.begin(); down != down_items.end(); ++down){ + if((*down)->isHidden()) { + has_down_hidden = true; + } + if((*down)->isLocked()) { + has_down_locked = true; + } + } + AddSeparator(); + Gtk::MenuItem* mi; + + mi = Gtk::manage(new Gtk::MenuItem(_("Hide selected objects"),1)); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::HideSelected)); + if (_desktop->selection->isEmpty()) { + mi->set_sensitive(false); + } + mi->show(); + append(*mi);//insert(*mi,positionOfLastDialog++); + + mi = Gtk::manage(new Gtk::MenuItem(_("Unhide objects below"),1)); + mi->signal_activate().connect(sigc::bind<std::vector< SPItem * > >(sigc::mem_fun(*this, &ContextMenu::UnHideBelow), down_items)); + if (!has_down_hidden) { + mi->set_sensitive(false); + } + mi->show(); + append(*mi);//insert(*mi,positionOfLastDialog++); + mi = Gtk::manage(new Gtk::MenuItem(_("Lock selected objects"),1)); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::LockSelected)); + if (_desktop->selection->isEmpty()) { + mi->set_sensitive(false); + } + mi->show(); + append(*mi);//insert(*mi,positionOfLastDialog++); + + mi = Gtk::manage(new Gtk::MenuItem(_("Unlock objects below"),1)); + mi->signal_activate().connect(sigc::bind<std::vector< SPItem * > >(sigc::mem_fun(*this, &ContextMenu::UnLockBelow), down_items)); + if (!has_down_locked) { + mi->set_sensitive(false); + } + mi->show(); + append(*mi);//insert(*mi,positionOfLastDialog++); /* Item menu */ if (item!=NULL) { AddSeparator(); MakeObjectMenu(); } - + AddSeparator(); /* layer menu */ SPGroup *group=NULL; if (item) { @@ -1507,6 +1552,44 @@ void ContextMenu::LeaveGroup(void) _desktop->setCurrentLayer(_desktop->currentLayer()->parent); } +void ContextMenu::LockSelected(void) +{ + auto itemlist = _desktop->selection->items(); + for(auto i=itemlist.begin();i!=itemlist.end(); ++i) { + (*i)->setLocked(true); + } +} + +void ContextMenu::HideSelected(void) +{ + auto itemlist =_desktop->selection->items(); + for(auto i=itemlist.begin();i!=itemlist.end(); ++i) { + (*i)->setHidden(true); + } +} + +void ContextMenu::UnLockBelow(std::vector<SPItem *> items) +{ + _desktop->selection->clear(); + for(auto i=items.begin();i!=items.end(); ++i) { + if ((*i)->isLocked()) { + (*i)->setLocked(false); + _desktop->selection->add(*i); + } + } +} + +void ContextMenu::UnHideBelow(std::vector<SPItem *> items) +{ + _desktop->selection->clear(); + for(auto i=items.begin();i!=items.end(); ++i) { + if ((*i)->isHidden()) { + (*i)->setHidden(false); + _desktop->selection->add(*i); + } + } +} + void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb)//, SPDesktop *view)//, bool radio, GSList *group) { SPAction *action; diff --git a/src/ui/interface.h b/src/ui/interface.h index 52074f0f0..a41c36cc3 100644 --- a/src/ui/interface.h +++ b/src/ui/interface.h @@ -172,6 +172,10 @@ class ContextMenu : public Gtk::Menu void EnterGroup(Gtk::MenuItem* mi); void LeaveGroup(void); + void LockSelected(void); + void HideSelected(void); + void UnLockBelow(std::vector<SPItem *> items); + void UnHideBelow(std::vector<SPItem *> items); ////////////////////////////////////////// //callbacks for the context menu entries of an SP_TYPE_ITEM object void ItemProperties(void); diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index f3185649b..98b2c7d03 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -1260,7 +1260,7 @@ void MeasureTool::showCanvasItems(bool to_guides, bool to_item, bool to_phantom, std::vector<SPItem*> items; SPDocument *doc = desktop->getDocument(); Geom::Rect rect(start_p, end_p); - items = doc->getItemsPartiallyInBox(desktop->dkey, rect, true); + items = doc->getItemsPartiallyInBox(desktop->dkey, rect, false, true); Inkscape::LayerModel *layer_model = NULL; SPObject *current_layer = NULL; if(desktop){ diff --git a/src/ui/widget/font-variants.cpp b/src/ui/widget/font-variants.cpp index b386051a6..e7645b620 100644 --- a/src/ui/widget/font-variants.cpp +++ b/src/ui/widget/font-variants.cpp @@ -231,9 +231,17 @@ namespace Widget { // Add tooltips _feature_entry.set_tooltip_text( _("Feature settings in CSS form. No sanity checking is performed.")); + _feature_list.set_justify( Gtk::JUSTIFY_LEFT ); + _feature_list.set_line_wrap( true ); + + _feature_substitutions.set_justify( Gtk::JUSTIFY_LEFT ); + _feature_substitutions.set_line_wrap( true ); + // Add to frame _feature_vbox.add( _feature_entry ); _feature_vbox.add( _feature_label ); + _feature_vbox.add( _feature_list ); + _feature_vbox.add( _feature_substitutions ); _feature_frame.add( _feature_vbox ); add( _feature_frame ); @@ -532,30 +540,65 @@ namespace Widget { // Make list of tables not handled above... eventually add Gtk::Label with // this info. - // std::map<Glib::ustring,int> table_copy = res->openTypeTables; - // if( (it = table_copy.find("liga")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("clig")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("dlig")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("hlig")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("calt")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("subs")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("sups")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("smcp")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("c2sc")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("pcap")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("unic")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("titl")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("lnum")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("onum")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("pnum")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("tnum")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("frac")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("afrc")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("ordn")) != table_copy.end() ) table_copy.erase( it ); - // if( (it = table_copy.find("zero")) != table_copy.end() ) table_copy.erase( it ); - // for(it = table_copy.begin(); it != table_copy.end(); ++it) { - // std::cout << "Other: " << it->first << " Occurances: " << it->second << std::endl; - // } + std::map<Glib::ustring,int> table_copy = res->openTypeTables; + if( (it = table_copy.find("liga")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("clig")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("dlig")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("hlig")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("calt")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("subs")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("sups")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("smcp")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("c2sc")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("pcap")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("unic")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("titl")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("lnum")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("onum")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("pnum")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("tnum")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("frac")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("afrc")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("ordn")) != table_copy.end() ) table_copy.erase( it ); + if( (it = table_copy.find("zero")) != table_copy.end() ) table_copy.erase( it ); + std::string ott_list = "OpenType tables not included above: "; + for(it = table_copy.begin(); it != table_copy.end(); ++it) { + // std::cout << "Other: " << it->first << " Occurances: " << it->second << std::endl; + ott_list += it->first; + ott_list += ", "; + } + + _feature_list.set_text( ott_list.c_str() ); + + // "<span foreground='darkblue'>"; + Glib::ustring markup; + + for (auto table: res->openTypeSubstitutions) { + + markup += table.first; + markup += ": "; + + markup += "<span font_family='"; + markup += sp_font_description_get_family(res->descr); + markup += "'>"; + markup += Glib::Markup::escape_text(table.second); + markup += "</span>"; + + markup += " → "; + + markup += "<span font_family='"; + markup += sp_font_description_get_family(res->descr); + markup += "'>"; + markup += "<span font_features='"; + markup += table.first; + markup += "'>"; + markup += Glib::Markup::escape_text(table.second); + markup += "</span>"; + markup += "</span>\n"; + + } + + _feature_substitutions.set_markup ( markup.c_str() ); } else { std::cerr << "FontVariants::update(): Couldn't find font_instance for: " diff --git a/src/ui/widget/font-variants.h b/src/ui/widget/font-variants.h index d4329feff..cf8e476a9 100644 --- a/src/ui/widget/font-variants.h +++ b/src/ui/widget/font-variants.h @@ -86,7 +86,9 @@ protected: Gtk::VBox _feature_vbox; Gtk::Entry _feature_entry; Gtk::Label _feature_label; - + Gtk::Label _feature_list; + Gtk::Label _feature_substitutions; + private: void ligatures_init(); void ligatures_callback(); |
