Code

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