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 )
EDA_DRAW_FRAME::OnZoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
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()
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style ) :
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxPoint& pos, const wxSize& size, long style ) :
EDA_BASE_FRAME( father, idtype, title, pos, size, style )
{
wxSize minsize;
......@@ -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
void EDA_DRAW_FRAME::ReCreateAuxiliaryToolbar()
{
......@@ -177,6 +260,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
{
}
/**
* Function PrintPage (virtual)
* used to print a page
......@@ -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 )
{
SetStatusText( msg, 5 );
......@@ -379,53 +454,14 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
// Change DrawPanel cursor if requested.
if( DrawPanel && aCursor >= 0 )
{
DrawPanel->SetCursor( aCursor );
}
DisplayToolMsg( aToolMsg );
if( aId < 0 )
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;
if( m_VToolBar )
m_VToolBar->Refresh( );
}
......
......@@ -16,7 +16,7 @@
#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.
* 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 )
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
}
event.Skip();
}
......@@ -882,7 +884,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
wxPoint pos = CalcUnscrolledPosition( event.GetPosition() );
/* Compute the cursor position in drawing (logical) units. */
screen->m_MousePosition = event.GetLogicalPosition( DC );
screen->SetMousePosition( event.GetLogicalPosition( DC ) );
int kbstat = 0;
......@@ -902,7 +904,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// Calling Double Click and Click functions :
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,
// because we have a double click, and we do not want a new
......@@ -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
// or this is the end of a double click, already seen
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease )
GetParent()->OnLeftClick( &DC, screen->m_MousePosition );
GetParent()->OnLeftClick( &DC, screen->RefPos( true ) );
ignoreNextLeftButtonRelease = false;
}
......@@ -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.
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
Screen->m_MousePosition = pos;
Screen->SetMousePosition( pos );
GetParent()->GeneralControle( &DC, pos );
......
......@@ -69,7 +69,6 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection();
m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue();
m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue();
m_Parent->SetToolbars();
m_Parent->DrawPanel->Refresh();
}
......
......@@ -228,7 +228,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
if( firstsegment == NULL )
return;
if( ( firstsegment->m_Flags & IS_NEW ) == 0 )
if( !firstsegment->IsNew() )
return;
/* Delete Null segments and Put line it in Drawlist */
......
......@@ -29,7 +29,7 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( BusEntry->m_Flags & IS_NEW )
if( BusEntry->IsNew() )
{
delete BusEntry;
Panel->GetScreen()->SetCurItem( NULL );
......@@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
if( BusEntry == NULL )
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;
g_ItemToUndoCopy = BusEntry->Clone();
......
......@@ -204,7 +204,7 @@ LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary )
BOOST_FOREACH( LIB_DRAW_ITEM& oldItem, aComponent.GetDrawItemList() )
{
if( ( oldItem.m_Flags & IS_NEW ) != 0 )
if( oldItem.IsNew() )
continue;
newItem = oldItem.GenCopy();
......
......@@ -283,7 +283,7 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
if( screen->IsRefreshReq() )
{
DrawPanel->Refresh( );
DrawPanel->Refresh();
wxSafeYield();
}
......@@ -310,7 +310,6 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
UpdateStatusBar(); /* Display cursor coordinates info */
SetToolbars();
}
......@@ -473,5 +472,4 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
UpdateStatusBar();
SetToolbars();
}
......@@ -39,7 +39,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
m_itemToRepeat = NULL;
if( (TextStruct->m_Flags & IS_NEW) == 0 )
if( !TextStruct->IsNew() )
{
delete g_ItemToUndoCopy;
g_ItemToUndoCopy = TextStruct->Clone();
......@@ -227,7 +227,7 @@ static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC )
* created)*/
Struct->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( Struct->m_Flags & IS_NEW )
if( Struct->IsNew() )
{
SAFE_DELETE( Struct );
screen->SetCurItem( NULL );
......
......@@ -23,7 +23,9 @@ enum id_eeschema_frm
/* Schematic editor veritcal toolbar IDs */
ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
ID_SCH_NO_TOOL,
ID_HIERARCHY_PUSH_POP_BUTT,
ID_SCH_PLACE_COMPONENT,
ID_PLACE_POWER_BUTT,
ID_BUS_BUTT,
ID_WIRE_BUTT,
......@@ -154,16 +156,17 @@ enum id_eeschema_frm
ID_LIBEDIT_SELECT_ALIAS,
/* Library editor vertical toolbar IDs. */
ID_LIBEDIT_NO_TOOL,
ID_LIBEDIT_PIN_BUTT,
ID_LIBEDIT_BODY_LINE_BUTT,
ID_LIBEDIT_BODY_ARC_BUTT,
ID_LIBEDIT_BODY_CIRCLE_BUTT,
ID_LIBEDIT_BODY_RECT_BUTT,
ID_LIBEDIT_BODY_TEXT_BUTT,
ID_LIBEDIT_DELETE_ITEM_BUTT,
ID_LIBEDIT_ANCHOR_ITEM_BUTT,
ID_LIBEDIT_IMPORT_BODY_BUTT,
ID_LIBEDIT_EXPORT_BODY_BUTT,
ID_LIBEDIT_DELETE_ITEM_BUTT,
/* Library editor context menu IDs */
ID_LIBEDIT_EDIT_PIN,
......
......@@ -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
// We can change active tool and ask for editing a new item
bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK);
bool RefreshToolBar = FALSE;
if( aHotKey == 0 )
return;
......@@ -343,7 +342,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_DELETE:
if( notBusy)
{
RefreshToolBar = LocateAndDeleteItem( this, aDC );
LocateAndDeleteItem( this, aDC );
OnModify();
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds( DrawPanel, aDC );
......@@ -390,8 +389,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( !itemInEdit )
{
// switch to m_ID_current_state = ID_COMPONENT_BUTT;
if( m_ID_current_state != ID_COMPONENT_BUTT )
SetToolID( ID_COMPONENT_BUTT, wxCURSOR_PENCIL, _( "Add Component" ) );
if( m_ID_current_state != ID_SCH_PLACE_COMPONENT )
SetToolID( ID_SCH_PLACE_COMPONENT, wxCURSOR_PENCIL, _( "Add Component" ) );
OnLeftClick( aDC, aPosition );
}
......@@ -648,7 +647,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->m_Flags == 0 )
{
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_Y );
......@@ -670,7 +668,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->m_Flags == 0 )
{
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_X );
......@@ -686,7 +683,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->m_Flags == 0 )
{
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_NORMAL );
......@@ -880,9 +876,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
}
break;
}
if( RefreshToolBar )
SetToolbars();
}
......@@ -979,7 +972,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_EDIT:
m_drawItem = LocateItemUsingCursor();
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem )
{
......@@ -1011,7 +1004,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_ROTATE:
m_drawItem = LocateItemUsingCursor();
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem )
{
......@@ -1047,7 +1040,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
}
case HK_DELETE:
m_drawItem = LocateItemUsingCursor();
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() )
{
......@@ -1058,7 +1051,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_LIBEDIT_MOVE_GRAPHIC_ITEM:
m_drawItem = LocateItemUsingCursor();
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() )
{
......@@ -1069,7 +1062,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_DRAG:
m_drawItem = LocateItemUsingCursor();
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() )
{
......
......@@ -328,7 +328,7 @@ int LIB_ARC::GetPenSize()
void LIB_ARC::drawEditGraphics( EDA_Rect* aClipBox, wxDC* aDC, int aColor )
{
// The edit indicators only get drawn when a new arc is being drawn.
if( ( m_Flags & IS_NEW ) == 0 )
if( !IsNew() )
return;
// 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
{
// Don't draw the arc until the end point is selected. Only the edit indicators
// get drawn at this time.
if( ( m_Flags & IS_NEW ) && m_lastEditState == 1 )
if( IsNew() && m_lastEditState == 1 )
return;
wxPoint pos1, pos2, posc;
......
......@@ -509,7 +509,7 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
if( ( pinList[i]->m_position == m_position )
&& ( pinList[i]->m_orientation == m_orientation )
&& ( !( m_Flags & IS_NEW ) )
&& !IsNew()
&& editPinByPin == false
&& enable )
pinList[i]->m_Flags |= IS_LINKED | IN_EDIT;
......
......@@ -18,7 +18,7 @@
#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;
......@@ -43,8 +43,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
else
{
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_MousePosition );
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
if( DrawEntry == NULL )
{
......@@ -64,7 +63,8 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
switch( m_ID_current_state )
{
case ID_NO_SELECT_BUTT:
case 0:
case ID_LIBEDIT_NO_TOOL:
break;
case ID_LIBEDIT_PIN_BUTT:
......@@ -89,7 +89,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
else if( m_drawItem )
{
if( m_drawItem->m_Flags & IS_NEW )
if( m_drawItem->IsNew() )
GraphicItemBeginDraw( DC );
else
EndDrawGraphicItem( DC );
......@@ -97,14 +97,14 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_LIBEDIT_DELETE_ITEM_BUTT:
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_MousePosition );
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
if( DrawEntry == NULL )
{
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->GetCrossHairPosition() );
}
if( DrawEntry == NULL )
{
DisplayCmpDoc();
......@@ -142,7 +142,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* If an editable item (field, pin, graphic):
* 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();
......@@ -151,8 +151,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
{ // We can locate an item
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_MousePosition );
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
if( m_drawItem == NULL )
{
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 )
{
EditGraphicSymbol( DC, m_drawItem );
}
else if( m_drawItem->m_Flags & IS_NEW )
else if( m_drawItem->IsNew() )
{
EndDrawGraphicItem( DC );
}
......
......@@ -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 );
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();
if( BlockActive )
......
......@@ -80,7 +80,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate )
/* 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_SELECT_CURRENT_LIB, LIB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_DELETE_PART, LIB_EDIT_FRAME::DeleteOnePart )
......@@ -106,9 +106,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias )
/* Right vertical toolbar. */
EVT_TOOL( ID_NO_SELECT_BUTT, LIB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT,
LIB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL_RANGE( ID_LIBEDIT_NO_TOOL, ID_LIBEDIT_DELETE_ITEM_BUTT,
LIB_EDIT_FRAME::OnSelectTool )
/* menubar commands */
EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow )
......@@ -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_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal )
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 )
END_EVENT_TABLE()
......@@ -180,6 +179,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_drawSpecificUnit = false;
m_tempCopyComponent = NULL;
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
m_ID_current_state = ID_LIBEDIT_NO_TOOL;
// Give an icon
SetIcon( wxIcon( libedit_xpm ) );
......@@ -251,8 +251,10 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
frame->m_LibeditFrame = NULL;
m_drawItem = m_lastDrawItem = NULL;
if ( m_tempCopyComponent )
delete m_tempCopyComponent;
m_tempCopyComponent = NULL;
}
......@@ -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 )
event.Enable( ( m_component != NULL )
&& ( ( m_component->GetPartCount() > 1 ) || m_showDeMorgan ) );
if( m_HToolBar )
m_HToolBar->ToggleTool( event.GetId(), g_EditPinByPinIsOn );
event.Check( g_EditPinByPinIsOn );
}
......@@ -510,7 +520,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
return;
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 )
return;
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 )
void LIB_EDIT_FRAME::OnSelectAlias( wxCommandEvent& event )
{
if( m_SelAliasBox == NULL
|| m_SelAliasBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0 )
|| ( m_SelAliasBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0) )
return;
m_lastDrawItem = NULL;
......@@ -660,61 +670,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
g_EditPinByPinIsOn = m_HToolBar->GetToolState(ID_LIBEDIT_EDIT_PIN_BY_PIN);
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:
DrawPanel->MoveCursorToCrossHair();
if( m_drawItem )
......@@ -749,17 +704,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
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:
{
// Delete the last created segment, while creating a polyline draw item
......@@ -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_PINNAMESIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
if( (m_drawItem == NULL )
|| (m_drawItem->Type() != LIB_PIN_T) )
if( ( m_drawItem == NULL ) || ( m_drawItem->Type() != LIB_PIN_T ) )
break;
SaveCopyInUndoList( m_component );
GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
......@@ -1081,3 +1024,86 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair();
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:
void Process_Config( wxCommandEvent& event );
void OnPlotCurrentComponent( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void OnImportPart( wxCommandEvent& event );
void OnExportPart( wxCommandEvent& event );
void OnSelectAlias( wxCommandEvent& event );
......@@ -75,6 +76,7 @@ public:
void OnEditPin( wxCommandEvent& event );
void OnRotatePin( wxCommandEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
void OnUpdateEditingPart( wxUpdateUIEvent& event );
void OnUpdateNotEditingPart( wxUpdateUIEvent& event );
void OnUpdateUndo( wxUpdateUIEvent& event );
......@@ -248,7 +250,7 @@ private:
void SaveOneSymbol();
void EditGraphicSymbol( 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 );
public:
......
......@@ -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 )
return NULL;
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
{
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_MousePosition );
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
if( m_drawItem == NULL )
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->GetCrossHairPosition() );
wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition );
if( m_drawItem == NULL && aPosition != pos )
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, pos );
}
return m_drawItem;
......
......@@ -45,7 +45,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
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 ) )
break;
......
......@@ -240,7 +240,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
/* Component */
text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr,
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 );
item->SetBitmap( add_component_xpm );
placeMenu->Append( item );
......
......@@ -31,7 +31,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
SCH_ITEM* item = GetScreen()->GetCurItem();
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;
m_itemToRepeat = NULL;
......@@ -84,13 +86,11 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state )
{
case 0:
break;
case ID_NO_SELECT_BUTT:
case ID_SCH_NO_TOOL:
break;
case ID_HIERARCHY_PUSH_POP_BUTT:
if( item && item->m_Flags )
if( ( item && item->m_Flags ) || ( g_RootSheet->CountSheets() == 0 ) )
break;
item = LocateAndShowItem( aPosition );
......@@ -274,7 +274,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
break;
case ID_COMPONENT_BUTT:
case ID_SCH_PLACE_COMPONENT:
if( (item == NULL) || (item->m_Flags == 0) )
{
GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) );
......@@ -334,6 +334,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state )
{
case ID_SCH_NO_TOOL:
case 0:
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
......@@ -380,7 +381,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case ID_BUS_BUTT:
case ID_WIRE_BUTT:
case ID_LINE_COMMENT_BUTT:
if( item && ( item->m_Flags & IS_NEW ) )
if( item && item->IsNew() )
EndSegment( aDC );
break;
......
......@@ -489,7 +489,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
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;
if( !is_new )
......@@ -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 )
{
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
bool is_new = Wire->IsNew();
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg;
......@@ -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 )
{
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
bool is_new = Bus->IsNew();
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg;
if( is_new )
{
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm );
......
......@@ -188,7 +188,7 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( CurrentPin == NULL || CurrentPin->Type() != LIB_PIN_T )
return;
if( CurrentPin->m_Flags & IS_NEW )
if( CurrentPin->IsNew() )
delete CurrentPin;
else
parent->RestoreComponent();
......
......@@ -602,9 +602,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{
/* save old text in undo list */
if( g_ItemToUndoCopy
&& ( g_ItemToUndoCopy->Type() == Type() )
&& ( ( m_Flags & IS_NEW ) == 0 ) )
if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == Type() ) && !IsNew() )
{
/* restore old values and save new ones */
SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
......
......@@ -325,7 +325,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{
/* 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 */
SwapData( (SCH_TEXT*) g_ItemToUndoCopy );
......
......@@ -159,74 +159,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() );
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:
DrawPanel->MoveCursorToCrossHair();
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' );
......@@ -338,10 +270,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_SCH_END_SHEET:
DrawPanel->MoveCursorToCrossHair();
screen->GetCurItem()->Place( this, &dc );
......@@ -399,7 +327,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_CMP_REQUEST:
// 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
if( (screen->GetCurItem()->Type() != SCH_COMPONENT_T)
&& (screen->GetCurItem()->Type() != SCH_LABEL_T)
......@@ -729,8 +657,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_ID_current_state == 0 )
m_itemToRepeat = NULL;
SetToolbars();
}
......@@ -805,3 +731,104 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
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 )
OnModify();
SetSheetNumberAndCount();
ReCreateHToolbar();
SetToolbars();
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh();
......@@ -453,7 +452,6 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
OnModify();
SetSheetNumberAndCount();
ReCreateHToolbar();
SetToolbars();
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh();
......
......@@ -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_AS, 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_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL )
EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print )
......@@ -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_SAVE, SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START,
ID_PREFERENCES_HOTKEY_END,
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig )
......@@ -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_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_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
......@@ -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_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
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_KICAD_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
// Tools and buttons for vertical toolbar.
EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
SCH_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
SCH_EDIT_FRAME::OnSelectTool )
EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
......@@ -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_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected )
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_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM,
ID_TB_OPTIONS_SELECT_UNIT_INCH,
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
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. */
EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
......@@ -172,6 +165,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr;
m_dlgFindReplace = NULL;
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
m_ID_current_state = ID_SCH_NO_TOOL;
CreateScreens();
......@@ -452,6 +446,7 @@ void SCH_EDIT_FRAME::OnModify( )
// >> change all sheets.
// I believe all sheets in a project must have the same date
SCH_SCREEN* screen = s_list.GetFirst();
for( ; screen != NULL; screen = s_list.GetNext() )
screen->m_Date = date;
}
......@@ -466,76 +461,36 @@ void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
event.Enable( enable );
m_HToolBar->EnableTool( wxID_CUT, enable );
m_HToolBar->EnableTool( wxID_COPY, enable );
}
void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
{
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 )
{
if( GetScreen() )
event.Enable( GetScreen()->GetRedoCommandCount() > 0 );
}
void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& event )
void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
{
wxString tool_tip = g_HVLines ?
_( "Draw wires and buses in any direction" ) :
_( "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 );
}
void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& event )
void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
{
wxString tool_tip = m_ShowAllPins ? _( "Do not 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 );
}
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 )
{
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
......@@ -630,10 +585,7 @@ void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
if( fn != wxEmptyString )
{
LoadOneEEProject( fn, false );
SetToolbars();
}
}
......@@ -724,10 +676,7 @@ void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
Close( true );
}
/**
* Function SetLanguage
* called on a language menu selection
*/
void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
{
EDA_BASE_FRAME::SetLanguage( 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 )
{
DIALOG_SVG_PRINT frame( this );
......
......@@ -256,7 +256,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
if( sheet == NULL )
return;
if( sheet->m_Flags & IS_NEW )
if( sheet->IsNew() )
{
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
SAFE_DELETE( sheet );
......@@ -312,7 +312,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( 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;
if( aSheet->Type() != SCH_SHEET_T )
......@@ -340,7 +340,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
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;
g_ItemToUndoCopy = DuplicateStruct( aSheet, true );
......@@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
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;
g_ItemToUndoCopy = DuplicateStruct( aSheet, true );
......
......@@ -40,7 +40,7 @@ static void ExitPinSheet( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( SheetLabel == NULL )
return;
if( SheetLabel->m_Flags & IS_NEW )
if( SheetLabel->IsNew() )
{
SheetLabel->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
SAFE_DELETE( SheetLabel );
......
......@@ -35,52 +35,37 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
// Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
wxBitmap( cursor_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
_( "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 );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString,
wxBitmap( add_text_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString, wxBitmap( add_text_xpm ),
HELP_ADD_BODYTEXT, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString,
wxBitmap( add_rectangle_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString, wxBitmap( add_rectangle_xpm ),
HELP_ADD_BODYRECT, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString,
wxBitmap( add_circle_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString, wxBitmap( add_circle_xpm ),
HELP_ADD_BODYCIRCLE, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString,
wxBitmap( add_arc_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString, wxBitmap( add_arc_xpm ),
HELP_ADD_BODYARC, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString,
wxBitmap( add_polygon_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString, wxBitmap( add_polygon_xpm ),
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 );
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 );
m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString,
wxBitmap( export_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString, wxBitmap( export_xpm ),
_( "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 );
m_VToolBar->Realize();
......
This diff is collapsed.
......@@ -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,
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,
LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
......
......@@ -7,11 +7,6 @@
#include "class_drawpanel.h"
#include "gerbview.h"
GERBER_DRAW_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
{
return Locate( CURSEUR_OFF_GRILLE );
}
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
......
......@@ -20,7 +20,7 @@
/* Process the command triggered by the left button of the mouse when a tool
* 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();
wxString msg;
......@@ -36,7 +36,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
else
{
DrawStruct = GerberGeneralLocateAndDisplay();
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
GetScreen()->SetCurItem( DrawStruct );
if( DrawStruct == NULL )
{
......@@ -50,14 +50,13 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
switch( m_ID_current_state )
{
case 0:
break;
case ID_NO_SELECT_BUTT:
case ID_GERBVIEW_NO_TOOL:
break;
case ID_GERBVIEW_DELETE_ITEM_BUTT:
DrawStruct = GerberGeneralLocateAndDisplay();
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
if( DrawStruct == NULL )
break;
/* TODO:
......@@ -132,7 +131,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
ClearMsgPanel();
break;
case ID_NO_SELECT_BUTT:
case ID_GERBVIEW_NO_TOOL:
SetToolID( 0, 0, wxEmptyString );
break;
......@@ -209,14 +208,12 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
wxMessageBox( wxT( "WinEDA_GerberFrame::Process_Special_Functions error" ) );
break;
}
SetToolbars();
}
/* 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
}
......@@ -53,9 +53,9 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
{
setActiveLayer(origLayer+1);
Erase_Current_Layer( false );
if( !LoadGerberFiles( wxEmptyString ) )
setActiveLayer(origLayer);
SetToolbars();
setActiveLayer( origLayer );
}
else
{
......
......@@ -29,7 +29,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
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( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
......@@ -51,8 +51,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
// menu Preferences
EVT_MENU( ID_CONFIG_REQ, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START,
ID_PREFERENCES_HOTKEY_END,
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
......@@ -86,7 +85,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
WinEDA_GerberFrame::Process_Special_Functions )
// 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_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
......@@ -103,11 +102,26 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
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( ID_TB_OPTIONS_SHOW_GBR_MODE_1, WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_2, WinEDA_GerberFrame::OnSelectDisplayMode )
END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
WinEDA_GerberFrame::OnUpdateFlashedItemsDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, WinEDA_GerberFrame::OnUpdateLinesDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
WinEDA_GerberFrame::OnUpdatePolygonsDrawMode )
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,
......@@ -204,8 +218,6 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
ReFillLayerWidget(); // this is near end because contents establish size
SetToolbars();
m_auimgr.Update();
}
......@@ -579,8 +591,6 @@ void WinEDA_GerberFrame::OnSelectDisplayMode( wxCommandEvent& event )
break;
}
SetToolbars();
if( GetDisplayMode() != oldMode )
DrawPanel->Refresh();
}
......@@ -18,6 +18,7 @@ enum gerbview_ids
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
ID_GERBVIEW_NO_TOOL,
ID_GERBVIEW_DELETE_ITEM_BUTT,
ID_GERBVIEW_GLOBAL_DELETE,
ID_GERBVIEW_OPTIONS_SETUP,
......
......@@ -10,27 +10,28 @@
/* localize a gerber item and return a pointer to it.
* 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();
wxPoint ref;
wxPoint ref = aPosition;
bool found = false;
if( aTypeloc == CURSEUR_ON_GRILLE )
ref = GetScreen()->GetCrossHairPosition();
else
ref = GetScreen()->m_MousePosition;
ref = GetScreen()->GetNearestGridPosition( ref );
int layer = GetScreen()->m_Active_Layer;
// Search first on active layer
BOARD_ITEM* item = GetBoard()->m_Drawings;
GERBER_DRAW_ITEM* gerb_item = NULL;
for( ; item; item = item->Next() )
{
gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer()!= layer )
continue;
if( gerb_item->HitTest( ref ) )
{
found = true;
......@@ -41,9 +42,11 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
if( !found ) // Search on all layers
{
item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() )
{
gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( ref ) )
{
found = true;
......@@ -51,10 +54,12 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
}
}
}
if( found )
{
gerb_item->DisplayInfo( this );
return gerb_item;
}
return NULL;
}
......@@ -13,8 +13,7 @@
/* Prepare the right-click pullup menu.
* The menu already has a list of zoom commands.
*/
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg;
......@@ -27,7 +26,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos,
// Simple location of elements where possible.
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
DrawStruct = GerberGeneralLocateAndDisplay();
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
}
// If command in progress, end command.
......
......@@ -38,32 +38,6 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
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:
if( state )
{
......@@ -73,21 +47,21 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
{
DisplayOpt.DisplayPadFill = m_DisplayPadFill = true;
}
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_LINES_SKETCH:
if(state )
{
m_DisplayPcbTrackFill = FALSE;
DisplayOpt.DisplayPcbTrackFill = FALSE;
m_DisplayPcbTrackFill = false;
DisplayOpt.DisplayPcbTrackFill = false;
}
else
{
m_DisplayPcbTrackFill = TRUE;
DisplayOpt.DisplayPcbTrackFill = TRUE;
m_DisplayPcbTrackFill = true;
DisplayOpt.DisplayPcbTrackFill = true;
}
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
......@@ -95,12 +69,12 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
g_DisplayPolygonsModeSketch = 1;
else
g_DisplayPolygonsModeSketch = 0;
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_DCODES:
SetElementVisibility( DCODES_VISIBLE, state );
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
......@@ -111,11 +85,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
default:
DisplayError( this,
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
DisplayError( this, wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
break;
}
SetToolbars();
}
This diff is collapsed.
......@@ -46,10 +46,10 @@ protected:
public:
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
// 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:
int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn:
......@@ -77,7 +77,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
* Function ReportMessage
* Add a message (a string) in message list
* 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 )
{
......@@ -121,7 +121,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
/**
* Function SetGridVisibility() , virtual
* 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
*/
virtual void SetGridVisibility( bool aVisible );
......@@ -277,16 +277,23 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
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_Config( wxCommandEvent& event );
void InstallConfigFrame( const wxPoint& pos );
void InstallGerberOptionsDialog( wxCommandEvent& event );
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 */
virtual int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC );
......
......@@ -63,6 +63,7 @@ class BASE_SCREEN : public EDA_ITEM
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
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
......@@ -74,7 +75,6 @@ class BASE_SCREEN : public EDA_ITEM
public:
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)
* in user units. (coordinates from last reset position)*/
......@@ -362,6 +362,8 @@ public:
*/
void GetGrids( GRIDS& aList );
void SetMousePosition( const wxPoint& aPosition ) { m_MousePosition = aPosition; }
/**
* Function RefPos
* Return the reference position, coming from either the mouse position
......
......@@ -33,7 +33,7 @@ private:
int m_cursor; ///< Current mouse cursor shape id.
int m_defaultCursor; ///< The default mouse cursor shape id.
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:
EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the
......@@ -221,7 +221,7 @@ public:
*/
void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL );
void ReDraw( wxDC* DC, bool erasebg = TRUE );
void ReDraw( wxDC* aDC, bool aEraseBackground = true );
/**
* Function RefreshDrawingRect
......
......@@ -180,13 +180,12 @@ enum main_id
ID_SHEET_SET,
ID_TO_LIBRARY,
ID_NO_SELECT_BUTT,
ID_COMPONENT_BUTT,
ID_ZOOM_IN,
ID_ZOOM_OUT,
ID_ZOOM_REDRAW,
ID_ZOOM_PAGE,
ID_ZOOM_REDRAW,
/* Panning command event IDs. */
ID_PAN_UP,
......@@ -204,21 +203,23 @@ enum main_id
/* Command IDs common to PCBNew and GerbView. */
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_INCH,
ID_TB_OPTIONS_SELECT_CURSOR,
ID_TB_OPTIONS_SHOW_POLAR_COORD,
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_DISABLE,
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_BUS_WIRES_ORIENT,
ID_TB_OPTIONS_SHOW_PADS_SKETCH,
......
......@@ -50,7 +50,6 @@ class GENERAL_COLLECTORS_GUIDE;
class WinEDA_BasePcbFrame : public EDA_DRAW_FRAME
{
public:
bool m_DisplayPadFill; // How show pads
bool m_DisplayViaFill; // How show vias
bool m_DisplayPadNum; // show pads numbers
......@@ -69,6 +68,9 @@ protected:
BOARD* m_Pcb;
GENERAL_COLLECTOR* m_Collector;
void updateGridSelectBox();
void updateZoomSelectBox();
public:
WinEDA_BasePcbFrame( wxWindow* father, int idtype,
const wxString& title,
......@@ -494,6 +496,15 @@ public:
*/
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()
};
......
......@@ -107,6 +107,7 @@ public:
void Process_Special_Functions( wxCommandEvent& event );
void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
......@@ -426,13 +427,9 @@ private:
/* User interface update event handlers. */
void OnUpdateBlockSelected( 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 OnUpdateBusOrientation( wxUpdateUIEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
/**
* Function SetLanguage
......
......@@ -53,6 +53,10 @@ class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
{
friend class PCB_LAYER_WIDGET;
void updateTraceWidthSelectBox();
void updateViaSizeSelectBox();
void updateDesignRulesSelectBoxes();
protected:
PCB_LAYER_WIDGET* m_Layers;
......@@ -103,6 +107,7 @@ protected:
* <p>
* This function cannot be inline without including layer_widget.h in
* here and we do not want to do that.
* </p>
*/
void syncLayerWidget( );
......@@ -157,6 +162,20 @@ public:
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
* used to print a page
......@@ -310,6 +329,7 @@ public:
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
......@@ -379,28 +399,13 @@ public:
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: */
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
/**
* Function OnRightClick
* populates a popup menu with the choices appropriate for the current
*context.
* populates a popup menu with the choices appropriate for the current context.
* The caller will add the ZOOM menu choices afterward.
* @param aMousePos The current mouse position
* @param aPopMenu The menu to add to.
......@@ -417,7 +422,7 @@ public:
* @param aItemToCopy = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for
*commands like move
* commands like move
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
UndoRedoOpType aTypeCommand,
......@@ -430,7 +435,7 @@ public:
* @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for
*commands like move
* commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand,
......@@ -439,13 +444,10 @@ public:
/**
* Function PutDataInPreviousState
* Used in undo or redo command.
* Put data pointed by List in the previous state, i.e. the state memorized
* by List
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to
* undo/redo
* Put data pointed by List in the previous state, i.e. the state memorized by List
* @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 aRebuildRatsnet = a bool: true to rebuild ratsnet (normal use),
* false
* @param aRebuildRatsnet = a bool: true to rebuild ratsnet (normal use), false
* to just retrieve last state (used in abort commands that do not need to
* rebuild ratsnest)
*/
......@@ -554,8 +556,6 @@ public:
*/
void Block_Duplicate();
void SetToolbars();
void Process_Settings( wxCommandEvent& event );
void OnConfigurePcbOptions( wxCommandEvent& aEvent );
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
......@@ -582,7 +582,7 @@ public:
* @param aForceFileDialog - Display the file open dialog even if aFullFileName is
* 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 aForceFileDialog = false );
......@@ -606,8 +606,7 @@ public:
/**
* Function Clear_Pcb
* delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to
* initialize silently
* @param aQuery = true to prompt user for confirmation, false to initialize silently
*/
bool Clear_Pcb( bool aQuery );
......@@ -1045,13 +1044,14 @@ public:
* @param aNetlistFullFilename = netlist file name (*.net)
* @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found,
* 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
* @param aChangeFootprint if true, footprints that have changed in netlist will be changed
* @param aDeleteBadTracks if true, erroneous tracks will be deleted
* @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
* from components (use after reannotation of the chematic)
* @param aSelect_By_Timestamp if true, use timestamp instead of reference to identify
* footprints from components (use after reannotation of the
* schematic)
* @return true if Ok
*
* the format of the netlist is something like:
......
......@@ -283,7 +283,6 @@ public:
void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event );
virtual void SetToolbars();
/**
* Function SetLanguage
......@@ -377,6 +376,19 @@ public:
virtual void OnSelectGrid( 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
* 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 )
GetScreen()->PushCommandToRedoList( List );
OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh();
}
......@@ -629,9 +626,6 @@ void WinEDA_PcbFrame::GetBoardFromRedoList( wxCommandEvent& event )
GetScreen()->PushCommandToUndoList( List );
OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh();
}
......
......@@ -103,7 +103,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
scanList = GENERAL_COLLECTOR::Tracks;
break;
case ID_COMPONENT_BUTT:
case ID_PCB_MODULE_BUTT:
scanList = GENERAL_COLLECTOR::ModuleItems;
break;
......@@ -376,6 +376,5 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxSafeYield();
}
SetToolbars();
UpdateStatusBar(); /* Display new cursor coordinates */
}
......@@ -25,7 +25,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
if( aTrack == 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 )
{
......
......@@ -710,7 +710,6 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
m_Pcb->SetCurrentNetClass( NETCLASS::Default );
m_Parent->m_TrackAndViasSizesList_Changed = true;
m_Parent->AuxiliaryToolBar_Update_UI();
}
......
......@@ -72,7 +72,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
UserUnitType ii;
DisplayOpt.DisplayPolarCood =
( m_PolarDisplay->GetSelection() == 0 ) ? FALSE : true;
( m_PolarDisplay->GetSelection() == 0 ) ? false : true;
ii = g_UserUnit;
g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
if( ii != g_UserUnit )
......@@ -114,45 +114,18 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id )
{
case ID_TB_OPTIONS_DRC_OFF:
Drc_On = state ? FALSE : true;
break;
case ID_TB_OPTIONS_SHOW_GRID:
SetElementVisibility(GRID_VISIBLE, state);
DrawPanel->Refresh();
Drc_On = !state;
break;
case ID_TB_OPTIONS_SHOW_RATSNEST:
SetElementVisibility(RATSNEST_VISIBLE, state);
DrawPanel->Refresh( );
SetElementVisibility( RATSNEST_VISIBLE, state );
DrawPanel->Refresh();
break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
g_Show_Module_Ratsnest = state; // TODO: use the visibility list
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:
g_AutoDeleteOldTrack = state;
break;
......@@ -172,27 +145,8 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
DrawPanel->Refresh();
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:
if( state )
{
m_DisplayViaFill = DisplayOpt.DisplayViaFill = false;
}
else
{
m_DisplayViaFill = DisplayOpt.DisplayViaFill = true;
}
m_DisplayViaFill = DisplayOpt.DisplayViaFill = !state;
DrawPanel->Refresh();
break;
......@@ -217,11 +171,12 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update();
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" ) );
else
GetMenuBar()->SetLabel(ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Show &Layers Manager" ) );
break;
......@@ -230,6 +185,4 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)" ) );
break;
}
SetToolbars();
}
......@@ -199,7 +199,7 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Dimension )
{
if( Dimension->m_Flags & IS_NEW )
if( Dimension->IsNew() )
{
Dimension->Draw( Panel, DC, GR_XOR );
Dimension->DeleteStructure();
......
......@@ -280,7 +280,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
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();
Edge->Draw( Panel, DC, GR_XOR, MoveVector );
......
......@@ -49,8 +49,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{
case wxID_CUT:
case wxID_COPY:
case ID_ON_GRID_SELECT:
case ID_ON_ZOOM_SELECT:
case ID_PCB_USER_GRID_SETUP:
case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
......@@ -231,66 +229,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
InstallFindFrame( pos, &dc );
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:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
......@@ -593,10 +531,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->Refresh();
break;
case ID_PCB_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
Process_Move_Item( this, GetCurItem(), &dc );
DrawPanel->m_AutoPAN_Request = true;
......@@ -952,7 +886,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
if( GetCurItem() && (GetCurItem()->IsNew()) )
{
End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
SetCurItem( NULL );
......@@ -961,7 +895,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
if( GetCurItem() && (GetCurItem()->IsNew()) )
{
if( End_Zone( &dc ) )
SetCurItem( NULL );
......@@ -971,7 +905,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
if( GetCurItem() && (GetCurItem()->IsNew()) )
{
if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
SetCurItem( NULL );
......@@ -1060,7 +994,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
}
SetToolbars();
DrawPanel->CrossHairOn( &dc );
DrawPanel->m_IgnoreMouseEvents = false;
}
......@@ -1222,7 +1155,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// See if we are drawing a segment; if so, add a via?
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 -
// see the implementation of Other_Layer_Route - the working
......@@ -1255,3 +1188,104 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
if( DisplayOpt.ContrastModeDisplay )
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 )
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();
return;
......@@ -69,7 +69,7 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( DrawPanel, DC, GR_OR );
OnModify();
if( (TextePcb->m_Flags & IS_NEW) ) // If new: prepare undo command
if( TextePcb->IsNew() ) // If new: prepare undo command
{
SaveCopyInUndoList( TextePcb, UR_NEW );
TextePcb->m_Flags = 0;
......@@ -100,7 +100,7 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
return;
// 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 );
TextePcb->Draw( DrawPanel, DC, GR_XOR );
......
......@@ -88,7 +88,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
if( Segment == NULL )
return;
if( Segment->m_Flags & IS_NEW ) // Trace in progress.
if( Segment->IsNew() ) // Trace in progress.
{
/* Delete current segment. */
DisplayOpt.DisplayDrawItems = SKETCH;
......@@ -175,7 +175,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
return;
}
if( Segment->m_Flags & IS_NEW )
if( Segment->IsNew() )
{
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
Segment ->DeleteStructure();
......
......@@ -104,7 +104,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM );
UpdateStatusBar();
SetToolbars();
return true;
}
......@@ -257,7 +256,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
via->DisplayInfo( this );
UpdateStatusBar();
SetToolbars();
return true;
}
......
......@@ -152,7 +152,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->SetNet( g_HighLight_NetCode );
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth();
......
......@@ -37,20 +37,17 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth =
not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth;
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0;
GetBoard()->m_ViaSizeSelector = 0;
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MoveCursorToCrossHair();
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true;
AuxiliaryToolBar_Update_UI( );
break;
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 )
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii;
AuxiliaryToolBar_Update_UI( );
break;
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 )
DrawPanel->MoveCursorToCrossHair();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetBoard()->m_ViaSizeSelector = ii;
AuxiliaryToolBar_Update_UI( );
break;
......
......@@ -30,8 +30,6 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
LoadOnePcbFile( fn );
ReCreateAuxiliaryToolbar();
SetToolbars();
DrawPanel->MoveCursorToCrossHair();
}
}
......@@ -55,8 +53,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
{
case ID_LOAD_FILE:
LoadOnePcbFile( GetScreen()->GetFileName(), false, true );
ReCreateAuxiliaryToolbar();
SetToolbars();
break;
case ID_MENU_READ_LAST_SAVED_VERSION_BOARD:
......@@ -91,8 +87,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
fn.SetExt( PcbFileExtension );
GetScreen()->SetFileName( fn.GetFullPath() );
SetTitle( GetScreen()->GetFileName() );
ReCreateAuxiliaryToolbar();
SetToolbars();
break;
}
......@@ -107,7 +101,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
GetChars( PcbFileExtension ) );
SetTitle( GetScreen()->GetFileName() );
ReCreateLayerBox( NULL );
SetToolbars();
break;
case ID_SAVE_BOARD:
......@@ -286,7 +279,6 @@ this file again." ) );
ReFillLayerWidget();
ReCreateLayerBox( NULL );
AuxiliaryToolBar_Update_UI();
syncLayerWidget();
// Display the loaded board:
......
......@@ -152,7 +152,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break;
case HK_ADD_MODULE:
evt_type = ID_COMPONENT_BUTT;
evt_type = ID_PCB_MODULE_BUTT;
break;
case HK_UNDO:
......@@ -214,8 +214,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break;
case HK_END_TRACK:
if( itemCurrentlyEdited && (GetCurItem()->IsTrack() )
&& ( (GetCurItem()->m_Flags & IS_NEW) != 0 ) )
if( itemCurrentlyEdited && GetCurItem()->IsTrack() && GetCurItem()->IsNew() )
{
// A new track is in progress: call to End_Route()
DrawPanel->MoveCursorToCrossHair();
......@@ -250,7 +249,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break;
if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur
return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
if( !GetCurItem()->IsNew() )
return;
// place micro via and switch layer
......@@ -268,7 +267,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
return;
if( GetCurItem()->Type() != TYPE_TRACK )
return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
if( !GetCurItem()->IsNew() )
return;
evt_type = ID_POPUP_PCB_PLACE_VIA;
break;
......@@ -300,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
if( track )
DrawPanel->m_AutoPAN_Request = true;
}
else if( GetCurItem()->m_Flags & IS_NEW )
else if( GetCurItem()->IsNew() )
{
TRACK* track = Begin_Route( (TRACK*) GetCurItem(), aDC );
......@@ -404,7 +403,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC )
}
break;
case ID_COMPONENT_BUTT:
case ID_PCB_MODULE_BUTT:
if( ItemFree )
{
wxPoint pos = GetScreen()->RefPos( false );
......
......@@ -66,7 +66,6 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery )
ReFillLayerWidget();
SetToolbars();
Zoom_Automatique( true );
return true;
......
......@@ -1121,7 +1121,6 @@ int WinEDA_PcbFrame::ReadPcbFile( LINE_READER* aReader, bool Append )
m_TrackAndViasSizesList_Changed = true;
SetStatusText( wxEmptyString );
BestZoom();
SetToolbars();
return 1;
}
......@@ -1156,10 +1155,8 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
// Select default Netclass before writing file.
// Useful to save default values in headers
GetBoard()->SetCurrentNetClass(
GetBoard()->m_NetClasses.GetDefault()->GetName() );
GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
WriteGeneralDescrPcb( aFile );
WriteSheetDescr( GetScreen(), aFile );
......
......@@ -132,7 +132,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Delete items */
item = new wxMenuItem( editMenu,
ID_MODEDIT_DELETE_ITEM_BUTT,
ID_MODEDIT_DELETE_TOOL,
_( "Delete" ),
_( "Delete objects with the eraser" ) );
item->SetBitmap( delete_body_xpm );
......@@ -236,9 +236,9 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Pad */
item = new wxMenuItem( placeMenu,
ID_MODEDIT_ADD_PAD,
ID_MODEDIT_PAD_TOOL,
_( "Pad" ),
_( "Add Pads" ) );
_( "Add pad" ) );
item->SetBitmap( pad_xpm );
placeMenu->Append( item );
......@@ -247,7 +247,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Circle */
item = new wxMenuItem( placeMenu,
ID_PCB_CIRCLE_BUTT,
ID_MODEDIT_CIRCLE_TOOL,
_( "Circle" ),
_( "Add graphic circle" ) );
item->SetBitmap( add_circle_xpm );
......@@ -255,7 +255,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Line or Polygon */
item = new wxMenuItem( placeMenu,
ID_PCB_ADD_LINE_BUTT,
ID_MODEDIT_LINE_TOOL,
_( "Line or Polygon" ),
_( "Add graphic line or polygon" ) );
item->SetBitmap( add_polygon_xpm );
......@@ -263,7 +263,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Arc */
item = new wxMenuItem( placeMenu,
ID_PCB_ARC_BUTT,
ID_MODEDIT_ARC_TOOL,
_( "Arc" ),
_( "Add graphic arc" ) );
item->SetBitmap( add_arc_xpm );
......@@ -271,7 +271,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Text */
item = new wxMenuItem( placeMenu,
ID_PCB_ADD_TEXT_BUTT,
ID_MODEDIT_TEXT_TOOL,
_( "Text" ),
_( "Add graphic text" ) );
item->SetBitmap( add_text_xpm );
......@@ -280,7 +280,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Anchor */
placeMenu->AppendSeparator();
item = new wxMenuItem( placeMenu,
ID_MODEDIT_PLACE_ANCHOR,
ID_MODEDIT_ANCHOR_TOOL,
_( "Anchor" ),
_( "Place the footprint module reference anchor" ) );
item->SetBitmap( anchor_xpm );
......
......@@ -381,9 +381,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
wxMenu* placeMenu = new wxMenu;
// Module
text = AddHotkeyName( _( "Module" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ADD_MODULE, false );
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text,
text = AddHotkeyName( _( "Module" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ADD_MODULE, false );
item = new wxMenuItem( placeMenu, ID_PCB_MODULE_BUTT, text,
_( "Add modules" ), wxITEM_NORMAL );
item->SetBitmap( module_xpm );
......
......@@ -184,7 +184,7 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
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->DeleteStructure();
......@@ -250,7 +250,7 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
SetCurItem( NULL );
OnModify();
if( (MirePcb->m_Flags & IS_NEW) )
if( MirePcb->IsNew() )
{
SaveCopyInUndoList( MirePcb, UR_NEW );
MirePcb->m_Flags = 0;
......
......@@ -443,46 +443,12 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
}
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:
break;
case ID_POPUP_CANCEL_CURRENT_COMMAND:
break;
case ID_MODEDIT_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
DrawPanel->MoveCursorToCrossHair();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
......@@ -708,8 +674,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break;
}
SetToolbars();
if( redraw )
DrawPanel->Refresh();
}
......@@ -836,3 +800,57 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
module->Set_Rectangle_Encadrement();
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 )
SetCurItem( NULL );
OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh();
}
......@@ -133,7 +131,5 @@ void WinEDA_ModuleEditFrame::GetComponentFromUndoList( wxCommandEvent& event )
SetCurItem( NULL );;
OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh();
}
......@@ -22,31 +22,6 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
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:
m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( );
......@@ -74,6 +49,4 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
wxT( "WinEDA_ModuleEditFrame::OnSelectOptionToolbar error" ) );
break;
}
SetToolbars();
}
......@@ -36,7 +36,6 @@ public:
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
......@@ -48,6 +47,15 @@ public:
bool OnHotkeyRotateItem( int aIdCommand );
void Show3D_Frame( wxCommandEvent& event );
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
......@@ -78,8 +86,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC,
int aPrintMaskLayer, bool aPrintMirrorMode,
virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode,
void * aData = NULL);
// BOARD handling
......
This diff is collapsed.
......@@ -156,7 +156,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
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 = NULL;
......@@ -396,7 +396,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
OnModify();
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
if( module->m_Flags & IS_NEW )
if( module->IsNew() )
{
SaveCopyInUndoList( module, UR_NEW );
}
......
......@@ -71,7 +71,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( NewTrack )
{
if( NewTrack->m_Flags & IS_NEW )
if( NewTrack->IsNew() )
{
for( ii = 0; ii < NbPtNewTrack; ii++, NewTrack = NextS )
{
......
......@@ -64,8 +64,6 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
wxT( "WinEDA_PcbFrame::ProcessMuWaveFunctions() id error" ) );
break;
}
SetToolbars();
}
......
......@@ -33,7 +33,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
switch( DrawStruct->Type() )
{
case TYPE_ZONE_CONTAINER:
if( (DrawStruct->m_Flags & IS_NEW) )
if( DrawStruct->IsNew() )
{
DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( aDC );
......@@ -127,7 +127,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
GetBoard()->SetCurrentNetClass(
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
break;
default:
......@@ -138,12 +137,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state )
{
case ID_MAIN_MENUBAR:
case ID_PCB_NO_TOOL:
case 0:
break;
case ID_NO_SELECT_BUTT:
break;
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
......@@ -211,7 +208,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else if( DrawStruct
&& (DrawStruct->Type() == TYPE_DRAWSEGMENT)
&& (DrawStruct->m_Flags & IS_NEW) )
&& DrawStruct->IsNew() )
{
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC );
SetCurItem( DrawStruct );
......@@ -234,7 +231,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( DrawStruct )
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 );
// SetCurItem() must not write to the msg panel
......@@ -284,7 +281,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else if( DrawStruct
&& (DrawStruct->Type() == TYPE_ZONE_CONTAINER)
&& (DrawStruct->m_Flags & IS_NEW) )
&& DrawStruct->IsNew() )
{ // Add a new corner to the current outline beeing created:
DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( aDC );
......@@ -311,7 +308,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) );
break;
case ID_COMPONENT_BUTT:
case ID_PCB_MODULE_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawPanel->MoveCursorToCrossHair();
......@@ -343,7 +340,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else if( DrawStruct
&& (DrawStruct->Type() == TYPE_DIMENSION)
&& (DrawStruct->m_Flags & IS_NEW) )
&& DrawStruct->IsNew() )
{
DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, aDC );
SetCurItem( DrawStruct );
......@@ -395,6 +392,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state )
{
case ID_PCB_NO_TOOL:
case 0:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
......@@ -413,7 +411,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
{
case TYPE_TRACK:
case TYPE_VIA:
if( DrawStruct->m_Flags & IS_NEW )
if( DrawStruct->IsNew() )
{
End_Route( (TRACK*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false;
......@@ -451,7 +449,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break; // end case 0
case ID_TRACK_BUTT:
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
if( DrawStruct && DrawStruct->IsNew() )
{
End_Route( (TRACK*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false;
......@@ -471,18 +469,21 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_CIRCLE_BUTT:
if( DrawStruct == NULL )
break;
if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
{
DisplayError( this, wxT( "DrawStruct Type error" ) );
DrawPanel->m_AutoPAN_Request = false;
break;
}
if( (DrawStruct->m_Flags & IS_NEW) )
if( DrawStruct->IsNew() )
{
End_Edge( (DRAWSEGMENT*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL );
}
break;
}
}
......
......@@ -134,8 +134,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
else
{
msg = AddHotkeyName( _(
"Unlock Module" ), g_Board_Editor_Hokeys_Descr,
msg = AddHotkeyName( _( "Unlock Module" ), g_Board_Editor_Hokeys_Descr,
HK_LOCK_UNLOCK_FOOTPRINT );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg,
unlocked_xpm );
......@@ -311,7 +310,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
aPopMenu->AppendSeparator();
break;
case ID_COMPONENT_BUTT:
case ID_PCB_MODULE_BUTT:
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC,
_( "Footprint Documentation" ), book_xpm );
aPopMenu->AppendSeparator();
......@@ -408,9 +407,9 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
GetBoard()->SetCurrentNetClass( Track->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
int flags = Track->m_Flags;
if( flags == 0 )
{
if( Track->Type() == TYPE_VIA )
......@@ -737,7 +736,6 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
wxString msg = Pad->MenuText( GetBoard() );
......
This diff is collapsed.
......@@ -17,17 +17,26 @@ enum pcbnew_ids
ID_MICROWAVE_V_TOOLBAR,
ID_OPEN_MODULE_EDITOR,
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_ARC_BUTT,
ID_PCB_HIGHLIGHT_BUTT,
ID_PCB_ADD_TEXT_BUTT,
ID_PCB_DIMENSION_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_GRID_COORD_BUTT,
ID_PCB_MASK_CLEARANCE,
ID_PCB_LAYERS_SETUP,
ID_PCB_ADD_LINE_BUTT,
ID_PCB_ADD_TEXT_BUTT,
ID_POPUP_PCB_START_RANGE,
ID_POPUP_PCB_MOVE_MODULE_REQUEST,
......@@ -228,7 +237,6 @@ enum pcbnew_ids
ID_PCB_PAD_SETUP,
ID_PCB_DIMENSION_BUTT,
ID_PCB_DRAWINGS_WIDTHS_SETUP,
ID_PCB_GEN_CMP_FILE,
......@@ -251,13 +259,21 @@ enum pcbnew_ids
ID_DRC_CONTROL,
ID_PCB_GLOBAL_DELETE,
ID_TRACK_BUTT,
ID_PCB_ZONES_BUTT,
ID_PCB_DELETE_ITEM_BUTT,
ID_POPUP_PCB_DELETE_TRACKSEG,
ID_TOOLBARH_PCB_SELECT_LAYER,
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_MODEDIT_CHECK,
ID_MODEDIT_SELECT_CURRENT_LIB,
......@@ -266,9 +282,6 @@ enum pcbnew_ids
ID_MODEDIT_NEW_MODULE,
ID_MODEDIT_SHEET_SET,
ID_MODEDIT_LOAD_MODULE,
ID_MODEDIT_ADD_PAD,
ID_MODEDIT_PLACE_ANCHOR,
ID_MODEDIT_DELETE_ITEM_BUTT,
ID_MODEDIT_PAD_SETTINGS,
ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
ID_MODEDIT_INSERT_MODULE_IN_BOARD,
......
......@@ -235,7 +235,6 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
int result = frame->ShowModal();
frame->Destroy();
DrawPanel->MoveCursorToCrossHair();
SetToolbars();
// if user changed colors and we are in high contrast mode, then redraw
// because the PAD_SMD pads may change color.
......
This diff is collapsed.
......@@ -29,7 +29,7 @@ void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
break;
}
case ID_COMPONENT_BUTT:
case ID_PCB_MODULE_BUTT:
break;
case ID_PCB_CIRCLE_BUTT:
......@@ -61,15 +61,14 @@ void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event )
switch( id )
{
case ID_MODEDIT_ADD_PAD:
case ID_MODEDIT_PAD_TOOL:
InstallPadOptionsFrame( NULL );
break;
case ID_PCB_CIRCLE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_DIMENSION_BUTT:
case ID_PCB_ADD_TEXT_BUTT:
case ID_MODEDIT_CIRCLE_TOOL:
case ID_MODEDIT_ARC_TOOL:
case ID_MODEDIT_LINE_TOOL:
case ID_MODEDIT_TEXT_TOOL:
InstallOptionsFrame( pos );
break;
......
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