Changeset 5445
- Timestamp:
- 08/14/09 17:53:21 (4 years ago)
- File:
-
- 1 edited
-
trunk/eda/fped/inst.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eda/fped/inst.c
r5440 r5445 41 41 static unsigned long active_set = 0; 42 42 43 static struct inst_ops vec_ops; 44 static struct inst_ops frame_ops; 45 43 46 44 47 #define IS_ACTIVE ((active_set & 1)) … … 88 91 89 92 93 /* ----- check connectedness ----------------------------------------------- */ 94 95 96 /* 97 * After an instantiation failure, the instances can get out of sync with the 98 * object tree, and attempts to select an item on the canvas can cause accesses 99 * to objects that aren't there anymore. So we need to check if we can still 100 * reach the corresponding object. 101 * 102 * Note: even this isn't bullet-proof. Theoretically, we may get a new object 103 * in the old place. However, this probably doesn't do any serious damage. 104 */ 105 106 107 static int inst_connected(const struct inst *inst) 108 { 109 const struct frame *frame; 110 const struct vec *vec; 111 const struct obj *obj; 112 113 for (frame = frames; frame; frame = frame->next) { 114 if (inst->ops == &vec_ops) { 115 for (vec = frame->vecs; vec; vec = vec->next) 116 if (vec == inst->vec) 117 return 1; 118 } else { 119 for (obj = frame->objs; obj; obj = obj->next) 120 if (obj == inst->obj) 121 return 1; 122 } 123 } 124 return 0; 125 } 126 127 90 128 /* ----- selection --------------------------------------------------------- */ 91 92 93 static struct inst_ops vec_ops;94 static struct inst_ops frame_ops;95 129 96 130 … … 140 174 for (inst = insts[prio]; inst; inst = inst->next) { 141 175 if (!inst->active || !inst->ops->distance) 176 continue; 177 if (!inst_connected(inst)) 142 178 continue; 143 179 dist = inst->ops->distance(inst, pos, draw_ctx.scale); … … 158 194 for (inst = insts[ip_vec]; inst; inst = inst->next) { 159 195 if (!inst->active) 196 continue; 197 if (!inst_connected(inst)) 160 198 continue; 161 199 dist = gui_dist_vec_fallback(inst, pos, draw_ctx.scale);
Note: See TracChangeset
for help on using the changeset viewer.
