More about undo/redo in pcbnew and minor cleanup

This commit is contained in:
charras 2009-08-12 10:40:01 +00:00
parent 32c54e4931
commit 2be6520a28
19 changed files with 81 additions and 143 deletions

View File

@ -88,8 +88,8 @@ void BLOCK_SELECTOR::SetMessageBlock( WinEDA_DrawFrame* frame )
msg = _( "Block Rotate" ); msg = _( "Block Rotate" );
break; break;
case BLOCK_INVERT: /* Flip */ case BLOCK_FLIP: /* Flip */
msg = _( "Block Invert" ); msg = _( "Block Flip" );
break; break;
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
@ -204,7 +204,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: /* Save */
case BLOCK_ROTATE: /* Rotate 90 deg */ case BLOCK_ROTATE: /* Rotate 90 deg */
case BLOCK_INVERT: /* Flip */ case BLOCK_FLIP: /* Flip */
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: /* Window Zoom */
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: /* mirror */ case BLOCK_MIRROR_Y: /* mirror */

View File

@ -40,9 +40,9 @@ BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, WinEDA_BasicFrame )
WinEDA_CvpcbFrame::SaveQuitCvpcb ) WinEDA_CvpcbFrame::SaveQuitCvpcb )
EVT_MENU( ID_CVPCB_QUIT, EVT_MENU( ID_CVPCB_QUIT,
WinEDA_CvpcbFrame::OnQuit ) WinEDA_CvpcbFrame::OnQuit )
EVT_MENU( ID_CVPCB_DISPLAY_HELP, EVT_MENU( ID_GENERAL_HELP,
WinEDA_CvpcbFrame::GetKicadHelp ) WinEDA_CvpcbFrame::GetKicadHelp )
EVT_MENU( ID_CVPCB_DISPLAY_LICENCE, EVT_MENU( ID_KICAD_ABOUT,
WinEDA_CvpcbFrame::GetKicadAbout ) WinEDA_CvpcbFrame::GetKicadAbout )
EVT_MENU( ID_CONFIG_REQ, EVT_MENU( ID_CONFIG_REQ,
WinEDA_CvpcbFrame::ConfigCvpcb ) WinEDA_CvpcbFrame::ConfigCvpcb )

View File

@ -79,11 +79,11 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
// Menu Help: // Menu Help:
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ), item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the cvpcb manual" ) ); _( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm ); item->SetBitmap( help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE, item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT,
_( "&About cvpcb" ), _( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) ); _( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm ); item->SetBitmap( info_xpm );

View File

@ -168,7 +168,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_ROTATE: case BLOCK_ROTATE:
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_INVERT: case BLOCK_FLIP:
case BLOCK_ABORT: case BLOCK_ABORT:
case BLOCK_SELECT_ITEMS_ONLY: case BLOCK_SELECT_ITEMS_ONLY:
break; break;
@ -295,7 +295,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
block->m_State = STATE_BLOCK_MOVE; block->m_State = STATE_BLOCK_MOVE;
break; break;
case BLOCK_INVERT: /* pcbnew only! */ case BLOCK_FLIP: /* pcbnew only! */
break; break;
case BLOCK_ROTATE: case BLOCK_ROTATE:

View File

@ -231,7 +231,7 @@ int WinEDA_LibeditFrame::ReturnBlockCommand( int key )
break; break;
case GR_KB_CTRL: case GR_KB_CTRL:
cmd = BLOCK_INVERT; cmd = BLOCK_MIRROR_Y;
break; break;
case MOUSE_MIDDLE: case MOUSE_MIDDLE:
@ -310,11 +310,11 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PASTE: case BLOCK_PASTE:
case BLOCK_ROTATE: case BLOCK_ROTATE:
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: case BLOCK_FLIP:
break; break;
case BLOCK_INVERT: case BLOCK_MIRROR_Y:
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate ); ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
SaveCopyInUndoList( CurrentLibEntry ); SaveCopyInUndoList( CurrentLibEntry );
@ -398,7 +398,7 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
case BLOCK_INVERT: /* Invert by popup menu, from block move */ case BLOCK_MIRROR_Y: /* Invert by popup menu, from block move */
SaveCopyInUndoList( CurrentLibEntry ); SaveCopyInUndoList( CurrentLibEntry );
MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() ); MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() );
break; break;

View File

@ -244,7 +244,7 @@ void AddMenusForBlock(wxMenu * PopMenu, WinEDA_LibeditFrame * frame)
ADD_MENUITEM(PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _("Select Items"), green_xpm); ADD_MENUITEM(PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _("Select Items"), green_xpm);
ADD_MENUITEM(PopMenu, ID_POPUP_COPY_BLOCK, ADD_MENUITEM(PopMenu, ID_POPUP_COPY_BLOCK,
_("Copy Block"), copyblock_xpm); _("Copy Block"), copyblock_xpm);
ADD_MENUITEM(PopMenu, ID_POPUP_INVERT_BLOCK, _("Mirror Block ||"), mirror_H_xpm ); ADD_MENUITEM(PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _("Mirror Block ||"), mirror_H_xpm );
ADD_MENUITEM(PopMenu, ID_POPUP_DELETE_BLOCK, ADD_MENUITEM(PopMenu, ID_POPUP_DELETE_BLOCK,
_("Delete Block"), delete_xpm ); _("Delete Block"), delete_xpm );
} }

View File

@ -414,7 +414,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
case ID_POPUP_SELECT_ITEMS_BLOCK: case ID_POPUP_SELECT_ITEMS_BLOCK:
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_MIRROR_Y_BLOCK:
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT: case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT: case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT:
@ -783,9 +783,9 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_MIRROR_Y_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT; GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_Y;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;

View File

@ -108,7 +108,7 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_ZOOM: // Handle by HandleBlockEnd() case BLOCK_ZOOM: // Handle by HandleBlockEnd()
case BLOCK_ROTATE: case BLOCK_ROTATE:
case BLOCK_INVERT: case BLOCK_FLIP:
case BLOCK_DELETE: case BLOCK_DELETE:
case BLOCK_SAVE: case BLOCK_SAVE:
case BLOCK_ABORT: case BLOCK_ABORT:
@ -183,7 +183,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_ROTATE: /* Unused */ case BLOCK_ROTATE: /* Unused */
break; break;
case BLOCK_INVERT: /* Fip */ case BLOCK_FLIP: /* Flip, unused */
break; break;
case BLOCK_SAVE: /* Save (not used)*/ case BLOCK_SAVE: /* Save (not used)*/

View File

@ -96,7 +96,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_FLIP_BLOCK:
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
break; break;
@ -144,29 +144,16 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_PCB_GLOBAL_DELETE: case ID_PCB_GLOBAL_DELETE:
Erase_Current_Layer( TRUE ); Erase_Current_Layer( TRUE );
break; break;
case ID_GET_TOOLS:
case ID_GET_TOOLS:
// InstallToolsFrame(this, wxPoint(-1,-1) ); // InstallToolsFrame(this, wxPoint(-1,-1) );
break; break;
case ID_FIND_ITEMS: case ID_FIND_ITEMS:
// InstallFindFrame(this, pos); // InstallFindFrame(this, pos);
break; break;
case ID_BUS_BUTT:
SetToolID( id, wxCURSOR_PENCIL, wxT( "Add Tracks" ) );
break;
case ID_LINE_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, wxT( "Add Drawing" ) );
break;
case ID_TEXT_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, wxT( "Add Text" ) );
break;
case ID_NO_SELECT_BUTT: case ID_NO_SELECT_BUTT:
SetToolID( 0, 0, wxEmptyString ); SetToolID( 0, 0, wxEmptyString );
break; break;
@ -178,12 +165,6 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
break; break;
case ID_POPUP_END_LINE:
DrawPanel->MouseToCursorSchema();
// EndSegment(&dc);
break;
case ID_POPUP_PCB_DELETE_TRACKSEG: case ID_POPUP_PCB_DELETE_TRACKSEG:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
@ -198,7 +179,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
((PCB_SCREEN*)GetScreen())->m_Active_Layer = m_SelLayerBox->GetChoice(); GetScreen()->m_Active_Layer = m_SelLayerBox->GetChoice();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
@ -283,11 +264,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/**************************************************************************/ /**************************************************************************/
/* Appel<65> sur un double click: /* Called on a double click:
* pour un <EFBFBD>l<EFBFBD>ment editable (textes, composant):
* appel de l'editeur correspondant.
* pour une connexion en cours:
* termine la connexion
*/ */
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
@ -305,11 +282,7 @@ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break; // end case 0 break; // end case 0
case ID_BUS_BUTT: default:
case ID_WIRE_BUTT:
// if ( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
// EndSegment(DC);
break; break;
} }
} }

View File

@ -40,7 +40,7 @@ typedef enum {
BLOCK_PASTE, BLOCK_PASTE,
BLOCK_DRAG, BLOCK_DRAG,
BLOCK_ROTATE, BLOCK_ROTATE,
BLOCK_INVERT, BLOCK_FLIP,
BLOCK_ZOOM, BLOCK_ZOOM,
BLOCK_ABORT, BLOCK_ABORT,
BLOCK_PRESELECT_MOVE, BLOCK_PRESELECT_MOVE,

View File

@ -179,7 +179,7 @@ enum main_id {
ID_POPUP_COPY_BLOCK, ID_POPUP_COPY_BLOCK,
ID_POPUP_ROTATE_BLOCK, ID_POPUP_ROTATE_BLOCK,
ID_POPUP_DELETE_BLOCK, ID_POPUP_DELETE_BLOCK,
ID_POPUP_INVERT_BLOCK, ID_POPUP_FLIP_BLOCK,
ID_POPUP_PLACE_BLOCK, ID_POPUP_PLACE_BLOCK,
ID_POPUP_ZOOM_BLOCK, ID_POPUP_ZOOM_BLOCK,
ID_POPUP_SELECT_ITEMS_BLOCK, ID_POPUP_SELECT_ITEMS_BLOCK,
@ -433,7 +433,6 @@ enum main_id {
ID_LIBEDIT_END_V_TOOL, // End Id pour VToolBar de Libedit ID_LIBEDIT_END_V_TOOL, // End Id pour VToolBar de Libedit
// ID pour CVPCB // ID pour CVPCB
ID_CVPCB_START_TOOL,
ID_CVPCB_QUIT, ID_CVPCB_QUIT,
ID_CVPCB_READ_INPUT_NETLIST, ID_CVPCB_READ_INPUT_NETLIST,
ID_CVPCB_SAVEQUITCVPCB, ID_CVPCB_SAVEQUITCVPCB,
@ -443,9 +442,6 @@ enum main_id {
ID_CVPCB_GOTO_PREVIOUSNA, ID_CVPCB_GOTO_PREVIOUSNA,
ID_CVPCB_DEL_ASSOCIATIONS, ID_CVPCB_DEL_ASSOCIATIONS,
ID_CVPCB_AUTO_ASSOCIE, ID_CVPCB_AUTO_ASSOCIE,
ID_CVPCB_DISPLAY_HELP,
ID_CVPCB_DISPLAY_LICENCE,
ID_CVPCB_END_TOOL,
ID_CVPCB_COMPONENT_LIST, ID_CVPCB_COMPONENT_LIST,
ID_CVPCB_FOOTPRINT_LIST, ID_CVPCB_FOOTPRINT_LIST,
ID_CVPCB_CREATE_STUFF_FILE, ID_CVPCB_CREATE_STUFF_FILE,
@ -455,8 +451,6 @@ enum main_id {
ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
ID_CVPCB_UNUSED0, ID_CVPCB_UNUSED0,
ID_CVPCB_UNUSED1, ID_CVPCB_UNUSED1,
ID_CVPCB_UNUSED2,
ID_CVPCB_UNUSED3,
// id specifiques pcbnew // id specifiques pcbnew
ID_LOAD_FILE, ID_LOAD_FILE,
@ -752,17 +746,14 @@ enum main_id {
ID_MODEDIT_TRANSFORM_MODULE, ID_MODEDIT_TRANSFORM_MODULE,
ID_MODEDIT_MODULE_ROTATE, ID_MODEDIT_MODULE_ROTATE,
ID_MODEDIT_MODULE_MIRROR, ID_MODEDIT_MODULE_MIRROR,
ID_MODEDIT_MODULE_SCALE,
ID_MODEDIT_MODULE_SCALEX,
ID_MODEDIT_MODULE_SCALEY,
ID_MODEDIT_UNDO, ID_MODEDIT_UNDO,
ID_MODEDIT_REDO, ID_MODEDIT_REDO,
ID_MODEDIT_IMPORT_PART, ID_MODEDIT_IMPORT_PART,
ID_MODEDIT_EXPORT_PART, ID_MODEDIT_EXPORT_PART,
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
ID_MODEDIT_UNUSED6, ID_MODEDIT_UNUSED0,
ID_MODEDIT_UNUSED7, ID_MODEDIT_UNUSED1,
ID_MODEDIT_UNUSED8, ID_MODEDIT_UNUSED2,
// For GERBVIEW only ///////////////// // For GERBVIEW only /////////////////
ID_GERBVIEW_SHOW_LIST_DCODES, ID_GERBVIEW_SHOW_LIST_DCODES,

View File

@ -235,7 +235,7 @@ int WinEDA_PcbFrame::ReturnBlockCommand( int key )
break; break;
case GR_KB_ALT: case GR_KB_ALT:
cmd = BLOCK_INVERT; cmd = BLOCK_FLIP;
break; break;
case MOUSE_MIDDLE: case MOUSE_MIDDLE:
@ -357,7 +357,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
Block_Rotate(); Block_Rotate();
break; break;
case BLOCK_INVERT: /* Flip */ case BLOCK_FLIP: /* Flip */
// Turn off the block rectangle now so it is not redisplayed // Turn off the block rectangle now so it is not redisplayed
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;

View File

@ -152,7 +152,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate ); ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
SaveCopyInUndoList( Currentmodule, UR_CHANGED ); SaveCopyInUndoList( Currentmodule, UR_MODEDIT );
DeleteMarkedItems( Currentmodule ); DeleteMarkedItems( Currentmodule );
break; break;
@ -163,17 +163,17 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_ROTATE: case BLOCK_ROTATE:
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate ); ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
SaveCopyInUndoList( Currentmodule, UR_CHANGED ); SaveCopyInUndoList( Currentmodule, UR_MODEDIT );
RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() ); RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
break; break;
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_INVERT: /* mirror */ case BLOCK_FLIP: /* mirror */
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate ); ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
SaveCopyInUndoList( Currentmodule, UR_CHANGED ); SaveCopyInUndoList( Currentmodule, UR_MODEDIT );
MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() ); MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
break; break;
@ -240,14 +240,14 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( Currentmodule, UR_CHANGED ); SaveCopyInUndoList( Currentmodule, UR_MODEDIT );
MoveMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector ); MoveMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( Currentmodule, UR_CHANGED ); SaveCopyInUndoList( Currentmodule, UR_MODEDIT );
CopyMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector ); CopyMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
break; break;
@ -257,13 +257,13 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_INVERT: /* Mirror by popup menu, from block move */ case BLOCK_FLIP: /* Mirror by popup menu, from block move */
SaveCopyInUndoList( Currentmodule, UR_CHANGED ); SaveCopyInUndoList( Currentmodule, UR_MODEDIT );
MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() ); MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
break; break;
case BLOCK_ROTATE: case BLOCK_ROTATE:
SaveCopyInUndoList( Currentmodule, UR_CHANGED ); SaveCopyInUndoList( Currentmodule, UR_MODEDIT );
RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() ); RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
break; break;
@ -348,10 +348,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
} }
/* Redessin nouvel affichage */ /* Redessin nouvel affichage */
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_MoveVector = screen->m_Curseur - PtBlock->m_BlockLastCursorPosition;
PtBlock->m_BlockLastCursorPosition.x;
PtBlock->m_MoveVector.y = screen->m_Curseur.y -
PtBlock->m_BlockLastCursorPosition.y;
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
@ -359,8 +356,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
if( Currentmodule ) if( Currentmodule )
{ {
item = Currentmodule->m_Drawings; item = Currentmodule->m_Drawings;
move_offset.x = -PtBlock->m_MoveVector.x; move_offset = - PtBlock->m_MoveVector;
move_offset.y = -PtBlock->m_MoveVector.y;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
@ -552,8 +548,8 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
continue; continue;
SETMIRROR( pad->GetPosition().x ); SETMIRROR( pad->GetPosition().x );
pad->m_Pos0.x = pad->GetPosition().x; pad->m_Pos0.x = pad->GetPosition().x;
pad->m_Offset.x = -pad->m_Offset.x; NEGATE( pad->m_Offset.x );
pad->m_DeltaSize.x = -pad->m_DeltaSize.x; NEGATE( pad->m_DeltaSize.x );
pad->m_Orient = 1800 - pad->m_Orient; pad->m_Orient = 1800 - pad->m_Orient;
NORMALIZE_ANGLE( pad->m_Orient ); NORMALIZE_ANGLE( pad->m_Orient );
} }
@ -567,14 +563,13 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() ) switch( item->Type() )
{ {
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
SETMIRROR( ( (EDGE_MODULE*) item )->m_Start.x ); { EDGE_MODULE * edge = (EDGE_MODULE*) item;
( (EDGE_MODULE*) item )->m_Start0.x = SETMIRROR( edge->m_Start.x );
( (EDGE_MODULE*) item )->m_Start.x; edge->m_Start0.x = edge->m_Start.x;
SETMIRROR( ( (EDGE_MODULE*) item )->m_End.x ); SETMIRROR( edge->m_End.x );
( (EDGE_MODULE*) item )->m_End0.x = edge->m_End0.x = edge->m_End.x;
( (EDGE_MODULE*) item )->m_End.x; NEGATE( edge->m_Angle );
( (EDGE_MODULE*) item )->m_Angle = }
-( (EDGE_MODULE*) item )->m_Angle;
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
@ -584,10 +579,11 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
break; break;
default: default:
; break;
} }
item->m_Flags = item->m_Selected = 0; item->m_Flags = 0;
item->m_Selected = 0;
} }
} }

View File

@ -122,7 +122,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_FLIP_BLOCK:
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
case ID_POPUP_PCB_VIA_EDITING: case ID_POPUP_PCB_VIA_EDITING:
@ -296,8 +296,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_FLIP_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT; GetScreen()->m_BlockLocate.m_Command = BLOCK_FLIP;
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;

View File

@ -175,7 +175,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_MIRROR_Y_BLOCK:
case ID_POPUP_MIRROR_X_BLOCK: case ID_POPUP_MIRROR_X_BLOCK:
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
@ -309,6 +308,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
pcbframe->Place_Module( newmodule, NULL ); pcbframe->Place_Module( newmodule, NULL );
pcbframe->GetScreen()->m_Curseur = cursor_pos; pcbframe->GetScreen()->m_Curseur = cursor_pos;
newmodule->m_TimeStamp = GetTimeStamp(); newmodule->m_TimeStamp = GetTimeStamp();
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
} }
newmodule->m_Flags = 0; newmodule->m_Flags = 0;
@ -601,9 +601,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_MODULE_ROTATE: case ID_MODEDIT_MODULE_ROTATE:
case ID_MODEDIT_MODULE_MIRROR: case ID_MODEDIT_MODULE_MIRROR:
case ID_MODEDIT_MODULE_SCALE:
case ID_MODEDIT_MODULE_SCALEX:
case ID_MODEDIT_MODULE_SCALEY:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
Transform( (MODULE*) GetScreen()->GetCurItem(), id ); Transform( (MODULE*) GetScreen()->GetCurItem(), id );
redraw = true; redraw = true;
@ -677,9 +674,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_MIRROR_X_BLOCK: case ID_POPUP_MIRROR_X_BLOCK:
case ID_POPUP_MIRROR_Y_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X;
case ID_POPUP_INVERT_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT;
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
{ {
SET_DC; SET_DC;
@ -761,25 +756,25 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
case ID_MODEDIT_MODULE_MIRROR: case ID_MODEDIT_MODULE_MIRROR:
for( ; pad != NULL; pad = (D_PAD*) pad->Next() ) for( ; pad != NULL; pad = (D_PAD*) pad->Next() )
{ {
pad->m_Pos.y = -pad->m_Pos.y; NEGATE( pad->m_Pos.y );
pad->m_Pos0.y = -pad->m_Pos0.y; NEGATE( pad->m_Pos0.y );
pad->m_Offset.y = -pad->m_Offset.y; NEGATE( pad->m_Offset.y );
pad->m_DeltaSize.y = -pad->m_DeltaSize.y; NEGATE( pad->m_DeltaSize.y );
if( pad->m_Orient ) if( pad->m_Orient )
pad->m_Orient = 3600 - pad->m_Orient; pad->m_Orient = 3600 - pad->m_Orient;
} }
/* Inversion miroir de la Reference */ /* Inversion miroir de la Reference */
textmod = module->m_Reference; textmod = module->m_Reference;
textmod->m_Pos.y = -textmod->m_Pos.y; NEGATE( textmod->m_Pos.y );
textmod->m_Pos0.y = textmod->m_Pos0.y; NEGATE( textmod->m_Pos0.y );
if( textmod->m_Orient ) if( textmod->m_Orient )
textmod->m_Orient = 3600 - textmod->m_Orient; textmod->m_Orient = 3600 - textmod->m_Orient;
/* Inversion miroir de la Valeur */ /* Inversion miroir de la Valeur */
textmod = module->m_Value; textmod = module->m_Value;
textmod->m_Pos.y = -textmod->m_Pos.y; NEGATE( textmod->m_Pos.y );
textmod->m_Pos0.y = textmod->m_Pos0.y; NEGATE( textmod->m_Pos0.y );
if( textmod->m_Orient ) if( textmod->m_Orient )
textmod->m_Orient = 3600 - textmod->m_Orient; textmod->m_Orient = 3600 - textmod->m_Orient;
@ -791,18 +786,18 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
{ {
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
edgemod = (EDGE_MODULE*) PtStruct; edgemod = (EDGE_MODULE*) PtStruct;
edgemod->m_Start.y = -edgemod->m_Start.y; NEGATE( edgemod->m_Start.y );
edgemod->m_End.y = -edgemod->m_End.y; NEGATE( edgemod->m_End.y );
/* inversion des coords locales */ /* inversion des coords locales */
edgemod->m_Start0.y = -edgemod->m_Start0.y; NEGATE( edgemod->m_Start0.y );
edgemod->m_End0.y = -edgemod->m_End0.y; NEGATE( edgemod->m_End0.y );
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
/* Inversion miroir de la position et mise en miroir : */ /* Inversion miroir de la position et mise en miroir : */
textmod = (TEXTE_MODULE*) PtStruct; textmod = (TEXTE_MODULE*) PtStruct;
textmod->m_Pos.y = -textmod->m_Pos.y; NEGATE( textmod->m_Pos.y );
textmod->m_Pos0.y = textmod->m_Pos0.y; NEGATE( textmod->m_Pos0.y );
if( textmod->m_Orient ) if( textmod->m_Orient )
textmod->m_Orient = 3600 - textmod->m_Orient; textmod->m_Orient = 3600 - textmod->m_Orient;
break; break;
@ -815,9 +810,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
break; break;
case ID_MODEDIT_MODULE_SCALE: default:
case ID_MODEDIT_MODULE_SCALEX:
case ID_MODEDIT_MODULE_SCALEY:
DisplayInfoMessage( this, wxT( "Not availlable" ) ); DisplayInfoMessage( this, wxT( "Not availlable" ) );
break; break;
} }

View File

@ -248,11 +248,6 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
_( "Rotate" ), rotate_module_pos_xpm ); _( "Rotate" ), rotate_module_pos_xpm );
ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_MIRROR, ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_MIRROR,
_( "Mirror" ), mirror_H_xpm ); _( "Mirror" ), mirror_H_xpm );
#if 0
transform_choice->Append( ID_MODEDIT_MODULE_SCALE, _( "Scale" ) );
transform_choice->Append( ID_MODEDIT_MODULE_SCALE, _( "Scale X" ) );
transform_choice->Append( ID_MODEDIT_MODULE_SCALE, _( "Scale Y" ) );
#endif
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_MODULE, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_MODULE,
_( "Edit Module" ), edit_module_xpm ); _( "Edit Module" ), edit_module_xpm );
ADD_MENUITEM_WITH_SUBMENU( PopMenu, transform_choice, ADD_MENUITEM_WITH_SUBMENU( PopMenu, transform_choice,

View File

@ -113,24 +113,18 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_ModuleEditFrame::OnSelectOptionToolbar ) WinEDA_ModuleEditFrame::OnSelectOptionToolbar )
// popup commands
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE, EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
// Annulation de commande en cours
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
// Transformations du module // Transformations du module
EVT_MENU( ID_MODEDIT_MODULE_ROTATE, EVT_MENU( ID_MODEDIT_MODULE_ROTATE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR, EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_SCALE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_SCALEX,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_SCALEY,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )

View File

@ -394,7 +394,7 @@ void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu )
_( "Place Block" ), apply_xpm ); _( "Place Block" ), apply_xpm );
ADD_MENUITEM( menu, ID_POPUP_COPY_BLOCK, ADD_MENUITEM( menu, ID_POPUP_COPY_BLOCK,
_( "Copy Block" ), copyblock_xpm ); _( "Copy Block" ), copyblock_xpm );
ADD_MENUITEM( menu, ID_POPUP_INVERT_BLOCK, ADD_MENUITEM( menu, ID_POPUP_FLIP_BLOCK,
_( "Flip Block" ), invert_module_xpm ); _( "Flip Block" ), invert_module_xpm );
ADD_MENUITEM( menu, ID_POPUP_ROTATE_BLOCK, ADD_MENUITEM( menu, ID_POPUP_ROTATE_BLOCK,
_( "Rotate Block" ), rotate_pos_xpm ); _( "Rotate Block" ), rotate_pos_xpm );

View File

@ -1,7 +1,8 @@
/****************************************************************************/ /****************************************************************************/
/* Name: zones_by_polygon.cpp */ /* Name: zones_test_and_combine_areas.cpp */
/* Licence: GPL License */ /* Licence: GPL License */
/* functions to test, merges and cut polygons used as copper areas outlines */ /* functions to test, merge and cut polygons used as copper areas outlines */
/* some pieces of code come from FreePCB */
/****************************************************************************/ /****************************************************************************/
#include <vector> #include <vector>
@ -11,11 +12,6 @@
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
using namespace std;
#undef ASSERT
#define ASSERT wxASSERT
bool bDontShowSelfIntersectionArcsWarning; bool bDontShowSelfIntersectionArcsWarning;
bool bDontShowSelfIntersectionWarning; bool bDontShowSelfIntersectionWarning;
bool bDontShowIntersectionArcsWarning; bool bDontShowIntersectionArcsWarning;
@ -685,7 +681,7 @@ int BOARD::CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combi
{ {
if( area_ref == area_to_combine ) if( area_ref == area_to_combine )
{ {
ASSERT( 0 ); wxASSERT( 0 );
} }
// polygons intersect, combine them // polygons intersect, combine them