]> git.sur5r.net Git - glabels/commitdiff
2007-04-26 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Fri, 27 Apr 2007 02:17:18 +0000 (02:17 +0000)
committerJim Evins <evins@snaught.com>
Fri, 27 Apr 2007 02:17:18 +0000 (02:17 +0000)
* 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.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@654 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/ChangeLog
glabels2/src/mini-preview-pixbuf.c
glabels2/src/print.c
glabels2/src/view-object.c
glabels2/src/view.c
glabels2/src/wdgt-mini-preview.c
glabels2/src/wdgt-rotate-label.c

index 1afaa2cf6a03dfc63f6846bf0d0c43ed31972fdd..0d94463a912c6c8c4b3799ba71808f31b3b951c4 100644 (file)
@@ -1,3 +1,15 @@
+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):
index 1fd467d11cb8c9572f2013e047e20ff4913a3276..b83afbc06a0273ca6eefa507f7b502485e0207e3 100644 (file)
 
 #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                             */
 /*===========================================*/
@@ -136,10 +148,10 @@ draw_paper (cairo_t           *cr,
 
        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);
 
@@ -162,7 +174,7 @@ draw_label_outlines (cairo_t           *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);
 
@@ -199,11 +211,11 @@ draw_label_outline (cairo_t           *cr,
 
         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);
index 15f07135986b34624ea70148c40da46b6ff63922..b4310017e752d6d23f0ed5f07bf39f096eb1a3e6 100644 (file)
 /* 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
 
@@ -391,8 +395,8 @@ print_crop_marks (PrintInfo *pi)
 
         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) {
 
@@ -532,8 +536,8 @@ draw_outline (PrintInfo *pi,
 
         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);
 
index 5a7f9aa99584bb0cb8183b02dd1241e71575c404..cfbe92b1151976be6c17047a7a25ad56e33742d5 100644 (file)
 /* 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
 
 /*========================================================*/
@@ -396,11 +400,11 @@ gl_view_object_draw_handles (glViewObject *view_object,
                 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);
index 79e768f556a7ff08e0fc45be51854637cfbea3c1..18312ca2baf6cb39208eee9215f36f7c78de2b80 100644 (file)
 /*==========================================================================*/
 
 #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.                                                           */
 /*==========================================================================*/
@@ -754,7 +754,7 @@ draw_bg_layer (glView  *view,
 
         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);
 }
@@ -796,8 +796,8 @@ draw_grid_layer (glView  *view,
                 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 )
                 {
@@ -843,8 +843,8 @@ draw_markup_layer (glView  *view,
 
                 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 )
                 {
@@ -882,8 +882,8 @@ draw_fg_layer (glView  *view,
 
         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);
 }
 
@@ -934,11 +934,11 @@ draw_select_region_layer (glView  *view,
 
                 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);
         }
 }
index 49e4a472ff5a1ffd3f63f63bc39c5b5b7a65e53e..abd1c5012ec3c99a7cbcb75ebc0525adf1f6909a 100644 (file)
 
 #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
 
@@ -647,10 +655,10 @@ draw_paper (glWdgtMiniPreview      *preview,
 
        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);
 
@@ -701,13 +709,13 @@ draw_labels (glWdgtMiniPreview *preview,
                }
                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);
index dbeb8150a89e10845387d295c57132a9a4dd9ddb..a4226006982ec71da9f59d24a87426e304fa1565 100644 (file)
@@ -49,6 +49,8 @@
 #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
 
@@ -310,7 +312,7 @@ drawingarea_update (GtkDrawingArea *drawing_area,
         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),