Changeset 5514
- Timestamp:
- 08/21/09 20:20:37 (4 years ago)
- Location:
- trunk/eda/fped
- Files:
-
- 1 added
- 12 edited
-
TODO (modified) (1 diff)
-
fped.c (modified) (2 diffs)
-
gui.c (modified) (2 diffs)
-
gui_style.c (modified) (1 diff)
-
gui_style.h (modified) (1 diff)
-
gui_tool.c (modified) (1 diff)
-
gui_tool.h (modified) (1 diff)
-
inst.c (modified) (2 diffs)
-
inst.h (modified) (1 diff)
-
leak.supp (added)
-
leakcheck (modified) (1 diff)
-
meas.c (modified) (2 diffs)
-
obj.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eda/fped/TODO
r5487 r5514 35 35 - can't edit measurement labels through the GUI 36 36 - r of rpads is misleading, particularly if we have a circle 37 - using variables in a measurement offset causes a crash because evaluation38 takes place after all table entries have been visited39 37 40 38 Code cleanup: -
trunk/eda/fped/fped.c
r5506 r5514 57 57 int batch_write_kicad = 0, batch_write_ps = 0; 58 58 int c; 59 int have_gui = !getenv("FPED_NO_GUI");60 59 61 if (have_gui) { 62 error = gui_init(&argc, &argv); 63 if (error) 64 return error; 65 } 60 error = gui_init(&argc, &argv); 61 if (error) 62 return error; 66 63 67 64 while ((c = getopt(argc, argv, "kp")) != EOF) … … 107 104 if (batch_write_ps) 108 105 write_ps(); 109 if ( have_gui &&!batch_write_kicad && !batch_write_ps) {106 if (!batch_write_kicad && !batch_write_ps) { 110 107 error = gui_main(); 111 108 if (error) -
trunk/eda/fped/gui.c
r5462 r5514 140 140 141 141 142 static void cleanup_tool_bar(void) 143 { 144 g_object_unref(stuff_image[0]); 145 g_object_unref(stuff_image[1]); 146 g_object_unref(meas_image[0]); 147 g_object_unref(meas_image[1]); 148 } 149 150 142 151 static void make_top_bar(GtkWidget *vbox) 143 152 { … … 249 258 gtk_main(); 250 259 260 gui_cleanup_style(); 261 gui_cleanup_tools(); 262 cleanup_tool_bar(); 263 251 264 return 0; 252 265 } -
trunk/eda/fped/gui_style.c
r5487 r5514 75 75 item_list_font = pango_font_description_from_string(ITEM_LIST_FONT); 76 76 } 77 78 79 void gui_cleanup_style(void) 80 { 81 pango_font_description_free(item_list_font); 82 } -
trunk/eda/fped/gui_style.h
r5461 r5514 116 116 117 117 void gui_setup_style(GdkDrawable *drawable); 118 void gui_cleanup_style(void); 118 119 119 120 #endif /* !GUI_STYLE_H */ -
trunk/eda/fped/gui_tool.c
r5480 r5514 1045 1045 return bar; 1046 1046 } 1047 1048 1049 void gui_cleanup_tools(void) 1050 { 1051 g_object_unref(frame_image); 1052 g_object_unref(frame_image_locked); 1053 g_object_unref(frame_image_ready); 1054 g_object_unref(delete_image[0]); 1055 g_object_unref(delete_image[1]); 1056 } -
trunk/eda/fped/gui_tool.h
r5440 r5514 78 78 79 79 GtkWidget *gui_setup_tools(GdkDrawable *drawable); 80 void gui_cleanup_tools(void); 80 81 81 82 #endif /* !GUI_TOOL_H */ -
trunk/eda/fped/inst.c
r5506 r5514 804 804 805 805 806 int inst_meas(struct obj *obj, 807 struct coord from, struct coord to, unit_type offset) 806 static struct inst *find_meas_hint(const struct obj *obj) 807 { 808 struct inst *inst; 809 810 for (inst = curr_pkg->insts[ip_meas]; inst; inst = inst->next) 811 if (inst->obj == obj) 812 break; 813 return inst; 814 } 815 816 817 int inst_meas(struct obj *obj, struct coord from, struct coord to) 808 818 { 809 819 struct inst *inst; 810 820 struct coord a1, b1; 811 821 812 inst = add_inst(&meas_ops, ip_meas, from); 813 inst->obj = obj; 822 inst = find_meas_hint(obj); 823 assert(inst); 824 inst->base = from; 814 825 inst->u.meas.end = to; 815 inst->u.meas.offset = offset;816 inst->active = 1; /* measurements are always active */817 826 /* @@@ we still need to consider the text size as well */ 827 update_bbox(&inst->bbox, from); 818 828 update_bbox(&inst->bbox, to); 819 829 project_meas(inst, &a1, &b1); … … 822 832 propagate_bbox(inst); 823 833 return 1; 834 } 835 836 837 void inst_meas_hint(struct obj *obj, unit_type offset) 838 { 839 static const struct coord zero = { 0, 0 }; 840 struct inst *inst; 841 842 inst = find_meas_hint(obj); 843 if (inst) 844 return; 845 inst = add_inst(&meas_ops, ip_meas, zero); 846 inst->obj = obj; 847 inst->u.meas.offset = offset; 848 inst->active = 1; /* measurements are always active */ 824 849 } 825 850 -
trunk/eda/fped/inst.h
r5506 r5514 165 165 int inst_arc(struct obj *obj, struct coord center, struct coord start, 166 166 struct coord stop, unit_type width); 167 int inst_meas(struct obj *obj, struct coord from, struct coord to ,168 unit_type offset);167 int inst_meas(struct obj *obj, struct coord from, struct coord to); 168 void inst_meas_hint(struct obj *obj, unit_type offset); 169 169 170 170 void inst_begin_active(int active); -
trunk/eda/fped/leakcheck
r5506 r5514 1 1 #!/bin/sh 2 #valgrind --leak-check=full --show-reachable=yes --suppressions=leak.supp \ 3 # ./fped "$@" 4 5 # 6 # Seems that we can't suppress warnings from gtk_init, so we use FPED_NO_GUI 7 # to avoid bringing up Gtk+ at all. 8 # 9 FPED_NO_GUI=y valgrind --leak-check=full --show-reachable=yes \ 2 valgrind --leak-check=full --show-reachable=yes --num-callers=50 \ 3 --suppressions=leak.supp \ 10 4 ./fped "$@" 11 12 #valgrind --leak-check=full --show-reachable=no \13 # ./fped "$@" -
trunk/eda/fped/meas.c
r5480 r5514 232 232 struct coord a0, b0; 233 233 lt_op_type lt; 234 struct num offset;235 234 236 235 for (obj = root_frame->objs; obj; obj = obj->next) { … … 251 250 curr_pkg->samples[meas->high->n]); 252 251 253 if (!meas->offset)254 offset.n = 0;255 else {256 offset = eval_unit(meas->offset, root_frame);257 if (is_undef(offset)) {258 instantiation_error = obj;259 return 0;260 }261 }262 252 inst_meas(obj, 263 meas->inverted ? b0 : a0, meas->inverted ? a0 : b0, 264 offset.n); 253 meas->inverted ? b0 : a0, meas->inverted ? a0 : b0); 265 254 } 266 255 return 1; -
trunk/eda/fped/obj.c
r5506 r5514 95 95 static int generate_objs(struct frame *frame, struct coord base, int active) 96 96 { 97 static const struct num zero_offset = { 98 .type = nt_mm, 99 .exponent = 0, 100 .n = 0, 101 }; 97 102 struct obj *obj; 98 103 char *name; 99 104 int ok; 100 struct num width ;105 struct num width, offset; 101 106 102 107 for (obj = frame->objs; obj; obj = obj->next) … … 151 156 break; 152 157 case ot_meas: 158 assert(frame == root_frame); 159 offset = eval_unit_default(obj->u.meas.offset, frame, 160 zero_offset); 161 if (is_undef(offset)) 162 goto error; 163 inst_meas_hint(obj, offset.n); 153 164 break; 154 165 default:
Note: See TracChangeset
for help on using the changeset viewer.
