Changeset 5419


Ignore:
Timestamp:
08/11/09 22:52:33 (4 years ago)
Author:
werner
Message:

Make delete feel "safer".

  • objects are now deleted by selecting them, then clicking on the delete icon
  • removed tool_ops.click, which was only there because of delete
Location:
trunk/eda/fped
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/eda/fped/Makefile

    r5418 r5419  
    1919XPMS = point.xpm delete.xpm vec.xpm frame.xpm frame_locked.xpm frame_ready.xpm \ 
    2020       line.xpm rect.xpm pad.xpm circ.xpm meas.xpm meas_x.xpm meas_y.xpm \ 
    21        stuff.xpm stuff_off.xpm meas_off.xpm 
     21       stuff.xpm stuff_off.xpm meas_off.xpm delete_off.xpm 
    2222 
    2323CFLAGS_GTK = `pkg-config --cflags gtk+-2.0` 
  • trunk/eda/fped/TODO

    r5416 r5419  
    33- add default unit (combine with grid unit selection ?) 
    44- consider adding auto/mm/mil selection for each dimension 
    5 - add postscript output 
     5- add postscript output (partially done) 
    66- add option to include/omit helper vecs and frames (done for display, still 
    7   need postscript) 
     7  need postscript). Better idea: in PS, print the component 10x, 1x, and then 
     8  each individual frame 10x. 
    89 
    910Minor missing features: 
     
    3637  list of points at each stage, then handle the highlighting and hovering 
    3738  inside a dragging module. 
     39- code organization is very poor. E.g., functions belonging to the different 
     40  items (pads, silk objects, vectors, etc.) should be grouped by item, not by 
     41  type of function, similar to how some things are now with gui_meas.c 
    3842 
    3943Open decisions: 
     
    6165- future: when encountering an error after a change, we could try to find the 
    6266  same element in the old instance, and select it 
    63 - future: consider editing off-canvas items in place 
     67- idea: run the sort algorithm of dump.c to generate a list of objects per 
     68  frame, then show the list per frame in the GUI, e.g., as an alternative to 
     69  the variables. Allow selection. 
     70- future: consider editing non-canvas items in place 
    6471- near future: treat part name as pattern 
  • trunk/eda/fped/gui_tool.c

    r5415 r5419  
    4242#include "icons/point.xpm" 
    4343#include "icons/delete.xpm" 
     44#include "icons/delete_off.xpm" 
    4445#include "icons/rect.xpm" 
    4546#include "icons/vec.xpm" 
    4647 
    4748 
    48 static GtkWidget *ev_point, *ev_frame; 
     49static GtkWidget *ev_point, *ev_delete, *ev_frame; 
    4950static GtkWidget *active_tool; 
    5051static struct tool_ops *active_ops = NULL; 
    5152static struct inst *hover_inst = NULL; 
    5253static GtkWidget *frame_image, *frame_image_locked, *frame_image_ready; 
     54static GtkWidget *delete_image[2]; 
    5355 
    5456static struct drag_state { 
     
    168170 
    169171 
    170 static void click_delete(struct coord pos) 
    171 { 
    172         inst_deselect(); 
    173         inst_select(pos); 
     172static void tool_selected_delete(void) 
     173{ 
    174174        if (selected_inst) { 
    175175                tool_dehover(); 
    176176                inst_delete(selected_inst); 
    177         } 
    178         change_world(); 
     177                change_world(); 
     178        } 
    179179        tool_reset(); 
    180180} 
     
    182182 
    183183static struct tool_ops delete_ops = { 
    184         .click          = click_delete, 
     184        .tool_selected  = tool_selected_delete, 
    185185}; 
     186 
     187 
     188void tool_selected_inst(struct inst *inst) 
     189{ 
     190        set_image(ev_delete, delete_image[inst != NULL]); 
     191} 
    186192 
    187193 
     
    773779 * N  N  don't 
    774780 * Y  -  if we could drag, drag_new/end_new, else fall over to tool 
    775  * N  Y  click, else single-click creation, else drag_new/end_new 
     781 * N  Y  else single-click creation, else drag_new/end_new 
    776782 */ 
    777783 
     
    801807        if (!active_ops) 
    802808                return 0; 
    803         if (active_ops->click) { 
    804                 active_ops->click(pos); 
    805                 return 0; 
    806         } 
    807809 
    808810        curr = get_hover_inst(pos); 
     
    962964        ev_point = tool_button(bar, drawable, xpm_point, 
    963965            tool_button_press_event, NULL); 
    964         tool_button(bar, drawable, xpm_delete, 
    965             tool_button_press_event, &delete_ops); 
     966        ev_delete = tool_button(bar, drawable, NULL, 
     967             tool_button_press_event, &delete_ops); 
    966968        tool_separator(bar); 
    967969        tool_button(bar, drawable, xpm_vec, 
     
    992994        set_frame_image(frame_image); 
    993995 
     996        delete_image[0] = gtk_widget_ref(make_image(drawable, xpm_delete_off)); 
     997        delete_image[1] = gtk_widget_ref(make_image(drawable, xpm_delete)); 
     998        set_image(ev_delete, delete_image[0]); 
     999 
    9941000        tool_reset(); 
    9951001 
  • trunk/eda/fped/gui_tool.h

    r5414 r5419  
    2424        void (*tool_deselected)(void); 
    2525        struct inst *(*find_point)(struct coord pos); 
    26         void (*click)(struct coord pos); 
    2726        void (*begin_drag_new)(struct inst *from); 
    2827        struct pix_buf *(*drag_new)(struct inst *from, struct coord to); 
     
    7271void tool_frame_deleted(const struct frame *frame); 
    7372 
     73void tool_selected_inst(struct inst *inst); 
     74 
    7475void tool_reset(void); 
    7576 
  • trunk/eda/fped/icons/delete.fig

    r5403 r5419  
    10102 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 
    1111         3600 2400 6000 2400 6000 4800 3600 4800 3600 2400 
    12 2 1 0 15 18 7 50 -1 -1 0.000 0 1 -1 0 0 2 
     122 1 0 15 19 7 50 -1 -1 0.000 0 1 -1 0 0 2 
    1313         4125 2925 5475 4275 
    14 2 1 0 15 18 7 50 -1 -1 0.000 0 1 -1 0 0 2 
     142 1 0 15 19 7 50 -1 -1 0.000 0 1 -1 0 0 2 
    1515         4125 4275 5475 2925 
  • trunk/eda/fped/inst.c

    r5416 r5419  
    119119        edit_nothing(); 
    120120        selected_inst = NULL; 
     121        if (selected_inst) 
     122                tool_selected_inst(NULL); 
    121123        FOR_INST_PRIOS_DOWN(prio) { 
    122124                if (!show(prio)) 
     
    155157selected: 
    156158        set_path(1); 
     159        tool_selected_inst(selected_inst); 
    157160        if (selected_inst->ops->select) 
    158161                selected_inst->ops->select(selected_inst); 
     
    264267void inst_deselect(void) 
    265268{ 
    266         if (selected_inst) 
     269        if (selected_inst) { 
    267270                set_path(0); 
     271                tool_selected_inst(NULL); 
     272        } 
    268273        deselect_outside(); 
    269274        status_set_type_x(""); 
Note: See TracChangeset for help on using the changeset viewer.