+2007-04-26 Jim Evins <evins@snaught.com>
+
+ * src/mini-preview-pixbuf.c: (draw_paper), (draw_label_outlines),
+ (draw_label_outline):
+ * src/print.c: (print_crop_marks), (draw_outline):
+ * src/view-object.c: (gl_view_object_draw_handles):
+ * src/view.c: (draw_bg_layer), (draw_grid_layer),
+ (draw_markup_layer), (draw_fg_layer), (draw_select_region_layer):
+ * src/wdgt-mini-preview.c: (draw_paper), (draw_labels):
+ * src/wdgt-rotate-label.c: (drawingarea_update):
+ Added defines for various magic numbers.
+
2007-04-25 Jim Evins <evins@snaught.com>
* src/label-text.c: (get_size), (draw_object), (draw_shadow):
#include "debug.h"
+/*===========================================*/
+/* Private macros and constants. */
+/*===========================================*/
+
+#define PAPER_RGB_ARGS 0.95, 0.95, 0.95
+#define PAPER_OUTLINE_RGB_ARGS 0.0, 0.0, 0.0
+#define LABEL_RGB_ARGS 1.0, 1.0, 1.0
+#define LABEL_OUTLINE_RGB_ARGS 0.25, 0.25, 0.25
+
+#define PAPER_OUTLINE_WIDTH_PIXELS 1.0
+#define LABEL_OUTLINE_WIDTH_PIXELS 1.0
+
/*===========================================*/
/* Private types */
/*===========================================*/
cairo_save (cr);
cairo_rectangle (cr, 0.0, 0.0, template->page_width, template->page_height);
- cairo_set_source_rgb (cr, 0.95, 0.95, 0.95);
+ cairo_set_source_rgb (cr, PAPER_RGB_ARGS);
cairo_fill_preserve (cr);
- cairo_set_line_width (cr, 1/scale);
- cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+ cairo_set_line_width (cr, PAPER_OUTLINE_WIDTH_PIXELS/scale);
+ cairo_set_source_rgb (cr, PAPER_OUTLINE_RGB_ARGS);
cairo_stroke (cr);
cairo_restore (cr);
cairo_save (cr);
- cairo_set_line_width (cr, 1.0/scale);
+ cairo_set_line_width (cr, LABEL_OUTLINE_WIDTH_PIXELS/scale);
label_type = gl_template_get_first_label_type (template);
gl_cairo_label_path (cr, template, FALSE, FALSE);
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ cairo_set_source_rgb (cr, LABEL_RGB_ARGS);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill_preserve (cr);
- cairo_set_source_rgb (cr, 0.25, 0.25, 0.25);
+ cairo_set_source_rgb (cr, LABEL_OUTLINE_RGB_ARGS);
cairo_stroke (cr);
cairo_restore (cr);
/* Private macros and constants. */
/*===========================================*/
+#define OUTLINE_RGB_ARGS 0.0, 0.0, 0.0
+
+#define OUTLINE_WIDTH 0.25
+
#define TICK_OFFSET 2.25
#define TICK_LENGTH 18.0
cairo_save (pi->cr);
- cairo_set_source_rgba (pi->cr, 0.0, 0.0, 0.0, 1.0);
- cairo_set_line_width (pi->cr, 0.25);
+ cairo_set_source_rgb (pi->cr, OUTLINE_RGB_ARGS);
+ cairo_set_line_width (pi->cr, OUTLINE_WIDTH);
for (p=label_type->layouts; p != NULL; p=p->next) {
cairo_save (pi->cr);
- cairo_set_source_rgba (pi->cr, 0.0, 0.0, 0.0, 1.0);
- cairo_set_line_width (pi->cr, 0.25);
+ cairo_set_source_rgb (pi->cr, OUTLINE_RGB_ARGS);
+ cairo_set_line_width (pi->cr, OUTLINE_WIDTH);
gl_cairo_label_path (pi->cr, label->template, FALSE, FALSE);
/* Private constants and macros. */
/*========================================================*/
+#define HANDLE_FILL_RGBA_ARGS 0.0, 0.75, 0.0, 0.4
+#define HANDLE_OUTLINE_RGBA_ARGS 0.0, 0.0, 0.0, 0.8
+
+#define HANDLE_OUTLINE_WIDTH_PIXELS 1.0
#define HANDLE_PIXELS 7
/*========================================================*/
break;
}
- cairo_set_source_rgba (cr, 0, 0.75, 0, 0.4);
+ cairo_set_source_rgba (cr, HANDLE_FILL_RGBA_ARGS);
cairo_fill_preserve (cr);
- cairo_set_line_width (cr, 1/scale);
- cairo_set_source_rgba (cr, 0, 0, 0, 0.8);
+ cairo_set_line_width (cr, HANDLE_OUTLINE_WIDTH_PIXELS/scale);
+ cairo_set_source_rgba (cr, HANDLE_OUTLINE_RGBA_ARGS);
cairo_stroke (cr);
cairo_restore (cr);
/*==========================================================================*/
#define BG_COLOR GL_COLOR (192, 192, 192)
-#define OUTLINE_COLOR GL_COLOR (173, 216, 230)
-#define PAPER_COLOR GL_COLOR (255, 255, 255)
-#define GRID_COLOR BG_COLOR
-#define MARKUP_COLOR GL_COLOR (240, 100, 100)
-#define SEL_LINE_COLOR GL_COLOR_A (0, 0, 255, 128)
-#define SEL_FILL_COLOR GL_COLOR_A (192, 192, 255, 128)
+#define PAPER_RGB_ARGS 1.0, 1.0, 1.0
+#define GRID_RGB_ARGS 0.753, 0.753, 0.753
+#define MARKUP_RGB_ARGS 0.94, 0.39, 0.39
+#define OUTLINE_RGB_ARGS 0.68, 0.85, 0.90
+#define SELECT_LINE_RGBA_ARGS 0.0, 0.0, 1.0, 0.5
+#define SELECT_FILL_RGBA_ARGS 0.75, 0.75, 1.0, 0.5
-#define ARC_FINE 2 /* Resolution in degrees of large arcs */
-#define ARC_COURSE 5 /* Resolution in degrees of small arcs */
+#define GRID_LINE_WIDTH_PIXELS 1.0
+#define MARKUP_LINE_WIDTH_PIXELS 1.0
+#define OUTLINE_WIDTH_PIXELS 3.0
+#define SELECT_LINE_WIDTH_PIXELS 3.0
#define ZOOMTOFIT_PAD 16
#define POINTS_PER_MM 2.83464566929
-#define DELTA 0.01
-
/*==========================================================================*/
/* Private types. */
/*==========================================================================*/
gl_cairo_label_path (cr, view->label->template, view->label->rotate_flag, FALSE);
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ cairo_set_source_rgb (cr, PAPER_RGB_ARGS);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill (cr);
}
cairo_save (cr);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
- cairo_set_line_width (cr, 1.0/(view->home_scale * view->zoom));
- cairo_set_source_rgb (cr, 0.753, 0.753, 0.753);
+ cairo_set_line_width (cr, GRID_LINE_WIDTH_PIXELS/(view->home_scale * view->zoom));
+ cairo_set_source_rgb (cr, GRID_RGB_ARGS);
for ( x=x0+view->grid_spacing; x < w; x += view->grid_spacing )
{
cairo_save (cr);
- cairo_set_line_width (cr, 1.0/(view->home_scale * view->zoom));
- cairo_set_source_rgb (cr, 0.94, 0.39, 0.39);
+ cairo_set_line_width (cr, MARKUP_LINE_WIDTH_PIXELS/(view->home_scale * view->zoom));
+ cairo_set_source_rgb (cr, MARKUP_RGB_ARGS);
for ( p=label_type->markups; p != NULL; p=p->next )
{
gl_cairo_label_path (cr, view->label->template, view->label->rotate_flag, FALSE);
- cairo_set_line_width (cr, 3.0/(view->home_scale * view->zoom));
- cairo_set_source_rgb (cr, 0.68, 0.85, 0.90);
+ cairo_set_line_width (cr, OUTLINE_WIDTH_PIXELS/(view->home_scale * view->zoom));
+ cairo_set_source_rgb (cr, OUTLINE_RGB_ARGS);
cairo_stroke (cr);
}
cairo_rectangle (cr, x1, y1, w, h);
- cairo_set_source_rgba (cr, 0.75, 0.75, 1.0, 0.5);
+ cairo_set_source_rgba (cr, SELECT_FILL_RGBA_ARGS);
cairo_fill_preserve (cr);
- cairo_set_line_width (cr, 3.0/(view->home_scale * view->zoom));
- cairo_set_source_rgba (cr, 0, 0, 1.0, 0.5);
+ cairo_set_line_width (cr, SELECT_LINE_WIDTH_PIXELS/(view->home_scale * view->zoom));
+ cairo_set_source_rgba (cr, SELECT_LINE_RGBA_ARGS);
cairo_stroke (cr);
}
}
#include "debug.h"
+/*===========================================*/
+/* Private macros and constants. */
+/*===========================================*/
+
+#define PAPER_RGB_ARGS 1.0, 1.0, 1.0
+#define PAPER_OUTLINE_RGB_ARGS 0.0, 0.0, 0.0
+#define LABEL_OUTLINE_RGB_ARGS 0.5, 0.5, 0.5
+
#define SHADOW_X_OFFSET 5
#define SHADOW_Y_OFFSET 5
cairo_rectangle (cr, 0.0, 0.0, width, height);
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ cairo_set_source_rgb (cr, PAPER_RGB_ARGS);
cairo_fill_preserve (cr);
- cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+ cairo_set_source_rgb (cr, PAPER_OUTLINE_RGB_ARGS);
cairo_set_line_width (cr, line_width);
cairo_stroke (cr);
}
else
{
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ cairo_set_source_rgb (cr, PAPER_RGB_ARGS);
}
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill_preserve (cr);
cairo_set_line_width (cr, line_width);
- cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
+ cairo_set_source_rgb (cr, LABEL_OUTLINE_RGB_ARGS);
cairo_stroke (cr);
cairo_restore (cr);
#define LINE_COLOR GL_COLOR(0,0,0)
#define FILL_COLOR GL_COLOR(255,255,255)
+#define LINE_WIDTH_PIXELS 1.0
+
#define SHADOW_X_OFFSET 3
#define SHADOW_Y_OFFSET 3
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill_preserve (cr);
- cairo_set_line_width (cr, 1.0/scale);
+ cairo_set_line_width (cr, LINE_WIDTH_PIXELS/scale);
cairo_set_source_rgb (cr,
GL_COLOR_F_RED(line_color),
GL_COLOR_F_GREEN(line_color),