More about undo/redo in pcbnew
This commit is contained in:
parent
148a574e6f
commit
514de91ee3
42
include/id.h
42
include/id.h
|
@ -569,15 +569,6 @@ enum main_id {
|
|||
ID_POPUP_PCB_SELECT_WIDTH6,
|
||||
ID_POPUP_PCB_SELECT_WIDTH7,
|
||||
ID_POPUP_PCB_SELECT_WIDTH8,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE1,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE2,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE3,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE4,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE5,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE6,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE7,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE8,
|
||||
ID_POPUP_PCB_EDIT_TRACKSEG,
|
||||
ID_POPUP_PCB_EDIT_TRACK_MNU,
|
||||
ID_POPUP_PCB_EDIT_NET,
|
||||
|
@ -613,13 +604,6 @@ enum main_id {
|
|||
ID_POPUP_PCB_MOVE_TRACK_NODE,
|
||||
ID_POPUP_PCB_BREAK_TRACK,
|
||||
ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE,
|
||||
ID_POPUP_PCB_VIA_EDITING,
|
||||
ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT,
|
||||
ID_POPUP_PCB_VIA_HOLE_TO_VALUE,
|
||||
ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE,
|
||||
ID_POPUP_PCB_VIA_HOLE_EXPORT,
|
||||
ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT,
|
||||
ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS,
|
||||
ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE,
|
||||
ID_POPUP_PCB_DRAG_TRACK_SEGMENT,
|
||||
ID_POPUP_PCB_MOVE_TRACK_SEGMENT,
|
||||
|
@ -630,9 +614,29 @@ enum main_id {
|
|||
ID_POPUP_PCB_UNUSED8,
|
||||
ID_POPUP_PCB_END_RANGE,
|
||||
|
||||
// reserve a block of MAX_ITEMS_IN_PICKER ids for the item selection popup
|
||||
ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||
ID_POPUP_PCB_ITEM_SELECTION_END = MAX_ITEMS_IN_PICKER + ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||
// Via edition
|
||||
ID_POPUP_VIA_EDIT_START_RANGE,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE1,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE2,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE3,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE4,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE5,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE6,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE7,
|
||||
ID_POPUP_PCB_SELECT_VIASIZE8,
|
||||
ID_POPUP_PCB_VIA_EDITING,
|
||||
ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT,
|
||||
ID_POPUP_PCB_VIA_HOLE_TO_VALUE,
|
||||
ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE,
|
||||
ID_POPUP_PCB_VIA_HOLE_EXPORT,
|
||||
ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT,
|
||||
ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS,
|
||||
ID_POPUP_VIA_EDIT_END_RANGE,
|
||||
|
||||
// reserve a block of MAX_ITEMS_IN_PICKER ids for the item selection popup
|
||||
ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||
ID_POPUP_PCB_ITEM_SELECTION_END = MAX_ITEMS_IN_PICKER + ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||
ID_POPUP_PCB_AUTOPLACE_START_RANGE,
|
||||
ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE,
|
||||
ID_POPUP_PCB_AUTOPLACE_FREE_MODULE,
|
||||
|
|
|
@ -356,13 +356,13 @@ public:
|
|||
|
||||
// Board handling
|
||||
void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
|
||||
void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via );
|
||||
|
||||
// Hightlight functions:
|
||||
int Select_High_Light( wxDC* DC );
|
||||
void Hight_Light( wxDC* DC );
|
||||
|
||||
// Track and via edition:
|
||||
void Via_Edit_Control( wxCommandEvent& event );
|
||||
void DisplayTrackSettings();
|
||||
|
||||
/**
|
||||
|
|
|
@ -164,11 +164,20 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
|||
|
||||
case TYPE_TRACK:
|
||||
case TYPE_VIA:
|
||||
case TYPE_ZONE:
|
||||
EXCHG( ( (TRACK*) aItem )->m_Start, ( (TRACK*) aImage )->m_Start );
|
||||
EXCHG( ( (TRACK*) aItem )->m_End, ( (TRACK*) aImage )->m_End );
|
||||
EXCHG( ( (TRACK*) aItem )->m_Width, ( (TRACK*) aImage )->m_Width );
|
||||
EXCHG( ( (TRACK*) aItem )->m_Shape, ( (TRACK*) aImage )->m_Shape );
|
||||
{
|
||||
int itmp = ((TRACK*) aItem )->GetDrillValue();
|
||||
if( ((TRACK*) aItem )->IsDrillDefault() )
|
||||
itmp = -1;
|
||||
int atmp = ((TRACK*) aImage )->GetDrillValue();
|
||||
if( ((TRACK*) aImage )->IsDrillDefault() )
|
||||
atmp = -1;
|
||||
( (TRACK*) aItem )->SetDrillValue( atmp );
|
||||
( (TRACK*) aImage )->SetDrillValue(itmp);
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE:
|
||||
|
@ -202,6 +211,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
|||
}
|
||||
break;
|
||||
|
||||
case TYPE_ZONE:
|
||||
default:
|
||||
wxMessageBox( wxT( "SwapData() error: unexpected type" ) );
|
||||
break;
|
||||
|
|
|
@ -104,15 +104,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_PCB_SELECT_WIDTH6:
|
||||
case ID_POPUP_PCB_SELECT_WIDTH7:
|
||||
case ID_POPUP_PCB_SELECT_WIDTH8:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE1:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE2:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE3:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE4:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE5:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE6:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE7:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE8:
|
||||
case ID_POPUP_PCB_MOVE_TRACK_NODE:
|
||||
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
|
||||
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
|
||||
|
@ -135,12 +126,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_ROTATE_BLOCK:
|
||||
case ID_POPUP_COPY_BLOCK:
|
||||
case ID_POPUP_PCB_VIA_EDITING:
|
||||
case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:
|
||||
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE:
|
||||
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE:
|
||||
case ID_POPUP_PCB_VIA_HOLE_EXPORT:
|
||||
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT:
|
||||
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS:
|
||||
case ID_POPUP_PCB_EDIT_DRAWING:
|
||||
case ID_POPUP_PCB_GETINFO_MARKER:
|
||||
break;
|
||||
|
@ -1058,9 +1043,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
g_DesignSettings.m_UseConnectedTrackWidth = true;
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE:
|
||||
break;
|
||||
|
||||
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
|
||||
{
|
||||
int ii = m_SelViaSizeBox->GetChoice();
|
||||
|
@ -1072,24 +1054,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE1:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE2:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE3:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE4:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE5:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE6:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE7:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE8:
|
||||
case ID_POPUP_PCB_VIA_EDITING:
|
||||
case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:
|
||||
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE:
|
||||
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE:
|
||||
case ID_POPUP_PCB_VIA_HOLE_EXPORT:
|
||||
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT:
|
||||
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS:
|
||||
Via_Edit_Control( &dc, id, (SEGVIA*) GetScreen()->GetCurItem() );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(),
|
||||
|
|
|
@ -88,7 +88,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
|
|||
EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
|
||||
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
|
||||
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
|
||||
EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config )
|
||||
EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config )
|
||||
EVT_MENU( ID_CONFIG_READ, WinEDA_PcbFrame::Process_Config )
|
||||
EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP, WinEDA_PcbFrame::InstallDisplayOptionsDialog )
|
||||
|
||||
|
@ -194,10 +194,13 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
|
|||
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
// Annulation de commande en cours
|
||||
// popup menus
|
||||
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
EVT_MENU_RANGE( ID_POPUP_VIA_EDIT_START_RANGE, ID_POPUP_VIA_EDIT_END_RANGE,
|
||||
WinEDA_PcbFrame::Via_Edit_Control )
|
||||
|
||||
// PopUp Menus pour Zooms traites dans drawpanel.cpp
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**********************************************/
|
||||
/* vi_edit.cpp: som editing function for vias */
|
||||
/* vi_edit.cpp: some editing function for vias */
|
||||
/**********************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
@ -12,7 +12,7 @@
|
|||
|
||||
|
||||
/**********************************************************************************/
|
||||
void WinEDA_PcbFrame::Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via )
|
||||
void WinEDA_PcbFrame::Via_Edit_Control( wxCommandEvent& event )
|
||||
/**********************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -21,8 +21,17 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via
|
|||
{
|
||||
int ii;
|
||||
TRACK* via_struct;
|
||||
SEGVIA* via = (SEGVIA*) GetCurItem();
|
||||
wxClientDC dc( DrawPanel );
|
||||
DrawPanel->CursorOff( &dc );
|
||||
DrawPanel->PrepareGraphicContext( &dc );
|
||||
|
||||
switch( command_type )
|
||||
wxASSERT( via->Type() == TYPE_VIA);
|
||||
|
||||
PICKED_ITEMS_LIST itemsListPicker;
|
||||
ITEM_PICKER picker( NULL, UR_CHANGED );
|
||||
|
||||
switch( event.GetId() )
|
||||
{
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE1:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE2:
|
||||
|
@ -33,21 +42,22 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via
|
|||
case ID_POPUP_PCB_SELECT_VIASIZE7:
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE8: // selec the new current value for via size (via diameter)
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
ii = command_type - ID_POPUP_PCB_SELECT_VIASIZE1;
|
||||
ii = event.GetId() - ID_POPUP_PCB_SELECT_VIASIZE1;
|
||||
g_DesignSettings.m_CurrentViaSize = g_DesignSettings.m_ViaSizeHistory[ii];
|
||||
DisplayTrackSettings();
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE: // Enter a new alternate value for drill via
|
||||
InstallPcbOptionsFrame( wxDefaultPosition, DC, ID_PCB_TRACK_SIZE_SETUP );
|
||||
InstallPcbOptionsFrame( wxDefaultPosition, &dc, ID_PCB_TRACK_SIZE_SETUP );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE: // Set the drill via to custom
|
||||
if( (g_DesignSettings.m_ViaDrillCustomValue > 0) && (g_DesignSettings.m_ViaDrillCustomValue < via->m_Width) )
|
||||
{
|
||||
via->Draw( DrawPanel, DC, GR_XOR );
|
||||
SaveCopyInUndoList(via, UR_CHANGED);
|
||||
via->Draw( DrawPanel, &dc, GR_XOR );
|
||||
via->SetDrillValue( g_DesignSettings.m_ViaDrillCustomValue );
|
||||
via->Draw( DrawPanel, DC, GR_OR );
|
||||
via->Draw( DrawPanel, &dc, GR_OR );
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
else
|
||||
|
@ -70,19 +80,24 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via
|
|||
{
|
||||
if( via_struct->m_Width != via->m_Width )
|
||||
continue;
|
||||
via_struct->Draw( DrawPanel, DC, GR_XOR );
|
||||
picker.m_PickedItem = via_struct;
|
||||
picker.m_Link = via_struct->Copy();
|
||||
itemsListPicker.PushItem(picker);
|
||||
via_struct->Draw( DrawPanel, &dc, GR_XOR );
|
||||
via_struct->SetDrillValue( via->GetDrillValue() );
|
||||
via_struct->Draw( DrawPanel, DC, GR_OR );
|
||||
via_struct->Draw( DrawPanel, &dc, GR_OR );
|
||||
}
|
||||
}
|
||||
SaveCopyInUndoList(itemsListPicker, UR_CHANGED);
|
||||
|
||||
GetScreen()->SetModify();
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:
|
||||
via->Draw( DrawPanel, DC, GR_XOR );
|
||||
SaveCopyInUndoList(via, UR_CHANGED);
|
||||
via->Draw( DrawPanel, &dc, GR_XOR );
|
||||
via->SetDrillDefault();
|
||||
via->Draw( DrawPanel, DC, GR_OR );
|
||||
via->Draw( DrawPanel, &dc, GR_OR );
|
||||
GetScreen()->SetModify();
|
||||
break;
|
||||
|
||||
|
@ -94,12 +109,16 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via
|
|||
{
|
||||
if( ! via_struct->IsDrillDefault() )
|
||||
{
|
||||
via_struct->Draw( DrawPanel, DC, GR_XOR );
|
||||
picker.m_PickedItem = via_struct;
|
||||
picker.m_Link = via_struct->Copy();
|
||||
itemsListPicker.PushItem(picker);
|
||||
via_struct->Draw( DrawPanel, &dc, GR_XOR );
|
||||
via_struct->SetDrillDefault();
|
||||
via_struct->Draw( DrawPanel, DC, GR_OR );
|
||||
via_struct->Draw( DrawPanel, &dc, GR_OR );
|
||||
}
|
||||
}
|
||||
}
|
||||
SaveCopyInUndoList(itemsListPicker, UR_CHANGED);
|
||||
|
||||
GetScreen()->SetModify();
|
||||
break;
|
||||
|
@ -109,5 +128,6 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via
|
|||
break;
|
||||
}
|
||||
|
||||
DrawPanel->CursorOn( &dc );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue