mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-04 23:43:43 +02:00
eeshow/gui/: experimental support for page layout; option -P pl-file.kicad_wks
Unlike libraries and schematics, page layouts are not (yet) tracked through revision history.
This commit is contained in:
parent
2d964c0f35
commit
6c4eae22e1
@ -66,6 +66,8 @@ struct gui_ctx {
|
||||
unsigned zoom; /* scale by 1.0 / (1 << zoom) */
|
||||
int x, y; /* center, in eeschema coordinates */
|
||||
|
||||
struct pl_ctx *pl; // @@@
|
||||
|
||||
struct gui_hist *hist; /* revision history; NULL if none */
|
||||
struct hist *vcs_hist; /* underlying VCS data; NULL if none */
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "misc/util.h"
|
||||
#include "misc/diag.h"
|
||||
#include "file/git-hist.h"
|
||||
#include "kicad/pl.h"
|
||||
#include "kicad/lib.h"
|
||||
#include "kicad/sch.h"
|
||||
#include "kicad/delta.h"
|
||||
@ -381,12 +382,14 @@ static void get_history(struct gui_ctx *ctx, const char *sch_name, int limit)
|
||||
/* ----- Initialization ---------------------------------------------------- */
|
||||
|
||||
|
||||
int gui(unsigned n_args, char **args, bool recurse, int limit)
|
||||
int gui(unsigned n_args, char **args, bool recurse, int limit,
|
||||
struct pl_ctx *pl)
|
||||
{
|
||||
GtkWidget *window;
|
||||
char *title;
|
||||
struct gui_ctx ctx = {
|
||||
.zoom = 4, /* scale by 1 / 16 */
|
||||
.pl = pl, // @@@
|
||||
.hist = NULL,
|
||||
.vcs_hist = NULL,
|
||||
.showing_history= 0,
|
||||
|
@ -20,6 +20,7 @@
|
||||
* and there is no NULL at the end.
|
||||
*/
|
||||
|
||||
int gui(unsigned n_args, char **args, bool recurse, int limit);
|
||||
int gui(unsigned n_args, char **args, bool recurse, int limit,
|
||||
struct pl_ctx *pl);
|
||||
|
||||
#endif /* !GUI_GUI_H */
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "gfx/style.h"
|
||||
#include "gfx/cro.h"
|
||||
#include "gfx/gfx.h"
|
||||
#include "kicad/pl.h"
|
||||
#include "kicad/sch.h"
|
||||
#include "kicad/delta.h"
|
||||
#include "gfx/diff.h"
|
||||
@ -230,6 +231,8 @@ void render_sheet(struct gui_sheet *sheet)
|
||||
char *argv[] = { "gui", NULL };
|
||||
|
||||
gfx_init(&cro_canvas_ops, 1, argv);
|
||||
if (sheet->ctx->pl)
|
||||
pl_render(sheet->ctx->pl, sheet->sch->w, sheet->sch->h);
|
||||
sch_render(sheet->sch);
|
||||
cro_canvas_end(gfx_ctx,
|
||||
&sheet->w, &sheet->h, &sheet->xmin, &sheet->ymin);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gfx/gfx.h"
|
||||
#include "file/file.h"
|
||||
#include "kicad/sexpr.h"
|
||||
#include "kicad/pl.h"
|
||||
#include "kicad/lib.h"
|
||||
#include "kicad/sch.h"
|
||||
#include "gui/fmt-pango.h"
|
||||
@ -120,6 +121,8 @@ int main(int argc, char **argv)
|
||||
const char *cat = NULL;
|
||||
const char *history = NULL;
|
||||
const char *fmt = NULL;
|
||||
const char *page_layout = NULL;
|
||||
struct pl_ctx *pl = NULL;
|
||||
int limit = 0;
|
||||
char c;
|
||||
int arg, dashdash;
|
||||
@ -150,7 +153,7 @@ int main(int argc, char **argv)
|
||||
if (!have_dashdash)
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
while ((c = getopt(dashdash, argv, "rvC:F:H:N:SV")) != EOF)
|
||||
while ((c = getopt(dashdash, argv, "P:rvC:F:H:N:SV")) != EOF)
|
||||
switch (c) {
|
||||
case 'r':
|
||||
recurse = 1;
|
||||
@ -170,6 +173,9 @@ int main(int argc, char **argv)
|
||||
case 'N':
|
||||
limit = atoi(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
page_layout = optarg;
|
||||
break;
|
||||
case 'S':
|
||||
sexpr();
|
||||
return 0;
|
||||
@ -209,6 +215,17 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (page_layout) {
|
||||
struct file file;
|
||||
|
||||
if (!file_open(&file, page_layout, NULL))
|
||||
return 1;
|
||||
pl = pl_parse(&file);
|
||||
file_close(&file);
|
||||
if (!pl)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (dashdash - optind < 1)
|
||||
usage(*argv);
|
||||
|
||||
@ -220,7 +237,7 @@ int main(int argc, char **argv)
|
||||
memcpy(args, argv + optind, sizeof(const char *) * n);
|
||||
|
||||
optind = 0; /* reset getopt */
|
||||
return gui(n, args, recurse, limit);
|
||||
return gui(n, args, recurse, limit, pl);
|
||||
}
|
||||
|
||||
sch_init(&sch_ctx, recurse);
|
||||
|
Loading…
Reference in New Issue
Block a user