Index: trunk/doc/TODO =================================================================== --- trunk/doc/TODO (revision 21106) +++ trunk/doc/TODO (revision 21107) @@ -1,7 +1,7 @@ 0. old, still waiting for ack 1. For the upcoming release =============================================================================== -- FEATURE: (prio) invert selection [report: Keantoken] ++ FEATURE: (prio) invert selection [report: Keantoken] - BUG: (prio) bug_files/png_export_fix_dpi.patch , ML #2474 [report: Cyril] - CLEANUP: boardflip rewrite: use data_mirror - BUG: can't undo after boardflip(), (ERROR: Attempt to pcb_undo() with Serial == 0) [report:Miloh] Index: trunk/doc/user/09_appendix/action_details.html =================================================================== --- trunk/doc/user/09_appendix/action_details.html (revision 21106) +++ trunk/doc/user/09_appendix/action_details.html (revision 21107) @@ -3085,7 +3085,7 @@ + +
Syntax summary: Select(Object|ToggleObject) -Select(All|Block|Connection) +Select(All|Block|Connection|Invert) Select(Convert)
Help text: Toggles or sets the selection. @@ -3128,7 +3128,13 @@ Convert - Converts the selected objects to a subcircuit. This uses the highest numbered paste buffer. + Converts the selected objects to a subcircuit. This uses the highest numbered paste buffer. +
+ Invert + + Invert selection: anything that was not selected becomes selected, everything that was selected becomes unselected. Locked objects are not affected.
Index: trunk/doc/user/09_appendix/action_reference.html =================================================================== --- trunk/doc/user/09_appendix/action_reference.html (revision 21106) +++ trunk/doc/user/09_appendix/action_reference.html (revision 21107) @@ -12,7 +12,7 @@

Action Reference

@@ -148,7 +148,7 @@ - + @@ -192,7 +192,7 @@ - + Index: trunk/doc/user/09_appendix/action_src/select.html =================================================================== --- trunk/doc/user/09_appendix/action_src/select.html (revision 21106) +++ trunk/doc/user/09_appendix/action_src/select.html (revision 21107) @@ -16,4 +16,9 @@
\n -This is pcb-rnd 2.0.1 (svn r20827) an interactive printed circuit board editor , Revision: 21065 +This is pcb-rnd 2.0.1 (svn r20827) an interactive printed circuit board editor , Revision: 21106
Action Description Syntax Plugin
AboutPresent the about boxAbout()dialogs plugin
PadstackEditinteractive pad stack editorPadstackEdit(object, [tab])dialogs plugin
PadstackPlacePlace a pad stack (either proto_id, or if not specified, the default for style)PadstackPlace([proto_id|default], [x, y])
PasteBufferVarious operations on the paste buffer.PasteBuffer(AddSelected|Clear|1..PCB_MAX_BUFFER)
PasteBuffer(Rotate, 1..3)
PasteBuffer(Convert|Restore|Mirror)
PasteBuffer(ToLayout, X, Y, units)
PasteBuffer(ToLayout, crosshair)
PasteBuffer(Save, Filename, [format], [force])
PasteBuffer(Push)
PasteBuffer(Pop)
Pinout2Present the subcircuit pinout boxPinout()dialogs plugin
PinoutPresent the subcircuit pinout boxPinout()dialogs plugin
PolyCombinepolycombine plugin
PolyHatchhatch the selected polygon(s) with lines of the current style; lines are drawn on the current layer; flags are h:horizontal, v:vertical, c:contour, p:polyPolyHatch([spacing], [hvcp])
PolyHatch(interactive)
lib_polyhelp
PolyNewCreate an empty polygon. For now data must be "pcb". Use PolyNewPoint to add points. Returns a polygon pointer valid until PolyNewEnd() is called.PolyNew(data, layer, ptlist, clearance, flags)act_draw
ScaleBufferScales the buffer by multiplying all coordinates by a floating point number.
If only x is given, it is also used for y and thickness too. If subc is not
empty, subcircuits are also scaled
ScaleBuffer(x [,y [,thickness [,subc]]])
ScriptCookieReturn a cookie specific to the current script instance during script initializationScriptCookie()script plugin
ScriptPersistencyRead or remove script persistency data savd on preunloadScriptPersistency(read|remove)script plugin
SelectToggles or sets the selection.Select(Object|ToggleObject)
Select(All|Block|Connection)
Select(Convert)
SelectToggles or sets the selection.Select(Object|ToggleObject)
Select(All|Block|Connection|Invert)
Select(Convert)
SelectLayerSelect which layer is the current layer.SelectLayer(1..MAXLAYER|Silk|Rats)
SetFlagSets flags on objects.SetFlag(Object|Selected|SelectedObjects, flag)
SetFlag(SelectedLines|SelectedPins|SelectedVias, flag)
SetFlag(SelectedPads|SelectedTexts|SelectedNames, flag)
SetFlag(SelectedElements, flag)
flag = thermal | join
SetOctagonoldactions plugin
Convert Converts the selected objects to a subcircuit. This uses the highest numbered paste buffer. + +
Invert + Invert selection: anything that was not selected becomes selected, + everything that was selected becomes unselected. Locked objects + are not affected.
Index: trunk/src/funchash_core_list.h =================================================================== --- trunk/src/funchash_core_list.h (revision 21106) +++ trunk/src/funchash_core_list.h (revision 21107) @@ -59,6 +59,7 @@ action_entry(Grid) action_entry(Hash) action_entry(InsertPoint) +action_entry(Invert) action_entry(Iseq) action_entry(Layer) action_entry(Layout) Index: trunk/src/select.c =================================================================== --- trunk/src/select.c (revision 21106) +++ trunk/src/select.c (revision 21107) @@ -377,6 +377,7 @@ typedef struct { pcb_box_t box; pcb_bool flag; + pcb_bool invert; } select_ctx_t; static pcb_r_dir_t pcb_select_block_cb(const pcb_box_t *box, void *cl) @@ -384,7 +385,7 @@ select_ctx_t *ctx = cl; pcb_any_obj_t *obj = (pcb_any_obj_t *)box; - if (PCB_FLAG_TEST(PCB_FLAG_SELECTED, obj) == ctx->flag) /* cheap check on the flag: don't do anything if the flag is already right */ + if (!ctx->invert && (PCB_FLAG_TEST(PCB_FLAG_SELECTED, obj) == ctx->flag)) /* cheap check on the flag: don't do anything if the flag is already right */ return PCB_R_DIR_NOT_FOUND; /* do not let locked object selected, but allow deselection */ @@ -396,7 +397,10 @@ pcb_undo_add_obj_to_flag((void *)obj); pcb_draw_obj(obj); - PCB_FLAG_ASSIGN(PCB_FLAG_SELECTED, ctx->flag, obj); + if (ctx->invert) + PCB_FLAG_TOGGLE(PCB_FLAG_SELECTED, obj); + else + PCB_FLAG_ASSIGN(PCB_FLAG_SELECTED, ctx->flag, obj); return PCB_R_DIR_FOUND_CONTINUE; } @@ -405,7 +409,7 @@ * Flag determines if the block is to be selected or unselected * returns pcb_true if the state of any object has changed */ -pcb_bool pcb_select_block(pcb_board_t *pcb, pcb_box_t *Box, pcb_bool flag, pcb_bool vis_only) +pcb_bool pcb_select_block(pcb_board_t *pcb, pcb_box_t *Box, pcb_bool flag, pcb_bool vis_only, pcb_bool invert) { select_ctx_t ctx; @@ -413,6 +417,7 @@ ctx.box = *Box; ctx.flag = flag; + ctx.invert = invert; fix_box_dir(Box, 1); Index: trunk/src/select.h =================================================================== --- trunk/src/select.h (revision 21106) +++ trunk/src/select.h (revision 21107) @@ -37,7 +37,7 @@ PCB_OBJ_PSTK | PCB_OBJ_RAT | PCB_OBJ_ARC) pcb_bool pcb_select_object(pcb_board_t *pcb); -pcb_bool pcb_select_block(pcb_board_t *pcb, pcb_box_t *Box, pcb_bool flag, pcb_bool vis_only); +pcb_bool pcb_select_block(pcb_board_t *pcb, pcb_box_t *Box, pcb_bool flag, pcb_bool vis_only, pcb_bool invert); long int *pcb_list_block(pcb_board_t *pcb, pcb_box_t *Box, int *len); pcb_bool pcb_select_connection(pcb_board_t *pcb, pcb_bool); Index: trunk/src/select_act.c =================================================================== --- trunk/src/select_act.c (revision 21106) +++ trunk/src/select_act.c (revision 21107) @@ -54,7 +54,7 @@ static const char pcb_acts_Select[] = "Select(Object|ToggleObject)\n" - "Select(All|Block|Connection)\n" + "Select(All|Block|Connection|Invert)\n" "Select(Convert)"; static const char pcb_acth_Select[] = "Toggles or sets the selection."; /* DOC: select.html */ @@ -83,7 +83,7 @@ box.Y2 = MAX(pcb_crosshair.AttachedBox.Point1.Y, pcb_crosshair.AttachedBox.Point2.Y); pcb_notify_crosshair_change(pcb_false); pcb_tool_notify_block(); - if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && pcb_select_block(PCB, &box, pcb_true, pcb_true)) { + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && pcb_select_block(PCB, &box, pcb_true, pcb_true, pcb_false)) { pcb_board_set_changed_flag(pcb_true); pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; } @@ -100,11 +100,24 @@ box.Y1 = -PCB_MAX_COORD; box.X2 = PCB_MAX_COORD; box.Y2 = PCB_MAX_COORD; - if (pcb_select_block(PCB, &box, pcb_true, pcb_true)) + if (pcb_select_block(PCB, &box, pcb_true, pcb_true, pcb_false)) pcb_board_set_changed_flag(pcb_true); break; } + case F_Invert: + { + pcb_box_t box; + + box.X1 = -PCB_MAX_COORD; + box.Y1 = -PCB_MAX_COORD; + box.X2 = PCB_MAX_COORD; + box.Y2 = PCB_MAX_COORD; + if (pcb_select_block(PCB, &box, pcb_true, pcb_true, pcb_true)) + pcb_board_set_changed_flag(pcb_true); + break; + } + /* all found connections */ case F_Connection: if (pcb_select_connection(PCB, pcb_true)) { @@ -166,7 +179,7 @@ box.Y2 = MAX(pcb_crosshair.AttachedBox.Point1.Y, pcb_crosshair.AttachedBox.Point2.Y); pcb_notify_crosshair_change(pcb_false); pcb_tool_notify_block(); - if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && pcb_select_block(PCB, &box, pcb_false, pcb_true)) { + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && pcb_select_block(PCB, &box, pcb_false, pcb_true, pcb_false)) { pcb_board_set_changed_flag(pcb_true); pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; } @@ -183,7 +196,7 @@ box.Y1 = -PCB_MAX_COORD; box.X2 = PCB_MAX_COORD; box.Y2 = PCB_MAX_COORD; - if (pcb_select_block(PCB, &box, pcb_false, pcb_false)) + if (pcb_select_block(PCB, &box, pcb_false, pcb_false, pcb_false)) pcb_board_set_changed_flag(pcb_true); break; } Index: trunk/src/tool_arrow.c =================================================================== --- trunk/src/tool_arrow.c (revision 21106) +++ trunk/src/tool_arrow.c (revision 21107) @@ -111,7 +111,7 @@ box.X2 = PCB_MAX_COORD; box.Y2 = PCB_MAX_COORD; /* unselect first if shift key not down */ - if (!pcb_gui->shift_is_pressed() && pcb_select_block(PCB, &box, pcb_false, pcb_false)) + if (!pcb_gui->shift_is_pressed() && pcb_select_block(PCB, &box, pcb_false, pcb_false, pcb_false)) pcb_board_set_changed_flag(pcb_true); pcb_tool_notify_block(); pcb_crosshair.AttachedBox.Point1.X = pcb_tool_note.X; @@ -173,7 +173,7 @@ pcb_undo_save_serial(); /* unselect first if shift key not down */ if (!pcb_gui->shift_is_pressed()) { - if (pcb_select_block(PCB, &box, pcb_false, pcb_false)) + if (pcb_select_block(PCB, &box, pcb_false, pcb_false, pcb_false)) pcb_board_set_changed_flag(pcb_true); if (pcb_tool_note.Moving) { pcb_tool_note.Moving = 0; @@ -198,7 +198,7 @@ box.Y2 = pcb_crosshair.AttachedBox.Point2.Y; pcb_undo_restore_serial(); - if (pcb_select_block(PCB, &box, pcb_true, pcb_true)) + if (pcb_select_block(PCB, &box, pcb_true, pcb_true, pcb_false)) pcb_board_set_changed_flag(pcb_true); else if (pcb_bumped) pcb_undo_inc_serial(); Index: trunk/src_plugins/asm/asm.c =================================================================== --- trunk/src_plugins/asm/asm.c (revision 21106) +++ trunk/src_plugins/asm/asm.c (revision 21107) @@ -368,7 +368,7 @@ box.Y1 = -PCB_MAX_COORD; box.X2 = PCB_MAX_COORD; box.Y2 = PCB_MAX_COORD; - if (pcb_select_block(PCB, &box, pcb_false, pcb_false)) + if (pcb_select_block(PCB, &box, pcb_false, pcb_false, pcb_false)) pcb_board_set_changed_flag(pcb_true); if (row == NULL) { Index: trunk/src_plugins/dialogs/dlg_lib_pstk.c =================================================================== --- trunk/src_plugins/dialogs/dlg_lib_pstk.c (revision 21106) +++ trunk/src_plugins/dialogs/dlg_lib_pstk.c (revision 21107) @@ -396,7 +396,7 @@ box.Y1 = -PCB_MAX_COORD; box.X2 = PCB_MAX_COORD; box.Y2 = PCB_MAX_COORD; - if (pcb_select_block(PCB, &box, pcb_false, pcb_false)) + if (pcb_select_block(PCB, &box, pcb_false, pcb_false, pcb_false)) changed = 1; for(ps = padstacklist_first(&data->padstack); ps != NULL; ps = padstacklist_next(ps)) {