mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2025-01-09 15:10:15 +02:00
eeshow/: missing components are no longer fatal
This commit is contained in:
parent
7af9b85e6c
commit
4c86cc1b46
@ -114,6 +114,8 @@ static bool comp_eq(const struct comp *a, const struct comp *b)
|
|||||||
{
|
{
|
||||||
if (a == b)
|
if (a == b)
|
||||||
return 1;
|
return 1;
|
||||||
|
if (!(a && b))
|
||||||
|
return 0;
|
||||||
if (strcmp(a->name, b->name))
|
if (strcmp(a->name, b->name))
|
||||||
return 0;
|
return 0;
|
||||||
if (a->units != b->units)
|
if (a->units != b->units)
|
||||||
|
@ -380,7 +380,8 @@ const struct comp *lib_find(const struct lib *lib, const char *name)
|
|||||||
if (!strcmp(alias->name, name))
|
if (!strcmp(alias->name, name))
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
fatal("\"%s\" not found\n", name);
|
error("\"%s\" not found\n", name);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -390,10 +391,26 @@ bool lib_field_visible(const struct comp *comp, int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void missing_component(const int m[4])
|
||||||
|
{
|
||||||
|
int sx = mx(0, 0, m);
|
||||||
|
int sy = my(0, 0, m);
|
||||||
|
int ex = mx(MISSING_WIDTH, MISSING_HEIGHT, m);
|
||||||
|
int ey = my(MISSING_WIDTH, MISSING_HEIGHT, m);
|
||||||
|
|
||||||
|
gfx_rect(sx, sy, ex, ey, COLOR_MISSING_FG, COLOR_MISSING_BG,
|
||||||
|
LAYER_COMP_DWG);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void lib_render(const struct comp *comp, unsigned unit, const int m[4])
|
void lib_render(const struct comp *comp, unsigned unit, const int m[4])
|
||||||
{
|
{
|
||||||
const struct lib_obj *obj;
|
const struct lib_obj *obj;
|
||||||
|
|
||||||
|
if (!comp) {
|
||||||
|
missing_component(m);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!unit)
|
if (!unit)
|
||||||
unit = 1;
|
unit = 1;
|
||||||
for (obj = comp->objs; obj; obj = obj->next) {
|
for (obj = comp->objs; obj; obj = obj->next) {
|
||||||
|
@ -114,12 +114,12 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
|
|||||||
&hor, &vert, &italic, &bold) != 11)
|
&hor, &vert, &italic, &bold) != 11)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (flags || !lib_field_visible(comp->comp, n)) {
|
if (flags || (comp->comp && !lib_field_visible(comp->comp, n))) {
|
||||||
free(field);
|
free(field);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n == 0 && comp->comp->units > 1) {
|
if (n == 0 && comp->comp && comp->comp->units > 1) {
|
||||||
int len = strlen(txt->s);
|
int len = strlen(txt->s);
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ uint32_t color_rgb[] = {
|
|||||||
[COLOR_RED3] = 0xb00000,
|
[COLOR_RED3] = 0xb00000,
|
||||||
[COLOR_MAGENTA4] = 0x900090,
|
[COLOR_MAGENTA4] = 0x900090,
|
||||||
[COLOR_BROWN2] = 0xc06000,
|
[COLOR_BROWN2] = 0xc06000,
|
||||||
|
[COLOR_PINK4] = 0xff8080,
|
||||||
|
|
||||||
/* user-defined colors */
|
/* user-defined colors */
|
||||||
[COLOR_DARK_YELLOW] = 0x848400,
|
[COLOR_DARK_YELLOW] = 0x848400,
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#define COLOR_RED3 19
|
#define COLOR_RED3 19
|
||||||
#define COLOR_MAGENTA4 21
|
#define COLOR_MAGENTA4 21
|
||||||
#define COLOR_BROWN2 26
|
#define COLOR_BROWN2 26
|
||||||
|
#define COLOR_PINK4 27
|
||||||
|
|
||||||
#define COLOR_DARK_YELLOW 32 /* user-defined */
|
#define COLOR_DARK_YELLOW 32 /* user-defined */
|
||||||
#define COLOR_LIGHT_GREY 33 /* user-defined, not used for FIG */
|
#define COLOR_LIGHT_GREY 33 /* user-defined, not used for FIG */
|
||||||
@ -54,6 +55,8 @@
|
|||||||
#define COLOR_FIELD COLOR_CYAN4
|
#define COLOR_FIELD COLOR_CYAN4
|
||||||
#define COLOR_PIN_NAME COLOR_FIELD
|
#define COLOR_PIN_NAME COLOR_FIELD
|
||||||
#define COLOR_PIN_NUMBER COLOR_RED4
|
#define COLOR_PIN_NUMBER COLOR_RED4
|
||||||
|
#define COLOR_MISSING_FG COLOR_RED
|
||||||
|
#define COLOR_MISSING_BG COLOR_PINK4
|
||||||
|
|
||||||
#define FONT_HELVETICA_BOLD 18
|
#define FONT_HELVETICA_BOLD 18
|
||||||
|
|
||||||
@ -90,6 +93,8 @@
|
|||||||
|
|
||||||
#define NEWLINE_SKIP 1.4 // * text size
|
#define NEWLINE_SKIP 1.4 // * text size
|
||||||
|
|
||||||
|
#define MISSING_WIDTH 300 // size of missing things indicator box
|
||||||
|
#define MISSING_HEIGHT 300
|
||||||
|
|
||||||
extern uint32_t color_rgb[];
|
extern uint32_t color_rgb[];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user