Commit bdca3c5e authored by Wayne Stambaugh's avatar Wayne Stambaugh

All control state handling is now performed in wxUpdateUIEvent handlers.

* Old control state handling code completely removed in all applications.
* Factor common control state handlers into EDA_DRAW_FRAME.
* Replaced EDA_ITEM test for newness with IsNew() method.
* Factor vertical right toolbar command handlers out of giant edit command
  switch statement in EESchema and PCBNew.
parent c476ae44
...@@ -44,13 +44,23 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME ) ...@@ -44,13 +44,23 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
EDA_DRAW_FRAME::OnZoom ) EDA_DRAW_FRAME::OnZoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
EDA_DRAW_FRAME::OnSelectGrid ) EDA_DRAW_FRAME::OnSelectGrid )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnToggleGridState )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
EDA_DRAW_FRAME::OnSelectUnits )
EVT_TOOL( ID_TB_OPTIONS_SELECT_CURSOR, EDA_DRAW_FRAME::OnToggleCrossHairStyle )
EVT_UPDATE_UI( wxID_UNDO, EDA_DRAW_FRAME::OnUpdateUndo )
EVT_UPDATE_UI( wxID_REDO, EDA_DRAW_FRAME::OnUpdateRedo )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnUpdateGrid )
EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, EDA_DRAW_FRAME::OnUpdateCrossHairStyle )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
EDA_DRAW_FRAME::OnUpdateUnits )
END_EVENT_TABLE() END_EVENT_TABLE()
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxString& title, const wxPoint& pos, const wxSize& size, long style ) :
const wxPoint& pos, const wxSize& size,
long style ) :
EDA_BASE_FRAME( father, idtype, title, pos, size, style ) EDA_BASE_FRAME( father, idtype, title, pos, size, style )
{ {
wxSize minsize; wxSize minsize;
...@@ -154,6 +164,79 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event ) ...@@ -154,6 +164,79 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
} }
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
{
SetGridVisibility( !IsGridVisible() );
DrawPanel->Refresh();
}
void EDA_DRAW_FRAME::OnSelectUnits( wxCommandEvent& aEvent )
{
if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && g_UserUnit != MILLIMETRES )
{
g_UserUnit = MILLIMETRES;
UpdateStatusBar();
}
else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && g_UserUnit != INCHES )
{
g_UserUnit = INCHES;
UpdateStatusBar();
}
}
void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
{
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
DrawPanel->CrossHairOff( &dc );
m_CursorShape = !m_CursorShape;
DrawPanel->CrossHairOn( &dc );
}
void EDA_DRAW_FRAME::OnUpdateUndo( wxUpdateUIEvent& aEvent )
{
if( GetScreen() )
aEvent.Enable( GetScreen()->GetUndoCommandCount() > 0 );
}
void EDA_DRAW_FRAME::OnUpdateRedo( wxUpdateUIEvent& aEvent )
{
if( GetScreen() )
aEvent.Enable( GetScreen()->GetRedoCommandCount() > 0 );
}
void EDA_DRAW_FRAME::OnUpdateUnits( wxUpdateUIEvent& aEvent )
{
bool enable;
enable = ( ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM) && (g_UserUnit == MILLIMETRES))
|| ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH) && (g_UserUnit == INCHES)) );
aEvent.Check( enable );
DisplayUnitsMsg();
}
void EDA_DRAW_FRAME::OnUpdateGrid( wxUpdateUIEvent& aEvent )
{
wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
aEvent.Check( IsGridVisible() );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
}
void EDA_DRAW_FRAME::OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_CursorShape );
}
// Virtual function // Virtual function
void EDA_DRAW_FRAME::ReCreateAuxiliaryToolbar() void EDA_DRAW_FRAME::ReCreateAuxiliaryToolbar()
{ {
...@@ -177,6 +260,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event ) ...@@ -177,6 +260,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
{ {
} }
/** /**
* Function PrintPage (virtual) * Function PrintPage (virtual)
* used to print a page * used to print a page
...@@ -307,15 +391,6 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -307,15 +391,6 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
} }
void EDA_DRAW_FRAME::SetToolbars()
{
DisplayUnitsMsg();
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
}
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg ) void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
{ {
SetStatusText( msg, 5 ); SetStatusText( msg, 5 );
...@@ -379,53 +454,14 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg ) ...@@ -379,53 +454,14 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
// Change DrawPanel cursor if requested. // Change DrawPanel cursor if requested.
if( DrawPanel && aCursor >= 0 ) if( DrawPanel && aCursor >= 0 )
{
DrawPanel->SetCursor( aCursor ); DrawPanel->SetCursor( aCursor );
}
DisplayToolMsg( aToolMsg ); DisplayToolMsg( aToolMsg );
if( aId < 0 ) if( aId < 0 )
return; return;
// Old Tool ID_NO_SELECT_BUTT active or inactive if no new tool.
if( m_ID_current_state )
{
if( m_VToolBar )
m_VToolBar->ToggleTool( m_ID_current_state, FALSE );
if( m_AuxVToolBar )
m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE );
}
else
{
if( aId )
{
if( m_VToolBar )
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, FALSE );
if( m_AuxVToolBar )
m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE );
}
else if( m_VToolBar )
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
}
if( aId )
{
if( m_VToolBar )
m_VToolBar->ToggleTool( aId, TRUE );
if( m_AuxVToolBar )
m_AuxVToolBar->ToggleTool( aId, TRUE );
}
else if( m_VToolBar )
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_ID_current_state = aId; m_ID_current_state = aId;
if( m_VToolBar )
m_VToolBar->Refresh( );
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define CURSOR_SIZE 12 // Cursor size in pixels #define CURSOR_SIZE 12 // Cursor size in pixels
#define CLIP_BOX_PADDING 1 #define CLIP_BOX_PADDING 2
/* Definitions for enabling and disabling debugging features in drawpanel.cpp. /* Definitions for enabling and disabling debugging features in drawpanel.cpp.
* Please don't forget to turn these off before making any commits to Launchpad. * Please don't forget to turn these off before making any commits to Launchpad.
...@@ -749,6 +749,8 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event ) ...@@ -749,6 +749,8 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
cmd.SetEventObject( this ); cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
} }
event.Skip();
} }
...@@ -882,7 +884,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -882,7 +884,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
wxPoint pos = CalcUnscrolledPosition( event.GetPosition() ); wxPoint pos = CalcUnscrolledPosition( event.GetPosition() );
/* Compute the cursor position in drawing (logical) units. */ /* Compute the cursor position in drawing (logical) units. */
screen->m_MousePosition = event.GetLogicalPosition( DC ); screen->SetMousePosition( event.GetLogicalPosition( DC ) );
int kbstat = 0; int kbstat = 0;
...@@ -902,7 +904,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -902,7 +904,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// Calling Double Click and Click functions : // Calling Double Click and Click functions :
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) ) if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{ {
GetParent()->OnLeftDClick( &DC, screen->m_MousePosition ); GetParent()->OnLeftDClick( &DC, screen->RefPos( true ) );
// inhibit a response to the mouse left button release, // inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new // because we have a double click, and we do not want a new
...@@ -914,7 +916,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -914,7 +916,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// A block command is in progress: a left up is the end of block // A block command is in progress: a left up is the end of block
// or this is the end of a double click, already seen // or this is the end of a double click, already seen
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease )
GetParent()->OnLeftClick( &DC, screen->m_MousePosition ); GetParent()->OnLeftClick( &DC, screen->RefPos( true ) );
ignoreNextLeftButtonRelease = false; ignoreNextLeftButtonRelease = false;
} }
...@@ -1140,7 +1142,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event ) ...@@ -1140,7 +1142,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
// Compute the cursor position in drawing units. Also known as logical units to wxDC. // Compute the cursor position in drawing units. Also known as logical units to wxDC.
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) ); pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
Screen->m_MousePosition = pos; Screen->SetMousePosition( pos );
GetParent()->GeneralControle( &DC, pos ); GetParent()->GeneralControle( &DC, pos );
......
...@@ -69,7 +69,6 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) ...@@ -69,7 +69,6 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection(); m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection();
m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue();
m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue(); m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue();
m_Parent->SetToolbars();
m_Parent->DrawPanel->Refresh(); m_Parent->DrawPanel->Refresh();
} }
......
...@@ -228,7 +228,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) ...@@ -228,7 +228,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
if( firstsegment == NULL ) if( firstsegment == NULL )
return; return;
if( ( firstsegment->m_Flags & IS_NEW ) == 0 ) if( !firstsegment->IsNew() )
return; return;
/* Delete Null segments and Put line it in Drawlist */ /* Delete Null segments and Put line it in Drawlist */
......
...@@ -29,7 +29,7 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -29,7 +29,7 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode ); BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( BusEntry->m_Flags & IS_NEW ) if( BusEntry->IsNew() )
{ {
delete BusEntry; delete BusEntry;
Panel->GetScreen()->SetCurItem( NULL ); Panel->GetScreen()->SetCurItem( NULL );
...@@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC ) ...@@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
if( (BusEntry->m_Flags & IS_NEW) == 0 ) // not already in edit, save shape if( !BusEntry->IsNew() ) // not already in edit, save shape
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = BusEntry->Clone(); g_ItemToUndoCopy = BusEntry->Clone();
......
...@@ -204,7 +204,7 @@ LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary ) ...@@ -204,7 +204,7 @@ LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary )
BOOST_FOREACH( LIB_DRAW_ITEM& oldItem, aComponent.GetDrawItemList() ) BOOST_FOREACH( LIB_DRAW_ITEM& oldItem, aComponent.GetDrawItemList() )
{ {
if( ( oldItem.m_Flags & IS_NEW ) != 0 ) if( oldItem.IsNew() )
continue; continue;
newItem = oldItem.GenCopy(); newItem = oldItem.GenCopy();
......
...@@ -283,7 +283,7 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -283,7 +283,7 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
if( screen->IsRefreshReq() ) if( screen->IsRefreshReq() )
{ {
DrawPanel->Refresh( ); DrawPanel->Refresh();
wxSafeYield(); wxSafeYield();
} }
...@@ -310,7 +310,6 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -310,7 +310,6 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
} }
UpdateStatusBar(); /* Display cursor coordinates info */ UpdateStatusBar(); /* Display cursor coordinates info */
SetToolbars();
} }
...@@ -473,5 +472,4 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -473,5 +472,4 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
} }
UpdateStatusBar(); UpdateStatusBar();
SetToolbars();
} }
...@@ -39,7 +39,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -39,7 +39,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
if( (TextStruct->m_Flags & IS_NEW) == 0 ) if( !TextStruct->IsNew() )
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = TextStruct->Clone(); g_ItemToUndoCopy = TextStruct->Clone();
...@@ -227,7 +227,7 @@ static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -227,7 +227,7 @@ static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC )
* created)*/ * created)*/
Struct->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode ); Struct->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( Struct->m_Flags & IS_NEW ) if( Struct->IsNew() )
{ {
SAFE_DELETE( Struct ); SAFE_DELETE( Struct );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
......
...@@ -23,7 +23,9 @@ enum id_eeschema_frm ...@@ -23,7 +23,9 @@ enum id_eeschema_frm
/* Schematic editor veritcal toolbar IDs */ /* Schematic editor veritcal toolbar IDs */
ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
ID_SCH_NO_TOOL,
ID_HIERARCHY_PUSH_POP_BUTT, ID_HIERARCHY_PUSH_POP_BUTT,
ID_SCH_PLACE_COMPONENT,
ID_PLACE_POWER_BUTT, ID_PLACE_POWER_BUTT,
ID_BUS_BUTT, ID_BUS_BUTT,
ID_WIRE_BUTT, ID_WIRE_BUTT,
...@@ -154,16 +156,17 @@ enum id_eeschema_frm ...@@ -154,16 +156,17 @@ enum id_eeschema_frm
ID_LIBEDIT_SELECT_ALIAS, ID_LIBEDIT_SELECT_ALIAS,
/* Library editor vertical toolbar IDs. */ /* Library editor vertical toolbar IDs. */
ID_LIBEDIT_NO_TOOL,
ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_PIN_BUTT,
ID_LIBEDIT_BODY_LINE_BUTT, ID_LIBEDIT_BODY_LINE_BUTT,
ID_LIBEDIT_BODY_ARC_BUTT, ID_LIBEDIT_BODY_ARC_BUTT,
ID_LIBEDIT_BODY_CIRCLE_BUTT, ID_LIBEDIT_BODY_CIRCLE_BUTT,
ID_LIBEDIT_BODY_RECT_BUTT, ID_LIBEDIT_BODY_RECT_BUTT,
ID_LIBEDIT_BODY_TEXT_BUTT, ID_LIBEDIT_BODY_TEXT_BUTT,
ID_LIBEDIT_DELETE_ITEM_BUTT,
ID_LIBEDIT_ANCHOR_ITEM_BUTT, ID_LIBEDIT_ANCHOR_ITEM_BUTT,
ID_LIBEDIT_IMPORT_BODY_BUTT, ID_LIBEDIT_IMPORT_BODY_BUTT,
ID_LIBEDIT_EXPORT_BODY_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT,
ID_LIBEDIT_DELETE_ITEM_BUTT,
/* Library editor context menu IDs */ /* Library editor context menu IDs */
ID_LIBEDIT_EDIT_PIN, ID_LIBEDIT_EDIT_PIN,
......
...@@ -269,7 +269,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -269,7 +269,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
// notBusy == true means no item currently edited and no other command in progress // notBusy == true means no item currently edited and no other command in progress
// We can change active tool and ask for editing a new item // We can change active tool and ask for editing a new item
bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK); bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK);
bool RefreshToolBar = FALSE;
if( aHotKey == 0 ) if( aHotKey == 0 )
return; return;
...@@ -343,7 +342,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -343,7 +342,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_DELETE: case HK_DELETE:
if( notBusy) if( notBusy)
{ {
RefreshToolBar = LocateAndDeleteItem( this, aDC ); LocateAndDeleteItem( this, aDC );
OnModify(); OnModify();
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds( DrawPanel, aDC ); GetScreen()->TestDanglingEnds( DrawPanel, aDC );
...@@ -390,8 +389,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -390,8 +389,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( !itemInEdit ) if( !itemInEdit )
{ {
// switch to m_ID_current_state = ID_COMPONENT_BUTT; // switch to m_ID_current_state = ID_COMPONENT_BUTT;
if( m_ID_current_state != ID_COMPONENT_BUTT ) if( m_ID_current_state != ID_SCH_PLACE_COMPONENT )
SetToolID( ID_COMPONENT_BUTT, wxCURSOR_PENCIL, _( "Add Component" ) ); SetToolID( ID_SCH_PLACE_COMPONENT, wxCURSOR_PENCIL, _( "Add Component" ) );
OnLeftClick( aDC, aPosition ); OnLeftClick( aDC, aPosition );
} }
...@@ -648,7 +647,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -648,7 +647,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->m_Flags == 0 ) if( aItem->m_Flags == 0 )
{ {
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
} }
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_Y ); CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_Y );
...@@ -670,7 +668,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -670,7 +668,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->m_Flags == 0 ) if( aItem->m_Flags == 0 )
{ {
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
} }
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_X ); CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_X );
...@@ -686,7 +683,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -686,7 +683,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->m_Flags == 0 ) if( aItem->m_Flags == 0 )
{ {
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
} }
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_NORMAL ); CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_NORMAL );
...@@ -880,9 +876,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -880,9 +876,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
} }
break; break;
} }
if( RefreshToolBar )
SetToolbars();
} }
...@@ -979,7 +972,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -979,7 +972,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_EDIT: case HK_EDIT:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem ) if( m_drawItem )
{ {
...@@ -1011,7 +1004,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -1011,7 +1004,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_ROTATE: case HK_ROTATE:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem ) if( m_drawItem )
{ {
...@@ -1047,7 +1040,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -1047,7 +1040,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
} }
case HK_DELETE: case HK_DELETE:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() ) if( m_drawItem && !m_drawItem->InEditMode() )
{ {
...@@ -1058,7 +1051,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -1058,7 +1051,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_LIBEDIT_MOVE_GRAPHIC_ITEM: case HK_LIBEDIT_MOVE_GRAPHIC_ITEM:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() ) if( m_drawItem && !m_drawItem->InEditMode() )
{ {
...@@ -1069,7 +1062,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -1069,7 +1062,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_DRAG: case HK_DRAG:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() ) if( m_drawItem && !m_drawItem->InEditMode() )
{ {
......
...@@ -328,7 +328,7 @@ int LIB_ARC::GetPenSize() ...@@ -328,7 +328,7 @@ int LIB_ARC::GetPenSize()
void LIB_ARC::drawEditGraphics( EDA_Rect* aClipBox, wxDC* aDC, int aColor ) void LIB_ARC::drawEditGraphics( EDA_Rect* aClipBox, wxDC* aDC, int aColor )
{ {
// The edit indicators only get drawn when a new arc is being drawn. // The edit indicators only get drawn when a new arc is being drawn.
if( ( m_Flags & IS_NEW ) == 0 ) if( !IsNew() )
return; return;
// Use the last edit state so when the drawing switches from the end mode to the center // Use the last edit state so when the drawing switches from the end mode to the center
...@@ -350,7 +350,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf ...@@ -350,7 +350,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
{ {
// Don't draw the arc until the end point is selected. Only the edit indicators // Don't draw the arc until the end point is selected. Only the edit indicators
// get drawn at this time. // get drawn at this time.
if( ( m_Flags & IS_NEW ) && m_lastEditState == 1 ) if( IsNew() && m_lastEditState == 1 )
return; return;
wxPoint pos1, pos2, posc; wxPoint pos1, pos2, posc;
......
...@@ -509,7 +509,7 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin ) ...@@ -509,7 +509,7 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
if( ( pinList[i]->m_position == m_position ) if( ( pinList[i]->m_position == m_position )
&& ( pinList[i]->m_orientation == m_orientation ) && ( pinList[i]->m_orientation == m_orientation )
&& ( !( m_Flags & IS_NEW ) ) && !IsNew()
&& editPinByPin == false && editPinByPin == false
&& enable ) && enable )
pinList[i]->m_Flags |= IS_LINKED | IN_EDIT; pinList[i]->m_Flags |= IS_LINKED | IN_EDIT;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "class_libentry.h" #include "class_libentry.h"
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{ {
LIB_DRAW_ITEM* DrawEntry = m_drawItem; LIB_DRAW_ITEM* DrawEntry = m_drawItem;
...@@ -43,8 +43,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -43,8 +43,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else else
{ {
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
GetScreen()->m_MousePosition );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
...@@ -64,7 +63,8 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -64,7 +63,8 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_NO_SELECT_BUTT: case 0:
case ID_LIBEDIT_NO_TOOL:
break; break;
case ID_LIBEDIT_PIN_BUTT: case ID_LIBEDIT_PIN_BUTT:
...@@ -89,7 +89,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -89,7 +89,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else if( m_drawItem ) else if( m_drawItem )
{ {
if( m_drawItem->m_Flags & IS_NEW ) if( m_drawItem->IsNew() )
GraphicItemBeginDraw( DC ); GraphicItemBeginDraw( DC );
else else
EndDrawGraphicItem( DC ); EndDrawGraphicItem( DC );
...@@ -97,14 +97,14 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -97,14 +97,14 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case ID_LIBEDIT_DELETE_ITEM_BUTT: case ID_LIBEDIT_DELETE_ITEM_BUTT:
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
GetScreen()->m_MousePosition );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->GetCrossHairPosition() ); GetScreen()->GetCrossHairPosition() );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DisplayCmpDoc(); DisplayCmpDoc();
...@@ -142,7 +142,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -142,7 +142,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* If an editable item (field, pin, graphic): * If an editable item (field, pin, graphic):
* Call the suitable dialog editor. * Call the suitable dialog editor.
*/ */
void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
{ {
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
...@@ -151,8 +151,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -151,8 +151,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) ) if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
{ // We can locate an item { // We can locate an item
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
GetScreen()->m_MousePosition );
if( m_drawItem == NULL ) if( m_drawItem == NULL )
{ {
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
...@@ -198,7 +197,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -198,7 +197,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
EditGraphicSymbol( DC, m_drawItem ); EditGraphicSymbol( DC, m_drawItem );
} }
else if( m_drawItem->m_Flags & IS_NEW ) else if( m_drawItem->IsNew() )
{ {
EndDrawGraphicItem( DC ); EndDrawGraphicItem( DC );
} }
......
...@@ -28,9 +28,9 @@ static void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame ); ...@@ -28,9 +28,9 @@ static void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame );
static void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame ); static void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame );
bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
LIB_DRAW_ITEM* DrawEntry = LocateItemUsingCursor(); LIB_DRAW_ITEM* DrawEntry = LocateItemUsingCursor( aPosition );
bool BlockActive = GetScreen()->IsBlockActive(); bool BlockActive = GetScreen()->IsBlockActive();
if( BlockActive ) if( BlockActive )
......
...@@ -80,7 +80,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -80,7 +80,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate ) EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate )
/* Main horizontal toolbar. */ /* Main horizontal toolbar. */
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, LIB_EDIT_FRAME::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, LIB_EDIT_FRAME::OnZoom )
EVT_TOOL( ID_LIBEDIT_SAVE_CURRENT_LIB, LIB_EDIT_FRAME::SaveActiveLibrary ) EVT_TOOL( ID_LIBEDIT_SAVE_CURRENT_LIB, LIB_EDIT_FRAME::SaveActiveLibrary )
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB, LIB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB, LIB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_DELETE_PART, LIB_EDIT_FRAME::DeleteOnePart ) EVT_TOOL( ID_LIBEDIT_DELETE_PART, LIB_EDIT_FRAME::DeleteOnePart )
...@@ -106,9 +106,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -106,9 +106,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias ) EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias )
/* Right vertical toolbar. */ /* Right vertical toolbar. */
EVT_TOOL( ID_NO_SELECT_BUTT, LIB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL_RANGE( ID_LIBEDIT_NO_TOOL, ID_LIBEDIT_DELETE_ITEM_BUTT,
EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT, LIB_EDIT_FRAME::OnSelectTool )
LIB_EDIT_FRAME::Process_Special_Functions )
/* menubar commands */ /* menubar commands */
EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow ) EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow )
...@@ -158,7 +157,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -158,7 +157,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnUpdateSelectAlias ) EVT_UPDATE_UI( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnUpdateSelectAlias )
EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal ) EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal )
EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert ) EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert )
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT, EVT_UPDATE_UI_RANGE( ID_LIBEDIT_NO_TOOL, ID_LIBEDIT_DELETE_ITEM_BUTT,
LIB_EDIT_FRAME::OnUpdateEditingPart ) LIB_EDIT_FRAME::OnUpdateEditingPart )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -180,6 +179,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, ...@@ -180,6 +179,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_drawSpecificUnit = false; m_drawSpecificUnit = false;
m_tempCopyComponent = NULL; m_tempCopyComponent = NULL;
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
m_ID_current_state = ID_LIBEDIT_NO_TOOL;
// Give an icon // Give an icon
SetIcon( wxIcon( libedit_xpm ) ); SetIcon( wxIcon( libedit_xpm ) );
...@@ -251,8 +251,10 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME() ...@@ -251,8 +251,10 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
frame->m_LibeditFrame = NULL; frame->m_LibeditFrame = NULL;
m_drawItem = m_lastDrawItem = NULL; m_drawItem = m_lastDrawItem = NULL;
if ( m_tempCopyComponent ) if ( m_tempCopyComponent )
delete m_tempCopyComponent; delete m_tempCopyComponent;
m_tempCopyComponent = NULL; m_tempCopyComponent = NULL;
} }
...@@ -433,9 +435,18 @@ void LIB_EDIT_FRAME::UpdatePartSelectList() ...@@ -433,9 +435,18 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
} }
void LIB_EDIT_FRAME::OnUpdateEditingPart( wxUpdateUIEvent& event ) void LIB_EDIT_FRAME::OnUpdateEditingPart( wxUpdateUIEvent& aEvent )
{ {
event.Enable( m_component != NULL ); aEvent.Enable( m_component != NULL );
if( m_component != NULL )
{
if( m_ID_current_state == 0 )
m_ID_current_state = ID_LIBEDIT_NO_TOOL;
if( aEvent.GetEventObject() == m_VToolBar )
aEvent.Check( m_ID_current_state == aEvent.GetId() );
}
} }
...@@ -487,8 +498,7 @@ void LIB_EDIT_FRAME::OnUpdatePinByPin( wxUpdateUIEvent& event ) ...@@ -487,8 +498,7 @@ void LIB_EDIT_FRAME::OnUpdatePinByPin( wxUpdateUIEvent& event )
event.Enable( ( m_component != NULL ) event.Enable( ( m_component != NULL )
&& ( ( m_component->GetPartCount() > 1 ) || m_showDeMorgan ) ); && ( ( m_component->GetPartCount() > 1 ) || m_showDeMorgan ) );
if( m_HToolBar ) event.Check( g_EditPinByPinIsOn );
m_HToolBar->ToggleTool( event.GetId(), g_EditPinByPinIsOn );
} }
...@@ -510,7 +520,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganNormal( wxUpdateUIEvent& event ) ...@@ -510,7 +520,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
return; return;
event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) ); event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 ); event.Check( m_convert <= 1 );
} }
...@@ -520,7 +530,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganConvert( wxUpdateUIEvent& event ) ...@@ -520,7 +530,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
return; return;
event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) ); event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 ); event.Check( m_convert > 1 );
} }
...@@ -539,7 +549,7 @@ void LIB_EDIT_FRAME::OnUpdateSelectAlias( wxUpdateUIEvent& event ) ...@@ -539,7 +549,7 @@ void LIB_EDIT_FRAME::OnUpdateSelectAlias( wxUpdateUIEvent& event )
void LIB_EDIT_FRAME::OnSelectAlias( wxCommandEvent& event ) void LIB_EDIT_FRAME::OnSelectAlias( wxCommandEvent& event )
{ {
if( m_SelAliasBox == NULL if( m_SelAliasBox == NULL
|| m_SelAliasBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0 ) || ( m_SelAliasBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0) )
return; return;
m_lastDrawItem = NULL; m_lastDrawItem = NULL;
...@@ -660,61 +670,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -660,61 +670,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
g_EditPinByPinIsOn = m_HToolBar->GetToolState(ID_LIBEDIT_EDIT_PIN_BY_PIN); g_EditPinByPinIsOn = m_HToolBar->GetToolState(ID_LIBEDIT_EDIT_PIN_BY_PIN);
break; break;
case ID_LIBEDIT_PIN_BUTT:
if( m_component )
{
SetToolID( id, wxCURSOR_PENCIL, _( "Add pin" ) );
}
else
{
SetToolID( id, wxCURSOR_ARROW, _( "Set pin options" ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
GetEventHandler()->ProcessEvent( cmd );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
}
break;
case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_BODY_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_LIBEDIT_BODY_RECT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add rectangle" ) );
break;
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
break;
case ID_LIBEDIT_BODY_ARC_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
break;
case ID_LIBEDIT_BODY_LINE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
break;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Set anchor position" ) );
break;
case ID_LIBEDIT_IMPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
LoadOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_EXPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Export" ) );
SaveOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_POPUP_LIBEDIT_END_CREATE_ITEM: case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
if( m_drawItem ) if( m_drawItem )
...@@ -749,17 +704,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -749,17 +704,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
break; break;
case ID_LIBEDIT_DELETE_ITEM_BUTT:
if( m_component == NULL )
{
wxBell();
break;
}
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT: case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
{ {
// Delete the last created segment, while creating a polyline draw item // Delete the last created segment, while creating a polyline draw item
...@@ -873,8 +817,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -873,8 +817,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
if( (m_drawItem == NULL ) if( ( m_drawItem == NULL ) || ( m_drawItem->Type() != LIB_PIN_T ) )
|| (m_drawItem->Type() != LIB_PIN_T) )
break; break;
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id ); GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
...@@ -1081,3 +1024,86 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event ) ...@@ -1081,3 +1024,86 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->CrossHairOn( &dc ); DrawPanel->CrossHairOn( &dc );
} }
void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
if( m_ID_current_state == 0 )
m_lastDrawItem = NULL;
DrawPanel->EndMouseCapture( ID_LIBEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
switch( id )
{
case ID_LIBEDIT_NO_TOOL:
SetToolID( id, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_PIN_BUTT:
if( m_component )
{
SetToolID( id, wxCURSOR_PENCIL, _( "Add pin" ) );
}
else
{
SetToolID( id, wxCURSOR_ARROW, _( "Set pin options" ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
GetEventHandler()->ProcessEvent( cmd );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
}
break;
case ID_LIBEDIT_BODY_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_LIBEDIT_BODY_RECT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add rectangle" ) );
break;
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
break;
case ID_LIBEDIT_BODY_ARC_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
break;
case ID_LIBEDIT_BODY_LINE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
break;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Set anchor position" ) );
break;
case ID_LIBEDIT_IMPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
LoadOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_EXPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Export" ) );
SaveOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_DELETE_ITEM_BUTT:
if( m_component == NULL )
{
wxBell();
break;
}
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
default:
break;
}
DrawPanel->m_IgnoreMouseEvents = false;
}
...@@ -59,6 +59,7 @@ public: ...@@ -59,6 +59,7 @@ public:
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void OnPlotCurrentComponent( wxCommandEvent& event ); void OnPlotCurrentComponent( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void OnImportPart( wxCommandEvent& event ); void OnImportPart( wxCommandEvent& event );
void OnExportPart( wxCommandEvent& event ); void OnExportPart( wxCommandEvent& event );
void OnSelectAlias( wxCommandEvent& event ); void OnSelectAlias( wxCommandEvent& event );
...@@ -75,6 +76,7 @@ public: ...@@ -75,6 +76,7 @@ public:
void OnEditPin( wxCommandEvent& event ); void OnEditPin( wxCommandEvent& event );
void OnRotatePin( wxCommandEvent& event ); void OnRotatePin( wxCommandEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
void OnUpdateEditingPart( wxUpdateUIEvent& event ); void OnUpdateEditingPart( wxUpdateUIEvent& event );
void OnUpdateNotEditingPart( wxUpdateUIEvent& event ); void OnUpdateNotEditingPart( wxUpdateUIEvent& event );
void OnUpdateUndo( wxUpdateUIEvent& event ); void OnUpdateUndo( wxUpdateUIEvent& event );
...@@ -248,7 +250,7 @@ private: ...@@ -248,7 +250,7 @@ private:
void SaveOneSymbol(); void SaveOneSymbol();
void EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem ); void EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem );
void EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem ); void EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem );
LIB_DRAW_ITEM* LocateItemUsingCursor(); LIB_DRAW_ITEM* LocateItemUsingCursor( const wxPoint& aPosition );
void EditField( wxDC* DC, LIB_FIELD* Field ); void EditField( wxDC* DC, LIB_FIELD* Field );
public: public:
......
...@@ -154,19 +154,19 @@ this component?" ), ...@@ -154,19 +154,19 @@ this component?" ),
} }
LIB_DRAW_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor() LIB_DRAW_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor( const wxPoint& aPosition )
{ {
if( m_component == NULL ) if( m_component == NULL )
return NULL; return NULL;
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) ) if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
{ {
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
GetScreen()->m_MousePosition );
if( m_drawItem == NULL ) wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition );
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->GetCrossHairPosition() ); if( m_drawItem == NULL && aPosition != pos )
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, pos );
} }
return m_drawItem; return m_drawItem;
......
...@@ -45,7 +45,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ) ...@@ -45,7 +45,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
while( DrawList ) while( DrawList )
{ {
if( !SnapPoint2( Screen->m_MousePosition, COMPONENT_T, DrawList ) ) if( !SnapPoint2( Screen->RefPos( true ), COMPONENT_T, DrawList ) )
{ {
if( !SnapPoint2( Screen->GetCrossHairPosition(), COMPONENT_T, DrawList ) ) if( !SnapPoint2( Screen->GetCrossHairPosition(), COMPONENT_T, DrawList ) )
break; break;
......
...@@ -240,7 +240,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() ...@@ -240,7 +240,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
/* Component */ /* Component */
text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text, item = new wxMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text,
HELP_PLACE_COMPONENTS, wxITEM_NORMAL ); HELP_PLACE_COMPONENTS, wxITEM_NORMAL );
item->SetBitmap( add_component_xpm ); item->SetBitmap( add_component_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
......
...@@ -31,7 +31,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -31,7 +31,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
SCH_ITEM* item = GetScreen()->GetCurItem(); SCH_ITEM* item = GetScreen()->GetCurItem();
wxPoint gridPosition = GetGridPosition( aPosition ); wxPoint gridPosition = GetGridPosition( aPosition );
if( ( m_ID_current_state == 0 ) || ( item && item->m_Flags ) ) if( ( m_ID_current_state == ID_SCH_NO_TOOL )
|| ( m_ID_current_state == 0 )
|| ( item && item->m_Flags ) )
{ {
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
...@@ -84,13 +86,11 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -84,13 +86,11 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case 0: case 0:
break; case ID_SCH_NO_TOOL:
case ID_NO_SELECT_BUTT:
break; break;
case ID_HIERARCHY_PUSH_POP_BUTT: case ID_HIERARCHY_PUSH_POP_BUTT:
if( item && item->m_Flags ) if( ( item && item->m_Flags ) || ( g_RootSheet->CountSheets() == 0 ) )
break; break;
item = LocateAndShowItem( aPosition ); item = LocateAndShowItem( aPosition );
...@@ -274,7 +274,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -274,7 +274,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
break; break;
case ID_COMPONENT_BUTT: case ID_SCH_PLACE_COMPONENT:
if( (item == NULL) || (item->m_Flags == 0) ) if( (item == NULL) || (item->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) ); GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) );
...@@ -334,6 +334,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -334,6 +334,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_SCH_NO_TOOL:
case 0: case 0:
if( ( item == NULL ) || ( item->m_Flags == 0 ) ) if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{ {
...@@ -380,7 +381,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -380,7 +381,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case ID_BUS_BUTT: case ID_BUS_BUTT:
case ID_WIRE_BUTT: case ID_WIRE_BUTT:
case ID_LINE_COMMENT_BUTT: case ID_LINE_COMMENT_BUTT:
if( item && ( item->m_Flags & IS_NEW ) ) if( item && item->IsNew() )
EndSegment( aDC ); EndSegment( aDC );
break; break;
......
...@@ -489,7 +489,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text ) ...@@ -489,7 +489,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame ) void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = Junction->IsNew();
wxString msg; wxString msg;
if( !is_new ) if( !is_new )
...@@ -513,7 +513,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM ...@@ -513,7 +513,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = Wire->IsNew();
wxPoint pos = frame->GetScreen()->GetCrossHairPosition(); wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg; wxString msg;
...@@ -551,9 +551,10 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) ...@@ -551,9 +551,10 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ) void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = Bus->IsNew();
wxPoint pos = frame->GetScreen()->GetCrossHairPosition(); wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg; wxString msg;
if( is_new ) if( is_new )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm );
......
...@@ -188,7 +188,7 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -188,7 +188,7 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( CurrentPin == NULL || CurrentPin->Type() != LIB_PIN_T ) if( CurrentPin == NULL || CurrentPin->Type() != LIB_PIN_T )
return; return;
if( CurrentPin->m_Flags & IS_NEW ) if( CurrentPin->IsNew() )
delete CurrentPin; delete CurrentPin;
else else
parent->RestoreComponent(); parent->RestoreComponent();
......
...@@ -602,9 +602,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem ) ...@@ -602,9 +602,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
/* save old text in undo list */ /* save old text in undo list */
if( g_ItemToUndoCopy if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == Type() ) && !IsNew() )
&& ( g_ItemToUndoCopy->Type() == Type() )
&& ( ( m_Flags & IS_NEW ) == 0 ) )
{ {
/* restore old values and save new ones */ /* restore old values and save new ones */
SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy ); SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
......
...@@ -325,7 +325,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem ) ...@@ -325,7 +325,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
/* save old text in undo list */ /* save old text in undo list */
if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) ) if( g_ItemToUndoCopy && !IsNew() )
{ {
/* restore old values and save new ones */ /* restore old values and save new ones */
SwapData( (SCH_TEXT*) g_ItemToUndoCopy ); SwapData( (SCH_TEXT*) g_ItemToUndoCopy );
......
...@@ -159,74 +159,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -159,74 +159,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() ); HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() );
break; break;
case ID_HIERARCHY_PUSH_POP_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Push/Pop Hierarchy" ) );
break;
case ID_NOCONN_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add NoConnect Flag" ) );
break;
case ID_WIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Wire" ) );
break;
case ID_BUS_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Bus" ) );
break;
case ID_LINE_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Lines" ) );
break;
case ID_JUNCTION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Junction" ) );
break;
case ID_LABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Label" ) );
break;
case ID_GLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Global label" ) );
break;
case ID_HIERLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchical label" ) );
break;
case ID_TEXT_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
break;
case ID_WIRETOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Wire to Bus entry" ) );
break;
case ID_BUSTOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Bus to Bus entry" ) );
break;
case ID_SHEET_SYMBOL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Sheet" ) );
break;
case ID_SHEET_LABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add PinSheet" ) );
break;
case ID_IMPORT_HLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Import PinSheet" ) );
break;
case ID_COMPONENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Component" ) );
break;
case ID_PLACE_POWER_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Power" ) );
break;
case ID_POPUP_SCH_ENTRY_SELECT_SLASH: case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' ); SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' );
...@@ -338,10 +270,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -338,10 +270,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
break; break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_SCH_END_SHEET: case ID_POPUP_SCH_END_SHEET:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
screen->GetCurItem()->Place( this, &dc ); screen->GetCurItem()->Place( this, &dc );
...@@ -399,7 +327,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -399,7 +327,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_CMP_REQUEST: case ID_POPUP_SCH_MOVE_CMP_REQUEST:
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) or a hierachical sheet // component, like Field, text..) or a hierarchical sheet
// or a label // or a label
if( (screen->GetCurItem()->Type() != SCH_COMPONENT_T) if( (screen->GetCurItem()->Type() != SCH_COMPONENT_T)
&& (screen->GetCurItem()->Type() != SCH_LABEL_T) && (screen->GetCurItem()->Type() != SCH_LABEL_T)
...@@ -729,8 +657,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -729,8 +657,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
SetToolbars();
} }
...@@ -805,3 +731,104 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent ) ...@@ -805,3 +731,104 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
} }
} }
void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
// Stop the current command and deselect the current tool.
DrawPanel->EndMouseCapture( ID_SCH_NO_TOOL, DrawPanel->GetDefaultCursor() );
switch( id )
{
case ID_SCH_NO_TOOL:
SetToolID( id, DrawPanel->GetDefaultCursor(), _( "No tool selected" ) );
break;
case ID_HIERARCHY_PUSH_POP_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Descend or ascend hierarchy" ) );
break;
case ID_NOCONN_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add no connect" ) );
break;
case ID_WIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire" ) );
break;
case ID_BUS_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus" ) );
break;
case ID_LINE_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add lines" ) );
break;
case ID_JUNCTION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add junction" ) );
break;
case ID_LABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add label" ) );
break;
case ID_GLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add global label" ) );
break;
case ID_HIERLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add hierarchical label" ) );
break;
case ID_TEXT_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_WIRETOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire to bus entry" ) );
break;
case ID_BUSTOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus to bus entry" ) );
break;
case ID_SHEET_SYMBOL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet" ) );
break;
case ID_SHEET_LABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet pins" ) );
break;
case ID_IMPORT_HLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Import sheet pins" ) );
break;
case ID_SCH_PLACE_COMPONENT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add component" ) );
break;
case ID_PLACE_POWER_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add power" ) );
break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
default:
m_itemToRepeat = NULL;
}
}
void SCH_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
{
if( m_ID_current_state == 0 )
m_ID_current_state = ID_SCH_NO_TOOL;
if( aEvent.GetEventObject() == m_VToolBar )
aEvent.Check( m_ID_current_state == aEvent.GetId() );
}
...@@ -427,7 +427,6 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event ) ...@@ -427,7 +427,6 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
OnModify(); OnModify();
SetSheetNumberAndCount(); SetSheetNumberAndCount();
ReCreateHToolbar(); ReCreateHToolbar();
SetToolbars();
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh(); DrawPanel->Refresh();
...@@ -453,7 +452,6 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event ) ...@@ -453,7 +452,6 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
OnModify(); OnModify();
SetSheetNumberAndCount(); SetSheetNumberAndCount();
ReCreateHToolbar(); ReCreateHToolbar();
SetToolbars();
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh(); DrawPanel->Refresh();
......
...@@ -57,7 +57,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -57,7 +57,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File )
EVT_TOOL( ID_SAVE_PROJECT, SCH_EDIT_FRAME::Save_File ) EVT_TOOL( ID_SAVE_PROJECT, SCH_EDIT_FRAME::Save_File )
EVT_MENU( wxID_PRINT, SCH_EDIT_FRAME::OnPrint )
EVT_MENU( ID_GEN_PLOT_PS, SCH_EDIT_FRAME::ToPlot_PS ) EVT_MENU( ID_GEN_PLOT_PS, SCH_EDIT_FRAME::ToPlot_PS )
EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL ) EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL )
EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print ) EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print )
...@@ -71,8 +70,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -71,8 +70,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_CONFIG_REQ, SCH_EDIT_FRAME::InstallConfigFrame ) EVT_MENU( ID_CONFIG_REQ, SCH_EDIT_FRAME::InstallConfigFrame )
EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config ) EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config ) EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
ID_PREFERENCES_HOTKEY_END,
SCH_EDIT_FRAME::Process_Config ) SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig ) EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig )
...@@ -80,7 +78,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -80,7 +78,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, SCH_EDIT_FRAME::SetLanguage ) EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, SCH_EDIT_FRAME::SetLanguage )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, SCH_EDIT_FRAME::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, SCH_EDIT_FRAME::OnZoom )
EVT_TOOL( ID_TO_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor ) EVT_TOOL( ID_TO_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor )
EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer ) EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
...@@ -102,16 +100,14 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -102,16 +100,14 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials ) EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems ) EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadStuffFile ) EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadStuffFile )
EVT_TOOL( ID_COMPONENT_BUTT, SCH_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, EDA_DRAW_FRAME::GetKicadAbout ) EVT_MENU( ID_KICAD_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
// Tools and buttons for vertical toolbar. // Tools and buttons for vertical toolbar.
EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand ) EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
ID_SCHEMATIC_VERTICAL_TOOLBAR_END, SCH_EDIT_FRAME::OnSelectTool )
SCH_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand ) EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE, EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
...@@ -128,15 +124,12 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -128,15 +124,12 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected ) EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected )
EVT_UPDATE_UI( wxID_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected ) EVT_UPDATE_UI( wxID_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected )
EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste ) EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
EVT_UPDATE_UI( wxID_UNDO, SCH_EDIT_FRAME::OnUpdateSchematicUndo )
EVT_UPDATE_UI( wxID_REDO, SCH_EDIT_FRAME::OnUpdateSchematicRedo )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, SCH_EDIT_FRAME::OnUpdateGrid )
EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, SCH_EDIT_FRAME::OnUpdateSelectCursor )
EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins ) EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation ) EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
ID_TB_OPTIONS_SELECT_UNIT_INCH,
SCH_EDIT_FRAME::OnUpdateUnits ) SCH_EDIT_FRAME::OnUpdateUnits )
EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
SCH_EDIT_FRAME::OnUpdateSelectTool )
/* Search dialog events. */ /* Search dialog events. */
EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose ) EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
...@@ -172,6 +165,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, ...@@ -172,6 +165,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr;
m_dlgFindReplace = NULL; m_dlgFindReplace = NULL;
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
m_ID_current_state = ID_SCH_NO_TOOL;
CreateScreens(); CreateScreens();
...@@ -452,6 +446,7 @@ void SCH_EDIT_FRAME::OnModify( ) ...@@ -452,6 +446,7 @@ void SCH_EDIT_FRAME::OnModify( )
// >> change all sheets. // >> change all sheets.
// I believe all sheets in a project must have the same date // I believe all sheets in a project must have the same date
SCH_SCREEN* screen = s_list.GetFirst(); SCH_SCREEN* screen = s_list.GetFirst();
for( ; screen != NULL; screen = s_list.GetNext() ) for( ; screen != NULL; screen = s_list.GetNext() )
screen->m_Date = date; screen->m_Date = date;
} }
...@@ -466,76 +461,36 @@ void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event ) ...@@ -466,76 +461,36 @@ void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ); bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
event.Enable( enable ); event.Enable( enable );
m_HToolBar->EnableTool( wxID_CUT, enable );
m_HToolBar->EnableTool( wxID_COPY, enable );
} }
void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
{ {
event.Enable( m_blockItems.GetCount() > 0 ); event.Enable( m_blockItems.GetCount() > 0 );
m_HToolBar->EnableTool( wxID_PASTE, m_blockItems.GetCount() > 0 );
}
void SCH_EDIT_FRAME::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
{
if( GetScreen() )
event.Enable( GetScreen()->GetUndoCommandCount() > 0 );
} }
void SCH_EDIT_FRAME::OnUpdateSchematicRedo( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
{
if( GetScreen() )
event.Enable( GetScreen()->GetRedoCommandCount() > 0 );
}
void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& event )
{ {
wxString tool_tip = g_HVLines ? wxString tool_tip = g_HVLines ?
_( "Draw wires and buses in any direction" ) : _( "Draw wires and buses in any direction" ) :
_( "Draw horizontal and vertical wires and buses only" ); _( "Draw horizontal and vertical wires and buses only" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, g_HVLines ); aEvent.Check( g_HVLines );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip ); m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip );
} }
void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
{ {
wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) : wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) :
_( "Show hidden pins" ); _( "Show hidden pins" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, m_ShowAllPins ); aEvent.Check( m_ShowAllPins );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip ); m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
} }
void SCH_EDIT_FRAME::OnUpdateSelectCursor( wxUpdateUIEvent& event )
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_CursorShape );
}
void SCH_EDIT_FRAME::OnUpdateUnits( wxUpdateUIEvent& event )
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, g_UserUnit == MILLIMETRES );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, g_UserUnit == INCHES );
DisplayUnitsMsg();
}
void SCH_EDIT_FRAME::OnUpdateGrid( wxUpdateUIEvent& event )
{
wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, IsGridVisible() );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
}
void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event )
{ {
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this ); DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
...@@ -630,10 +585,7 @@ void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event ) ...@@ -630,10 +585,7 @@ void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) ); fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
if( fn != wxEmptyString ) if( fn != wxEmptyString )
{
LoadOneEEProject( fn, false ); LoadOneEEProject( fn, false );
SetToolbars();
}
} }
...@@ -724,10 +676,7 @@ void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event ) ...@@ -724,10 +676,7 @@ void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
Close( true ); Close( true );
} }
/**
* Function SetLanguage
* called on a language menu selection
*/
void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event ) void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
{ {
EDA_BASE_FRAME::SetLanguage( event ); EDA_BASE_FRAME::SetLanguage( event );
...@@ -757,8 +706,6 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event ) ...@@ -757,8 +706,6 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
} }
/* Creates the SVG print file for the current edited component.
*/
void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
{ {
DIALOG_SVG_PRINT frame( this ); DIALOG_SVG_PRINT frame( this );
......
...@@ -256,7 +256,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) ...@@ -256,7 +256,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
if( sheet == NULL ) if( sheet == NULL )
return; return;
if( sheet->m_Flags & IS_NEW ) if( sheet->IsNew() )
{ {
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
SAFE_DELETE( sheet ); SAFE_DELETE( sheet );
...@@ -312,7 +312,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC ) ...@@ -312,7 +312,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
{ {
if( aSheet == NULL || aSheet->m_Flags & IS_NEW ) if( aSheet == NULL || aSheet->IsNew() )
return; return;
if( aSheet->Type() != SCH_SHEET_T ) if( aSheet->Type() != SCH_SHEET_T )
...@@ -340,7 +340,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -340,7 +340,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo if( aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = DuplicateStruct( aSheet, true ); g_ItemToUndoCopy = DuplicateStruct( aSheet, true );
...@@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CrossHairOn( aDC ); DrawPanel->CrossHairOn( aDC );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo if( !aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = DuplicateStruct( aSheet, true ); g_ItemToUndoCopy = DuplicateStruct( aSheet, true );
......
...@@ -40,7 +40,7 @@ static void ExitPinSheet( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -40,7 +40,7 @@ static void ExitPinSheet( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( SheetLabel == NULL ) if( SheetLabel == NULL )
return; return;
if( SheetLabel->m_Flags & IS_NEW ) if( SheetLabel->IsNew() )
{ {
SheetLabel->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode ); SheetLabel->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
SAFE_DELETE( SheetLabel ); SAFE_DELETE( SheetLabel );
......
...@@ -35,52 +35,37 @@ void LIB_EDIT_FRAME::ReCreateVToolbar() ...@@ -35,52 +35,37 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false ); m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
wxBitmap( cursor_xpm ),
_( "Deselect current tool" ), wxITEM_CHECK ); _( "Deselect current tool" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, wxBitmap( pin_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString,
wxBitmap( pin_xpm ),
HELP_ADD_PIN, wxITEM_CHECK ); HELP_ADD_PIN, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString, wxBitmap( add_text_xpm ),
wxBitmap( add_text_xpm ),
HELP_ADD_BODYTEXT, wxITEM_CHECK ); HELP_ADD_BODYTEXT, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString, wxBitmap( add_rectangle_xpm ),
wxBitmap( add_rectangle_xpm ),
HELP_ADD_BODYRECT, wxITEM_CHECK ); HELP_ADD_BODYRECT, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString, wxBitmap( add_circle_xpm ),
wxBitmap( add_circle_xpm ),
HELP_ADD_BODYCIRCLE, wxITEM_CHECK ); HELP_ADD_BODYCIRCLE, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString, wxBitmap( add_arc_xpm ),
wxBitmap( add_arc_xpm ),
HELP_ADD_BODYARC, wxITEM_CHECK ); HELP_ADD_BODYARC, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString, wxBitmap( add_polygon_xpm ),
wxBitmap( add_polygon_xpm ),
HELP_ADD_BODYPOLYGON, wxITEM_CHECK ); HELP_ADD_BODYPOLYGON, wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString, wxBitmap( anchor_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString,
wxBitmap( anchor_xpm ),
_( "Move part anchor" ), wxITEM_CHECK ); _( "Move part anchor" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString, wxBitmap( import_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString,
wxBitmap( import_xpm ),
_( "Import existing drawings" ), wxITEM_CHECK ); _( "Import existing drawings" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString, wxBitmap( export_xpm ),
wxBitmap( export_xpm ),
_( "Export current drawing" ), wxITEM_CHECK ); _( "Export current drawing" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString,
wxBitmap( delete_body_xpm ),
HELP_DELETE_ITEMS, wxITEM_CHECK ); HELP_DELETE_ITEMS, wxITEM_CHECK );
m_VToolBar->Realize(); m_VToolBar->Realize();
......
This diff is collapsed.
...@@ -49,7 +49,7 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME ) ...@@ -49,7 +49,7 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
LIB_VIEW_FRAME::Process_Special_Functions ) LIB_VIEW_FRAME::Process_Special_Functions )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, LIB_VIEW_FRAME::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, LIB_VIEW_FRAME::OnZoom )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
LIB_VIEW_FRAME::ExportToSchematicLibraryPart ) LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER, EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
......
...@@ -7,11 +7,6 @@ ...@@ -7,11 +7,6 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "gerbview.h" #include "gerbview.h"
GERBER_DRAW_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
{
return Locate( CURSEUR_OFF_GRILLE );
}
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{ {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* Process the command triggered by the left button of the mouse when a tool /* Process the command triggered by the left button of the mouse when a tool
* is already selected. * is already selected.
*/ */
void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{ {
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
...@@ -36,7 +36,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -36,7 +36,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else else
{ {
DrawStruct = GerberGeneralLocateAndDisplay(); DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
GetScreen()->SetCurItem( DrawStruct ); GetScreen()->SetCurItem( DrawStruct );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
{ {
...@@ -50,14 +50,13 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -50,14 +50,13 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case 0: case 0:
break; case ID_GERBVIEW_NO_TOOL:
case ID_NO_SELECT_BUTT:
break; break;
case ID_GERBVIEW_DELETE_ITEM_BUTT: case ID_GERBVIEW_DELETE_ITEM_BUTT:
DrawStruct = GerberGeneralLocateAndDisplay(); DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
/* TODO: /* TODO:
...@@ -132,7 +131,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -132,7 +131,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
ClearMsgPanel(); ClearMsgPanel();
break; break;
case ID_NO_SELECT_BUTT: case ID_GERBVIEW_NO_TOOL:
SetToolID( 0, 0, wxEmptyString ); SetToolID( 0, 0, wxEmptyString );
break; break;
...@@ -209,14 +208,12 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -209,14 +208,12 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
wxMessageBox( wxT( "WinEDA_GerberFrame::Process_Special_Functions error" ) ); wxMessageBox( wxT( "WinEDA_GerberFrame::Process_Special_Functions error" ) );
break; break;
} }
SetToolbars();
} }
/* Called on a double click of left mouse button. /* Called on a double click of left mouse button.
*/ */
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
{ {
// Currently: no nothing // Currently: no nothing
} }
...@@ -53,9 +53,9 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) ...@@ -53,9 +53,9 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
{ {
setActiveLayer(origLayer+1); setActiveLayer(origLayer+1);
Erase_Current_Layer( false ); Erase_Current_Layer( false );
if( !LoadGerberFiles( wxEmptyString ) ) if( !LoadGerberFiles( wxEmptyString ) )
setActiveLayer(origLayer); setActiveLayer( origLayer );
SetToolbars();
} }
else else
{ {
......
...@@ -29,7 +29,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame ) ...@@ -29,7 +29,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize ) EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_GerberFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, WinEDA_GerberFrame::OnZoom )
EVT_TOOL( wxID_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( wxID_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
...@@ -51,8 +51,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame ) ...@@ -51,8 +51,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
// menu Preferences // menu Preferences
EVT_MENU( ID_CONFIG_REQ, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_CONFIG_REQ, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_CONFIG_SAVE, WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
ID_PREFERENCES_HOTKEY_END,
WinEDA_GerberFrame::Process_Config ) WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
...@@ -86,7 +85,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame ) ...@@ -86,7 +85,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
// Vertical toolbar: // Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_GERBVIEW_NO_TOOL, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
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,
...@@ -103,15 +102,30 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame ) ...@@ -103,15 +102,30 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_0, WinEDA_GerberFrame::OnSelectDisplayMode ) EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_1, WinEDA_GerberFrame::OnSelectDisplayMode ) WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_2, WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, WinEDA_GerberFrame::OnUpdateFlashedItemsDrawMode )
const wxString& title, EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, WinEDA_GerberFrame::OnUpdateLinesDrawMode )
const wxPoint& pos, EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
const wxSize& size, WinEDA_GerberFrame::OnUpdatePolygonsDrawMode )
long style ) : EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnUpdateShowDCodes )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
WinEDA_GerberFrame::OnUpdateShowLayerManager )
EVT_UPDATE_UI( ID_TOOLBARH_GERBER_SELECT_TOOL, WinEDA_GerberFrame::OnUpdateSelectDCode )
EVT_UPDATE_UI( ID_TOOLBARH_GERBVIEW_SELECT_LAYER, WinEDA_GerberFrame::OnUpdateLayerSelectBox )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
WinEDA_GerberFrame::OnUpdateDrawMode )
END_EVENT_TABLE()
WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) :
WinEDA_BasePcbFrame( father, GERBER_FRAME, title, pos, size, style ) WinEDA_BasePcbFrame( father, GERBER_FRAME, title, pos, size, style )
{ {
m_FrameName = wxT( "GerberFrame" ); m_FrameName = wxT( "GerberFrame" );
...@@ -204,8 +218,6 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father ...@@ -204,8 +218,6 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
SetToolbars();
m_auimgr.Update(); m_auimgr.Update();
} }
...@@ -579,8 +591,6 @@ void WinEDA_GerberFrame::OnSelectDisplayMode( wxCommandEvent& event ) ...@@ -579,8 +591,6 @@ void WinEDA_GerberFrame::OnSelectDisplayMode( wxCommandEvent& event )
break; break;
} }
SetToolbars();
if( GetDisplayMode() != oldMode ) if( GetDisplayMode() != oldMode )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -18,6 +18,7 @@ enum gerbview_ids ...@@ -18,6 +18,7 @@ enum gerbview_ids
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER, ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
ID_GERBVIEW_NO_TOOL,
ID_GERBVIEW_DELETE_ITEM_BUTT, ID_GERBVIEW_DELETE_ITEM_BUTT,
ID_GERBVIEW_GLOBAL_DELETE, ID_GERBVIEW_GLOBAL_DELETE,
ID_GERBVIEW_OPTIONS_SETUP, ID_GERBVIEW_OPTIONS_SETUP,
......
...@@ -10,27 +10,28 @@ ...@@ -10,27 +10,28 @@
/* localize a gerber item and return a pointer to it. /* localize a gerber item and return a pointer to it.
* Display info about this item * Display info about this item
*/ */
GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc ) GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( const wxPoint& aPosition, int aTypeloc )
{ {
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
wxPoint ref; wxPoint ref = aPosition;
bool found = false; bool found = false;
if( aTypeloc == CURSEUR_ON_GRILLE ) if( aTypeloc == CURSEUR_ON_GRILLE )
ref = GetScreen()->GetCrossHairPosition(); ref = GetScreen()->GetNearestGridPosition( ref );
else
ref = GetScreen()->m_MousePosition;
int layer = GetScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
// Search first on active layer // Search first on active layer
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
GERBER_DRAW_ITEM* gerb_item = NULL; GERBER_DRAW_ITEM* gerb_item = NULL;
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
gerb_item = (GERBER_DRAW_ITEM*) item; gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer()!= layer ) if( gerb_item->GetLayer()!= layer )
continue; continue;
if( gerb_item->HitTest( ref ) ) if( gerb_item->HitTest( ref ) )
{ {
found = true; found = true;
...@@ -41,9 +42,11 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc ) ...@@ -41,9 +42,11 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
if( !found ) // Search on all layers if( !found ) // Search on all layers
{ {
item = GetBoard()->m_Drawings; item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
gerb_item = (GERBER_DRAW_ITEM*) item; gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( ref ) ) if( gerb_item->HitTest( ref ) )
{ {
found = true; found = true;
...@@ -51,10 +54,12 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc ) ...@@ -51,10 +54,12 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
} }
} }
} }
if( found ) if( found )
{ {
gerb_item->DisplayInfo( this ); gerb_item->DisplayInfo( this );
return gerb_item; return gerb_item;
} }
return NULL; return NULL;
} }
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
/* Prepare the right-click pullup menu. /* Prepare the right-click pullup menu.
* The menu already has a list of zoom commands. * The menu already has a list of zoom commands.
*/ */
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, bool WinEDA_GerberFrame::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
wxMenu* PopMenu )
{ {
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
...@@ -27,7 +26,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, ...@@ -27,7 +26,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos,
// Simple location of elements where possible. // Simple location of elements where possible.
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) ) if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{ {
DrawStruct = GerberGeneralLocateAndDisplay(); DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
} }
// If command in progress, end command. // If command in progress, end command.
......
...@@ -38,32 +38,6 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -38,32 +38,6 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID:
SetGridVisibility( state );
DrawPanel->Refresh( TRUE );
break;
case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UserUnit = MILLIMETRES;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
g_UserUnit = INCHES;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = state;
DrawPanel->Refresh( TRUE );
break;
case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH: case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH:
if( state ) if( state )
{ {
...@@ -73,21 +47,21 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -73,21 +47,21 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
DisplayOpt.DisplayPadFill = m_DisplayPadFill = true; DisplayOpt.DisplayPadFill = m_DisplayPadFill = true;
} }
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_LINES_SKETCH: case ID_TB_OPTIONS_SHOW_LINES_SKETCH:
if(state ) if(state )
{ {
m_DisplayPcbTrackFill = FALSE; m_DisplayPcbTrackFill = false;
DisplayOpt.DisplayPcbTrackFill = FALSE; DisplayOpt.DisplayPcbTrackFill = false;
} }
else else
{ {
m_DisplayPcbTrackFill = TRUE; m_DisplayPcbTrackFill = true;
DisplayOpt.DisplayPcbTrackFill = TRUE; DisplayOpt.DisplayPcbTrackFill = true;
} }
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH: case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
...@@ -95,12 +69,12 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -95,12 +69,12 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
g_DisplayPolygonsModeSketch = 1; g_DisplayPolygonsModeSketch = 1;
else else
g_DisplayPolygonsModeSketch = 0; g_DisplayPolygonsModeSketch = 0;
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_DCODES: case ID_TB_OPTIONS_SHOW_DCODES:
SetElementVisibility( DCODES_VISIBLE, state ); SetElementVisibility( DCODES_VISIBLE, state );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR: case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
...@@ -111,11 +85,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -111,11 +85,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, DisplayError( this, wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
break; break;
} }
SetToolbars();
} }
This diff is collapsed.
...@@ -46,10 +46,10 @@ protected: ...@@ -46,10 +46,10 @@ protected:
public: public:
WinEDALayerChoiceBox* m_SelLayerBox; WinEDALayerChoiceBox* m_SelLayerBox;
DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to hightlight. DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to highlight.
wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about
// gerber data (format..) // gerber data (format..)
wxArrayString m_DCodesList; // an array string containint all decodes Id (10 to 999) wxArrayString m_DCodesList; // an array string containing all decodes Id (10 to 999)
private: private:
int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn: int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn:
...@@ -77,7 +77,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title, ...@@ -77,7 +77,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
* Function ReportMessage * Function ReportMessage
* Add a message (a string) in message list * Add a message (a string) in message list
* for instance when reading a Gerber file * for instance when reading a Gerber file
* @param aMessage = the straing to add in list * @param aMessage = the string to add in list
*/ */
void ReportMessage( const wxString aMessage ) void ReportMessage( const wxString aMessage )
{ {
...@@ -121,7 +121,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title, ...@@ -121,7 +121,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
/** /**
* Function SetGridVisibility() , virtual * Function SetGridVisibility() , virtual
* It may be overloaded by derived classes * It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration. * if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown * @param aVisible = true if the grid must be shown
*/ */
virtual void SetGridVisibility( bool aVisible ); virtual void SetGridVisibility( bool aVisible );
...@@ -277,16 +277,23 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title, ...@@ -277,16 +277,23 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay(); GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay();
GERBER_DRAW_ITEM* Locate( int typeloc ); GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
void SetToolbars();
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void InstallConfigFrame( const wxPoint& pos ); void InstallConfigFrame( const wxPoint& pos );
void InstallGerberOptionsDialog( wxCommandEvent& event ); void InstallGerberOptionsDialog( wxCommandEvent& event );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
/* handlers for block commands */ /* handlers for block commands */
virtual int ReturnBlockCommand( int key ); virtual int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC ); virtual void HandleBlockPlace( wxDC* DC );
......
...@@ -63,6 +63,7 @@ class BASE_SCREEN : public EDA_ITEM ...@@ -63,6 +63,7 @@ class BASE_SCREEN : public EDA_ITEM
EDA_ITEM* m_CurrentItem; ///< Currently selected object EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection. GRID_TYPE m_Grid; ///< Current grid selection.
wxPoint m_scrollCenter; ///< Current scroll center point in logical units. wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
/** /**
* The cross hair position in logical (drawing) units. The cross hair is not the cursor * The cross hair position in logical (drawing) units. The cross hair is not the cursor
...@@ -74,7 +75,6 @@ class BASE_SCREEN : public EDA_ITEM ...@@ -74,7 +75,6 @@ class BASE_SCREEN : public EDA_ITEM
public: public:
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */ wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid) wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units. (coordinates from last reset position)*/ * in user units. (coordinates from last reset position)*/
...@@ -362,6 +362,8 @@ public: ...@@ -362,6 +362,8 @@ public:
*/ */
void GetGrids( GRIDS& aList ); void GetGrids( GRIDS& aList );
void SetMousePosition( const wxPoint& aPosition ) { m_MousePosition = aPosition; }
/** /**
* Function RefPos * Function RefPos
* Return the reference position, coming from either the mouse position * Return the reference position, coming from either the mouse position
......
...@@ -19,7 +19,7 @@ class PCB_SCREEN; ...@@ -19,7 +19,7 @@ class PCB_SCREEN;
* Mouse capture callback function prototype. * Mouse capture callback function prototype.
*/ */
typedef void ( *MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC, typedef void ( *MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase ); const wxPoint& aPosition, bool aErase );
/** /**
* End mouse capture callback function prototype. * End mouse capture callback function prototype.
...@@ -33,7 +33,7 @@ private: ...@@ -33,7 +33,7 @@ private:
int m_cursor; ///< Current mouse cursor shape id. int m_cursor; ///< Current mouse cursor shape id.
int m_defaultCursor; ///< The default mouse cursor shape id. int m_defaultCursor; ///< The default mouse cursor shape id.
bool m_showCrossHair; ///< Indicate if cross hair is to be shown. bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
int m_cursorLevel; // Index for cursor redraw in XOR mode. int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
public: public:
EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the
...@@ -221,7 +221,7 @@ public: ...@@ -221,7 +221,7 @@ public:
*/ */
void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL ); void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL );
void ReDraw( wxDC* DC, bool erasebg = TRUE ); void ReDraw( wxDC* aDC, bool aEraseBackground = true );
/** /**
* Function RefreshDrawingRect * Function RefreshDrawingRect
......
...@@ -180,13 +180,12 @@ enum main_id ...@@ -180,13 +180,12 @@ enum main_id
ID_SHEET_SET, ID_SHEET_SET,
ID_TO_LIBRARY, ID_TO_LIBRARY,
ID_NO_SELECT_BUTT,
ID_COMPONENT_BUTT, ID_COMPONENT_BUTT,
ID_ZOOM_IN, ID_ZOOM_IN,
ID_ZOOM_OUT, ID_ZOOM_OUT,
ID_ZOOM_REDRAW,
ID_ZOOM_PAGE, ID_ZOOM_PAGE,
ID_ZOOM_REDRAW,
/* Panning command event IDs. */ /* Panning command event IDs. */
ID_PAN_UP, ID_PAN_UP,
...@@ -204,21 +203,23 @@ enum main_id ...@@ -204,21 +203,23 @@ enum main_id
/* Command IDs common to PCBNew and GerbView. */ /* Command IDs common to PCBNew and GerbView. */
ID_PCB_DISPLAY_FOOTPRINT_DOC, ID_PCB_DISPLAY_FOOTPRINT_DOC,
ID_TB_OPTIONS_START,
ID_TB_OPTIONS_DRC_OFF,
ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_MM,
ID_TB_OPTIONS_SELECT_UNIT_INCH, ID_TB_OPTIONS_SELECT_UNIT_INCH,
ID_TB_OPTIONS_SELECT_CURSOR, ID_TB_OPTIONS_SELECT_CURSOR,
ID_TB_OPTIONS_SHOW_POLAR_COORD, ID_TB_OPTIONS_SHOW_POLAR_COORD,
ID_TB_OPTIONS_SHOW_GRID, ID_TB_OPTIONS_SHOW_GRID,
ID_TB_OPTIONS_SHOW_RATSNEST,
ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
ID_TB_OPTIONS_AUTO_DEL_TRACK,
ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES,
ID_TB_OPTIONS_SHOW_ZONES_DISABLE, ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
ID_TB_OPTIONS_START,
ID_TB_OPTIONS_DRC_OFF,
ID_TB_OPTIONS_SHOW_RATSNEST,
ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
ID_TB_OPTIONS_AUTO_DEL_TRACK,
ID_TB_OPTIONS_HIDDEN_PINS, ID_TB_OPTIONS_HIDDEN_PINS,
ID_TB_OPTIONS_BUS_WIRES_ORIENT, ID_TB_OPTIONS_BUS_WIRES_ORIENT,
ID_TB_OPTIONS_SHOW_PADS_SKETCH, ID_TB_OPTIONS_SHOW_PADS_SKETCH,
......
...@@ -50,7 +50,6 @@ class GENERAL_COLLECTORS_GUIDE; ...@@ -50,7 +50,6 @@ class GENERAL_COLLECTORS_GUIDE;
class WinEDA_BasePcbFrame : public EDA_DRAW_FRAME class WinEDA_BasePcbFrame : public EDA_DRAW_FRAME
{ {
public: public:
bool m_DisplayPadFill; // How show pads bool m_DisplayPadFill; // How show pads
bool m_DisplayViaFill; // How show vias bool m_DisplayViaFill; // How show vias
bool m_DisplayPadNum; // show pads numbers bool m_DisplayPadNum; // show pads numbers
...@@ -69,6 +68,9 @@ protected: ...@@ -69,6 +68,9 @@ protected:
BOARD* m_Pcb; BOARD* m_Pcb;
GENERAL_COLLECTOR* m_Collector; GENERAL_COLLECTOR* m_Collector;
void updateGridSelectBox();
void updateZoomSelectBox();
public: public:
WinEDA_BasePcbFrame( wxWindow* father, int idtype, WinEDA_BasePcbFrame( wxWindow* father, int idtype,
const wxString& title, const wxString& title,
...@@ -494,6 +496,15 @@ public: ...@@ -494,6 +496,15 @@ public:
*/ */
virtual void SaveSettings(); virtual void SaveSettings();
void OnTogglePolarCoords( wxCommandEvent& aEvent );
void OnTogglePadDrawMode( wxCommandEvent& aEvent );
/* User interface update event handlers. */
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
void OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
...@@ -107,6 +107,7 @@ public: ...@@ -107,6 +107,7 @@ public:
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void OnColorConfig( wxCommandEvent& aEvent ); void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition ); void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
...@@ -426,13 +427,9 @@ private: ...@@ -426,13 +427,9 @@ private:
/* User interface update event handlers. */ /* User interface update event handlers. */
void OnUpdateBlockSelected( wxUpdateUIEvent& event ); void OnUpdateBlockSelected( wxUpdateUIEvent& event );
void OnUpdatePaste( wxUpdateUIEvent& event ); void OnUpdatePaste( wxUpdateUIEvent& event );
void OnUpdateSchematicUndo( wxUpdateUIEvent& event );
void OnUpdateSchematicRedo( wxUpdateUIEvent& event );
void OnUpdateGrid( wxUpdateUIEvent& event );
void OnUpdateUnits( wxUpdateUIEvent& event );
void OnUpdateSelectCursor( wxUpdateUIEvent& event );
void OnUpdateHiddenPins( wxUpdateUIEvent& event ); void OnUpdateHiddenPins( wxUpdateUIEvent& event );
void OnUpdateBusOrientation( wxUpdateUIEvent& event ); void OnUpdateBusOrientation( wxUpdateUIEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
/** /**
* Function SetLanguage * Function SetLanguage
......
...@@ -53,11 +53,15 @@ class WinEDA_PcbFrame : public WinEDA_BasePcbFrame ...@@ -53,11 +53,15 @@ class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
{ {
friend class PCB_LAYER_WIDGET; friend class PCB_LAYER_WIDGET;
void updateTraceWidthSelectBox();
void updateViaSizeSelectBox();
void updateDesignRulesSelectBoxes();
protected: protected:
PCB_LAYER_WIDGET* m_Layers; PCB_LAYER_WIDGET* m_Layers;
DRC* m_drc; ///< the DRC controller, see drc.cpp DRC* m_drc; ///< the DRC controller, see drc.cpp
PARAM_CFG_ARRAY m_projectFileParams; ///< List of PCBNew project file settings. PARAM_CFG_ARRAY m_projectFileParams; ///< List of PCBNew project file settings.
PARAM_CFG_ARRAY m_configSettings; ///< List of PCBNew configuration settings. PARAM_CFG_ARRAY m_configSettings; ///< List of PCBNew configuration settings.
...@@ -103,6 +107,7 @@ protected: ...@@ -103,6 +107,7 @@ protected:
* <p> * <p>
* This function cannot be inline without including layer_widget.h in * This function cannot be inline without including layer_widget.h in
* here and we do not want to do that. * here and we do not want to do that.
* </p>
*/ */
void syncLayerWidget( ); void syncLayerWidget( );
...@@ -157,6 +162,20 @@ public: ...@@ -157,6 +162,20 @@ public:
void SVG_Print( wxCommandEvent& event ); void SVG_Print( wxCommandEvent& event );
// User interface update command event handlers.
void OnUpdateSave( wxUpdateUIEvent& aEvent );
void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
void OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent );
void OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent );
void OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent );
void OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateAuxilaryToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
/** /**
* Function PrintPage , virtual * Function PrintPage , virtual
* used to print a page * used to print a page
...@@ -310,6 +329,7 @@ public: ...@@ -310,6 +329,7 @@ public:
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( wxCommandEvent& event ); void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void ProcessMuWaveFunctions( wxCommandEvent& event ); void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
...@@ -379,28 +399,13 @@ public: ...@@ -379,28 +399,13 @@ public:
void PrepareLayerIndicator(); void PrepareLayerIndicator();
/**
* Function AuxiliaryToolBar_Update_UI
* update the displayed values on auxiliary horizontal toolbar
* (track width, via sizes, clearance ...
*/
void AuxiliaryToolBar_Update_UI();
/**
* Function AuxiliaryToolBar_DesignRules_Update_UI
* update the displayed values: track width, via sizes, clearance
* used when a new netclass is selected
*/
void AuxiliaryToolBar_DesignRules_Update_UI();
/* mouse functions events: */ /* mouse functions events: */
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
/** /**
* Function OnRightClick * Function OnRightClick
* populates a popup menu with the choices appropriate for the current * populates a popup menu with the choices appropriate for the current context.
*context.
* The caller will add the ZOOM menu choices afterward. * The caller will add the ZOOM menu choices afterward.
* @param aMousePos The current mouse position * @param aMousePos The current mouse position
* @param aPopMenu The menu to add to. * @param aPopMenu The menu to add to.
...@@ -417,7 +422,7 @@ public: ...@@ -417,7 +422,7 @@ public:
* @param aItemToCopy = the board item modified by the command to undo * @param aItemToCopy = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType) * @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for * @param aTransformPoint = the reference point of the transformation, for
*commands like move * commands like move
*/ */
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
UndoRedoOpType aTypeCommand, UndoRedoOpType aTypeCommand,
...@@ -430,7 +435,7 @@ public: ...@@ -430,7 +435,7 @@ public:
* @param aItemsList = the list of items modified by the command to undo * @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType) * @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for * @param aTransformPoint = the reference point of the transformation, for
*commands like move * commands like move
*/ */
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand, UndoRedoOpType aTypeCommand,
...@@ -439,13 +444,10 @@ public: ...@@ -439,13 +444,10 @@ public:
/** /**
* Function PutDataInPreviousState * Function PutDataInPreviousState
* Used in undo or redo command. * Used in undo or redo command.
* Put data pointed by List in the previous state, i.e. the state memorized * Put data pointed by List in the previous state, i.e. the state memorized by List
* by List * @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to
* undo/redo
* @param aRedoCommand = a bool: true for redo, false for undo * @param aRedoCommand = a bool: true for redo, false for undo
* @param aRebuildRatsnet = a bool: true to rebuild ratsnet (normal use), * @param aRebuildRatsnet = a bool: true to rebuild ratsnet (normal use), false
* false
* to just retrieve last state (used in abort commands that do not need to * to just retrieve last state (used in abort commands that do not need to
* rebuild ratsnest) * rebuild ratsnest)
*/ */
...@@ -554,8 +556,6 @@ public: ...@@ -554,8 +556,6 @@ public:
*/ */
void Block_Duplicate(); void Block_Duplicate();
void SetToolbars();
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
void OnConfigurePcbOptions( wxCommandEvent& aEvent ); void OnConfigurePcbOptions( wxCommandEvent& aEvent );
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent ); void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
...@@ -582,7 +582,7 @@ public: ...@@ -582,7 +582,7 @@ public:
* @param aForceFileDialog - Display the file open dialog even if aFullFileName is * @param aForceFileDialog - Display the file open dialog even if aFullFileName is
* valid if true; Default = false. * valid if true; Default = false.
* *
* @return False if file load fails or is cancelled by the user, otherwise true. * @return False if file load fails or is canceled by the user, otherwise true.
*/ */
bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false, bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
bool aForceFileDialog = false ); bool aForceFileDialog = false );
...@@ -606,8 +606,7 @@ public: ...@@ -606,8 +606,7 @@ public:
/** /**
* Function Clear_Pcb * Function Clear_Pcb
* delete all and reinitialize the current board * delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to * @param aQuery = true to prompt user for confirmation, false to initialize silently
* initialize silently
*/ */
bool Clear_Pcb( bool aQuery ); bool Clear_Pcb( bool aQuery );
...@@ -1045,13 +1044,14 @@ public: ...@@ -1045,13 +1044,14 @@ public:
* @param aNetlistFullFilename = netlist file name (*.net) * @param aNetlistFullFilename = netlist file name (*.net)
* @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found, * @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found,
* only the netlist will be used * only the netlist will be used
* @param aMessageWindow = a reference to a wxTextCtrl where to dislay messages. * @param aMessageWindow = a reference to a wxTextCtrl where to display messages.
* can be NULL * can be NULL
* @param aChangeFootprint if true, footprints that have changed in netlist will be changed * @param aChangeFootprint if true, footprints that have changed in netlist will be changed
* @param aDeleteBadTracks if true, erroneous tracks will be deleted * @param aDeleteBadTracks if true, erroneous tracks will be deleted
* @param aDeleteExtraFootprints if true, remove unlocked footprints that are not in netlist * @param aDeleteExtraFootprints if true, remove unlocked footprints that are not in netlist
* @param aSelect_By_Timestamp if true, use timestamp instead of reference to identify footprints * @param aSelect_By_Timestamp if true, use timestamp instead of reference to identify
* from components (use after reannotation of the chematic) * footprints from components (use after reannotation of the
* schematic)
* @return true if Ok * @return true if Ok
* *
* the format of the netlist is something like: * the format of the netlist is something like:
......
...@@ -283,7 +283,6 @@ public: ...@@ -283,7 +283,6 @@ public:
void EraseMsgBox(); void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event ); void Process_PageSettings( wxCommandEvent& event );
virtual void SetToolbars();
/** /**
* Function SetLanguage * Function SetLanguage
...@@ -377,6 +376,19 @@ public: ...@@ -377,6 +376,19 @@ public:
virtual void OnSelectGrid( wxCommandEvent& event ); virtual void OnSelectGrid( wxCommandEvent& event );
virtual void OnSelectZoom( wxCommandEvent& event ); virtual void OnSelectZoom( wxCommandEvent& event );
// Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
void OnToggleGridState( wxCommandEvent& aEvent );
void OnSelectUnits( wxCommandEvent& aEvent );
void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
// Update user interface event handlers shared by all applications derived from
// EDA_DRAW_FRAME.
void OnUpdateUndo( wxUpdateUIEvent& aEvent );
void OnUpdateRedo( wxUpdateUIEvent& aEvent );
void OnUpdateGrid( wxUpdateUIEvent& aEvent );
void OnUpdateUnits( wxUpdateUIEvent& aEvent );
void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
/** /**
* Function GeneralControle * Function GeneralControle
* performs application specific control using \a aDC at \a aPosition in logical units. * performs application specific control using \a aDC at \a aPosition in logical units.
......
This diff is collapsed.
...@@ -598,9 +598,6 @@ void WinEDA_PcbFrame::GetBoardFromUndoList( wxCommandEvent& event ) ...@@ -598,9 +598,6 @@ void WinEDA_PcbFrame::GetBoardFromUndoList( wxCommandEvent& event )
GetScreen()->PushCommandToRedoList( List ); GetScreen()->PushCommandToRedoList( List );
OnModify(); OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -629,9 +626,6 @@ void WinEDA_PcbFrame::GetBoardFromRedoList( wxCommandEvent& event ) ...@@ -629,9 +626,6 @@ void WinEDA_PcbFrame::GetBoardFromRedoList( wxCommandEvent& event )
GetScreen()->PushCommandToUndoList( List ); GetScreen()->PushCommandToUndoList( List );
OnModify(); OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
......
...@@ -103,7 +103,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -103,7 +103,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
scanList = GENERAL_COLLECTOR::Tracks; scanList = GENERAL_COLLECTOR::Tracks;
break; break;
case ID_COMPONENT_BUTT: case ID_PCB_MODULE_BUTT:
scanList = GENERAL_COLLECTOR::ModuleItems; scanList = GENERAL_COLLECTOR::ModuleItems;
break; break;
...@@ -376,6 +376,5 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -376,6 +376,5 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxSafeYield(); wxSafeYield();
} }
SetToolbars();
UpdateStatusBar(); /* Display new cursor coordinates */ UpdateStatusBar(); /* Display new cursor coordinates */
} }
...@@ -25,7 +25,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -25,7 +25,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
if( aTrack == NULL ) if( aTrack == NULL )
return NULL; return NULL;
if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last segment if( aTrack->IsNew() ) // Trace in progress, erase the last segment
{ {
if( g_CurrentTrackList.GetCount() > 0 ) if( g_CurrentTrackList.GetCount() > 0 )
{ {
......
...@@ -710,7 +710,6 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event ) ...@@ -710,7 +710,6 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
m_Pcb->SetCurrentNetClass( NETCLASS::Default ); m_Pcb->SetCurrentNetClass( NETCLASS::Default );
m_Parent->m_TrackAndViasSizesList_Changed = true; m_Parent->m_TrackAndViasSizesList_Changed = true;
m_Parent->AuxiliaryToolBar_Update_UI();
} }
......
...@@ -72,7 +72,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) ...@@ -72,7 +72,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
UserUnitType ii; UserUnitType ii;
DisplayOpt.DisplayPolarCood = DisplayOpt.DisplayPolarCood =
( m_PolarDisplay->GetSelection() == 0 ) ? FALSE : true; ( m_PolarDisplay->GetSelection() == 0 ) ? false : true;
ii = g_UserUnit; ii = g_UserUnit;
g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES; g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
if( ii != g_UserUnit ) if( ii != g_UserUnit )
...@@ -114,45 +114,18 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -114,45 +114,18 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_DRC_OFF: case ID_TB_OPTIONS_DRC_OFF:
Drc_On = state ? FALSE : true; Drc_On = !state;
break;
case ID_TB_OPTIONS_SHOW_GRID:
SetElementVisibility(GRID_VISIBLE, state);
DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SHOW_RATSNEST: case ID_TB_OPTIONS_SHOW_RATSNEST:
SetElementVisibility(RATSNEST_VISIBLE, state); SetElementVisibility( RATSNEST_VISIBLE, state );
DrawPanel->Refresh( ); DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST: case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
g_Show_Module_Ratsnest = state; // TODO: use the visibility list g_Show_Module_Ratsnest = state; // TODO: use the visibility list
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UserUnit = MILLIMETRES;
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UserUnit = INCHES;
m_TrackAndViasSizesList_Changed = true;
UpdateStatusBar();
ReCreateAuxiliaryToolbar();
DisplayUnitsMsg();
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = state;
break;
case ID_TB_OPTIONS_AUTO_DEL_TRACK: case ID_TB_OPTIONS_AUTO_DEL_TRACK:
g_AutoDeleteOldTrack = state; g_AutoDeleteOldTrack = state;
break; break;
...@@ -172,27 +145,8 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -172,27 +145,8 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
if( state )
{
m_DisplayPadFill = DisplayOpt.DisplayPadFill = false;
}
else
{
m_DisplayPadFill = DisplayOpt.DisplayPadFill = true;
}
DrawPanel->Refresh();
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
if( state ) m_DisplayViaFill = DisplayOpt.DisplayViaFill = !state;
{
m_DisplayViaFill = DisplayOpt.DisplayViaFill = false;
}
else
{
m_DisplayViaFill = DisplayOpt.DisplayViaFill = true;
}
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
...@@ -217,12 +171,13 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -217,12 +171,13 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
m_show_layer_manager_tools = state; m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update(); m_auimgr.Update();
if( m_show_layer_manager_tools ) if( m_show_layer_manager_tools )
GetMenuBar()->SetLabel(ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Hide &Layers Manager" ) ); _("Hide &Layers Manager" ) );
else else
GetMenuBar()->SetLabel(ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Show &Layers Manager" ) ); _("Show &Layers Manager" ) );
break; break;
default: default:
...@@ -230,6 +185,4 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -230,6 +185,4 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)" ) ); wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)" ) );
break; break;
} }
SetToolbars();
} }
...@@ -199,7 +199,7 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -199,7 +199,7 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Dimension ) if( Dimension )
{ {
if( Dimension->m_Flags & IS_NEW ) if( Dimension->IsNew() )
{ {
Dimension->Draw( Panel, DC, GR_XOR ); Dimension->Draw( Panel, DC, GR_XOR );
Dimension->DeleteStructure(); Dimension->DeleteStructure();
......
...@@ -280,7 +280,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -280,7 +280,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Edge && ( Edge->Type() == TYPE_EDGE_MODULE ) ) if( Edge && ( Edge->Type() == TYPE_EDGE_MODULE ) )
{ {
if( Edge->m_Flags & IS_NEW ) // On aborting, delete new outline. if( Edge->IsNew() ) // On aborting, delete new outline.
{ {
MODULE* Module = (MODULE*) Edge->GetParent(); MODULE* Module = (MODULE*) Edge->GetParent();
Edge->Draw( Panel, DC, GR_XOR, MoveVector ); Edge->Draw( Panel, DC, GR_XOR, MoveVector );
......
...@@ -49,8 +49,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -49,8 +49,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
case wxID_CUT: case wxID_CUT:
case wxID_COPY: case wxID_COPY:
case ID_ON_GRID_SELECT:
case ID_ON_ZOOM_SELECT:
case ID_PCB_USER_GRID_SETUP: case ID_PCB_USER_GRID_SETUP:
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
...@@ -231,66 +229,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -231,66 +229,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
InstallFindFrame( pos, &dc ); InstallFindFrame( pos, &dc );
break; break;
case ID_TRACK_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Tracks" ) );
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
{
Compile_Ratsnest( &dc, true );
}
break;
case ID_PCB_ZONES_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Zones" ) );
if( DisplayOpt.DisplayZonesMode != 0 )
DisplayInfoMessage( this, _( "Warning: Display Zone is OFF!!!" ) );
if( !g_HighLight_Status && (g_HighLight_NetCode > 0 ) )
High_Light( &dc );
break;
case ID_PCB_MIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Layer Alignment Target" ) );
break;
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Zero" ) );
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Grid Origin" ) );
break;
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Graphic" ) );
break;
case ID_PCB_ADD_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
break;
case ID_COMPONENT_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Add Modules" ) );
break;
case ID_PCB_DIMENSION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Dimension" ) );
break;
case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_PCB_HIGHLIGHT_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Net Highlight" ) );
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Local Ratsnest" ) );
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
Compile_Ratsnest( &dc, true );
break;
case ID_POPUP_CLOSE_CURRENT_TOOL: case ID_POPUP_CLOSE_CURRENT_TOOL:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
...@@ -593,10 +531,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -593,10 +531,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_PCB_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST: case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
Process_Move_Item( this, GetCurItem(), &dc ); Process_Move_Item( this, GetCurItem(), &dc );
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
...@@ -952,7 +886,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -952,7 +886,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->IsNew()) )
{ {
End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc ); End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
SetCurItem( NULL ); SetCurItem( NULL );
...@@ -961,7 +895,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -961,7 +895,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->IsNew()) )
{ {
if( End_Zone( &dc ) ) if( End_Zone( &dc ) )
SetCurItem( NULL ); SetCurItem( NULL );
...@@ -971,7 +905,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -971,7 +905,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER: case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->IsNew()) )
{ {
if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline, if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
SetCurItem( NULL ); SetCurItem( NULL );
...@@ -1060,7 +994,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -1060,7 +994,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
SetToolbars();
DrawPanel->CrossHairOn( &dc ); DrawPanel->CrossHairOn( &dc );
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
} }
...@@ -1222,7 +1155,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -1222,7 +1155,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// See if we are drawing a segment; if so, add a via? // See if we are drawing a segment; if so, add a via?
if( m_ID_current_state == ID_TRACK_BUTT && current != NULL ) if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
{ {
if( current->Type() == TYPE_TRACK && ( current->m_Flags & IS_NEW ) ) if( current->Type() == TYPE_TRACK && ( current->IsNew() ) )
{ {
// Want to set the routing layers so that it switches properly - // Want to set the routing layers so that it switches properly -
// see the implementation of Other_Layer_Route - the working // see the implementation of Other_Layer_Route - the working
...@@ -1255,3 +1188,104 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -1255,3 +1188,104 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq();
} }
void WinEDA_PcbFrame::OnSelectTool( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
if( m_ID_current_state == id )
return;
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
// Stop the current command and deselect the current tool.
DrawPanel->EndMouseCapture( ID_PCB_NO_TOOL, DrawPanel->GetDefaultCursor() );
switch( id )
{
case ID_PCB_NO_TOOL:
SetToolID( id, DrawPanel->GetDefaultCursor(), wxEmptyString );
break;
case ID_TRACK_BUTT:
if( Drc_On )
SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
else
SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
{
Compile_Ratsnest( &dc, true );
}
break;
case ID_PCB_MODULE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add module" ) );
break;
case ID_PCB_ZONES_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add zones" ) );
if( DisplayOpt.DisplayZonesMode != 0 )
DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
if( !g_HighLight_Status && (g_HighLight_NetCode > 0 ) )
High_Light( &dc );
break;
case ID_PCB_MIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
break;
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust zero" ) );
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
break;
case ID_PCB_ADD_LINE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic line" ) );
break;
case ID_PCB_ARC_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
break;
case ID_PCB_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
break;
case ID_PCB_ADD_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_COMPONENT_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Add module" ) );
break;
case ID_PCB_DIMENSION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add dimension" ) );
break;
case ID_PCB_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_PCB_HIGHLIGHT_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Highlight net" ) );
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
Compile_Ratsnest( &dc, true );
break;
}
}
...@@ -42,7 +42,7 @@ void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -42,7 +42,7 @@ void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC )
TextePcb->Draw( Panel, DC, GR_XOR ); TextePcb->Draw( Panel, DC, GR_XOR );
if( (TextePcb->m_Flags & IS_NEW) ) // If new: remove it if( TextePcb->IsNew() ) // If new: remove it
{ {
TextePcb->DeleteStructure(); TextePcb->DeleteStructure();
return; return;
...@@ -69,7 +69,7 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -69,7 +69,7 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( DrawPanel, DC, GR_OR ); TextePcb->Draw( DrawPanel, DC, GR_OR );
OnModify(); OnModify();
if( (TextePcb->m_Flags & IS_NEW) ) // If new: prepare undo command if( TextePcb->IsNew() ) // If new: prepare undo command
{ {
SaveCopyInUndoList( TextePcb, UR_NEW ); SaveCopyInUndoList( TextePcb, UR_NEW );
TextePcb->m_Flags = 0; TextePcb->m_Flags = 0;
...@@ -100,7 +100,7 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -100,7 +100,7 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
return; return;
// if it is an existing item: prepare a copy to undo/abort command // if it is an existing item: prepare a copy to undo/abort command
if( (TextePcb->m_Flags & IS_NEW) == 0 ) if( !TextePcb->IsNew() )
s_TextCopy.Copy( TextePcb ); s_TextCopy.Copy( TextePcb );
TextePcb->Draw( DrawPanel, DC, GR_XOR ); TextePcb->Draw( DrawPanel, DC, GR_XOR );
......
...@@ -88,7 +88,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) ...@@ -88,7 +88,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
if( Segment == NULL ) if( Segment == NULL )
return; return;
if( Segment->m_Flags & IS_NEW ) // Trace in progress. if( Segment->IsNew() ) // Trace in progress.
{ {
/* Delete current segment. */ /* Delete current segment. */
DisplayOpt.DisplayDrawItems = SKETCH; DisplayOpt.DisplayDrawItems = SKETCH;
...@@ -175,7 +175,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -175,7 +175,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
return; return;
} }
if( Segment->m_Flags & IS_NEW ) if( Segment->IsNew() )
{ {
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false ); Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
Segment ->DeleteStructure(); Segment ->DeleteStructure();
......
...@@ -104,7 +104,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -104,7 +104,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM ); setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM );
UpdateStatusBar(); UpdateStatusBar();
SetToolbars();
return true; return true;
} }
...@@ -257,7 +256,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -257,7 +256,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
via->DisplayInfo( this ); via->DisplayInfo( this );
UpdateStatusBar(); UpdateStatusBar();
SetToolbars();
return true; return true;
} }
......
...@@ -152,7 +152,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -152,7 +152,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->SetNet( g_HighLight_NetCode ); g_CurrentTrackSegment->SetNet( g_HighLight_NetCode );
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() ); GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth(); g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth();
......
...@@ -37,20 +37,17 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -37,20 +37,17 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth =
not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth; not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth;
AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES: case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0; GetBoard()->m_TrackWidthSelector = 0;
GetBoard()->m_ViaSizeSelector = 0; GetBoard()->m_ViaSizeSelector = 0;
AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH: case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true;
AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection
...@@ -65,7 +62,6 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -65,7 +62,6 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1; ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii; GetBoard()->m_TrackWidthSelector = ii;
AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection
...@@ -79,7 +75,6 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -79,7 +75,6 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1; ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetBoard()->m_ViaSizeSelector = ii; GetBoard()->m_ViaSizeSelector = ii;
AuxiliaryToolBar_Update_UI( );
break; break;
......
...@@ -30,8 +30,6 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event ) ...@@ -30,8 +30,6 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
::wxSetWorkingDirectory( ::wxPathOnly( fn ) ); ::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
LoadOnePcbFile( fn ); LoadOnePcbFile( fn );
ReCreateAuxiliaryToolbar();
SetToolbars();
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
} }
} }
...@@ -55,8 +53,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -55,8 +53,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
{ {
case ID_LOAD_FILE: case ID_LOAD_FILE:
LoadOnePcbFile( GetScreen()->GetFileName(), false, true ); LoadOnePcbFile( GetScreen()->GetFileName(), false, true );
ReCreateAuxiliaryToolbar();
SetToolbars();
break; break;
case ID_MENU_READ_LAST_SAVED_VERSION_BOARD: case ID_MENU_READ_LAST_SAVED_VERSION_BOARD:
...@@ -91,8 +87,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -91,8 +87,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
fn.SetExt( PcbFileExtension ); fn.SetExt( PcbFileExtension );
GetScreen()->SetFileName( fn.GetFullPath() ); GetScreen()->SetFileName( fn.GetFullPath() );
SetTitle( GetScreen()->GetFileName() ); SetTitle( GetScreen()->GetFileName() );
ReCreateAuxiliaryToolbar();
SetToolbars();
break; break;
} }
...@@ -103,11 +97,10 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -103,11 +97,10 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
case ID_NEW_BOARD: case ID_NEW_BOARD:
Clear_Pcb( true ); Clear_Pcb( true );
GetScreen()->GetFileName().Printf( wxT( "%s%cnoname%s" ), GetScreen()->GetFileName().Printf( wxT( "%s%cnoname%s" ),
GetChars( wxGetCwd() ), DIR_SEP, GetChars( wxGetCwd() ), DIR_SEP,
GetChars( PcbFileExtension ) ); GetChars( PcbFileExtension ) );
SetTitle( GetScreen()->GetFileName() ); SetTitle( GetScreen()->GetFileName() );
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
SetToolbars();
break; break;
case ID_SAVE_BOARD: case ID_SAVE_BOARD:
...@@ -286,7 +279,6 @@ this file again." ) ); ...@@ -286,7 +279,6 @@ this file again." ) );
ReFillLayerWidget(); ReFillLayerWidget();
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
AuxiliaryToolBar_Update_UI();
syncLayerWidget(); syncLayerWidget();
// Display the loaded board: // Display the loaded board:
......
...@@ -152,7 +152,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi ...@@ -152,7 +152,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break; break;
case HK_ADD_MODULE: case HK_ADD_MODULE:
evt_type = ID_COMPONENT_BUTT; evt_type = ID_PCB_MODULE_BUTT;
break; break;
case HK_UNDO: case HK_UNDO:
...@@ -214,8 +214,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi ...@@ -214,8 +214,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break; break;
case HK_END_TRACK: case HK_END_TRACK:
if( itemCurrentlyEdited && (GetCurItem()->IsTrack() ) if( itemCurrentlyEdited && GetCurItem()->IsTrack() && GetCurItem()->IsNew() )
&& ( (GetCurItem()->m_Flags & IS_NEW) != 0 ) )
{ {
// A new track is in progress: call to End_Route() // A new track is in progress: call to End_Route()
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
...@@ -250,7 +249,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi ...@@ -250,7 +249,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break; break;
if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur
return; return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 ) if( !GetCurItem()->IsNew() )
return; return;
// place micro via and switch layer // place micro via and switch layer
...@@ -268,7 +267,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi ...@@ -268,7 +267,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
return; return;
if( GetCurItem()->Type() != TYPE_TRACK ) if( GetCurItem()->Type() != TYPE_TRACK )
return; return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 ) if( !GetCurItem()->IsNew() )
return; return;
evt_type = ID_POPUP_PCB_PLACE_VIA; evt_type = ID_POPUP_PCB_PLACE_VIA;
break; break;
...@@ -300,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi ...@@ -300,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
if( track ) if( track )
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
} }
else if( GetCurItem()->m_Flags & IS_NEW ) else if( GetCurItem()->IsNew() )
{ {
TRACK* track = Begin_Route( (TRACK*) GetCurItem(), aDC ); TRACK* track = Begin_Route( (TRACK*) GetCurItem(), aDC );
...@@ -404,7 +403,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC ) ...@@ -404,7 +403,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC )
} }
break; break;
case ID_COMPONENT_BUTT: case ID_PCB_MODULE_BUTT:
if( ItemFree ) if( ItemFree )
{ {
wxPoint pos = GetScreen()->RefPos( false ); wxPoint pos = GetScreen()->RefPos( false );
......
...@@ -66,7 +66,6 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery ) ...@@ -66,7 +66,6 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery )
ReFillLayerWidget(); ReFillLayerWidget();
SetToolbars();
Zoom_Automatique( true ); Zoom_Automatique( true );
return true; return true;
......
...@@ -1121,7 +1121,6 @@ int WinEDA_PcbFrame::ReadPcbFile( LINE_READER* aReader, bool Append ) ...@@ -1121,7 +1121,6 @@ int WinEDA_PcbFrame::ReadPcbFile( LINE_READER* aReader, bool Append )
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
SetStatusText( wxEmptyString ); SetStatusText( wxEmptyString );
BestZoom(); BestZoom();
SetToolbars();
return 1; return 1;
} }
...@@ -1156,10 +1155,8 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile ) ...@@ -1156,10 +1155,8 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
// Select default Netclass before writing file. // Select default Netclass before writing file.
// Useful to save default values in headers // Useful to save default values in headers
GetBoard()->SetCurrentNetClass( GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
GetBoard()->m_NetClasses.GetDefault()->GetName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
WriteGeneralDescrPcb( aFile ); WriteGeneralDescrPcb( aFile );
WriteSheetDescr( GetScreen(), aFile ); WriteSheetDescr( GetScreen(), aFile );
......
...@@ -132,7 +132,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ...@@ -132,7 +132,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Delete items */ /* Delete items */
item = new wxMenuItem( editMenu, item = new wxMenuItem( editMenu,
ID_MODEDIT_DELETE_ITEM_BUTT, ID_MODEDIT_DELETE_TOOL,
_( "Delete" ), _( "Delete" ),
_( "Delete objects with the eraser" ) ); _( "Delete objects with the eraser" ) );
item->SetBitmap( delete_body_xpm ); item->SetBitmap( delete_body_xpm );
...@@ -236,9 +236,9 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ...@@ -236,9 +236,9 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Pad */ /* Pad */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_ADD_PAD, ID_MODEDIT_PAD_TOOL,
_( "Pad" ), _( "Pad" ),
_( "Add Pads" ) ); _( "Add pad" ) );
item->SetBitmap( pad_xpm ); item->SetBitmap( pad_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
...@@ -247,7 +247,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ...@@ -247,7 +247,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Circle */ /* Circle */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_PCB_CIRCLE_BUTT, ID_MODEDIT_CIRCLE_TOOL,
_( "Circle" ), _( "Circle" ),
_( "Add graphic circle" ) ); _( "Add graphic circle" ) );
item->SetBitmap( add_circle_xpm ); item->SetBitmap( add_circle_xpm );
...@@ -255,7 +255,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ...@@ -255,7 +255,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Line or Polygon */ /* Line or Polygon */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_PCB_ADD_LINE_BUTT, ID_MODEDIT_LINE_TOOL,
_( "Line or Polygon" ), _( "Line or Polygon" ),
_( "Add graphic line or polygon" ) ); _( "Add graphic line or polygon" ) );
item->SetBitmap( add_polygon_xpm ); item->SetBitmap( add_polygon_xpm );
...@@ -263,7 +263,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ...@@ -263,7 +263,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Arc */ /* Arc */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_PCB_ARC_BUTT, ID_MODEDIT_ARC_TOOL,
_( "Arc" ), _( "Arc" ),
_( "Add graphic arc" ) ); _( "Add graphic arc" ) );
item->SetBitmap( add_arc_xpm ); item->SetBitmap( add_arc_xpm );
...@@ -271,7 +271,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ...@@ -271,7 +271,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Text */ /* Text */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_PCB_ADD_TEXT_BUTT, ID_MODEDIT_TEXT_TOOL,
_( "Text" ), _( "Text" ),
_( "Add graphic text" ) ); _( "Add graphic text" ) );
item->SetBitmap( add_text_xpm ); item->SetBitmap( add_text_xpm );
...@@ -280,7 +280,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ...@@ -280,7 +280,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Anchor */ /* Anchor */
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_PLACE_ANCHOR, ID_MODEDIT_ANCHOR_TOOL,
_( "Anchor" ), _( "Anchor" ),
_( "Place the footprint module reference anchor" ) ); _( "Place the footprint module reference anchor" ) );
item->SetBitmap( anchor_xpm ); item->SetBitmap( anchor_xpm );
......
...@@ -381,9 +381,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -381,9 +381,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
// Module // Module
text = AddHotkeyName( _( "Module" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "Module" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ADD_MODULE, false );
HK_ADD_MODULE, false ); item = new wxMenuItem( placeMenu, ID_PCB_MODULE_BUTT, text,
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text,
_( "Add modules" ), wxITEM_NORMAL ); _( "Add modules" ), wxITEM_NORMAL );
item->SetBitmap( module_xpm ); item->SetBitmap( module_xpm );
......
...@@ -184,7 +184,7 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -184,7 +184,7 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
MirePcb->Draw( Panel, DC, GR_XOR ); MirePcb->Draw( Panel, DC, GR_XOR );
if( MirePcb->m_Flags & IS_NEW ) // If it is new, delete it if( MirePcb->IsNew() ) // If it is new, delete it
{ {
MirePcb->Draw( Panel, DC, GR_XOR ); MirePcb->Draw( Panel, DC, GR_XOR );
MirePcb->DeleteStructure(); MirePcb->DeleteStructure();
...@@ -250,7 +250,7 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC ) ...@@ -250,7 +250,7 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
if( (MirePcb->m_Flags & IS_NEW) ) if( MirePcb->IsNew() )
{ {
SaveCopyInUndoList( MirePcb, UR_NEW ); SaveCopyInUndoList( MirePcb, UR_NEW );
MirePcb->m_Flags = 0; MirePcb->m_Flags = 0;
......
...@@ -443,46 +443,12 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -443,46 +443,12 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
} }
break; break;
case ID_MODEDIT_ADD_PAD:
if( GetBoard()->m_Modules )
SetToolID( id, wxCURSOR_PENCIL, _( "Add Pad" ) );
else
{
SetToolID( id, wxCURSOR_ARROW, _( "Pad Settings" ) );
InstallPadOptionsFrame( NULL );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
}
break;
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT:
case ID_PCB_ADD_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Drawing" ) );
break;
case ID_MODEDIT_PLACE_ANCHOR:
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Grid Origin" ) );
break;
case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_POPUP_CLOSE_CURRENT_TOOL: case ID_POPUP_CLOSE_CURRENT_TOOL:
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
break; break;
case ID_MODEDIT_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true ); Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
...@@ -708,8 +674,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -708,8 +674,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
SetToolbars();
if( redraw ) if( redraw )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -836,3 +800,57 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform ) ...@@ -836,3 +800,57 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
module->Set_Rectangle_Encadrement(); module->Set_Rectangle_Encadrement();
OnModify(); OnModify();
} }
void WinEDA_ModuleEditFrame::OnVerticalToolbar( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
switch( id )
{
case ID_MODEDIT_LINE_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
break;
case ID_MODEDIT_ARC_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
break;
case ID_MODEDIT_CIRCLE_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
break;
case ID_MODEDIT_TEXT_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_MODEDIT_ANCHOR_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
break;
case ID_MODEDIT_PLACE_GRID_COORD:
SetToolID( id, wxCURSOR_PENCIL, _( "Set grid origin" ) );
break;
case ID_MODEDIT_PAD_TOOL:
if( GetBoard()->m_Modules )
SetToolID( id, wxCURSOR_PENCIL, _( "Add pad" ) );
else
{
SetToolID( id, wxCURSOR_ARROW, _( "Pad settings" ) );
InstallPadOptionsFrame( NULL );
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
}
break;
case ID_MODEDIT_DELETE_TOOL:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
default:
wxFAIL_MSG( wxT( "Unknown command id." ) );
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
}
}
This diff is collapsed.
...@@ -95,8 +95,6 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList( wxCommandEvent& event ) ...@@ -95,8 +95,6 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList( wxCommandEvent& event )
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -133,7 +131,5 @@ void WinEDA_ModuleEditFrame::GetComponentFromUndoList( wxCommandEvent& event ) ...@@ -133,7 +131,5 @@ void WinEDA_ModuleEditFrame::GetComponentFromUndoList( wxCommandEvent& event )
SetCurItem( NULL );; SetCurItem( NULL );;
OnModify(); OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -22,31 +22,6 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -22,31 +22,6 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID:
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UserUnit = MILLIMETRES;
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UserUnit = INCHES;
UpdateStatusBar();
ReCreateAuxiliaryToolbar();
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = m_OptionsToolBar->GetToolState( id );
break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH: case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id ); m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
...@@ -74,6 +49,4 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -74,6 +49,4 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
wxT( "WinEDA_ModuleEditFrame::OnSelectOptionToolbar error" ) ); wxT( "WinEDA_ModuleEditFrame::OnSelectOptionToolbar error" ) );
break; break;
} }
SetToolbars();
} }
...@@ -36,7 +36,6 @@ public: ...@@ -36,7 +36,6 @@ public:
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void ReCreateMenuBar(); void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
...@@ -48,6 +47,15 @@ public: ...@@ -48,6 +47,15 @@ public:
bool OnHotkeyRotateItem( int aIdCommand ); bool OnHotkeyRotateItem( int aIdCommand );
void Show3D_Frame( wxCommandEvent& event ); void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition ); void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void OnVerticalToolbar( wxCommandEvent& aEvent );
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateLibSelected( wxUpdateUIEvent& aEvent );
void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent );
void OnUpdateLibAndModuleSelected( wxUpdateUIEvent& aEvent );
void OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent );
void OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent );
void OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent );
/** /**
* Function LoadModuleFromBoard * Function LoadModuleFromBoard
...@@ -78,9 +86,8 @@ public: ...@@ -78,9 +86,8 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (NULL if not used) * @param aData = a pointer on an auxiliary data (NULL if not used)
*/ */
virtual void PrintPage( wxDC* aDC, virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode,
int aPrintMaskLayer, bool aPrintMirrorMode, void * aData = NULL);
void * aData = NULL);
// BOARD handling // BOARD handling
......
This diff is collapsed.
...@@ -156,7 +156,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -156,7 +156,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
module->m_Flags = 0; module->m_Flags = 0;
} }
if( (module->m_Flags & IS_NEW) ) // Copy command: delete new footprint if( (module->IsNew()) ) // Copy command: delete new footprint
{ {
module->DeleteStructure(); module->DeleteStructure();
module = NULL; module = NULL;
...@@ -396,7 +396,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, ...@@ -396,7 +396,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
OnModify(); OnModify();
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK); GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
if( module->m_Flags & IS_NEW ) if( module->IsNew() )
{ {
SaveCopyInUndoList( module, UR_NEW ); SaveCopyInUndoList( module, UR_NEW );
} }
......
...@@ -71,7 +71,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -71,7 +71,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( NewTrack ) if( NewTrack )
{ {
if( NewTrack->m_Flags & IS_NEW ) if( NewTrack->IsNew() )
{ {
for( ii = 0; ii < NbPtNewTrack; ii++, NewTrack = NextS ) for( ii = 0; ii < NbPtNewTrack; ii++, NewTrack = NextS )
{ {
......
...@@ -64,8 +64,6 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event ) ...@@ -64,8 +64,6 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
wxT( "WinEDA_PcbFrame::ProcessMuWaveFunctions() id error" ) ); wxT( "WinEDA_PcbFrame::ProcessMuWaveFunctions() id error" ) );
break; break;
} }
SetToolbars();
} }
......
...@@ -33,7 +33,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -33,7 +33,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case TYPE_ZONE_CONTAINER: case TYPE_ZONE_CONTAINER:
if( (DrawStruct->m_Flags & IS_NEW) ) if( DrawStruct->IsNew() )
{ {
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( aDC ); Begin_Zone( aDC );
...@@ -127,7 +127,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -127,7 +127,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
GetBoard()->SetCurrentNetClass( GetBoard()->SetCurrentNetClass(
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() ); ((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
break; break;
default: default:
...@@ -138,12 +137,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -138,12 +137,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_MAIN_MENUBAR: case ID_MAIN_MENUBAR:
case ID_PCB_NO_TOOL:
case 0: case 0:
break; break;
case ID_NO_SELECT_BUTT:
break;
case ID_PCB_MUWAVE_TOOL_SELF_CMD: case ID_PCB_MUWAVE_TOOL_SELF_CMD:
case ID_PCB_MUWAVE_TOOL_GAP_CMD: case ID_PCB_MUWAVE_TOOL_GAP_CMD:
case ID_PCB_MUWAVE_TOOL_STUB_CMD: case ID_PCB_MUWAVE_TOOL_STUB_CMD:
...@@ -211,7 +208,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -211,7 +208,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else if( DrawStruct else if( DrawStruct
&& (DrawStruct->Type() == TYPE_DRAWSEGMENT) && (DrawStruct->Type() == TYPE_DRAWSEGMENT)
&& (DrawStruct->m_Flags & IS_NEW) ) && DrawStruct->IsNew() )
{ {
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC ); DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC );
SetCurItem( DrawStruct ); SetCurItem( DrawStruct );
...@@ -234,7 +231,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -234,7 +231,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( DrawStruct ) if( DrawStruct )
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
} }
else if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) ) else if( DrawStruct && DrawStruct->IsNew() )
{ {
TRACK* track = Begin_Route( (TRACK*) DrawStruct, aDC ); TRACK* track = Begin_Route( (TRACK*) DrawStruct, aDC );
// SetCurItem() must not write to the msg panel // SetCurItem() must not write to the msg panel
...@@ -284,7 +281,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -284,7 +281,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else if( DrawStruct else if( DrawStruct
&& (DrawStruct->Type() == TYPE_ZONE_CONTAINER) && (DrawStruct->Type() == TYPE_ZONE_CONTAINER)
&& (DrawStruct->m_Flags & IS_NEW) ) && DrawStruct->IsNew() )
{ // Add a new corner to the current outline beeing created: { // Add a new corner to the current outline beeing created:
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( aDC ); Begin_Zone( aDC );
...@@ -311,7 +308,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -311,7 +308,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) ); DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) );
break; break;
case ID_COMPONENT_BUTT: case ID_PCB_MODULE_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
...@@ -343,7 +340,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -343,7 +340,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else if( DrawStruct else if( DrawStruct
&& (DrawStruct->Type() == TYPE_DIMENSION) && (DrawStruct->Type() == TYPE_DIMENSION)
&& (DrawStruct->m_Flags & IS_NEW) ) && DrawStruct->IsNew() )
{ {
DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, aDC ); DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, aDC );
SetCurItem( DrawStruct ); SetCurItem( DrawStruct );
...@@ -395,6 +392,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -395,6 +392,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_PCB_NO_TOOL:
case 0: case 0:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
...@@ -413,7 +411,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -413,7 +411,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
{ {
case TYPE_TRACK: case TYPE_TRACK:
case TYPE_VIA: case TYPE_VIA:
if( DrawStruct->m_Flags & IS_NEW ) if( DrawStruct->IsNew() )
{ {
End_Route( (TRACK*) DrawStruct, aDC ); End_Route( (TRACK*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
...@@ -451,7 +449,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -451,7 +449,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break; // end case 0 break; // end case 0
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) ) if( DrawStruct && DrawStruct->IsNew() )
{ {
End_Route( (TRACK*) DrawStruct, aDC ); End_Route( (TRACK*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
...@@ -471,18 +469,21 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -471,18 +469,21 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_CIRCLE_BUTT: case ID_PCB_CIRCLE_BUTT:
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() != TYPE_DRAWSEGMENT ) if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
{ {
DisplayError( this, wxT( "DrawStruct Type error" ) ); DisplayError( this, wxT( "DrawStruct Type error" ) );
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
break; break;
} }
if( (DrawStruct->m_Flags & IS_NEW) )
if( DrawStruct->IsNew() )
{ {
End_Edge( (DRAWSEGMENT*) DrawStruct, aDC ); End_Edge( (DRAWSEGMENT*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL ); SetCurItem( NULL );
} }
break; break;
} }
} }
......
...@@ -134,8 +134,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -134,8 +134,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
} }
else else
{ {
msg = AddHotkeyName( _( msg = AddHotkeyName( _( "Unlock Module" ), g_Board_Editor_Hokeys_Descr,
"Unlock Module" ), g_Board_Editor_Hokeys_Descr,
HK_LOCK_UNLOCK_FOOTPRINT ); HK_LOCK_UNLOCK_FOOTPRINT );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg,
unlocked_xpm ); unlocked_xpm );
...@@ -143,7 +142,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -143,7 +142,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( !flags ) if( !flags )
aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE, aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,
_( "Auto Place Module" ) ); _( "Auto Place Module" ) );
} }
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS )
...@@ -311,7 +310,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -311,7 +310,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
break; break;
case ID_COMPONENT_BUTT: case ID_PCB_MODULE_BUTT:
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC,
_( "Footprint Documentation" ), book_xpm ); _( "Footprint Documentation" ), book_xpm );
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
...@@ -408,9 +407,9 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ...@@ -408,9 +407,9 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
GetBoard()->SetCurrentNetClass( Track->GetNetClassName() ); GetBoard()->SetCurrentNetClass( Track->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
int flags = Track->m_Flags; int flags = Track->m_Flags;
if( flags == 0 ) if( flags == 0 )
{ {
if( Track->Type() == TYPE_VIA ) if( Track->Type() == TYPE_VIA )
...@@ -737,7 +736,6 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) ...@@ -737,7 +736,6 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() ); GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
wxString msg = Pad->MenuText( GetBoard() ); wxString msg = Pad->MenuText( GetBoard() );
......
This diff is collapsed.
...@@ -17,17 +17,26 @@ enum pcbnew_ids ...@@ -17,17 +17,26 @@ enum pcbnew_ids
ID_MICROWAVE_V_TOOLBAR, ID_MICROWAVE_V_TOOLBAR,
ID_OPEN_MODULE_EDITOR, ID_OPEN_MODULE_EDITOR,
ID_READ_NETLIST, ID_READ_NETLIST,
// Right vertical tool bar command IDs.
ID_PCB_NO_TOOL,
ID_PCB_HIGHLIGHT_BUTT,
ID_PCB_SHOW_1_RATSNEST_BUTT,
ID_PCB_MODULE_BUTT,
ID_TRACK_BUTT,
ID_PCB_ZONES_BUTT,
ID_PCB_ADD_LINE_BUTT,
ID_PCB_CIRCLE_BUTT, ID_PCB_CIRCLE_BUTT,
ID_PCB_ARC_BUTT, ID_PCB_ARC_BUTT,
ID_PCB_HIGHLIGHT_BUTT, ID_PCB_ADD_TEXT_BUTT,
ID_PCB_DIMENSION_BUTT,
ID_PCB_MIRE_BUTT, ID_PCB_MIRE_BUTT,
ID_PCB_SHOW_1_RATSNEST_BUTT, ID_PCB_DELETE_ITEM_BUTT,
ID_PCB_PLACE_OFFSET_COORD_BUTT, ID_PCB_PLACE_OFFSET_COORD_BUTT,
ID_PCB_PLACE_GRID_COORD_BUTT, ID_PCB_PLACE_GRID_COORD_BUTT,
ID_PCB_MASK_CLEARANCE, ID_PCB_MASK_CLEARANCE,
ID_PCB_LAYERS_SETUP, ID_PCB_LAYERS_SETUP,
ID_PCB_ADD_LINE_BUTT,
ID_PCB_ADD_TEXT_BUTT,
ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_START_RANGE,
ID_POPUP_PCB_MOVE_MODULE_REQUEST, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
...@@ -228,7 +237,6 @@ enum pcbnew_ids ...@@ -228,7 +237,6 @@ enum pcbnew_ids
ID_PCB_PAD_SETUP, ID_PCB_PAD_SETUP,
ID_PCB_DIMENSION_BUTT,
ID_PCB_DRAWINGS_WIDTHS_SETUP, ID_PCB_DRAWINGS_WIDTHS_SETUP,
ID_PCB_GEN_CMP_FILE, ID_PCB_GEN_CMP_FILE,
...@@ -251,13 +259,21 @@ enum pcbnew_ids ...@@ -251,13 +259,21 @@ enum pcbnew_ids
ID_DRC_CONTROL, ID_DRC_CONTROL,
ID_PCB_GLOBAL_DELETE, ID_PCB_GLOBAL_DELETE,
ID_TRACK_BUTT,
ID_PCB_ZONES_BUTT,
ID_PCB_DELETE_ITEM_BUTT,
ID_POPUP_PCB_DELETE_TRACKSEG, ID_POPUP_PCB_DELETE_TRACKSEG,
ID_TOOLBARH_PCB_SELECT_LAYER, ID_TOOLBARH_PCB_SELECT_LAYER,
ID_PCB_DISPLAY_OPTIONS_SETUP, ID_PCB_DISPLAY_OPTIONS_SETUP,
// Module editor right vertical tool bar commands.
ID_MODEDIT_NO_TOOL,
ID_MODEDIT_PAD_TOOL,
ID_MODEDIT_LINE_TOOL,
ID_MODEDIT_CIRCLE_TOOL,
ID_MODEDIT_ARC_TOOL,
ID_MODEDIT_TEXT_TOOL,
ID_MODEDIT_ANCHOR_TOOL,
ID_MODEDIT_DELETE_TOOL,
ID_MODEDIT_PLACE_GRID_COORD,
// ID used in module editor: // ID used in module editor:
ID_MODEDIT_CHECK, ID_MODEDIT_CHECK,
ID_MODEDIT_SELECT_CURRENT_LIB, ID_MODEDIT_SELECT_CURRENT_LIB,
...@@ -266,9 +282,6 @@ enum pcbnew_ids ...@@ -266,9 +282,6 @@ enum pcbnew_ids
ID_MODEDIT_NEW_MODULE, ID_MODEDIT_NEW_MODULE,
ID_MODEDIT_SHEET_SET, ID_MODEDIT_SHEET_SET,
ID_MODEDIT_LOAD_MODULE, ID_MODEDIT_LOAD_MODULE,
ID_MODEDIT_ADD_PAD,
ID_MODEDIT_PLACE_ANCHOR,
ID_MODEDIT_DELETE_ITEM_BUTT,
ID_MODEDIT_PAD_SETTINGS, ID_MODEDIT_PAD_SETTINGS,
ID_MODEDIT_LOAD_MODULE_FROM_BOARD, ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
ID_MODEDIT_INSERT_MODULE_IN_BOARD, ID_MODEDIT_INSERT_MODULE_IN_BOARD,
......
...@@ -235,7 +235,6 @@ void WinEDA_BasePcbFrame::SelectLayerPair() ...@@ -235,7 +235,6 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
int result = frame->ShowModal(); int result = frame->ShowModal();
frame->Destroy(); frame->Destroy();
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
SetToolbars();
// if user changed colors and we are in high contrast mode, then redraw // if user changed colors and we are in high contrast mode, then redraw
// because the PAD_SMD pads may change color. // because the PAD_SMD pads may change color.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment