summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-06-01 21:47:04 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-06-01 21:47:04 +0000
commit6c85e7bc3b136ad5f831a4c289e04fdbe7451297 (patch)
treea026eaf58deb09da7b04db6a266dfb7516f21c9a /src/display
parentopening kaleidscope (diff)
parentMark user-visible messages for translation (diff)
downloadinkscape-6c85e7bc3b136ad5f831a4c289e04fdbe7451297.tar.gz
inkscape-6c85e7bc3b136ad5f831a4c289e04fdbe7451297.zip
update to trunk
(bzr r13708.1.29)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/canvas-arena.cpp2
-rw-r--r--src/display/canvas-axonomgrid.cpp4
-rw-r--r--src/display/canvas-grid.cpp28
-rw-r--r--src/display/drawing-text.cpp3
-rw-r--r--src/display/sp-canvas.h1
5 files changed, 25 insertions, 13 deletions
diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp
index 8738b93e4..ec99eca9a 100644
--- a/src/display/canvas-arena.cpp
+++ b/src/display/canvas-arena.cpp
@@ -290,7 +290,7 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event)
ret = sp_canvas_arena_send_event (arena, (GdkEvent *) &ec);
}
}
- ret = sp_canvas_arena_send_event (arena, event);
+ ret = ret || sp_canvas_arena_send_event (arena, event);
break;
case GDK_SCROLL: {
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp
index a2df86823..1794ccbab 100644
--- a/src/display/canvas-axonomgrid.cpp
+++ b/src/display/canvas-axonomgrid.cpp
@@ -17,10 +17,6 @@
# include "config.h"
#endif
-#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
-#include <glibmm/threads.h>
-#endif
-
#include <gtkmm/box.h>
#include <gtkmm/label.h>
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 9b9f64529..decf93626 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -17,10 +17,6 @@
# include "config.h"
#endif
-#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
-#include <glibmm/threads.h>
-#endif
-
#include <gtkmm/box.h>
#include <gtkmm/label.h>
@@ -910,7 +906,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf)
gdouble const syg = floor ((buf->rect.top() - ow[Geom::Y]) / sw[Geom::Y]) * sw[Geom::Y] + ow[Geom::Y];
gint const ylinestart = round((syg - ow[Geom::Y]) / sw[Geom::Y]);
- //set correct coloring, depending preference (when zoomed out, always major coloring or minor coloring)
+ // no_emphasize_when_zoomedout determines color (minor or major) when only major grid lines/dots shown.
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
guint32 _empcolor;
bool no_emp_when_zoomed_out = prefs->getBool("/options/grids/no_emphasize_when_zoomedout", false);
@@ -926,6 +922,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf)
cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE);
if (!render_dotted) {
+ // Line grid
gint ylinenum;
gdouble y;
for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) {
@@ -948,8 +945,23 @@ CanvasXYGrid::Render (SPCanvasBuf *buf)
}
}
} else {
+ // Dotted grid
gint ylinenum;
gdouble y;
+
+ // alpha needs to be larger than in the line case to maintain a similar visual impact but
+ // setting it to the maximal value makes the dots dominant in some cases. Solution,
+ // increase the alpha by a factor of 4. This then allows some user adjustment.
+ guint32 _empdot = (_empcolor & 0xff) << 2;
+ if (_empdot > 0xff)
+ _empdot = 0xff;
+ _empdot += (_empcolor & 0xffffff00);
+
+ guint32 _colordot = (color & 0xff) << 2;
+ if (_colordot > 0xff)
+ _colordot = 0xff;
+ _colordot += (color & 0xffffff00);
+
for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) {
gint const iy = round(y);
@@ -961,13 +973,15 @@ CanvasXYGrid::Render (SPCanvasBuf *buf)
|| (!scaled[Geom::Y] && (ylinenum % empspacing) != 0)
|| ((scaled[Geom::X] || scaled[Geom::Y]) && no_emp_when_zoomed_out) )
{
- grid_dot (buf, ix, iy, color | (guint32)0x000000FF); // put alpha to max value
+ // Minor point: dot only
+ grid_dot (buf, ix, iy, _colordot); // | (guint32)0x000000FF); // put alpha to max value
} else {
+ // Major point: small cross
gint const pitch = 1;
grid_dot (buf, ix-pitch, iy, _empcolor);
grid_dot (buf, ix+pitch, iy, _empcolor);
- grid_dot (buf, ix, iy, _empcolor | (guint32)0x000000FF); // put alpha to max value
+ grid_dot (buf, ix, iy, _empdot ); // | (guint32)0x000000FF); // put alpha to max value
grid_dot (buf, ix, iy-pitch, _empcolor);
grid_dot (buf, ix, iy+pitch, _empcolor);
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp
index e20a7ff2a..3928ad796 100644
--- a/src/display/drawing-text.cpp
+++ b/src/display/drawing-text.cpp
@@ -367,7 +367,7 @@ void DrawingText::decorateStyle(DrawingContext &dc, double vextent, double xphas
/* returns scaled line thickness */
void DrawingText::decorateItem(DrawingContext &dc, double phase_length, bool under)
{
- if (_nrstyle.font_size < 1.0e-32)return; // would cause a divide by zero and nothing would be visible anyway
+ if ( _nrstyle.font_size <= 1.0e-32 )return; // might cause a divide by zero or overflow and nothing would be visible anyway
double tsp_width_adj = _nrstyle.tspan_width / _nrstyle.font_size;
double tsp_asc_adj = _nrstyle.ascender / _nrstyle.font_size;
double tsp_size_adj = (_nrstyle.ascender + _nrstyle.descender) / _nrstyle.font_size;
@@ -381,6 +381,7 @@ void DrawingText::decorateItem(DrawingContext &dc, double phase_length, bool und
Geom::Point p2;
// All lines must be the same thickness, in combinations, line_through trumps underline
double thickness = final_underline_thickness;
+ if ( thickness <= 1.0e-32 )return; // might cause a divide by zero or overflow and nothing would be visible anyway
dc.setTolerance(0.5); // Is this really necessary... could effect dots.
if( under ) {
diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h
index 48c3de2fc..65b06ade8 100644
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
@@ -23,6 +23,7 @@
#endif
#include <gtk/gtk.h>
+#include <stdint.h>
#include <glibmm/ustring.h>
#include <2geom/affine.h>
#include <2geom/rect.h>