Code

simplify sketch result to fix crash
[inkscape.git] / src / desktop-style.h
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 }
28 namespace Glib { class ustring; }
30 enum { // what kind of a style the query is returning
31     QUERY_STYLE_NOTHING,   // nothing was queried - e.g. no selection
32     QUERY_STYLE_SINGLE,  // single object was queried
33     QUERY_STYLE_MULTIPLE_SAME, // multiple objects were queried, the results were the same
34     QUERY_STYLE_MULTIPLE_DIFFERENT, // multiple objects were queried, the results could NOT be meaningfully averaged
35     QUERY_STYLE_MULTIPLE_AVERAGED // multiple objects were queried, the results were meaningfully averaged
36 };
38 enum { // which property was queried (add when you need more)
39     QUERY_STYLE_PROPERTY_EVERYTHING,
40     QUERY_STYLE_PROPERTY_FILL,  // fill, fill-opacity
41     QUERY_STYLE_PROPERTY_STROKE,  // stroke, stroke-opacity
42     QUERY_STYLE_PROPERTY_STROKEWIDTH,  // stroke-width
43     QUERY_STYLE_PROPERTY_STROKEMITERLIMIT,  // miter limit
44     QUERY_STYLE_PROPERTY_STROKEJOIN,  // stroke join
45     QUERY_STYLE_PROPERTY_STROKECAP,  // stroke cap
46     QUERY_STYLE_PROPERTY_STROKESTYLE, // markers, dasharray, miterlimit, stroke-width, stroke-cap, stroke-join
47     QUERY_STYLE_PROPERTY_FONT_SPECIFICATION, //-inkscape-font-specification
48     QUERY_STYLE_PROPERTY_FONTFAMILY, // font-family
49     QUERY_STYLE_PROPERTY_FONTSTYLE, // font style 
50     QUERY_STYLE_PROPERTY_FONTNUMBERS, // size, spacings
51     QUERY_STYLE_PROPERTY_MASTEROPACITY, // opacity
52     QUERY_STYLE_PROPERTY_BLEND, // blend
53     QUERY_STYLE_PROPERTY_BLUR // blur
54 };
56 void sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines);
57 void sp_desktop_set_color(SPDesktop *desktop, ColorRGBA const &color, bool is_relative, bool fill);
58 void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true);
59 SPCSSAttr *sp_desktop_get_style(SPDesktop *desktop, bool with_text);
60 guint32 sp_desktop_get_color (SPDesktop *desktop, bool is_fill);
61 double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool* has_opacity = NULL);
62 double sp_desktop_get_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool is_fill);
63 guint32 sp_desktop_get_color_tool(SPDesktop *desktop, Glib::ustring const &tool, bool is_fill, bool* has_color = NULL);
64 double sp_desktop_get_font_size_tool (SPDesktop *desktop);
65 void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, Glib::ustring const &tool, bool with_text);
67 gdouble stroke_average_width (GSList const *objects);
69 int objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill);
70 int objects_query_fontnumbers (GSList *objects, SPStyle *style_res);
71 int objects_query_fontstyle (GSList *objects, SPStyle *style_res);
72 int objects_query_fontfamily (GSList *objects, SPStyle *style_res);
73 int objects_query_opacity (GSList *objects, SPStyle *style_res);
74 int objects_query_strokewidth (GSList *objects, SPStyle *style_res);
75 int objects_query_miterlimit (GSList *objects, SPStyle *style_res);
76 int objects_query_strokecap (GSList *objects, SPStyle *style_res);
77 int objects_query_strokejoin (GSList *objects, SPStyle *style_res);
79 int objects_query_blur (GSList *objects, SPStyle *style_res);
81 int sp_desktop_query_style_from_list (GSList *list, SPStyle *style, int property);
82 int sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property);
83 bool sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query);
85 #endif
88 /*
89   Local Variables:
90   mode:c++
91   c-file-style:"stroustrup"
92   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
93   indent-tabs-mode:nil
94   fill-column:99
95   End:
96 */
97 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :