mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-05 00:00:37 +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) */
|
unsigned zoom; /* scale by 1.0 / (1 << zoom) */
|
||||||
int x, y; /* center, in eeschema coordinates */
|
int x, y; /* center, in eeschema coordinates */
|
||||||
|
|
||||||
|
struct pl_ctx *pl; // @@@
|
||||||
|
|
||||||
struct gui_hist *hist; /* revision history; NULL if none */
|
struct gui_hist *hist; /* revision history; NULL if none */
|
||||||
struct hist *vcs_hist; /* underlying VCS data; NULL if none */
|
struct hist *vcs_hist; /* underlying VCS data; NULL if none */
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "misc/util.h"
|
#include "misc/util.h"
|
||||||
#include "misc/diag.h"
|
#include "misc/diag.h"
|
||||||
#include "file/git-hist.h"
|
#include "file/git-hist.h"
|
||||||
|
#include "kicad/pl.h"
|
||||||
#include "kicad/lib.h"
|
#include "kicad/lib.h"
|
||||||
#include "kicad/sch.h"
|
#include "kicad/sch.h"
|
||||||
#include "kicad/delta.h"
|
#include "kicad/delta.h"
|
||||||
@ -381,12 +382,14 @@ static void get_history(struct gui_ctx *ctx, const char *sch_name, int limit)
|
|||||||
/* ----- Initialization ---------------------------------------------------- */
|
/* ----- 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;
|
GtkWidget *window;
|
||||||
char *title;
|
char *title;
|
||||||
struct gui_ctx ctx = {
|
struct gui_ctx ctx = {
|
||||||
.zoom = 4, /* scale by 1 / 16 */
|
.zoom = 4, /* scale by 1 / 16 */
|
||||||
|
.pl = pl, // @@@
|
||||||
.hist = NULL,
|
.hist = NULL,
|
||||||
.vcs_hist = NULL,
|
.vcs_hist = NULL,
|
||||||
.showing_history= 0,
|
.showing_history= 0,
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
* and there is no NULL at the end.
|
* 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 */
|
#endif /* !GUI_GUI_H */
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "gfx/style.h"
|
#include "gfx/style.h"
|
||||||
#include "gfx/cro.h"
|
#include "gfx/cro.h"
|
||||||
#include "gfx/gfx.h"
|
#include "gfx/gfx.h"
|
||||||
|
#include "kicad/pl.h"
|
||||||
#include "kicad/sch.h"
|
#include "kicad/sch.h"
|
||||||
#include "kicad/delta.h"
|
#include "kicad/delta.h"
|
||||||
#include "gfx/diff.h"
|
#include "gfx/diff.h"
|
||||||
@ -230,6 +231,8 @@ void render_sheet(struct gui_sheet *sheet)
|
|||||||
char *argv[] = { "gui", NULL };
|
char *argv[] = { "gui", NULL };
|
||||||
|
|
||||||
gfx_init(&cro_canvas_ops, 1, argv);
|
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);
|
sch_render(sheet->sch);
|
||||||
cro_canvas_end(gfx_ctx,
|
cro_canvas_end(gfx_ctx,
|
||||||
&sheet->w, &sheet->h, &sheet->xmin, &sheet->ymin);
|
&sheet->w, &sheet->h, &sheet->xmin, &sheet->ymin);
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "gfx/gfx.h"
|
#include "gfx/gfx.h"
|
||||||
#include "file/file.h"
|
#include "file/file.h"
|
||||||
#include "kicad/sexpr.h"
|
#include "kicad/sexpr.h"
|
||||||
|
#include "kicad/pl.h"
|
||||||
#include "kicad/lib.h"
|
#include "kicad/lib.h"
|
||||||
#include "kicad/sch.h"
|
#include "kicad/sch.h"
|
||||||
#include "gui/fmt-pango.h"
|
#include "gui/fmt-pango.h"
|
||||||
@ -120,6 +121,8 @@ int main(int argc, char **argv)
|
|||||||
const char *cat = NULL;
|
const char *cat = NULL;
|
||||||
const char *history = NULL;
|
const char *history = NULL;
|
||||||
const char *fmt = NULL;
|
const char *fmt = NULL;
|
||||||
|
const char *page_layout = NULL;
|
||||||
|
struct pl_ctx *pl = NULL;
|
||||||
int limit = 0;
|
int limit = 0;
|
||||||
char c;
|
char c;
|
||||||
int arg, dashdash;
|
int arg, dashdash;
|
||||||
@ -150,7 +153,7 @@ int main(int argc, char **argv)
|
|||||||
if (!have_dashdash)
|
if (!have_dashdash)
|
||||||
gtk_init(&argc, &argv);
|
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) {
|
switch (c) {
|
||||||
case 'r':
|
case 'r':
|
||||||
recurse = 1;
|
recurse = 1;
|
||||||
@ -170,6 +173,9 @@ int main(int argc, char **argv)
|
|||||||
case 'N':
|
case 'N':
|
||||||
limit = atoi(optarg);
|
limit = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'P':
|
||||||
|
page_layout = optarg;
|
||||||
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
sexpr();
|
sexpr();
|
||||||
return 0;
|
return 0;
|
||||||
@ -209,6 +215,17 @@ int main(int argc, char **argv)
|
|||||||
return 0;
|
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)
|
if (dashdash - optind < 1)
|
||||||
usage(*argv);
|
usage(*argv);
|
||||||
|
|
||||||
@ -220,7 +237,7 @@ int main(int argc, char **argv)
|
|||||||
memcpy(args, argv + optind, sizeof(const char *) * n);
|
memcpy(args, argv + optind, sizeof(const char *) * n);
|
||||||
|
|
||||||
optind = 0; /* reset getopt */
|
optind = 0; /* reset getopt */
|
||||||
return gui(n, args, recurse, limit);
|
return gui(n, args, recurse, limit, pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
sch_init(&sch_ctx, recurse);
|
sch_init(&sch_ctx, recurse);
|
||||||
|
Loading…
Reference in New Issue
Block a user