1 #ifndef __SP_DESKTOP_STYLE_H__
2 #define __SP_DESKTOP_STYLE_H__
4 /*
5 * Desktop style management
6 *
7 * Authors:
8 * bulia byak
9 * verbalshadow
10 *
11 * Copyright (C) 2004, 2006 authors
12 *
13 * Released under GNU GPL, read the file 'COPYING' for more information
14 */
16 #include <glib/gtypes.h>
18 class ColorRGBA;
19 struct SPCSSAttr;
20 struct SPDesktop;
21 struct SPObject;
22 struct SPStyle;
23 namespace Inkscape {
24 namespace XML {
25 struct Node;
26 }
27 }
29 enum { // what kind of a style the query is returning
30 QUERY_STYLE_NOTHING, // nothing was queried - e.g. no selection
31 QUERY_STYLE_SINGLE, // single object was queried
32 QUERY_STYLE_MULTIPLE_SAME, // multiple objects were queried, the results were the same
33 QUERY_STYLE_MULTIPLE_DIFFERENT, // multiple objects were queried, the results could NOT be meaningfully averaged
34 QUERY_STYLE_MULTIPLE_AVERAGED // multiple objects were queried, the results were meaningfully averaged
35 };
37 enum { // which property was queried (add when you need more)
38 QUERY_STYLE_PROPERTY_EVERYTHING,
39 QUERY_STYLE_PROPERTY_FILL, // fill, fill-opacity
40 QUERY_STYLE_PROPERTY_STROKE, // stroke, stroke-opacity
41 QUERY_STYLE_PROPERTY_STROKEWIDTH, // stroke-width
42 QUERY_STYLE_PROPERTY_STROKEMITERLIMIT, // miter limit
43 QUERY_STYLE_PROPERTY_STROKEJOIN, // stroke join
44 QUERY_STYLE_PROPERTY_STROKECAP, // stroke cap
45 QUERY_STYLE_PROPERTY_STROKESTYLE, // markers, dasharray, miterlimit, stroke-width, stroke-cap, stroke-join
46 QUERY_STYLE_PROPERTY_FONTFAMILY, // font-family
47 QUERY_STYLE_PROPERTY_FONTSTYLE, // font style
48 QUERY_STYLE_PROPERTY_FONTNUMBERS, // size, spacings
49 QUERY_STYLE_PROPERTY_MASTEROPACITY, // opacity
50 QUERY_STYLE_PROPERTY_BLUR // blur
51 };
53 void sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines);
54 void sp_desktop_set_color(SPDesktop *desktop, ColorRGBA const &color, bool is_relative, bool fill);
55 void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true);
56 SPCSSAttr *sp_desktop_get_style(SPDesktop *desktop, bool with_text);
57 guint32 sp_desktop_get_color (SPDesktop *desktop, bool is_fill);
58 double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool);
59 double sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool is_fill);
60 guint32 sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill);
61 double sp_desktop_get_font_size_tool (SPDesktop *desktop);
62 void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, char const *tool, bool with_text);
64 gdouble stroke_average_width (GSList const *objects);
66 int objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill);
67 int objects_query_fontnumbers (GSList *objects, SPStyle *style_res);
68 int objects_query_fontstyle (GSList *objects, SPStyle *style_res);
69 int objects_query_fontfamily (GSList *objects, SPStyle *style_res);
70 int objects_query_opacity (GSList *objects, SPStyle *style_res);
71 int objects_query_strokewidth (GSList *objects, SPStyle *style_res);
72 int objects_query_miterlimit (GSList *objects, SPStyle *style_res);
73 int objects_query_strokecap (GSList *objects, SPStyle *style_res);
74 int objects_query_strokejoin (GSList *objects, SPStyle *style_res);
76 int objects_query_blur (GSList *objects, SPStyle *style_res);
78 int sp_desktop_query_style_from_list (GSList *list, SPStyle *style, int property);
79 int sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property);
80 bool sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query);
82 #endif
85 /*
86 Local Variables:
87 mode:c++
88 c-file-style:"stroustrup"
89 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
90 indent-tabs-mode:nil
91 fill-column:99
92 End:
93 */
94 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :