Inkscape
Vector Graphics Editor
|
Go to the source code of this file.
Namespaces | |
namespace | Inkscape |
Helper class to stream background task notifications as a series of messages. | |
namespace | Inkscape::UI |
User interface code. | |
Functions | |
Glib::ustring | ink_ellipsize_text (Glib::ustring const &src, std::size_t maxlen) |
void | reveal_widget (Gtk::Widget *widget, bool show) |
Show widget, if the widget has a Gtk::Reveal parent, reveal instead. | |
bool | is_widget_effectively_visible (Gtk::Widget const *widget) |
void | Inkscape::UI::set_icon_sizes (Gtk::Widget *parent, int pixel_size) |
Recursively set all the icon sizes inside this parent widget. | |
void | Inkscape::UI::set_icon_sizes (GtkWidget *parent, int pixel_size) |
void | Inkscape::UI::gui_warning (const std::string &msg, Gtk::Window *parent_window) |
void | Inkscape::UI::system_open (const Glib::ustring &path) |
Opens the given path with platform-specific tools. | |
std::vector< Gtk::Widget * > | Inkscape::UI::get_children (Gtk::Widget &widget) |
Get a vector of the widgetʼs children, from get_first_child() through each get_next_sibling(). | |
Gtk::Widget & | Inkscape::UI::get_nth_child (Gtk::Widget &widget, std::size_t index) |
Get the widgetʼs child at the given position. Throws std::out_of_range if the index is invalid. | |
Gtk::Widget * | Inkscape::UI::find_widget_by_name (Gtk::Widget &parent, Glib::ustring const &name, bool visible_only) |
Returns a named descendent of parent, which has the given name, or nullptr if there's none. | |
Gtk::Widget * | Inkscape::UI::find_focusable_widget (Gtk::Widget &parent) |
This function traverses a tree of widgets searching for first focusable widget. | |
bool | Inkscape::UI::is_descendant_of (Gtk::Widget const &descendant, Gtk::Widget const &ancestor) |
Returns if widget is a descendant of given ancestor, i.e.: itself, a child, or a childʼs child. | |
bool | Inkscape::UI::contains_focus (Gtk::Widget &widget) |
Returns if widget or one of its descendants has focus. | |
int | Inkscape::UI::get_font_size (Gtk::Widget &widget) |
Get the relative font size as determined by a widgetʼs style/Pango contexts. | |
void | Inkscape::UI::ellipsize (Gtk::Label &label, int const max_width_chars, Pango::EllipsizeMode const mode) |
unsigned int | get_color_value (const Glib::ustring color) |
Color is store as a string in the form #RRGGBBAA, '0' means "unset". | |
Gdk::RGBA | mix_colors (const Gdk::RGBA &a, const Gdk::RGBA &b, float ratio) |
double | get_luminance (Gdk::RGBA const &rgba) |
Calculate luminance of an RGBA color from its RGB in range 0 to 1 inclusive. | |
Gdk::RGBA | get_color_with_class (Gtk::Widget &widget, Glib::ustring const &css_class) |
guint32 | to_guint32 (Gdk::RGBA const &rgba) |
Gdk::RGBA | color_to_rgba (Inkscape::Colors::Color const &color) |
Gdk::RGBA | to_rgba (guint32 const u32) |
Glib::ustring | gdk_to_css_color (const Gdk::RGBA &color) |
These GUI related color conversions allow us to convert from SVG xml attributes to Gdk colors, without needing the entire CMS framework, which would be excessive for widget painting. | |
Gdk::RGBA | css_color_to_gdk (const char *value) |
Cairo::RectangleInt | geom_to_cairo (const Geom::IntRect &rect) |
Geom::IntRect | cairo_to_geom (const Cairo::RectangleInt &rect) |
Cairo::Matrix | geom_to_cairo (const Geom::Affine &affine) |
Geom::IntPoint | dimensions (const Cairo::RefPtr< Cairo::ImageSurface > &surface) |
Geom::IntPoint | dimensions (const Gdk::Rectangle &allocation) |
std::vector< GskColorStop > | create_cubic_gradient (const Gdk::RGBA &from, const Gdk::RGBA &to, Geom::Point ctrl1, Geom::Point ctrl2, Geom::Point p0, Geom::Point p1, int steps) |
Gdk::RGBA | change_alpha (const Gdk::RGBA &color, double new_alpha) |
uint32_t | conv_gdk_color_to_rgba (const Gdk::RGBA &color, double replace_alpha) |
void | set_dark_titlebar (Glib::RefPtr< Gdk::Surface > const &surface, bool is_dark) |
static int | fmt_number (const _GMatchInfo *match, _GString *ret, void *prec) |
Glib::ustring | round_numbers (const Glib::ustring &text, int precision) |
void | truncate_digits (const Glib::RefPtr< Gtk::TextBuffer > &buffer, int precision) |
Glib::RefPtr< Gdk::Texture > | to_texture (Cairo::RefPtr< Cairo::Surface > const &surface) |
Convert an image surface in ARGB32 format to a texture. | |
void | restrict_minsize_to_square (Gtk::Widget &widget, int min_size_px) |
char const * | get_text (Gtk::Editable const &editable) |
Get the text from a GtkEditable without the temporary copy imposed by gtkmm. | |
Geom::IntRect cairo_to_geom | ( | const Cairo::RectangleInt & | rect | ) |
Definition at line 358 of file util.cpp.
References Geom::GenericRect< C >::from_xywh().
Referenced by Inkscape::DrawingCache::_dumpCache(), Inkscape::UI::Widget::coarsen(), Inkscape::DrawingCache::paintFromCache(), Inkscape::DrawingPattern::renderPattern(), Inkscape::UI::Widget::CairoGraphics::shift_store(), Inkscape::UI::Widget::shrink_region(), Inkscape::UI::Widget::Stores::snapshot_combine(), and Inkscape::UI::Widget::Stores::update().
Gdk::RGBA change_alpha | ( | const Gdk::RGBA & | color, |
double | new_alpha | ||
) |
Gdk::RGBA color_to_rgba | ( | Inkscape::Colors::Color const & | color | ) |
Definition at line 320 of file util.cpp.
References to_rgba(), and Inkscape::Colors::Color::toRGBA().
Referenced by Inkscape::Extension::ParamColor::get_widget().
uint32_t conv_gdk_color_to_rgba | ( | const Gdk::RGBA & | color, |
double | replace_alpha | ||
) |
Definition at line 423 of file util.cpp.
Referenced by Inkscape::UI::Widget::ImageProperties::update(), and Inkscape::UI::Widget::ImageProperties::update_bg_color().
std::vector< GskColorStop > create_cubic_gradient | ( | const Gdk::RGBA & | from, |
const Gdk::RGBA & | to, | ||
Geom::Point | ctrl1, | ||
Geom::Point | ctrl2, | ||
Geom::Point | p0, | ||
Geom::Point | p1, | ||
int | steps | ||
) |
Definition at line 378 of file util.cpp.
References Geom::bernstein_value_at(), mix_colors(), offset, and result.
Referenced by Inkscape::UI::Widget::Ruler::draw_ruler().
Gdk::RGBA css_color_to_gdk | ( | const char * | value | ) |
Definition at line 343 of file util.cpp.
References Inkscape::Colors::hex_to_rgba(), and to_rgba().
Geom::IntPoint dimensions | ( | const Cairo::RefPtr< Cairo::ImageSurface > & | surface | ) |
Definition at line 368 of file util.cpp.
References surface.
Referenced by Inkscape::LivePathEffect::LPESimplify::doEffect(), SPItem::getSnappoints(), Inkscape::UI::Widget::ColorWheelHSLuv::on_drawing_area_draw(), Inkscape::UI::Widget::CairoGraphics::recreate_store(), Inkscape::UI::Widget::CairoGraphics::shift_store(), and SPItem::visualBounds().
Geom::IntPoint dimensions | ( | const Gdk::Rectangle & | allocation | ) |
|
static |
Definition at line 451 of file util.cpp.
References end, fmt, and Inkscape::Util::format_number().
Referenced by round_numbers().
Glib::ustring gdk_to_css_color | ( | const Gdk::RGBA & | color | ) |
These GUI related color conversions allow us to convert from SVG xml attributes to Gdk colors, without needing the entire CMS framework, which would be excessive for widget painting.
Definition at line 340 of file util.cpp.
References Inkscape::Colors::rgba_to_hex(), and to_guint32().
Referenced by Inkscape::UI::Dialog::StartScreen::canvas_changed(), and Inkscape::UI::Widget::GradientWithStops::draw_func().
Cairo::Matrix geom_to_cairo | ( | const Geom::Affine & | affine | ) |
Cairo::RectangleInt geom_to_cairo | ( | const Geom::IntRect & | rect | ) |
Definition at line 353 of file util.cpp.
References Geom::GenericRect< C >::height(), Geom::GenericRect< C >::left(), Geom::GenericRect< C >::top(), and Geom::GenericRect< C >::width().
Referenced by Inkscape::CanvasItemRect::_render(), Inkscape::CanvasItemText::_render(), Inkscape::UI::Widget::CairoGraphics::fast_snapshot_combine(), feed_curve_to_cairo(), Inkscape::UI::Widget::Stores::mark_drawn(), Inkscape::DrawingCache::markClean(), Inkscape::DrawingCache::markDirty(), Inkscape::UI::Widget::Graphics::paint_background(), Inkscape::UI::Widget::CairoGraphics::paint_widget(), Inkscape::DrawingCache::paintFromCache(), Inkscape::DrawingCache::prepare(), Inkscape::UI::Widget::Canvas::redraw_all(), Inkscape::UI::Widget::Canvas::redraw_area(), Inkscape::DrawingPattern::renderPattern(), Inkscape::UI::Widget::CairoGraphics::shift_store(), Inkscape::UI::Widget::Stores::shift_store(), Inkscape::UI::Widget::shrink_region(), Inkscape::UI::Widget::CairoGraphics::snapshot_combine(), and Inkscape::UI::Widget::Updater::create< Updater::Strategy::FullRedraw >().
unsigned int get_color_value | ( | const Glib::ustring | color | ) |
Color is store as a string in the form #RRGGBBAA, '0' means "unset".
color | - The string color from glade. |
Definition at line 275 of file util.cpp.
References SP_RGBA32_F_COMPOSE().
Referenced by Inkscape::UI::Dialog::StartScreen::theme_changed().
Gdk::RGBA get_color_with_class | ( | Gtk::Widget & | widget, |
Glib::ustring const & | css_class | ||
) |
Definition at line 303 of file util.cpp.
References result.
Referenced by Inkscape::UI::Widget::Ruler::css_changed(), Inkscape::UI::Widget::GradientWithStops::css_changed(), Inkscape::UI::Dialog::FilterEffectsDialog::PrimitiveList::css_changed(), Inkscape::UI::Widget::MarkerComboBox::css_changed(), Inkscape::UI::ThemeContext::isCurrentThemeDark(), Inkscape::UI::Dialog::ObjectsPanel::ObjectsPanel(), and Inkscape::UI::Widget::ImageProperties::update_bg_color().
double get_luminance | ( | const Gdk::RGBA & | color | ) |
Calculate luminance of an RGBA color from its RGB in range 0 to 1 inclusive.
This uses the perceived brightness formula given at: https://www.w3.org/TR/AERT/#color-contrast
char const * get_text | ( | Gtk::Editable const & | editable | ) |
Get the text from a GtkEditable without the temporary copy imposed by gtkmm.
Definition at line 549 of file util.cpp.
Referenced by Inkscape::UI::Widget::InkSpinButton::commit_entry().
Glib::ustring ink_ellipsize_text | ( | Glib::ustring const & | src, |
std::size_t | maxlen | ||
) |
bool is_widget_effectively_visible | ( | Gtk::Widget const * | widget | ) |
Gdk::RGBA mix_colors | ( | const Gdk::RGBA & | a, |
const Gdk::RGBA & | b, | ||
float | ratio | ||
) |
Definition at line 283 of file util.cpp.
References result.
Referenced by create_cubic_gradient(), and Inkscape::UI::Dialog::FilterEffectsDialog::PrimitiveList::snapshot_vfunc().
void restrict_minsize_to_square | ( | Gtk::Widget & | widget, |
int | min_size_px | ||
) |
Definition at line 537 of file util.cpp.
Referenced by Inkscape::UI::Widget::ColorPicker::_construct().
void reveal_widget | ( | Gtk::Widget * | widget, |
bool | show | ||
) |
Glib::ustring round_numbers | ( | const Glib::ustring & | text, |
int | precision | ||
) |
void set_dark_titlebar | ( | Glib::RefPtr< Gdk::Surface > const & | surface, |
bool | is_dark | ||
) |
Definition at line 433 of file util.cpp.
References surface.
Referenced by Inkscape::UI::ThemeContext::themechangecallback().
guint32 to_guint32 | ( | Gdk::RGBA const & | rgba | ) |
Definition at line 312 of file util.cpp.
Referenced by Inkscape::Extension::ParamColor::_onColorButtonChanged(), gdk_to_css_color(), Inkscape::UI::Dialog::InkscapePreferences::get_highlight_colors(), Inkscape::UI::ThemeContext::getHighlightColors(), Inkscape::UI::Dialog::InkscapePreferences::resetIconsColors(), and Inkscape::UI::Widget::CellRendererItemIcon::snapshot_vfunc().
Gdk::RGBA to_rgba | ( | guint32 const | u32 | ) |
Definition at line 325 of file util.cpp.
Referenced by color_to_rgba(), css_color_to_gdk(), and Inkscape::UI::Dialog::InkscapePreferences::resetIconsColors().
Glib::RefPtr< Gdk::Texture > to_texture | ( | Cairo::RefPtr< Cairo::Surface > const & | surface | ) |
Convert an image surface in ARGB32 format to a texture.
The texture shares data with the surface, so the surface shouldn't modified afterwards.
Definition at line 510 of file util.cpp.
References surface, and texture.
Referenced by Inkscape::UI::Dialog::_add_items_with_images(), Inkscape::UI::Dialog::add_colors(), Inkscape::UI::Widget::IconComboBox::add_row(), Inkscape::UI::Widget::PatternEditor::bind_store(), Inkscape::UI::Dialog::ExtensionsGallery::get_image(), Inkscape::UI::Widget::TemplateList::init(), Inkscape::UI::Dialog::InkscapePreferences::initPageUI(), Inkscape::UI::Widget::MarkerComboBox::MarkerComboBox(), Inkscape::UI::Dialog::IconPreviewPanel::renderPreview(), Inkscape::UI::Widget::PatternEditor::set_selected(), Inkscape::UI::Widget::MarkerComboBox::update_menu_btn(), and Inkscape::UI::Widget::MarkerComboBox::update_preview().
void truncate_digits | ( | const Glib::RefPtr< Gtk::TextBuffer > & | buffer, |
int | precision | ||
) |
Definition at line 481 of file util.cpp.
References end, round_numbers(), and start.
Referenced by Inkscape::UI::Dialog::AttrDialog::truncateDigits().