11#include <cairomm/enums.h>
12#include <cairomm/refptr.h>
13#include <cairomm/surface.h>
15#include <gdkmm/pixbuf.h>
16#include <gdkmm/rgba.h>
17#include <gdkmm/texture.h>
18#include <giomm/liststore.h>
19#include <glib/gi18n.h>
20#include <glibmm/error.h>
21#include <glibmm/fileutils.h>
22#include <glibmm/main.h>
23#include <glibmm/markup.h>
24#include <glibmm/miscutils.h>
25#include <glibmm/refptr.h>
26#include <glibmm/uriutils.h>
27#include <glibmm/ustring.h>
28#include <gtkmm/boolfilter.h>
29#include <gtkmm/builder.h>
30#include <gtkmm/button.h>
31#include <gtkmm/celleditable.h>
32#include <gtkmm/cellrendererpixbuf.h>
33#include <gtkmm/cellrenderertext.h>
34#include <gtkmm/columnview.h>
35#include <gtkmm/columnviewcolumn.h>
36#include <gtkmm/columnviewrow.h>
37#include <gtkmm/dialog.h>
38#include <gtkmm/drawingarea.h>
39#include <gtkmm/enums.h>
40#include <gtkmm/filterlistmodel.h>
41#include <gtkmm/grid.h>
42#include <gtkmm/iconview.h>
43#include <gtkmm/image.h>
44#include <gtkmm/label.h>
45#include <gtkmm/liststore.h>
46#include <gtkmm/noselection.h>
47#include <gtkmm/paned.h>
48#include <gtkmm/searchentry2.h>
49#include <gtkmm/signallistitemfactory.h>
50#include <gtkmm/sortlistmodel.h>
51#include <gtkmm/stack.h>
52#include <gtkmm/stringsorter.h>
53#include <gtkmm/treemodelfilter.h>
54#include <gtkmm/treemodelsort.h>
55#include <gtkmm/treeselection.h>
56#include <gtkmm/treeview.h>
57#include <gtkmm/window.h>
98struct InfoItem :
public Glib::Object {
104 static Glib::RefPtr<InfoItem>
create(
const Glib::ustring& item,
const Glib::ustring& value, uint32_t count,
SPObject*
object) {
105 auto infoitem = Glib::make_refptr_for_instance<InfoItem>(
new InfoItem());
106 infoitem->item =
item;
107 infoitem->value = value;
108 infoitem->count = count;
109 infoitem->object = object;
112 static Glib::RefPtr<InfoItem>
create(
const Glib::ustring& item,
const Glib::ustring& value) {
113 return create(item, value, 0,
nullptr);
118 Stats,
Colors,
Fonts,
Styles,
Patterns,
Symbols,
Markers,
Gradients,
Swatches,
Images,
Filters,
External,
Metadata
155 case Stats:
return 1;
184 Glib::ustring mime_type, Glib::ustring file_name) {
185 static std::string current_folder;
191 std::ostringstream ost;
192 ost <<
"GIMP Palette\n";
194 ost <<
"Name: " <<
name <<
"\n";
197 for (
auto c : colors) {
198 auto r = (
c >> 16) & 0xff;
199 auto g = (
c >> 8) & 0xff;
201 ost << r <<
' ' << g <<
' ' << b <<
'\n';
203 Glib::file_set_contents(fname, ost.str());
205 catch (Glib::Error
const &ex) {
206 g_warning(
"Error saving color palette: %s", ex.what());
209 g_warning(
"Error saving color palette.");
214 if (colors.empty() || !
parent)
return;
216 auto file =
choose_file(_(
"Export Color Palette"),
parent,
"application/color-palette",
"color-palette.gpl");
224 if (!
object || !selection)
return;
226 auto document =
object->document;
228 if (
auto pattern = cast<SPPattern>(
object)) {
230 pattern->deleteObject(
true);
231 DocumentUndo::done(document, _(
"Delete pattern"), INKSCAPE_ICON(
"document-resources"));
233 else if (
auto gradient = cast<SPGradient>(
object)) {
235 gradient->deleteObject(
true);
236 DocumentUndo::done(document, _(
"Delete gradient"), INKSCAPE_ICON(
"document-resources"));
239 selection->
set(
object);
248 auto label =
object.getAttribute(
"inkscape:label");
252 object.setAttribute(
"inkscape:label",
label.c_str());
257 auto title =
object.title();
258 Glib::ustring str(title ? title :
"");
263 object.setTitle(title.c_str());
266struct ResourceItem :
public Glib::Object {
269 Glib::RefPtr<Gdk::Texture>
image;
274 static Glib::RefPtr<ResourceItem>
create(
275 const Glib::ustring&
id,
276 Glib::ustring& label,
277 Glib::RefPtr<Gdk::Texture> image,
279 bool editable =
false,
280 uint32_t rgb24color = 0
282 auto item = Glib::make_refptr_for_instance<ResourceItem>(
new ResourceItem());
286 item->object = object;
287 item->editable = editable;
288 item->color = rgb24color;
318struct ResourceTextItem :
public Glib::Object {
323 static Glib::RefPtr<ResourceTextItem>
create(
const Glib::ustring&
id, Glib::ustring& name, Glib::ustring& icon) {
324 auto item = Glib::make_refptr_for_instance<ResourceTextItem>(
new ResourceTextItem());
339 :
DialogBase(
"/dialogs/document-resources",
"DocumentResources"),
343 _listview(
get_widget<
Gtk::ColumnView>(_builder,
"listview")),
359 _item_filter = std::make_unique<TextMatchingFilter>([](
const Glib::RefPtr<Glib::ObjectBase>&
item){
360 auto ptr = std::dynamic_pointer_cast<details::ResourceItem>(
item);
361 return ptr ? ptr->label : Glib::ustring();
365 auto sorter = Gtk::StringSorter::create(Gtk::ClosureExpression<Glib::ustring>::create([
this](
auto&
item){
366 auto ptr = std::dynamic_pointer_cast<details::ResourceItem>(
item);
367 return ptr ? ptr->label :
"";
369 auto model = Gtk::SortListModel::create(filtered_items, sorter);
373 auto rsrc = std::dynamic_pointer_cast<details::ResourceItem>(ptr);
374 if (!rsrc)
return {};
376 auto name = Glib::Markup::escape_text(rsrc->label);
377 return { .label_markup =
name, .image = rsrc->image, .tooltip = rsrc->label };
379 _gridview.add_css_class(
"grid-view-small");
401 auto set_up_label = [](
auto& list_item){
402 auto label = Gtk::make_managed<Gtk::Label>();
403 label->set_xalign(0);
404 list_item->set_child(*
label);
406 auto bind_label = [](
auto& list_item,
const Glib::ustring& markup){
407 auto label =
dynamic_cast<Gtk::Label*
>(list_item->get_child());
411 _listview.add_css_class(
"list-view-small");
413 for (
int i = 0; i < cols->get_n_items(); ++i) {
414 auto info_factory = Gtk::SignalListItemFactory::create();
415 info_factory->signal_setup().connect(set_up_label);
416 info_factory->signal_bind().connect([
this, i, bind_label](
auto& list_item) {
417 auto item = std::dynamic_pointer_cast<InfoItem>(list_item->get_item());
420 if (i == 0) text =
item->item;
421 else if (i == 1) { text =
item->count ? std::to_string(
item->count) :
""; }
422 else text =
item->value;
423 bind_label(list_item, text);
425 cols->get_typed_object<Gtk::ColumnViewColumn>(i)->set_factory(info_factory);
427 _listview.set_model(Gtk::NoSelection::create(filtered_info));
429 auto refilter_info = [
this]() {
430 auto expression = Gtk::ClosureExpression<bool>::create([
this](
auto&
item){
431 auto ptr = std::dynamic_pointer_cast<InfoItem>(
item);
432 if (!ptr)
return false;
434 auto str =
_search.get_text().lowercase();
435 if (str.empty())
return true;
437 return ptr->value.lowercase().find(str) != Glib::ustring::npos;
443 auto treestore = get_object<Gtk::ListStore>(
_builder,
"liststore");
445 treestore->foreach([&](
auto& path,
auto& it) {
447 it->get_value(
COL_ID,
id);
452 store->append(ResourceTextItem::create(
id,
name, icon));
456 auto factory_1 = Gtk::SignalListItemFactory::create();
457 factory_1->signal_setup().connect([
this](
auto& list_item) {
458 auto box = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL);
459 box->add_css_class(
"item-box");
460 auto image = Gtk::make_managed<Gtk::Image>();
461 image->set_icon_size(Gtk::IconSize::NORMAL);
463 box->append(*Gtk::make_managed<Gtk::Label>());
464 list_item->set_child(*box);
467 factory_1->signal_bind().connect([
this](
auto& list_item) {
468 auto item = std::dynamic_pointer_cast<ResourceTextItem>(list_item->get_item());
470 auto box =
dynamic_cast<Gtk::Box*
>(list_item->get_child());
472 auto image =
dynamic_cast<Gtk::Image*
>(box->get_first_child());
474 auto label =
dynamic_cast<Gtk::Label*
>(
image->get_next_sibling());
477 bool separator =
item->
id ==
"-";
479 image->set_from_icon_name(
item->icon !=
"-" ?
item->icon :
"");
480 image->set_visible(!separator);
481 label->set_text(separator ?
"" :
item->name);
482 label->set_hexpand();
483 label->set_xalign(0);
484 label->set_margin_start(3);
485 label->set_visible(!separator);
488 list_item->set_activatable(!separator);
489 list_item->set_selectable(!separator);
490 if (separator) box->add_css_class(
"separator");
else box->remove_css_class(
"separator");
494 _selector.add_css_class(
"list-view-small");
497 _filter = Gtk::BoolFilter::create({});
498 auto filtered_model = Gtk::FilterListModel::create(
store,
_filter);
501 if (
auto item = std::dynamic_pointer_cast<ResourceTextItem>(
_selection_model->get_selected_item())) {
502 select_page(item->id);
507 _categories = Gtk::TreeModelFilter::create(treestore);
508 _categories->set_visible_func([
this](Gtk::TreeModel::const_iterator
const &it){
510 it->get_value(
COL_ID,
id);
523 auto paned = &get_widget<Gtk::Paned>(
_builder,
"paned");
524 auto const move = [=,
this](){
525 auto pos = paned->get_position();
526 get_widget<Gtk::Label>(
_builder,
"spacer").set_size_request(pos);
528 paned->property_position().signal_changed().connect([move](){ move(); });
531 _edit.signal_clicked().connect([
this]{
545 _select.signal_clicked().connect([
this]{
562 _search.signal_search_changed().connect([
this, refilter_info](){
567 _delete.signal_clicked().connect([
this]{
576 _extract.signal_clicked().connect([
this]{
577 auto const window =
dynamic_cast<Gtk::Window *
>(get_root());
589 std::vector<int> colors;
592 for (
size_t i = 0; i <
N; ++i) {
593 if (
auto r =
_item_store->get_typed_object<details::ResourceItem>(i)) {
594 colors.push_back(r->color);
614 auto rsrc = std::dynamic_pointer_cast<details::ResourceItem>(sel);
623 _edit.set_sensitive(single_sel);
625 _delete.set_sensitive(single_sel);
626 _select.set_sensitive(single_sel);
630 Cairo::RefPtr<Cairo::Surface> nul;
635 auto style = obj.
style;
638 colors.
set(
c.toString(),
c);
641 if (style->stroke.set && style->stroke.isColor()) {
642 add(style->stroke.getColor());
644 if (style->color.set) {
645 add(style->color.getColor());
647 if (style->fill.set) {
648 add(style->fill.getColor());
650 if (style->solid_color.set) {
651 add(style->solid_color.getColor());
661 if (is<SPUse>(&
object))
return;
663 for (
auto&&
child :
object.children) {
675 auto style =
object.style;
677 if (style->font_specification.set) {
678 auto fspec = style->font_specification.value();
679 if (fspec && *fspec) {
683 else if (style->font.set) {
685 auto font = style->font.get_value();
686 if (style->font_style.set) {
687 font +=
' ' + style->font_style.get_value();
694 std::set<std::string> fonts;
712 std::vector<T*>
items;
715 if (
auto t = cast<T>(&obj)) {
716 if (filter(*t))
items.push_back(t);
724 std::unordered_map<std::string, size_t> map;
725 if (!
root)
return map;
737 bool present =
false;
739 if (*href && *href !=
'#' && *href !=
'?') {
740 auto scheme = Glib::uri_parse_scheme(href);
743 if (scheme ==
"file" || scheme ==
"http" || scheme ==
"https" || scheme.empty()) {
759 std::set<std::string> fonts;
765 if (
auto pattern = cast<SPPattern>(&obj)) {
770 else if (is<SPMeshGradient>(&obj)) {
773 else if (
auto gradient = cast<SPGradient>(&obj)) {
775 if (gradient->isSwatch()) {
783 else if (
auto marker = cast<SPMarker>(&obj)) {
788 else if (
auto symbol = cast<SPSymbol>(&obj)) {
793 else if (is<SPFont>(&obj)) {
796 else if (is<SPImage>(&obj)) {
799 else if (
auto group = cast<SPGroup>(&obj)) {
800 if (strcmp(group->getRepr()->name(),
"svg:g") == 0) {
801 switch (group->layerMode()) {
811 else if (is<SPPath>(&obj)) {
814 else if (is<SPFilter>(&obj)) {
817 else if (is<ColorProfile>(&obj)) {
822 if (*style) stats.styles++;
836 stats.colors = colors.
size();
837 stats.fonts = fonts.size();
844 auto root = _document ? _document->getRoot() :
nullptr;
848 for (
auto& el : _rdf_list) {
849 bool read_only =
true;
850 el.update(_document, read_only);
851 if (!el.content().empty()) stats.metadata++;
858void DocumentResources::rebuild_stats() {
861 if (
auto desktop = getDesktop()) {
866 auto expression = Gtk::ClosureExpression<bool>::create([
this](
auto&
item){
867 auto ptr = std::dynamic_pointer_cast<ResourceTextItem>(
item);
868 if (!ptr)
return false;
870 if (ptr->id ==
"-")
return true;
875 _filter->set_expression(expression);
877 _categories->refilter();
878 _categories->foreach_iter([
this](Gtk::TreeModel::iterator
const &it){
880 it->get_value(
COL_ID,
id);
882 if (
id ==
"stats") count = 0;
888void DocumentResources::documentReplaced() {
889 _document = getDocument();
891 _document_modified = _document->connectModified([
this](
unsigned){
893 _idle_refresh = Glib::signal_timeout().connect([
this]{
895 refresh_current_page();
901 _document_modified.disconnect();
905 refresh_current_page();
908void DocumentResources::refresh_current_page() {
909 auto page = _cur_page_id;
912 _selection_model->set_selected(0);
915 auto selected = _selection_model->get_selected_item();
916 if (
auto item = std::dynamic_pointer_cast<ResourceTextItem>(selected)) {
926auto get_id = [](
const SPObject* object) {
auto id =
object->getId();
return id ? id :
""; };
930 for (
auto&& it : colors) {
931 const auto& color = it.second;
933 Glib::ustring
name = color.toString();
934 auto rgba32 = color.toRGBA(0xff);
935 auto rgb24 = rgba32 >> 8;
941 item_store->append(details::ResourceItem::create(
name,
name,
image,
nullptr,
false, rgb24));
947 item_store->freeze_notify();
962 item_store->append(details::ResourceItem::create(
id,
label,
image,
item));
965 item_store->thaw_notify();
970 static_assert(std::is_base_of<SPObject, T>::value);
971 _add_items_with_images(item_store,
reinterpret_cast<const std::vector<SPObject*>&
>(
items),
width,
height, device_scale, use_title, opt);
974void add_fonts(Glib::RefPtr<Gio::ListStoreBase>
store,
const std::set<std::string>& fontspecs) {
976 for (
auto&& fs : fontspecs) {
977 auto item = Glib::ustring::compose(
"%1 %2", _(
"Font"), i++);
978 auto name = Glib::Markup::escape_text(fs);
979 auto value = Glib::ustring::format(
980 "<span allow_breaks='false' size='xx-large' font='", fs,
"'>",
name,
"</span>\n",
981 "<span allow_breaks='false' size='small' alpha='60%'>",
name,
"</span>"
983 store->append(InfoItem::create(
item, value));
988 auto read_only =
true;
989 auto license = document ?
rdf_get_license(document, read_only) :
nullptr;
991 std::pair<const char*, std::string> str[] = {
993 {_(
"License"), license && license->name ? license->name :
"-"},
994 {_(
"Metadata"), stats.
metadata > 0 ? C_(
"Adjective for Metadata status",
"Present") :
"-"},
996 for (
auto& pair : str) {
997 info_store->append(InfoItem::create(pair.first, Glib::Markup::escape_text(pair.second)));
1000 std::pair<const char*, size_t> kv[] = {
1001 {_(
"Colors"), stats.
colors},
1004 {_(
"Fonts"), stats.
fonts},
1008 {_(
"Symbols"), stats.
symbols},
1009 {_(
"Markers"), stats.
markers},
1010 {_(
"Filters"), stats.
filters},
1011 {_(
"Images"), stats.
images},
1013 {_(
"Layers"), stats.
layers},
1014 {_(
"Total elements"), stats.
nodes},
1015 {_(
"Groups"), stats.
groups},
1016 {_(
"Paths"), stats.
paths},
1019 for (
auto& pair : kv) {
1020 info_store->append(InfoItem::create(pair.first, pair.second ? std::to_string(pair.second) :
"-"));
1025 const boost::ptr_vector<Inkscape::UI::Widget::EntityEntry>& rdf_list) {
1027 for (
auto& entry : rdf_list) {
1028 auto label = entry._label.get_label();
1030 info_store->append(InfoItem::create(
label, Glib::Markup::escape_text(entry.content())));
1034void add_filters(Glib::RefPtr<Gio::ListStoreBase> info_store,
const std::vector<SPFilter*>& filters) {
1035 for (
auto& filter : filters) {
1036 auto label = filter->getAttribute(
"inkscape:label");
1038 std::ostringstream ost;
1040 for (
auto& obj : filter->children) {
1041 if (
auto primitive = cast<SPFilterPrimitive>(&obj)) {
1042 if (!first) ost <<
", ";
1043 Glib::ustring
name = primitive->getRepr()->name();
1044 if (
name.find(
"svg:") != std::string::npos) {
1051 info_store->append(InfoItem::create(
name, ost.str()));
1055void add_styles(Glib::RefPtr<Gio::ListStoreBase> info_store,
const std::unordered_map<std::string, size_t>& map) {
1056 std::vector<std::string> vect;
1057 vect.reserve(map.size());
1058 for (
auto style : map) {
1059 vect.emplace_back(style.first);
1061 std::sort(vect.begin(), vect.end());
1062 info_store->freeze_notify();
1064 for (
auto& style : vect) {
1065 info_store->append(InfoItem::create(_(
"Style ") + std::to_string(n++), Glib::Markup::escape_text(style), map.find(style)->second,
nullptr));
1067 info_store->thaw_notify();
1070void add_refs(Glib::RefPtr<Gio::ListStoreBase> info_store,
const std::vector<SPObject*>& objects) {
1071 info_store->freeze_notify();
1072 for (
auto& obj : objects) {
1074 if (!href)
continue;
1076 info_store->append(InfoItem::create(
label_fmt(
nullptr,
get_id(obj)), href, 0, obj));
1078 info_store->thaw_notify();
1081void DocumentResources::select_page(
const Glib::ustring&
id) {
1082 if (_cur_page_id ==
id.raw())
return;
1088void DocumentResources::clear_stores() {
1089 _item_store->freeze_notify();
1090 _item_store->remove_all();
1091 _item_store->thaw_notify();
1093 _info_store->freeze_notify();
1094 _info_store->remove_all();
1095 _info_store->thaw_notify();
1098void DocumentResources::refresh_page(
const Glib::ustring&
id) {
1109 auto root = _document ? _document->getRoot() :
nullptr;
1110 auto defs = _document ? _document->getDefs() :
nullptr;
1112 int device_scale = get_scale_factor();
1113 auto tab =
"iconview";
1114 auto has_count =
false;
1115 auto item_width = 90;
1116 auto const color = get_color();
1117 auto label_editable =
false;
1118 auto items_selectable =
true;
1119 auto can_delete =
false;
1120 auto can_extract =
false;
1127 add_colors(_item_store, colors, device_scale);
1129 items_selectable =
false;
1136 if (
auto const window =
dynamic_cast<Gtk::Window *
>(get_root());
1137 INKSCAPE.themecontext->isCurrentThemeDark(window))
1140 opt.solid_background(0xf0f0f0ff, 3, 3);
1142 opt.symbol_style_from_use();
1145 label_editable =
true;
1151 label_editable =
true;
1158 label_editable =
true;
1164 collect_items<SPGradient>(defs, [](
auto& g){
return filter_element(g) && !g.isSwatch(); }),
1165 180, 22, device_scale);
1166 label_editable =
true;
1172 collect_items<SPGradient>(defs, [](
auto& g){
return filter_element(g) && g.isSwatch(); }),
1173 100, 22, device_scale);
1174 label_editable =
true;
1181 items_selectable =
false;
1185 add_filters(_info_store, collect_items<SPFilter>(defs));
1186 label_editable =
true;
1188 items_selectable =
false;
1195 items_selectable =
false;
1200 label_editable =
true;
1208 items_selectable =
false;
1212 add_stats(_info_store, _document, _stats);
1214 items_selectable =
false;
1220 items_selectable =
false;
1224 _showing_resource = rsrc;
1226 _listview.get_columns()->get_typed_object<Gtk::ColumnViewColumn>(1)->set_visible(has_count);
1229 _edit .set_visible(label_editable);
1230 _select .set_visible(items_selectable);
1231 _delete .set_visible(can_delete);
1232 _extract.set_visible(can_extract);
1236 get_widget<Gtk::Stack>(_builder,
"stack").set_visible_child(tab);
1241void DocumentResources::end_editing(
const Glib::ustring& path,
const Glib::ustring& new_text) {
1249 g_warning(
"Missing object ptr, cannot edit object's name.");
1256 if (!getter || !setter) {
1261 auto name = getter(*
object);
1262 if (new_text ==
name)
return;
1264 setter(*
object, new_text);
1269 if (
auto document = object->
document) {
1270 DocumentUndo::done(document, _(
"Edit object title"), INKSCAPE_ICON(
"document-resources"));
bool set(Color const &color)
Remove any other colors and set to just this one color.
unsigned size() const
Return the number of items in the color set.
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
void deleteItems(bool skip_undo=false)
The set of selected SPObjects for a given document and layer model.
void set(XML::Node *repr)
Set the selection to an XML node's SPObject.
DialogBase is the base class for the dialog system.
Selection * getSelection() const
SPDocument * getDocument() const
SPDesktop * getDesktop() const
Glib::RefPtr< Gtk::SingleSelection > _item_selection_model
std::unique_ptr< IconViewItemFactory > _item_factory
void refresh_current_page()
Glib::RefPtr< Gtk::BoolFilter > _info_filter
Glib::RefPtr< Gtk::TreeModelFilter > _categories
std::shared_ptr< details::ResourceItem > selected_item()
std::unique_ptr< TextMatchingFilter > _item_filter
sigc::scoped_connection _selection_change
boost::ptr_vector< Inkscape::UI::Widget::EntityEntry > _rdf_list
Glib::RefPtr< Gio::ListStoreBase > _item_store
Gtk::ListView & _selector
Gtk::ColumnView & _listview
Glib::RefPtr< Gtk::BoolFilter > _filter
Glib::RefPtr< Gtk::SingleSelection > _selection_model
Gtk::GridView & _gridview
Gtk::SearchEntry2 & _search
details::Statistics _stats
Glib::RefPtr< Gio::ListStoreBase > _info_store
Glib::RefPtr< Gtk::Builder > _builder
static std::unique_ptr< IconViewItemFactory > create(std::function< ItemData(Glib::RefPtr< Glib::ObjectBase > &)> get_item)
static EntityEntry * create(rdf_work_entity_t *ent, Registry &wr)
Cairo::RefPtr< Cairo::Surface > render(SPObject &object, double width, double height, double device_scale, options options={})
Inkscape::Selection * getSelection() const
Typed SVG document implementation.
char const * getDocumentFilename() const
SPObject * getObjectById(std::string const &id) const
char const * getDocumentName() const
basename or other human-readable label for the document.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
char const * label() const
Gets the author-visible label property for the object or a default if no label is defined.
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
char const * getAttribute(char const *name) const
char * title() const
Returns the title of this object, or NULL if there is none.
SPObject of the color-profile object found a direct child of defs.
A set of colors which can be modified together used for color pickers.
Editable view implementation.
static char const *const parent
A simple dialog for previewing document resources.
TODO: insert short description here.
Macro for icon names used in Inkscape.
std::unique_ptr< Magick::Image > image
Glib::ustring get_inkscape_label(const SPObject &object)
void set_inkscape_label(SPObject &object, const Glib::ustring &label)
Glib::ustring get_title(const SPObject &object)
void set_title(SPObject &object, const Glib::ustring &title)
void add_items_with_images(Glib::RefPtr< Gio::ListStoreBase > item_store, const std::vector< T * > &items, double width, double height, int device_scale, bool use_title=false, object_renderer::options opt={})
void add_colors(Glib::RefPtr< Gio::ListStoreBase > &item_store, Colors::ColorSet const &colors, int device_scale)
Resources id_to_resource(const std::string &id)
void add_filters(Glib::RefPtr< Gio::ListStoreBase > info_store, const std::vector< SPFilter * > &filters)
void add_fonts(Glib::RefPtr< Gio::ListStoreBase > store, const std::set< std::string > &fontspecs)
Cairo::RefPtr< Cairo::Surface > render_color(uint32_t rgb, double size, double radius, int device_scale)
bool filter_element< SPPattern >(SPPattern &object)
bool is_resource_present(std::string const &id, details::Statistics const &stats)
void add_stats(Glib::RefPtr< Gio::ListStoreBase > info_store, SPDocument *document, const details::Statistics &stats)
std::map< std::type_index, std::function< Glib::ustring(const SPObject &)> > g_get_label
bool filter_element(T &object)
static void delete_object(SPObject *object, Inkscape::Selection *selection)
void _add_items_with_images(Glib::RefPtr< Gio::ListStoreBase > &item_store, const std::vector< SPObject * > &items, double width, double height, int device_scale, bool use_title, object_renderer::options opt)
void extract_colors(Gtk::Window *parent, const std::vector< int > &colors, const char *name)
void collect_object_colors(SPObject &obj, Colors::ColorSet &colors)
std::set< std::string > collect_fontspecs(SPObject *object)
details::Statistics collect_statistics(SPObject *root)
const std::unordered_map< std::string, Resources > g_id_to_resource
void collect_colors(SPObject *object, Colors::ColorSet &colors)
bool has_external_ref(SPObject &obj)
std::map< std::type_index, std::function< void(SPObject &, const Glib::ustring &)> > g_set_label
void add_styles(Glib::RefPtr< Gio::ListStoreBase > info_store, const std::unordered_map< std::string, size_t > &map)
void add_refs(Glib::RefPtr< Gio::ListStoreBase > info_store, const std::vector< SPObject * > &objects)
Glib::RefPtr< Gio::File > choose_file(Glib::ustring title, Gtk::Window *parent, Glib::ustring mime_type, Glib::ustring file_name)
bool filter_element< SPGradient >(SPGradient &object)
void save_gimp_palette(std::string fname, const std::vector< int > &colors, const char *name)
std::vector< T * > collect_items(SPObject *object, bool(*filter)(T &)=filter_element< T >)
std::size_t get_resource_count(details::Statistics const &stats, Resources const rsrc)
void collect_used_fonts(SPObject &object, std::set< std::string > &fonts)
std::unordered_map< std::string, size_t > collect_styles(SPObject *root)
void add_metadata(Glib::RefPtr< Gio::ListStoreBase > info_store, SPDocument *document, const boost::ptr_vector< Inkscape::UI::Widget::EntityEntry > &rdf_list)
void apply_visitor(SPObject &object, V &&visitor)
W & get_widget(const Glib::RefPtr< Gtk::Builder > &builder, const char *id)
Glib::RefPtr< Gtk::Builder > create_builder(const char *filename)
void trim(Glib::ustring &input, Glib::ustring const &also_remove="")
Modifies a string in place, removing leading and trailing whitespace characters.
Cairo::RefPtr< Cairo::Surface > add_background_to_image(Cairo::RefPtr< Cairo::Surface > image, uint32_t rgb, double margin, double radius, int device_scale, std::optional< uint32_t > border=std::optional< uint32_t >())
static void append(std::vector< T > &target, std::vector< T > &&source)
std::pair< char const *, char const * > getHrefAttribute(XML::Node const &node)
Get the 'href' or 'xlink:href' (fallback) attribute from an XML node.
Glib::RefPtr< Gio::File > choose_file_save(Glib::ustring const &title, Gtk::Window *parent, Glib::RefPtr< Gio::ListStore< Gtk::FileFilter > > const &filters_model, std::string const &file_name, std::string ¤t_folder)
Synchronously run a Gtk::FileDialog to select a file for saving data.
bool extract_image(Gtk::Window *parent, SPImage *image)
struct rdf_work_entity_t rdf_work_entities[]
struct rdf_license_t * rdf_get_license(SPDocument *document, bool read_only)
Attempts to match and retrieve a known RDF/License from the document XML.
Document level base class for all SVG filter primitives.
SVG <image> implementation.
TODO: insert short description here.
SVG <pattern> implementation.
SPRoot: SVG <svg> implementation.
std::size_t meshgradients
std::size_t colorprofiles
std::size_t external_uris
SPStyle - a style object for SPItem objects.
Gtk <themes> helper code.
Inkscape::Util::trim - trim whitespace and other characters.
Glib::RefPtr< Gdk::Texture > to_texture(Cairo::RefPtr< Cairo::Surface > const &surface)
Convert an image surface in ARGB32 format to a texture.