summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-12-11 11:38:27 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-12-11 11:38:27 +0000
commit90f006ed224ecc2a321440fcaaab121881273cbd (patch)
tree5785279f3136625ba19d09c962534b68c02ea3b6 /src
parentMinor tweaks. (diff)
downloadinkscape-90f006ed224ecc2a321440fcaaab121881273cbd.tar.gz
inkscape-90f006ed224ecc2a321440fcaaab121881273cbd.zip
Turn #defines into enum.
Diffstat (limited to 'src')
-rw-r--r--src/display/drawing-text.cpp18
-rw-r--r--src/display/nr-style.h37
2 files changed, 30 insertions, 25 deletions
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp
index d80985163..d809e8dcb 100644
--- a/src/display/drawing-text.cpp
+++ b/src/display/drawing-text.cpp
@@ -291,7 +291,7 @@ void DrawingText::decorateStyle(DrawingContext &dc, double vextent, double xphas
Geom::Point pf = Geom::Point(step * round(p2[Geom::X]/step),p2[Geom::Y]);
Geom::Point poff = Geom::Point(0,thickness/2.0);
- if(_nrstyle.text_decoration_style & TEXT_DECORATION_STYLE_ISDOUBLE){
+ if(_nrstyle.text_decoration_style & NRStyle::TEXT_DECORATION_STYLE_ISDOUBLE){
ps -= Geom::Point(0, vextent/12.0);
pf -= Geom::Point(0, vextent/12.0);
dc.rectangle( Geom::Rect(ps + poff, pf - poff));
@@ -304,7 +304,7 @@ void DrawingText::decorateStyle(DrawingContext &dc, double vextent, double xphas
to figure where in each of their cycles to start. Only accurate to 1 part in 16.
Huge positive offset should keep the phase calculation from ever being negative.
*/
- else if(_nrstyle.text_decoration_style & TEXT_DECORATION_STYLE_DOTTED){
+ else if(_nrstyle.text_decoration_style & NRStyle::TEXT_DECORATION_STYLE_DOTTED){
// FIXME: Per spec, this should produce round dots.
Geom::Point pv = ps;
while(true){
@@ -330,7 +330,7 @@ void DrawingText::decorateStyle(DrawingContext &dc, double vextent, double xphas
i = 0; // once in phase, it stays in phase
}
}
- else if(_nrstyle.text_decoration_style & TEXT_DECORATION_STYLE_DASHED){
+ else if(_nrstyle.text_decoration_style & NRStyle::TEXT_DECORATION_STYLE_DASHED){
Geom::Point pv = ps;
while(true){
Geom::Point pvlast = pv;
@@ -355,7 +355,7 @@ void DrawingText::decorateStyle(DrawingContext &dc, double vextent, double xphas
i = 0; // once in phase, it stays in phase
}
}
- else if(_nrstyle.text_decoration_style & TEXT_DECORATION_STYLE_WAVY){
+ else if(_nrstyle.text_decoration_style & NRStyle::TEXT_DECORATION_STYLE_WAVY){
double amp = vextent/10.0;
double x = ps[Geom::X];
double y = ps[Geom::Y] + poff[Geom::Y];
@@ -403,13 +403,13 @@ void DrawingText::decorateItem(DrawingContext &dc, double phase_length, bool und
if( under ) {
- if(_nrstyle.text_decoration_line & TEXT_DECORATION_LINE_UNDERLINE){
+ if(_nrstyle.text_decoration_line & NRStyle::TEXT_DECORATION_LINE_UNDERLINE){
p1 = Geom::Point(0.0, -_nrstyle.underline_position);
p2 = Geom::Point(tsp_width_adj,-_nrstyle.underline_position);
decorateStyle(dc, tsp_size_adj, xphase, p1, p2, thickness);
}
- if(_nrstyle.text_decoration_line & TEXT_DECORATION_LINE_OVERLINE){
+ if(_nrstyle.text_decoration_line & NRStyle::TEXT_DECORATION_LINE_OVERLINE){
p1 = Geom::Point(0.0, tsp_asc_adj -_nrstyle.underline_position + 1 * final_underline_thickness);
p2 = Geom::Point(tsp_width_adj,tsp_asc_adj -_nrstyle.underline_position + 1 * final_underline_thickness);
decorateStyle(dc, tsp_size_adj, xphase, p1, p2, thickness);
@@ -418,7 +418,7 @@ void DrawingText::decorateItem(DrawingContext &dc, double phase_length, bool und
} else {
// Over
- if(_nrstyle.text_decoration_line & TEXT_DECORATION_LINE_LINETHROUGH){
+ if(_nrstyle.text_decoration_line & NRStyle::TEXT_DECORATION_LINE_LINETHROUGH){
thickness = final_line_through_thickness;
p1 = Geom::Point(0.0, _nrstyle.line_through_position);
p2 = Geom::Point(tsp_width_adj,_nrstyle.line_through_position);
@@ -426,7 +426,7 @@ void DrawingText::decorateItem(DrawingContext &dc, double phase_length, bool und
}
// Obviously this does not blink, but it does indicate which text has been set with that attribute
- if(_nrstyle.text_decoration_line & TEXT_DECORATION_LINE_BLINK){
+ if(_nrstyle.text_decoration_line & NRStyle::TEXT_DECORATION_LINE_BLINK){
thickness = final_line_through_thickness;
p1 = Geom::Point(0.0, _nrstyle.line_through_position - 2*final_line_through_thickness);
p2 = Geom::Point(tsp_width_adj,_nrstyle.line_through_position - 2*final_line_through_thickness);
@@ -467,7 +467,7 @@ unsigned DrawingText::_renderItem(DrawingContext &dc, Geom::IntRect const &/*are
// Do we have text decorations?
- bool decorate = (_nrstyle.text_decoration_line != TEXT_DECORATION_LINE_CLEAR );
+ bool decorate = (_nrstyle.text_decoration_line != NRStyle::TEXT_DECORATION_LINE_CLEAR );
// prepareFill / prepareStroke need to be called with _ctm in effect.
// However, we might need to apply a different ctm for glyphs.
diff --git a/src/display/nr-style.h b/src/display/nr-style.h
index 813f3aeb7..ba1a919ef 100644
--- a/src/display/nr-style.h
+++ b/src/display/nr-style.h
@@ -87,28 +87,33 @@ struct NRStyle {
static const size_t PAINT_ORDER_LAYERS = 3;
PaintOrderType paint_order_layer[PAINT_ORDER_LAYERS];
-#define TEXT_DECORATION_LINE_CLEAR 0x00
-#define TEXT_DECORATION_LINE_SET 0x01
-#define TEXT_DECORATION_LINE_INHERIT 0x02
-#define TEXT_DECORATION_LINE_UNDERLINE 0x04
-#define TEXT_DECORATION_LINE_OVERLINE 0x08
-#define TEXT_DECORATION_LINE_LINETHROUGH 0x10
-#define TEXT_DECORATION_LINE_BLINK 0x20
-
-#define TEXT_DECORATION_STYLE_CLEAR 0x00
-#define TEXT_DECORATION_STYLE_SET 0x01
-#define TEXT_DECORATION_STYLE_INHERIT 0x02
-#define TEXT_DECORATION_STYLE_SOLID 0x04
-#define TEXT_DECORATION_STYLE_ISDOUBLE 0x08
-#define TEXT_DECORATION_STYLE_DOTTED 0x10
-#define TEXT_DECORATION_STYLE_DASHED 0x20
-#define TEXT_DECORATION_STYLE_WAVY 0x40
+ enum TextDecorationLine {
+ TEXT_DECORATION_LINE_CLEAR = 0x00,
+ TEXT_DECORATION_LINE_SET = 0x01,
+ TEXT_DECORATION_LINE_INHERIT = 0x02,
+ TEXT_DECORATION_LINE_UNDERLINE = 0x04,
+ TEXT_DECORATION_LINE_OVERLINE = 0x08,
+ TEXT_DECORATION_LINE_LINETHROUGH = 0x10,
+ TEXT_DECORATION_LINE_BLINK = 0x20
+ };
+
+ enum TextDecorationStyle {
+ TEXT_DECORATION_STYLE_CLEAR = 0x00,
+ TEXT_DECORATION_STYLE_SET = 0x01,
+ TEXT_DECORATION_STYLE_INHERIT = 0x02,
+ TEXT_DECORATION_STYLE_SOLID = 0x04,
+ TEXT_DECORATION_STYLE_ISDOUBLE = 0x08,
+ TEXT_DECORATION_STYLE_DOTTED = 0x10,
+ TEXT_DECORATION_STYLE_DASHED = 0x20,
+ TEXT_DECORATION_STYLE_WAVY = 0x40
+ };
int text_decoration_line;
int text_decoration_style;
Paint text_decoration_fill;
Paint text_decoration_stroke;
float text_decoration_stroke_width;
+
// These are the same as in style.h
float phase_length;
bool tspan_line_start;