1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-04 23:05:21 +02: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)
{
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"
" -d dump the tree instead of generating a PDF\n"
" -L libdir search all libraries in the specified directory\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"
, name, (int) strlen(name), "");
exit(1);
@ -38,10 +39,10 @@ int main(int argc, char **argv)
{
FILE *file;
int c;
int dump = 0, postscript = 0;
int dump = 0, postscript = 0, portrait = 0;
char **arg;
while ((c = getopt(argc, argv, "dL:l:P")) != EOF)
while ((c = getopt(argc, argv, "dL:l:Pp")) != EOF)
switch (c) {
case 'd':
dump = 1;
@ -55,6 +56,9 @@ int main(int argc, char **argv)
case 'P':
postscript = 1;
break;
case 'p':
portrait = 1;
break;
default:
usage(*argv);
}
@ -88,6 +92,6 @@ int main(int argc, char **argv)
if (dump)
dump_tree();
else
make_pdf(!postscript);
make_pdf(!postscript, portrait);
return 0;
}

View File

@ -30,7 +30,7 @@ static struct format {
} name, path, lib, comment;
int comment_line_skip;
} landscape = {
.file_setup = "",
.file_setup = "%%Orientation: Landscape",
.overlay_setup = "90 rotate",
.comp_setup = "",
.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;
int res;
if (0)
format = landscape;
else
if (use_portrait)
format = portrait;
else
format = landscape;
if (pdf)
out = popen(
"gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- "

View File

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