1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-22 07:44:04 +02:00

genkicat: new option "-t title.ps" to include a title page file

This commit is contained in:
Werner Almesberger 2012-12-21 00:11:14 -03:00
parent afae5c753e
commit 560bf9d64a
4 changed files with 24 additions and 16 deletions

View File

@ -1,3 +0,0 @@
#!/bin/sh
PATH=$PATH:.
exec genkicat-bin "$@"

View File

@ -28,15 +28,16 @@ static void usage(const char *name)
{
fprintf(stderr,
"usage: %s [-F] [-d|-D] [-p] [-P] [-q] [-L libdir ...] [-l lib ...]\n"
" %*s hierarchy [descriptions ...]\n\n"
" -d dump the tree instead of generating a PDF\n"
" -D dump all the canonical component names (without aliases)\n"
" -F use fped footprints instead of KiCad components\n"
" -L libdir search all libraries in the specified directory\n"
" -l lib search the specified library\n"
" -p use portrait orientation; default: landscape\n"
" -P generate Postscript instead of PDF (mainly for debugging)\n"
" -q don't show progress\n"
" %*s [-t title.ps] hierarchy [descriptions ...]\n\n"
" -d dump the tree instead of generating a PDF\n"
" -D dump all the canonical component names (without aliases)\n"
" -F use fped footprints instead of KiCad components\n"
" -L libdir search all libraries in the specified directory\n"
" -l lib search the specified library\n"
" -p use portrait orientation; default: landscape\n"
" -P generate Postscript instead of PDF (mainly for debugging)\n"
" -q don't show progress\n"
" -t title.ps Postscript file with title page\n"
, name, (int) strlen(name), "");
exit(1);
}
@ -48,9 +49,10 @@ int main(int argc, char **argv)
FILE *file;
int c;
int opt_dump_tree = 0, opt_dump_comp = 0, postscript = 0, portrait = 0;
const char *title_page = NULL;
char **arg;
while ((c = getopt(argc, argv, "dDFL:l:Ppq")) != EOF)
while ((c = getopt(argc, argv, "dDFL:l:Ppqt:")) != EOF)
switch (c) {
case 'd':
opt_dump_tree = 1;
@ -76,6 +78,9 @@ int main(int argc, char **argv)
case 'q':
quiet = 1;
break;
case 't':
title_page = optarg;
break;
default:
usage(*argv);
}
@ -114,6 +119,6 @@ int main(int argc, char **argv)
else if (opt_dump_comp)
dump_comp();
else
make_pdf(!postscript, portrait);
make_pdf(!postscript, portrait, title_page);
return 0;
}

View File

@ -15,6 +15,7 @@
#include <string.h>
#include "util.h"
#include "run.h"
#include "genkicat.h"
#include "tree.h"
#include "libs.h"
@ -334,7 +335,7 @@ static int count_tree(const struct node *node)
}
void make_pdf(int pdf, int use_portrait)
void make_pdf(int pdf, int use_portrait, const char *title_page)
{
FILE *out;
int res;
@ -354,6 +355,11 @@ void make_pdf(int pdf, int use_portrait)
exit(1);
}
fprintf(out, "%%!PS\n%s\n", format->file_setup);
if (title_page) {
fprintf(out, "gsave\n");
cat(out, title_page);
fprintf(out, "grestore\n");
}
make_index(out, tree);
total = count_tree(tree);
convert_tree(tree, out);

View File

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