[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.7.2-20111231-125-g9eb7428)
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 <vzhbanov@xxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
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 <vzhbanov@xxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
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),
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs