From git at gpleda.org Wed Feb 1 15:38:44 2012 From: git at gpleda.org (git at gpleda.org) Date: Wed, 01 Feb 2012 20:38:44 +0000 Subject: gEDA-cvs: gaf.git: branch: master updated (1.7.2-20111231-125-g9eb7428) Message-ID: The branch, master has been updated via 9eb7428d7005428e4fb60c4046b258ee999eebd5 (commit) from 0110f9ce43676a340474e58d09fdec8494dabdf2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. ========= Summary ========= gschem/lib/system-gschemrc.scm | 7 ++++--- gschem/src/g_rc.c | 3 ++- gschem/src/i_vars.c | 2 +- gschem/src/x_print.c | 6 ++++++ libgeda/include/libgeda/defines.h | 1 + libgeda/include/prototype_priv.h | 2 +- libgeda/src/f_print.c | 25 ++++++++++++++----------- 7 files changed, 29 insertions(+), 17 deletions(-) ================= Commit Messages ================= commit 9eb7428d7005428e4fb60c4046b258ee999eebd5 Author: Vladimir Zhbanov Commit: Peter TB Brett Add an option to automatically choose portrait/landscape To choose portrait or landscape for a schematic the printing function relies upon its X and Y dimensions. If the dimensions are equal, landscape is chosen as more often used layout. Closes-bug: lp-722347 :100644 100644 b3fd193... 800b90c... M gschem/lib/system-gschemrc.scm :100644 100644 b7d28f4... a1e0a3d... M gschem/src/g_rc.c :100644 100644 c4dca9e... fb5550c... M gschem/src/i_vars.c :100644 100644 a536cc1... 7c09dac... M gschem/src/x_print.c :100644 100644 fe2df6a... 6fb41d8... M libgeda/include/libgeda/defines.h :100644 100644 87f58b8... 3dccc54... M libgeda/include/prototype_priv.h :100644 100644 473b3a0... 1d15e96... M libgeda/src/f_print.c ========= Changes ========= commit 9eb7428d7005428e4fb60c4046b258ee999eebd5 Author: Vladimir Zhbanov Commit: Peter TB Brett Add an option to automatically choose portrait/landscape To choose portrait or landscape for a schematic the printing function relies upon its X and Y dimensions. If the dimensions are equal, landscape is chosen as more often used layout. Closes-bug: lp-722347 diff --git a/gschem/lib/system-gschemrc.scm b/gschem/lib/system-gschemrc.scm index b3fd193..800b90c 100644 --- a/gschem/lib/system-gschemrc.scm +++ b/gschem/lib/system-gschemrc.scm @@ -619,10 +619,11 @@ ; output-orientation string ; -; Controls which way the output page is layed out (landscape or portrait) -; +; Controls which way the output page is layed out (landscape or portrait). +; "auto" allows gschem to automatically choose a proper layout +(output-orientation "auto") ;(output-orientation "portrait") -(output-orientation "landscape") +;(output-orientation "landscape") ; output-color string ; diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c index b7d28f4..a1e0a3d 100644 --- a/gschem/src/g_rc.c +++ b/gschem/src/g_rc.c @@ -656,11 +656,12 @@ SCM g_rc_output_orientation(SCM mode) static const vstbl_entry mode_table[] = { {PORTRAIT , "portrait" }, {LANDSCAPE, "landscape"}, + {AUTOLAYOUT, "auto" }, }; RETURN_G_RC_MODE("output-orientation", default_print_orientation, - 2); + 3); } /*! \todo Finish function documentation!!! diff --git a/gschem/src/i_vars.c b/gschem/src/i_vars.c index c4dca9e..fb5550c 100644 --- a/gschem/src/i_vars.c +++ b/gschem/src/i_vars.c @@ -67,7 +67,7 @@ int default_paper_width = 11000; /* letter size */ int default_paper_height = 85000; int default_scrollbars_flag = TRUE; char *default_print_command = NULL; -int default_print_orientation = LANDSCAPE; +int default_print_orientation = AUTOLAYOUT; int default_image_color = FALSE; int default_image_width = 800; int default_image_height = 600; diff --git a/gschem/src/x_print.c b/gschem/src/x_print.c index a536cc1..7c09dac 100644 --- a/gschem/src/x_print.c +++ b/gschem/src/x_print.c @@ -206,6 +206,12 @@ print_dialog_init_orient_combobox (PrintDialog * d) model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); gtk_list_store_append (model, &iter); + gtk_list_store_set (model, &iter, + 0, _("Automatic"), + 1, AUTOLAYOUT, + -1); + + gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, 0, _("Landscape"), 1, LANDSCAPE, diff --git a/libgeda/include/libgeda/defines.h b/libgeda/include/libgeda/defines.h index fe2df6a..6fb41d8 100644 --- a/libgeda/include/libgeda/defines.h +++ b/libgeda/include/libgeda/defines.h @@ -171,6 +171,7 @@ /* for print dialog box */ #define LANDSCAPE 0 #define PORTRAIT 1 +#define AUTOLAYOUT 2 /* for type to s_cue_output_all */ #define POSTSCRIPT 0 diff --git a/libgeda/include/prototype_priv.h b/libgeda/include/prototype_priv.h index 87f58b8..3dccc54 100644 --- a/libgeda/include/prototype_priv.h +++ b/libgeda/include/prototype_priv.h @@ -4,7 +4,7 @@ gchar *o_save_objects(TOPLEVEL *toplevel, const GList *object_list, gboolean sav /* f_print.c */ void f_print_set_line_width(FILE *fp, int width); int f_print_set_color(TOPLEVEL *toplevel, FILE *fp, int color); -int f_print_header(TOPLEVEL *toplevel, PAGE *page, FILE *fp, int paper_size_x, int paper_size_y, int eps); +int f_print_header(TOPLEVEL *toplevel, PAGE *page, FILE *fp, int paper_size_x, int paper_size_y, int eps, gboolean landscape); void f_print_footer(FILE *fp); void f_print_objects(TOPLEVEL *toplevel, FILE *fp, const GList *obj_list, int start_x, int start_y, float scale, int unicode_count, gunichar *unicode_table); int f_print_initialize_glyph_table(void); diff --git a/libgeda/src/f_print.c b/libgeda/src/f_print.c index 473b3a0..1d15e96 100644 --- a/libgeda/src/f_print.c +++ b/libgeda/src/f_print.c @@ -100,10 +100,11 @@ int f_print_set_color(TOPLEVEL *toplevel, FILE *fp, int color) * \param [in] paper_size_x The width of the document on paper in inches. * \param [in] paper_size_y The height of the document on paper in inches. * \param [in] eps whether to create a eps of a ps document + * \param [in] landscape whether to print a page in landscape format * \return 0 on success, -1 on failure. */ int f_print_header(TOPLEVEL *toplevel, PAGE *page, FILE *fp, - int paper_size_x, int paper_size_y, int eps) + int paper_size_x, int paper_size_y, int eps, gboolean landscape) { char *buf = NULL; FILE *prolog; @@ -147,8 +148,7 @@ int f_print_header(TOPLEVEL *toplevel, PAGE *page, FILE *fp, getlogin(), #endif llx, lly, urx, ury, - ((toplevel->print_orientation == LANDSCAPE) - ? "Landscape" : "Portrait") + (landscape ? "Landscape" : "Portrait") ); /* Fetch and insert the Postscript prolog from disk here */ @@ -424,13 +424,14 @@ int f_print_command (TOPLEVEL *toplevel, PAGE *page, const char *command) int f_print_stream(TOPLEVEL *toplevel, PAGE *page, FILE *fp) { int origin_x, origin_y, bottom, right; - int margin_x, margin_y; - int dx,dy; + int margin_x=0, margin_y=0; + int dx=0, dy=0; float scale; int unicode_count; gunichar unicode_table [128]; /* to contain the list of unicode characters that need mapping */ int eps; + gboolean landscape; /* Unicode support */ f_print_initialize_glyph_table(); /* Fill up unicode map */ @@ -449,8 +450,7 @@ int f_print_stream(TOPLEVEL *toplevel, PAGE *page, FILE *fp) &right, &bottom); /* Calculate scale factor that will make the image fit on the page */ - dx = 0; dy = 0; - margin_x = 0; margin_y = 0; + switch (toplevel->print_output_type) { case EXTENTS: dx = right - origin_x; @@ -482,9 +482,12 @@ int f_print_stream(TOPLEVEL *toplevel, PAGE *page, FILE *fp) } + landscape = ((toplevel->print_orientation == LANDSCAPE) || + ((toplevel->print_orientation == AUTOLAYOUT) && ( dx >= dy ))); + if(toplevel->paper_width == 0) { eps = 1; - if(toplevel->print_orientation == LANDSCAPE) { + if (landscape) { toplevel->paper_width = dx; toplevel->paper_height = dy; } else { /* portrait */ @@ -495,7 +498,7 @@ int f_print_stream(TOPLEVEL *toplevel, PAGE *page, FILE *fp) eps = 0; scale = 0.0; - if(toplevel->print_orientation == LANDSCAPE) { + if (landscape) { /* First attempt to fit in x direction. */ scale = toplevel->paper_width / (float)dx; if((toplevel->paper_height / (float)dy) < scale ) { @@ -522,7 +525,7 @@ int f_print_stream(TOPLEVEL *toplevel, PAGE *page, FILE *fp) if (f_print_header(toplevel, page, fp, toplevel->paper_width, toplevel->paper_height, - eps) != 0) { + eps, landscape) != 0) { /* There was an error in f_print_header */ return -1; @@ -575,7 +578,7 @@ int f_print_stream(TOPLEVEL *toplevel, PAGE *page, FILE *fp) /* Now rotate and translate the graphics to fit onto the desired * page with the orientation we want. Center it too */ - if(toplevel->print_orientation == LANDSCAPE) { + if (landscape) { fprintf(fp, "%d %d translate 90 rotate\n", (int)((toplevel->paper_height + ( dy-margin_y) * scale)/2.0), From git at gpleda.org Sun Feb 12 14:48:16 2012 From: git at gpleda.org (git at gpleda.org) Date: Sun, 12 Feb 2012 19:48:16 +0000 Subject: gEDA-cvs: pcb.git: branch: master updated (c6dd6949b59a41bf37b4cacbc4871397030b6fe2) Message-ID: The branch, master has been updated via c6dd6949b59a41bf37b4cacbc4871397030b6fe2 (commit) from b30e524e5ef574befa1fa538333aa739271b4e14 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. ========= Summary ========= src/hid/gtk/gtkhid-gl.c | 17 ----------------- 1 files changed, 0 insertions(+), 17 deletions(-) ================= Commit Messages ================= commit c6dd6949b59a41bf37b4cacbc4871397030b6fe2 Author: Peter Clifton Commit: Peter Clifton hid/gtk: Remove XOR colour logic from the GL rederer. This code was not being used, so remove it. :100644 100644 f3133ec... 45b9b72... M src/hid/gtk/gtkhid-gl.c ========= Changes ========= commit c6dd6949b59a41bf37b4cacbc4871397030b6fe2 Author: Peter Clifton Commit: Peter Clifton hid/gtk: Remove XOR colour logic from the GL rederer. This code was not being used, so remove it. diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c index f3133ec..45b9b72 100644 --- a/src/hid/gtk/gtkhid-gl.c +++ b/src/hid/gtk/gtkhid-gl.c @@ -68,7 +68,6 @@ typedef struct hid_gc_struct double alpha_mult; Coord width; gint cap, join; - gchar xor; } hid_gc_struct; @@ -356,8 +355,6 @@ typedef struct { int color_set; GdkColor color; - int xor_set; - GdkColor xor_color; double red; double green; double blue; @@ -420,20 +417,6 @@ set_gl_color_for_gc (hidGC gc) cc->blue = cc->color.blue / 65535.; cc->color_set = 1; } - if (gc->xor) - { - if (!cc->xor_set) - { - cc->xor_color.red = cc->color.red ^ gport->bg_color.red; - cc->xor_color.green = cc->color.green ^ gport->bg_color.green; - cc->xor_color.blue = cc->color.blue ^ gport->bg_color.blue; - gdk_color_alloc (gport->colormap, &cc->xor_color); - cc->red = cc->color.red / 65535.; - cc->green = cc->color.green / 65535.; - cc->blue = cc->color.blue / 65535.; - cc->xor_set = 1; - } - } r = cc->red; g = cc->green; b = cc->blue; From git at gpleda.org Sun Feb 12 14:59:32 2012 From: git at gpleda.org (git at gpleda.org) Date: Sun, 12 Feb 2012 19:59:32 +0000 Subject: gEDA-cvs: pcb.git: branch: master updated (82b497e0ab801cc08c19752af224a9c97f74110a) Message-ID: The branch, master has been updated via 82b497e0ab801cc08c19752af224a9c97f74110a (commit) from c6dd6949b59a41bf37b4cacbc4871397030b6fe2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. ========= Summary ========= src/line.c | 57 +++++++++++++++++++++++++++------------------------------ 1 files changed, 27 insertions(+), 30 deletions(-) ================= Commit Messages ================= commit 82b497e0ab801cc08c19752af224a9c97f74110a Author: Peter Clifton Commit: Peter Clifton Fiddle with the 45-degre line snapping code The results should be identical, but hopefully this is clearer code. I believe there were some masked bugs lurking in the old calculations, which shouldn't be present in the new code. :100644 100644 8898238... 47e3125... M src/line.c ========= Changes ========= commit 82b497e0ab801cc08c19752af224a9c97f74110a Author: Peter Clifton Commit: Peter Clifton Fiddle with the 45-degre line snapping code The results should be identical, but hopefully this is clearer code. I believe there were some masked bugs lurking in the old calculations, which shouldn't be present in the new code. diff --git a/src/line.c b/src/line.c index 8898238..47e3125 100644 --- a/src/line.c +++ b/src/line.c @@ -82,16 +82,16 @@ AdjustAttachedLine (void) * * directions: * - * 0 - * 7 1 - * 6 2 - * 5 3 * 4 + * 5 3 + * 6 2 + * 7 1 + * 0 */ void FortyFiveLine (AttachedLineType *Line) { - Coord dx, dy, min; + Coord dx, dy, min, max; unsigned direction = 0; double m; @@ -99,22 +99,20 @@ FortyFiveLine (AttachedLineType *Line) dx = Crosshair.X - Line->Point1.X; dy = Crosshair.Y - Line->Point1.Y; - if (!dx) - { - if (!dy) - /* zero length line, don't draw anything */ - return; - else - direction = dy > 0 ? 0 : 4; - } + /* zero length line, don't draw anything */ + if (dx == 0 && dy == 0) + return; + + if (dx == 0) + direction = dy > 0 ? 0 : 4; else { - m = (double) dy / dx; + m = (double)dy / (double)dx; direction = 2; if (m > TAN_30_DEGREE) - direction = m > TAN_60_DEGREE ? 0 : 1; + direction = m > TAN_60_DEGREE ? 0 : 1; else if (m < -TAN_30_DEGREE) - direction = m < -TAN_60_DEGREE ? 0 : 3; + direction = m < -TAN_60_DEGREE ? 4 : 3; } if (dx < 0) direction += 4; @@ -122,19 +120,28 @@ FortyFiveLine (AttachedLineType *Line) dx = abs (dx); dy = abs (dy); min = MIN (dx, dy); + max = MAX (dx, dy); /* now set up the second pair of coordinates */ switch (direction) { case 0: + Line->Point2.X = Line->Point1.X; + Line->Point2.Y = Line->Point1.Y + max; + break; + case 4: Line->Point2.X = Line->Point1.X; - Line->Point2.Y = Crosshair.Y; + Line->Point2.Y = Line->Point1.Y - max; break; case 2: + Line->Point2.X = Line->Point1.X + max; + Line->Point2.Y = Line->Point1.Y; + break; + case 6: - Line->Point2.X = Crosshair.X; + Line->Point2.X = Line->Point1.X - max; Line->Point2.Y = Line->Point1.Y; break; @@ -500,24 +507,14 @@ EnforceLineDRC (void) if (XOR (r1 > r2, shift)) { if (PCB->Clipping) - { - if (shift) - PCB->Clipping = 2; - else - PCB->Clipping = 1; - } + PCB->Clipping = shift ? 2 : 1; Crosshair.X = rs.X; Crosshair.Y = rs.Y; } else { if (PCB->Clipping) - { - if (shift) - PCB->Clipping = 1; - else - PCB->Clipping = 2; - } + PCB->Clipping = shift ? 1 : 2; Crosshair.X = r45.X; Crosshair.Y = r45.Y; }