28#include <glibmm/i18n.h>
29#include <gdkmm/pixbuf.h>
44static Glib::ustring
const prefs_path =
"/dialogs/gradienteditor/";
54 set_orientation(Gtk::Orientation::VERTICAL);
69 static gboolean suppress = FALSE;
71 g_return_if_fail(!gr || (doc !=
nullptr));
72 g_return_if_fail(!gr || (gr->
document == doc));
73 g_return_if_fail(!gr || gr->
hasStops());
99 }
else if (gr !=
_gr) {
158 std::vector<SPGradient *> gl;
161 for (
auto gradient : gradients) {
162 auto grad = cast<SPGradient>(gradient);
163 if ( grad->hasStops() && (grad->isSwatch() ==
_swatched) ) {
164 gl.push_back(cast<SPGradient>(gradient));
170 std::map<SPGradient *, gint> usageCount;
174 Gtk::TreeModel::Row row = *(
_store->append());
177 }
else if (gl.empty()) {
178 Gtk::TreeModel::Row row = *(
_store->append());
182 Gtk::TreeModel::Row row = *(
_store->append());
191 Gtk::TreeModel::Row row = *(
_store->append());
226 if (strlen(
id) > 14 && (!strncmp (
id,
"linearGradient", 14) || !strncmp (
id,
"radialGradient", 14)))
237 if (src.length() > maxlen && maxlen > 8) {
238 size_t p1 = (size_t) maxlen / 2;
239 size_t p2 = (size_t) src.length() - (maxlen - p1 - 1);
240 return src.substr(0, p1) +
"…" + src.substr(p2);
253 return ((
int)(hsl[0]*100 * 10000)) + ((int)(hsl[1]*100 * 100)) + ((
int)(hsl[2]*100 * 1));
270 mapUsageCount->count(gr) > 0 ? (*mapUsageCount)[gr] += 1 : (*mapUsageCount)[gr] = 1;
274 mapUsageCount->count(gr) > 0 ? (*mapUsageCount)[gr] += 1 : (*mapUsageCount)[gr] = 1;
struct _GdkPixbuf GdkPixbuf
bool convert(Color const &other)
Convert to the same format as the other color.
virtual char const * name() const =0
Get the name of the element node.
Typed SVG document implementation.
std::vector< SPObject * > const getResourceList(char const *key)
SPDefs * getDefs()
Return the main defs object 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.
char const * getId() const
Returns the objects current ID string.
sigc::connection connectRelease(sigc::slot< void(SPObject *)> slot)
Connects to the release request signal.
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
sigc::connection connectModified(sigc::slot< void(SPObject *, unsigned int)> slot)
Connects to the modification notification signal.
Inkscape::Colors::Color getColor() const
std::vector< SPItem * > sp_get_all_document_items(SPDocument *document)
SPGradient * sp_item_get_gradient(SPItem *item, bool fillorstroke)
GdkPixbuf * sp_gradient_to_pixbuf(SPGradient *gr, int width, int height)
Glib::ustring gr_ellipsize_text(Glib::ustring const &src, size_t maxlen)
Glib::ustring gr_prepare_label(SPObject *obj)
static Glib::ustring const prefs_path
void gr_get_usage_counts(SPDocument *doc, std::map< SPGradient *, gint > *mapUsageCount)
unsigned long sp_gradient_to_hhssll(SPGradient *gr)
Helper class to stream background task notifications as a series of messages.
Singleton class to access the preferences file in a convenient way.
TODO: insert short description here.