1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-09-30 00:35:05 +03:00

genex: changed default orientation back to landscape; option -p for portrait

Since -l and -L are already taken, it's easier to make landscape the
default. genex will typically be invoked from some wrapper anyway.
This commit is contained in:
Werner Almesberger 2012-04-17 08:21:14 -03:00
parent f8e10b31a7
commit 0565adf11f
3 changed files with 14 additions and 10 deletions

View File

@ -23,11 +23,12 @@
static void usage(const char *name) static void usage(const char *name)
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s [-d] [-P] [-L libdir ...] [-l lib ...] hierarchy\n" "usage: %s [-d] [-p] [-P] [-L libdir ...] [-l lib ...] hierarchy\n"
" %*s [descriptions ...]\n\n" " %*s [descriptions ...]\n\n"
" -d dump the tree instead of generating a PDF\n" " -d dump the tree instead of generating a PDF\n"
" -L libdir search all libraries in the specified directory\n" " -L libdir search all libraries in the specified directory\n"
" -l lib search the specified component library\n" " -l lib search the specified component library\n"
" -p use portrait orientation; default: landscape\n"
" -P generate Postscript instead of PDF (mainly for debugging)\n" " -P generate Postscript instead of PDF (mainly for debugging)\n"
, name, (int) strlen(name), ""); , name, (int) strlen(name), "");
exit(1); exit(1);
@ -38,10 +39,10 @@ int main(int argc, char **argv)
{ {
FILE *file; FILE *file;
int c; int c;
int dump = 0, postscript = 0; int dump = 0, postscript = 0, portrait = 0;
char **arg; char **arg;
while ((c = getopt(argc, argv, "dL:l:P")) != EOF) while ((c = getopt(argc, argv, "dL:l:Pp")) != EOF)
switch (c) { switch (c) {
case 'd': case 'd':
dump = 1; dump = 1;
@ -55,6 +56,9 @@ int main(int argc, char **argv)
case 'P': case 'P':
postscript = 1; postscript = 1;
break; break;
case 'p':
portrait = 1;
break;
default: default:
usage(*argv); usage(*argv);
} }
@ -88,6 +92,6 @@ int main(int argc, char **argv)
if (dump) if (dump)
dump_tree(); dump_tree();
else else
make_pdf(!postscript); make_pdf(!postscript, portrait);
return 0; return 0;
} }

View File

@ -30,7 +30,7 @@ static struct format {
} name, path, lib, comment; } name, path, lib, comment;
int comment_line_skip; int comment_line_skip;
} landscape = { } landscape = {
.file_setup = "", .file_setup = "%%Orientation: Landscape",
.overlay_setup = "90 rotate", .overlay_setup = "90 rotate",
.comp_setup = "", .comp_setup = "",
.left = 20, .left = 20,
@ -211,15 +211,15 @@ static void convert_tree(const struct node *node, FILE *out)
} }
void make_pdf(int pdf) void make_pdf(int pdf, int use_portrait)
{ {
FILE *out; FILE *out;
int res; int res;
if (0) if (use_portrait)
format = landscape;
else
format = portrait; format = portrait;
else
format = landscape;
if (pdf) if (pdf)
out = popen( out = popen(
"gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- " "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- "

View File

@ -12,6 +12,6 @@
#ifndef PDF_H #ifndef PDF_H
#define PDF_H #define PDF_H
void make_pdf(int pdf); void make_pdf(int pdf, int use_portrait);
#endif /* !PDF_H */ #endif /* !PDF_H */