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.
This commit is contained in:
Wayne Stambaugh 2011-02-21 08:54:29 -05:00
parent c476ae44b5
commit bdca3c5efb
88 changed files with 1781 additions and 2065 deletions

View File

@ -44,13 +44,23 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
EDA_DRAW_FRAME::OnZoom ) EDA_DRAW_FRAME::OnZoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
EDA_DRAW_FRAME::OnSelectGrid ) EDA_DRAW_FRAME::OnSelectGrid )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnToggleGridState )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
EDA_DRAW_FRAME::OnSelectUnits )
EVT_TOOL( ID_TB_OPTIONS_SELECT_CURSOR, EDA_DRAW_FRAME::OnToggleCrossHairStyle )
EVT_UPDATE_UI( wxID_UNDO, EDA_DRAW_FRAME::OnUpdateUndo )
EVT_UPDATE_UI( wxID_REDO, EDA_DRAW_FRAME::OnUpdateRedo )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnUpdateGrid )
EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, EDA_DRAW_FRAME::OnUpdateCrossHairStyle )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
EDA_DRAW_FRAME::OnUpdateUnits )
END_EVENT_TABLE() END_EVENT_TABLE()
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxString& title, const wxPoint& pos, const wxSize& size, long style ) :
const wxPoint& pos, const wxSize& size,
long style ) :
EDA_BASE_FRAME( father, idtype, title, pos, size, style ) EDA_BASE_FRAME( father, idtype, title, pos, size, style )
{ {
wxSize minsize; wxSize minsize;
@ -154,6 +164,79 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
} }
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
{
SetGridVisibility( !IsGridVisible() );
DrawPanel->Refresh();
}
void EDA_DRAW_FRAME::OnSelectUnits( wxCommandEvent& aEvent )
{
if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && g_UserUnit != MILLIMETRES )
{
g_UserUnit = MILLIMETRES;
UpdateStatusBar();
}
else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && g_UserUnit != INCHES )
{
g_UserUnit = INCHES;
UpdateStatusBar();
}
}
void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
{
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
DrawPanel->CrossHairOff( &dc );
m_CursorShape = !m_CursorShape;
DrawPanel->CrossHairOn( &dc );
}
void EDA_DRAW_FRAME::OnUpdateUndo( wxUpdateUIEvent& aEvent )
{
if( GetScreen() )
aEvent.Enable( GetScreen()->GetUndoCommandCount() > 0 );
}
void EDA_DRAW_FRAME::OnUpdateRedo( wxUpdateUIEvent& aEvent )
{
if( GetScreen() )
aEvent.Enable( GetScreen()->GetRedoCommandCount() > 0 );
}
void EDA_DRAW_FRAME::OnUpdateUnits( wxUpdateUIEvent& aEvent )
{
bool enable;
enable = ( ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM) && (g_UserUnit == MILLIMETRES))
|| ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH) && (g_UserUnit == INCHES)) );
aEvent.Check( enable );
DisplayUnitsMsg();
}
void EDA_DRAW_FRAME::OnUpdateGrid( wxUpdateUIEvent& aEvent )
{
wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
aEvent.Check( IsGridVisible() );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
}
void EDA_DRAW_FRAME::OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_CursorShape );
}
// Virtual function // Virtual function
void EDA_DRAW_FRAME::ReCreateAuxiliaryToolbar() void EDA_DRAW_FRAME::ReCreateAuxiliaryToolbar()
{ {
@ -177,6 +260,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
{ {
} }
/** /**
* Function PrintPage (virtual) * Function PrintPage (virtual)
* used to print a page * used to print a page
@ -307,15 +391,6 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
} }
void EDA_DRAW_FRAME::SetToolbars()
{
DisplayUnitsMsg();
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
}
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg ) void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
{ {
SetStatusText( msg, 5 ); SetStatusText( msg, 5 );
@ -379,53 +454,14 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
// Change DrawPanel cursor if requested. // Change DrawPanel cursor if requested.
if( DrawPanel && aCursor >= 0 ) if( DrawPanel && aCursor >= 0 )
{
DrawPanel->SetCursor( aCursor ); DrawPanel->SetCursor( aCursor );
}
DisplayToolMsg( aToolMsg ); DisplayToolMsg( aToolMsg );
if( aId < 0 ) if( aId < 0 )
return; return;
// Old Tool ID_NO_SELECT_BUTT active or inactive if no new tool.
if( m_ID_current_state )
{
if( m_VToolBar )
m_VToolBar->ToggleTool( m_ID_current_state, FALSE );
if( m_AuxVToolBar )
m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE );
}
else
{
if( aId )
{
if( m_VToolBar )
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, FALSE );
if( m_AuxVToolBar )
m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE );
}
else if( m_VToolBar )
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
}
if( aId )
{
if( m_VToolBar )
m_VToolBar->ToggleTool( aId, TRUE );
if( m_AuxVToolBar )
m_AuxVToolBar->ToggleTool( aId, TRUE );
}
else if( m_VToolBar )
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_ID_current_state = aId; m_ID_current_state = aId;
if( m_VToolBar )
m_VToolBar->Refresh( );
} }

View File

@ -16,7 +16,7 @@
#define CURSOR_SIZE 12 // Cursor size in pixels #define CURSOR_SIZE 12 // Cursor size in pixels
#define CLIP_BOX_PADDING 1 #define CLIP_BOX_PADDING 2
/* Definitions for enabling and disabling debugging features in drawpanel.cpp. /* Definitions for enabling and disabling debugging features in drawpanel.cpp.
* Please don't forget to turn these off before making any commits to Launchpad. * Please don't forget to turn these off before making any commits to Launchpad.
@ -749,6 +749,8 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
cmd.SetEventObject( this ); cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
} }
event.Skip();
} }
@ -882,7 +884,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
wxPoint pos = CalcUnscrolledPosition( event.GetPosition() ); wxPoint pos = CalcUnscrolledPosition( event.GetPosition() );
/* Compute the cursor position in drawing (logical) units. */ /* Compute the cursor position in drawing (logical) units. */
screen->m_MousePosition = event.GetLogicalPosition( DC ); screen->SetMousePosition( event.GetLogicalPosition( DC ) );
int kbstat = 0; int kbstat = 0;
@ -902,7 +904,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// Calling Double Click and Click functions : // Calling Double Click and Click functions :
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) ) if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{ {
GetParent()->OnLeftDClick( &DC, screen->m_MousePosition ); GetParent()->OnLeftDClick( &DC, screen->RefPos( true ) );
// inhibit a response to the mouse left button release, // inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new // because we have a double click, and we do not want a new
@ -914,7 +916,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// A block command is in progress: a left up is the end of block // A block command is in progress: a left up is the end of block
// or this is the end of a double click, already seen // or this is the end of a double click, already seen
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease )
GetParent()->OnLeftClick( &DC, screen->m_MousePosition ); GetParent()->OnLeftClick( &DC, screen->RefPos( true ) );
ignoreNextLeftButtonRelease = false; ignoreNextLeftButtonRelease = false;
} }
@ -1140,7 +1142,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
// Compute the cursor position in drawing units. Also known as logical units to wxDC. // Compute the cursor position in drawing units. Also known as logical units to wxDC.
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) ); pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
Screen->m_MousePosition = pos; Screen->SetMousePosition( pos );
GetParent()->GeneralControle( &DC, pos ); GetParent()->GeneralControle( &DC, pos );

View File

@ -69,7 +69,6 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection(); m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection();
m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue();
m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue(); m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue();
m_Parent->SetToolbars();
m_Parent->DrawPanel->Refresh(); m_Parent->DrawPanel->Refresh();
} }

View File

@ -228,7 +228,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
if( firstsegment == NULL ) if( firstsegment == NULL )
return; return;
if( ( firstsegment->m_Flags & IS_NEW ) == 0 ) if( !firstsegment->IsNew() )
return; return;
/* Delete Null segments and Put line it in Drawlist */ /* Delete Null segments and Put line it in Drawlist */

View File

@ -29,7 +29,7 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode ); BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( BusEntry->m_Flags & IS_NEW ) if( BusEntry->IsNew() )
{ {
delete BusEntry; delete BusEntry;
Panel->GetScreen()->SetCurItem( NULL ); Panel->GetScreen()->SetCurItem( NULL );
@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
if( (BusEntry->m_Flags & IS_NEW) == 0 ) // not already in edit, save shape if( !BusEntry->IsNew() ) // not already in edit, save shape
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = BusEntry->Clone(); g_ItemToUndoCopy = BusEntry->Clone();

View File

@ -204,7 +204,7 @@ LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary )
BOOST_FOREACH( LIB_DRAW_ITEM& oldItem, aComponent.GetDrawItemList() ) BOOST_FOREACH( LIB_DRAW_ITEM& oldItem, aComponent.GetDrawItemList() )
{ {
if( ( oldItem.m_Flags & IS_NEW ) != 0 ) if( oldItem.IsNew() )
continue; continue;
newItem = oldItem.GenCopy(); newItem = oldItem.GenCopy();

View File

@ -283,7 +283,7 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
if( screen->IsRefreshReq() ) if( screen->IsRefreshReq() )
{ {
DrawPanel->Refresh( ); DrawPanel->Refresh();
wxSafeYield(); wxSafeYield();
} }
@ -310,7 +310,6 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
} }
UpdateStatusBar(); /* Display cursor coordinates info */ UpdateStatusBar(); /* Display cursor coordinates info */
SetToolbars();
} }
@ -473,5 +472,4 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
} }
UpdateStatusBar(); UpdateStatusBar();
SetToolbars();
} }

View File

@ -39,7 +39,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
if( (TextStruct->m_Flags & IS_NEW) == 0 ) if( !TextStruct->IsNew() )
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = TextStruct->Clone(); g_ItemToUndoCopy = TextStruct->Clone();
@ -227,7 +227,7 @@ static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC )
* created)*/ * created)*/
Struct->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode ); Struct->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( Struct->m_Flags & IS_NEW ) if( Struct->IsNew() )
{ {
SAFE_DELETE( Struct ); SAFE_DELETE( Struct );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );

View File

@ -23,7 +23,9 @@ enum id_eeschema_frm
/* Schematic editor veritcal toolbar IDs */ /* Schematic editor veritcal toolbar IDs */
ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
ID_SCH_NO_TOOL,
ID_HIERARCHY_PUSH_POP_BUTT, ID_HIERARCHY_PUSH_POP_BUTT,
ID_SCH_PLACE_COMPONENT,
ID_PLACE_POWER_BUTT, ID_PLACE_POWER_BUTT,
ID_BUS_BUTT, ID_BUS_BUTT,
ID_WIRE_BUTT, ID_WIRE_BUTT,
@ -154,16 +156,17 @@ enum id_eeschema_frm
ID_LIBEDIT_SELECT_ALIAS, ID_LIBEDIT_SELECT_ALIAS,
/* Library editor vertical toolbar IDs. */ /* Library editor vertical toolbar IDs. */
ID_LIBEDIT_NO_TOOL,
ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_PIN_BUTT,
ID_LIBEDIT_BODY_LINE_BUTT, ID_LIBEDIT_BODY_LINE_BUTT,
ID_LIBEDIT_BODY_ARC_BUTT, ID_LIBEDIT_BODY_ARC_BUTT,
ID_LIBEDIT_BODY_CIRCLE_BUTT, ID_LIBEDIT_BODY_CIRCLE_BUTT,
ID_LIBEDIT_BODY_RECT_BUTT, ID_LIBEDIT_BODY_RECT_BUTT,
ID_LIBEDIT_BODY_TEXT_BUTT, ID_LIBEDIT_BODY_TEXT_BUTT,
ID_LIBEDIT_DELETE_ITEM_BUTT,
ID_LIBEDIT_ANCHOR_ITEM_BUTT, ID_LIBEDIT_ANCHOR_ITEM_BUTT,
ID_LIBEDIT_IMPORT_BODY_BUTT, ID_LIBEDIT_IMPORT_BODY_BUTT,
ID_LIBEDIT_EXPORT_BODY_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT,
ID_LIBEDIT_DELETE_ITEM_BUTT,
/* Library editor context menu IDs */ /* Library editor context menu IDs */
ID_LIBEDIT_EDIT_PIN, ID_LIBEDIT_EDIT_PIN,

View File

@ -269,7 +269,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
// notBusy == true means no item currently edited and no other command in progress // notBusy == true means no item currently edited and no other command in progress
// We can change active tool and ask for editing a new item // We can change active tool and ask for editing a new item
bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK); bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK);
bool RefreshToolBar = FALSE;
if( aHotKey == 0 ) if( aHotKey == 0 )
return; return;
@ -343,7 +342,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_DELETE: case HK_DELETE:
if( notBusy) if( notBusy)
{ {
RefreshToolBar = LocateAndDeleteItem( this, aDC ); LocateAndDeleteItem( this, aDC );
OnModify(); OnModify();
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds( DrawPanel, aDC ); GetScreen()->TestDanglingEnds( DrawPanel, aDC );
@ -390,8 +389,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( !itemInEdit ) if( !itemInEdit )
{ {
// switch to m_ID_current_state = ID_COMPONENT_BUTT; // switch to m_ID_current_state = ID_COMPONENT_BUTT;
if( m_ID_current_state != ID_COMPONENT_BUTT ) if( m_ID_current_state != ID_SCH_PLACE_COMPONENT )
SetToolID( ID_COMPONENT_BUTT, wxCURSOR_PENCIL, _( "Add Component" ) ); SetToolID( ID_SCH_PLACE_COMPONENT, wxCURSOR_PENCIL, _( "Add Component" ) );
OnLeftClick( aDC, aPosition ); OnLeftClick( aDC, aPosition );
} }
@ -648,7 +647,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->m_Flags == 0 ) if( aItem->m_Flags == 0 )
{ {
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
} }
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_Y ); CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_Y );
@ -670,7 +668,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->m_Flags == 0 ) if( aItem->m_Flags == 0 )
{ {
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
} }
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_X ); CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_X );
@ -686,7 +683,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->m_Flags == 0 ) if( aItem->m_Flags == 0 )
{ {
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
} }
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_NORMAL ); CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_NORMAL );
@ -880,9 +876,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
} }
break; break;
} }
if( RefreshToolBar )
SetToolbars();
} }
@ -979,7 +972,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_EDIT: case HK_EDIT:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem ) if( m_drawItem )
{ {
@ -1011,7 +1004,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_ROTATE: case HK_ROTATE:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem ) if( m_drawItem )
{ {
@ -1047,7 +1040,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
} }
case HK_DELETE: case HK_DELETE:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() ) if( m_drawItem && !m_drawItem->InEditMode() )
{ {
@ -1058,7 +1051,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_LIBEDIT_MOVE_GRAPHIC_ITEM: case HK_LIBEDIT_MOVE_GRAPHIC_ITEM:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() ) if( m_drawItem && !m_drawItem->InEditMode() )
{ {
@ -1069,7 +1062,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_DRAG: case HK_DRAG:
m_drawItem = LocateItemUsingCursor(); m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() ) if( m_drawItem && !m_drawItem->InEditMode() )
{ {

View File

@ -328,7 +328,7 @@ int LIB_ARC::GetPenSize()
void LIB_ARC::drawEditGraphics( EDA_Rect* aClipBox, wxDC* aDC, int aColor ) void LIB_ARC::drawEditGraphics( EDA_Rect* aClipBox, wxDC* aDC, int aColor )
{ {
// The edit indicators only get drawn when a new arc is being drawn. // The edit indicators only get drawn when a new arc is being drawn.
if( ( m_Flags & IS_NEW ) == 0 ) if( !IsNew() )
return; return;
// Use the last edit state so when the drawing switches from the end mode to the center // Use the last edit state so when the drawing switches from the end mode to the center
@ -350,7 +350,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
{ {
// Don't draw the arc until the end point is selected. Only the edit indicators // Don't draw the arc until the end point is selected. Only the edit indicators
// get drawn at this time. // get drawn at this time.
if( ( m_Flags & IS_NEW ) && m_lastEditState == 1 ) if( IsNew() && m_lastEditState == 1 )
return; return;
wxPoint pos1, pos2, posc; wxPoint pos1, pos2, posc;

View File

@ -509,7 +509,7 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
if( ( pinList[i]->m_position == m_position ) if( ( pinList[i]->m_position == m_position )
&& ( pinList[i]->m_orientation == m_orientation ) && ( pinList[i]->m_orientation == m_orientation )
&& ( !( m_Flags & IS_NEW ) ) && !IsNew()
&& editPinByPin == false && editPinByPin == false
&& enable ) && enable )
pinList[i]->m_Flags |= IS_LINKED | IN_EDIT; pinList[i]->m_Flags |= IS_LINKED | IN_EDIT;

View File

@ -18,7 +18,7 @@
#include "class_libentry.h" #include "class_libentry.h"
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{ {
LIB_DRAW_ITEM* DrawEntry = m_drawItem; LIB_DRAW_ITEM* DrawEntry = m_drawItem;
@ -43,8 +43,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else else
{ {
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
GetScreen()->m_MousePosition );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
@ -64,7 +63,8 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_NO_SELECT_BUTT: case 0:
case ID_LIBEDIT_NO_TOOL:
break; break;
case ID_LIBEDIT_PIN_BUTT: case ID_LIBEDIT_PIN_BUTT:
@ -89,7 +89,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else if( m_drawItem ) else if( m_drawItem )
{ {
if( m_drawItem->m_Flags & IS_NEW ) if( m_drawItem->IsNew() )
GraphicItemBeginDraw( DC ); GraphicItemBeginDraw( DC );
else else
EndDrawGraphicItem( DC ); EndDrawGraphicItem( DC );
@ -97,14 +97,14 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case ID_LIBEDIT_DELETE_ITEM_BUTT: case ID_LIBEDIT_DELETE_ITEM_BUTT:
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
GetScreen()->m_MousePosition );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->GetCrossHairPosition() ); GetScreen()->GetCrossHairPosition() );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DisplayCmpDoc(); DisplayCmpDoc();
@ -142,7 +142,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* If an editable item (field, pin, graphic): * If an editable item (field, pin, graphic):
* Call the suitable dialog editor. * Call the suitable dialog editor.
*/ */
void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
{ {
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
@ -151,8 +151,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) ) if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
{ // We can locate an item { // We can locate an item
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
GetScreen()->m_MousePosition );
if( m_drawItem == NULL ) if( m_drawItem == NULL )
{ {
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
@ -198,7 +197,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
EditGraphicSymbol( DC, m_drawItem ); EditGraphicSymbol( DC, m_drawItem );
} }
else if( m_drawItem->m_Flags & IS_NEW ) else if( m_drawItem->IsNew() )
{ {
EndDrawGraphicItem( DC ); EndDrawGraphicItem( DC );
} }

View File

@ -28,9 +28,9 @@ static void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame );
static void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame ); static void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame );
bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
LIB_DRAW_ITEM* DrawEntry = LocateItemUsingCursor(); LIB_DRAW_ITEM* DrawEntry = LocateItemUsingCursor( aPosition );
bool BlockActive = GetScreen()->IsBlockActive(); bool BlockActive = GetScreen()->IsBlockActive();
if( BlockActive ) if( BlockActive )

View File

@ -80,7 +80,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate ) EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate )
/* Main horizontal toolbar. */ /* Main horizontal toolbar. */
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, LIB_EDIT_FRAME::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, LIB_EDIT_FRAME::OnZoom )
EVT_TOOL( ID_LIBEDIT_SAVE_CURRENT_LIB, LIB_EDIT_FRAME::SaveActiveLibrary ) EVT_TOOL( ID_LIBEDIT_SAVE_CURRENT_LIB, LIB_EDIT_FRAME::SaveActiveLibrary )
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB, LIB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB, LIB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_DELETE_PART, LIB_EDIT_FRAME::DeleteOnePart ) EVT_TOOL( ID_LIBEDIT_DELETE_PART, LIB_EDIT_FRAME::DeleteOnePart )
@ -106,9 +106,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias ) EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias )
/* Right vertical toolbar. */ /* Right vertical toolbar. */
EVT_TOOL( ID_NO_SELECT_BUTT, LIB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL_RANGE( ID_LIBEDIT_NO_TOOL, ID_LIBEDIT_DELETE_ITEM_BUTT,
EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT, LIB_EDIT_FRAME::OnSelectTool )
LIB_EDIT_FRAME::Process_Special_Functions )
/* menubar commands */ /* menubar commands */
EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow ) EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow )
@ -158,7 +157,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnUpdateSelectAlias ) EVT_UPDATE_UI( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnUpdateSelectAlias )
EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal ) EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal )
EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert ) EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert )
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT, EVT_UPDATE_UI_RANGE( ID_LIBEDIT_NO_TOOL, ID_LIBEDIT_DELETE_ITEM_BUTT,
LIB_EDIT_FRAME::OnUpdateEditingPart ) LIB_EDIT_FRAME::OnUpdateEditingPart )
END_EVENT_TABLE() END_EVENT_TABLE()
@ -180,6 +179,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_drawSpecificUnit = false; m_drawSpecificUnit = false;
m_tempCopyComponent = NULL; m_tempCopyComponent = NULL;
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
m_ID_current_state = ID_LIBEDIT_NO_TOOL;
// Give an icon // Give an icon
SetIcon( wxIcon( libedit_xpm ) ); SetIcon( wxIcon( libedit_xpm ) );
@ -251,8 +251,10 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
frame->m_LibeditFrame = NULL; frame->m_LibeditFrame = NULL;
m_drawItem = m_lastDrawItem = NULL; m_drawItem = m_lastDrawItem = NULL;
if ( m_tempCopyComponent ) if ( m_tempCopyComponent )
delete m_tempCopyComponent; delete m_tempCopyComponent;
m_tempCopyComponent = NULL; m_tempCopyComponent = NULL;
} }
@ -433,9 +435,18 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
} }
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 ) event.Enable( ( m_component != NULL )
&& ( ( m_component->GetPartCount() > 1 ) || m_showDeMorgan ) ); && ( ( m_component->GetPartCount() > 1 ) || m_showDeMorgan ) );
if( m_HToolBar ) event.Check( g_EditPinByPinIsOn );
m_HToolBar->ToggleTool( event.GetId(), g_EditPinByPinIsOn );
} }
@ -510,7 +520,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
return; return;
event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) ); event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 ); event.Check( m_convert <= 1 );
} }
@ -520,7 +530,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
return; return;
event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) ); event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 ); event.Check( m_convert > 1 );
} }
@ -539,7 +549,7 @@ void LIB_EDIT_FRAME::OnUpdateSelectAlias( wxUpdateUIEvent& event )
void LIB_EDIT_FRAME::OnSelectAlias( wxCommandEvent& event ) void LIB_EDIT_FRAME::OnSelectAlias( wxCommandEvent& event )
{ {
if( m_SelAliasBox == NULL if( m_SelAliasBox == NULL
|| m_SelAliasBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0 ) || ( m_SelAliasBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0) )
return; return;
m_lastDrawItem = NULL; m_lastDrawItem = NULL;
@ -660,61 +670,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
g_EditPinByPinIsOn = m_HToolBar->GetToolState(ID_LIBEDIT_EDIT_PIN_BY_PIN); g_EditPinByPinIsOn = m_HToolBar->GetToolState(ID_LIBEDIT_EDIT_PIN_BY_PIN);
break; break;
case ID_LIBEDIT_PIN_BUTT:
if( m_component )
{
SetToolID( id, wxCURSOR_PENCIL, _( "Add pin" ) );
}
else
{
SetToolID( id, wxCURSOR_ARROW, _( "Set pin options" ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
GetEventHandler()->ProcessEvent( cmd );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
}
break;
case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_BODY_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_LIBEDIT_BODY_RECT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add rectangle" ) );
break;
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
break;
case ID_LIBEDIT_BODY_ARC_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
break;
case ID_LIBEDIT_BODY_LINE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
break;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Set anchor position" ) );
break;
case ID_LIBEDIT_IMPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
LoadOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_EXPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Export" ) );
SaveOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_POPUP_LIBEDIT_END_CREATE_ITEM: case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
if( m_drawItem ) if( m_drawItem )
@ -749,17 +704,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
break; break;
case ID_LIBEDIT_DELETE_ITEM_BUTT:
if( m_component == NULL )
{
wxBell();
break;
}
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT: case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
{ {
// Delete the last created segment, while creating a polyline draw item // Delete the last created segment, while creating a polyline draw item
@ -873,8 +817,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
if( (m_drawItem == NULL ) if( ( m_drawItem == NULL ) || ( m_drawItem->Type() != LIB_PIN_T ) )
|| (m_drawItem->Type() != LIB_PIN_T) )
break; break;
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id ); GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
@ -1081,3 +1024,86 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->CrossHairOn( &dc ); DrawPanel->CrossHairOn( &dc );
} }
void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
if( m_ID_current_state == 0 )
m_lastDrawItem = NULL;
DrawPanel->EndMouseCapture( ID_LIBEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
switch( id )
{
case ID_LIBEDIT_NO_TOOL:
SetToolID( id, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_PIN_BUTT:
if( m_component )
{
SetToolID( id, wxCURSOR_PENCIL, _( "Add pin" ) );
}
else
{
SetToolID( id, wxCURSOR_ARROW, _( "Set pin options" ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
GetEventHandler()->ProcessEvent( cmd );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
}
break;
case ID_LIBEDIT_BODY_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_LIBEDIT_BODY_RECT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add rectangle" ) );
break;
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
break;
case ID_LIBEDIT_BODY_ARC_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
break;
case ID_LIBEDIT_BODY_LINE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
break;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Set anchor position" ) );
break;
case ID_LIBEDIT_IMPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
LoadOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_EXPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Export" ) );
SaveOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_LIBEDIT_DELETE_ITEM_BUTT:
if( m_component == NULL )
{
wxBell();
break;
}
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
default:
break;
}
DrawPanel->m_IgnoreMouseEvents = false;
}

View File

@ -59,6 +59,7 @@ public:
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void OnPlotCurrentComponent( wxCommandEvent& event ); void OnPlotCurrentComponent( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void OnImportPart( wxCommandEvent& event ); void OnImportPart( wxCommandEvent& event );
void OnExportPart( wxCommandEvent& event ); void OnExportPart( wxCommandEvent& event );
void OnSelectAlias( wxCommandEvent& event ); void OnSelectAlias( wxCommandEvent& event );
@ -75,6 +76,7 @@ public:
void OnEditPin( wxCommandEvent& event ); void OnEditPin( wxCommandEvent& event );
void OnRotatePin( wxCommandEvent& event ); void OnRotatePin( wxCommandEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
void OnUpdateEditingPart( wxUpdateUIEvent& event ); void OnUpdateEditingPart( wxUpdateUIEvent& event );
void OnUpdateNotEditingPart( wxUpdateUIEvent& event ); void OnUpdateNotEditingPart( wxUpdateUIEvent& event );
void OnUpdateUndo( wxUpdateUIEvent& event ); void OnUpdateUndo( wxUpdateUIEvent& event );
@ -248,7 +250,7 @@ private:
void SaveOneSymbol(); void SaveOneSymbol();
void EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem ); void EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem );
void EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem ); void EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem );
LIB_DRAW_ITEM* LocateItemUsingCursor(); LIB_DRAW_ITEM* LocateItemUsingCursor( const wxPoint& aPosition );
void EditField( wxDC* DC, LIB_FIELD* Field ); void EditField( wxDC* DC, LIB_FIELD* Field );
public: public:

View File

@ -154,19 +154,19 @@ this component?" ),
} }
LIB_DRAW_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor() LIB_DRAW_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor( const wxPoint& aPosition )
{ {
if( m_component == NULL ) if( m_component == NULL )
return NULL; return NULL;
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) ) if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
{ {
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
GetScreen()->m_MousePosition );
if( m_drawItem == NULL ) wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition );
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->GetCrossHairPosition() ); if( m_drawItem == NULL && aPosition != pos )
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, pos );
} }
return m_drawItem; return m_drawItem;

View File

@ -45,7 +45,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
while( DrawList ) while( DrawList )
{ {
if( !SnapPoint2( Screen->m_MousePosition, COMPONENT_T, DrawList ) ) if( !SnapPoint2( Screen->RefPos( true ), COMPONENT_T, DrawList ) )
{ {
if( !SnapPoint2( Screen->GetCrossHairPosition(), COMPONENT_T, DrawList ) ) if( !SnapPoint2( Screen->GetCrossHairPosition(), COMPONENT_T, DrawList ) )
break; break;

View File

@ -240,7 +240,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
/* Component */ /* Component */
text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text, item = new wxMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text,
HELP_PLACE_COMPONENTS, wxITEM_NORMAL ); HELP_PLACE_COMPONENTS, wxITEM_NORMAL );
item->SetBitmap( add_component_xpm ); item->SetBitmap( add_component_xpm );
placeMenu->Append( item ); placeMenu->Append( item );

View File

@ -31,7 +31,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
SCH_ITEM* item = GetScreen()->GetCurItem(); SCH_ITEM* item = GetScreen()->GetCurItem();
wxPoint gridPosition = GetGridPosition( aPosition ); wxPoint gridPosition = GetGridPosition( aPosition );
if( ( m_ID_current_state == 0 ) || ( item && item->m_Flags ) ) if( ( m_ID_current_state == ID_SCH_NO_TOOL )
|| ( m_ID_current_state == 0 )
|| ( item && item->m_Flags ) )
{ {
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
@ -84,13 +86,11 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case 0: case 0:
break; case ID_SCH_NO_TOOL:
case ID_NO_SELECT_BUTT:
break; break;
case ID_HIERARCHY_PUSH_POP_BUTT: case ID_HIERARCHY_PUSH_POP_BUTT:
if( item && item->m_Flags ) if( ( item && item->m_Flags ) || ( g_RootSheet->CountSheets() == 0 ) )
break; break;
item = LocateAndShowItem( aPosition ); item = LocateAndShowItem( aPosition );
@ -274,7 +274,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
break; break;
case ID_COMPONENT_BUTT: case ID_SCH_PLACE_COMPONENT:
if( (item == NULL) || (item->m_Flags == 0) ) if( (item == NULL) || (item->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) ); GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) );
@ -334,6 +334,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_SCH_NO_TOOL:
case 0: case 0:
if( ( item == NULL ) || ( item->m_Flags == 0 ) ) if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{ {
@ -380,7 +381,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case ID_BUS_BUTT: case ID_BUS_BUTT:
case ID_WIRE_BUTT: case ID_WIRE_BUTT:
case ID_LINE_COMMENT_BUTT: case ID_LINE_COMMENT_BUTT:
if( item && ( item->m_Flags & IS_NEW ) ) if( item && item->IsNew() )
EndSegment( aDC ); EndSegment( aDC );
break; break;

View File

@ -489,7 +489,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame ) void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = Junction->IsNew();
wxString msg; wxString msg;
if( !is_new ) if( !is_new )
@ -513,7 +513,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = Wire->IsNew();
wxPoint pos = frame->GetScreen()->GetCrossHairPosition(); wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg; wxString msg;
@ -551,9 +551,10 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ) void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = Bus->IsNew();
wxPoint pos = frame->GetScreen()->GetCrossHairPosition(); wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg; wxString msg;
if( is_new ) if( is_new )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm );

View File

@ -188,7 +188,7 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( CurrentPin == NULL || CurrentPin->Type() != LIB_PIN_T ) if( CurrentPin == NULL || CurrentPin->Type() != LIB_PIN_T )
return; return;
if( CurrentPin->m_Flags & IS_NEW ) if( CurrentPin->IsNew() )
delete CurrentPin; delete CurrentPin;
else else
parent->RestoreComponent(); parent->RestoreComponent();

View File

@ -602,9 +602,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
/* save old text in undo list */ /* save old text in undo list */
if( g_ItemToUndoCopy if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == Type() ) && !IsNew() )
&& ( g_ItemToUndoCopy->Type() == Type() )
&& ( ( m_Flags & IS_NEW ) == 0 ) )
{ {
/* restore old values and save new ones */ /* restore old values and save new ones */
SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy ); SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );

View File

@ -325,7 +325,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
/* save old text in undo list */ /* save old text in undo list */
if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) ) if( g_ItemToUndoCopy && !IsNew() )
{ {
/* restore old values and save new ones */ /* restore old values and save new ones */
SwapData( (SCH_TEXT*) g_ItemToUndoCopy ); SwapData( (SCH_TEXT*) g_ItemToUndoCopy );

View File

@ -159,74 +159,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() ); HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() );
break; break;
case ID_HIERARCHY_PUSH_POP_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Push/Pop Hierarchy" ) );
break;
case ID_NOCONN_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add NoConnect Flag" ) );
break;
case ID_WIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Wire" ) );
break;
case ID_BUS_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Bus" ) );
break;
case ID_LINE_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Lines" ) );
break;
case ID_JUNCTION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Junction" ) );
break;
case ID_LABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Label" ) );
break;
case ID_GLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Global label" ) );
break;
case ID_HIERLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchical label" ) );
break;
case ID_TEXT_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
break;
case ID_WIRETOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Wire to Bus entry" ) );
break;
case ID_BUSTOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Bus to Bus entry" ) );
break;
case ID_SHEET_SYMBOL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Sheet" ) );
break;
case ID_SHEET_LABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add PinSheet" ) );
break;
case ID_IMPORT_HLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Import PinSheet" ) );
break;
case ID_COMPONENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Component" ) );
break;
case ID_PLACE_POWER_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Power" ) );
break;
case ID_POPUP_SCH_ENTRY_SELECT_SLASH: case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' ); SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' );
@ -338,10 +270,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
break; break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_SCH_END_SHEET: case ID_POPUP_SCH_END_SHEET:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
screen->GetCurItem()->Place( this, &dc ); screen->GetCurItem()->Place( this, &dc );
@ -399,7 +327,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_CMP_REQUEST: case ID_POPUP_SCH_MOVE_CMP_REQUEST:
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) or a hierachical sheet // component, like Field, text..) or a hierarchical sheet
// or a label // or a label
if( (screen->GetCurItem()->Type() != SCH_COMPONENT_T) if( (screen->GetCurItem()->Type() != SCH_COMPONENT_T)
&& (screen->GetCurItem()->Type() != SCH_LABEL_T) && (screen->GetCurItem()->Type() != SCH_LABEL_T)
@ -729,8 +657,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
SetToolbars();
} }
@ -805,3 +731,104 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
} }
} }
void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
// Stop the current command and deselect the current tool.
DrawPanel->EndMouseCapture( ID_SCH_NO_TOOL, DrawPanel->GetDefaultCursor() );
switch( id )
{
case ID_SCH_NO_TOOL:
SetToolID( id, DrawPanel->GetDefaultCursor(), _( "No tool selected" ) );
break;
case ID_HIERARCHY_PUSH_POP_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Descend or ascend hierarchy" ) );
break;
case ID_NOCONN_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add no connect" ) );
break;
case ID_WIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire" ) );
break;
case ID_BUS_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus" ) );
break;
case ID_LINE_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add lines" ) );
break;
case ID_JUNCTION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add junction" ) );
break;
case ID_LABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add label" ) );
break;
case ID_GLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add global label" ) );
break;
case ID_HIERLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add hierarchical label" ) );
break;
case ID_TEXT_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_WIRETOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire to bus entry" ) );
break;
case ID_BUSTOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus to bus entry" ) );
break;
case ID_SHEET_SYMBOL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet" ) );
break;
case ID_SHEET_LABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet pins" ) );
break;
case ID_IMPORT_HLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Import sheet pins" ) );
break;
case ID_SCH_PLACE_COMPONENT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add component" ) );
break;
case ID_PLACE_POWER_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add power" ) );
break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
default:
m_itemToRepeat = NULL;
}
}
void SCH_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
{
if( m_ID_current_state == 0 )
m_ID_current_state = ID_SCH_NO_TOOL;
if( aEvent.GetEventObject() == m_VToolBar )
aEvent.Check( m_ID_current_state == aEvent.GetId() );
}

View File

@ -427,7 +427,6 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
OnModify(); OnModify();
SetSheetNumberAndCount(); SetSheetNumberAndCount();
ReCreateHToolbar(); ReCreateHToolbar();
SetToolbars();
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh(); DrawPanel->Refresh();
@ -453,7 +452,6 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
OnModify(); OnModify();
SetSheetNumberAndCount(); SetSheetNumberAndCount();
ReCreateHToolbar(); ReCreateHToolbar();
SetToolbars();
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh(); DrawPanel->Refresh();

View File

@ -57,7 +57,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File )
EVT_TOOL( ID_SAVE_PROJECT, SCH_EDIT_FRAME::Save_File ) EVT_TOOL( ID_SAVE_PROJECT, SCH_EDIT_FRAME::Save_File )
EVT_MENU( wxID_PRINT, SCH_EDIT_FRAME::OnPrint )
EVT_MENU( ID_GEN_PLOT_PS, SCH_EDIT_FRAME::ToPlot_PS ) EVT_MENU( ID_GEN_PLOT_PS, SCH_EDIT_FRAME::ToPlot_PS )
EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL ) EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL )
EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print ) EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print )
@ -71,8 +70,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_CONFIG_REQ, SCH_EDIT_FRAME::InstallConfigFrame ) EVT_MENU( ID_CONFIG_REQ, SCH_EDIT_FRAME::InstallConfigFrame )
EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config ) EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config ) EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
ID_PREFERENCES_HOTKEY_END,
SCH_EDIT_FRAME::Process_Config ) SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig ) EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig )
@ -80,7 +78,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, SCH_EDIT_FRAME::SetLanguage ) EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, SCH_EDIT_FRAME::SetLanguage )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, SCH_EDIT_FRAME::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, SCH_EDIT_FRAME::OnZoom )
EVT_TOOL( ID_TO_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor ) EVT_TOOL( ID_TO_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor )
EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer ) EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
@ -102,16 +100,14 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials ) EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems ) EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadStuffFile ) EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadStuffFile )
EVT_TOOL( ID_COMPONENT_BUTT, SCH_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, EDA_DRAW_FRAME::GetKicadAbout ) EVT_MENU( ID_KICAD_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
// Tools and buttons for vertical toolbar. // Tools and buttons for vertical toolbar.
EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand ) EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
ID_SCHEMATIC_VERTICAL_TOOLBAR_END, SCH_EDIT_FRAME::OnSelectTool )
SCH_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand ) EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE, EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
@ -128,15 +124,12 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected ) EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected )
EVT_UPDATE_UI( wxID_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected ) EVT_UPDATE_UI( wxID_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected )
EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste ) EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
EVT_UPDATE_UI( wxID_UNDO, SCH_EDIT_FRAME::OnUpdateSchematicUndo )
EVT_UPDATE_UI( wxID_REDO, SCH_EDIT_FRAME::OnUpdateSchematicRedo )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, SCH_EDIT_FRAME::OnUpdateGrid )
EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, SCH_EDIT_FRAME::OnUpdateSelectCursor )
EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins ) EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation ) EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
ID_TB_OPTIONS_SELECT_UNIT_INCH,
SCH_EDIT_FRAME::OnUpdateUnits ) SCH_EDIT_FRAME::OnUpdateUnits )
EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
SCH_EDIT_FRAME::OnUpdateSelectTool )
/* Search dialog events. */ /* Search dialog events. */
EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose ) EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
@ -172,6 +165,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr;
m_dlgFindReplace = NULL; m_dlgFindReplace = NULL;
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
m_ID_current_state = ID_SCH_NO_TOOL;
CreateScreens(); CreateScreens();
@ -452,6 +446,7 @@ void SCH_EDIT_FRAME::OnModify( )
// >> change all sheets. // >> change all sheets.
// I believe all sheets in a project must have the same date // I believe all sheets in a project must have the same date
SCH_SCREEN* screen = s_list.GetFirst(); SCH_SCREEN* screen = s_list.GetFirst();
for( ; screen != NULL; screen = s_list.GetNext() ) for( ; screen != NULL; screen = s_list.GetNext() )
screen->m_Date = date; screen->m_Date = date;
} }
@ -466,76 +461,36 @@ void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ); bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
event.Enable( enable ); event.Enable( enable );
m_HToolBar->EnableTool( wxID_CUT, enable );
m_HToolBar->EnableTool( wxID_COPY, enable );
} }
void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
{ {
event.Enable( m_blockItems.GetCount() > 0 ); event.Enable( m_blockItems.GetCount() > 0 );
m_HToolBar->EnableTool( wxID_PASTE, m_blockItems.GetCount() > 0 );
} }
void SCH_EDIT_FRAME::OnUpdateSchematicUndo( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
{
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 )
{ {
wxString tool_tip = g_HVLines ? wxString tool_tip = g_HVLines ?
_( "Draw wires and buses in any direction" ) : _( "Draw wires and buses in any direction" ) :
_( "Draw horizontal and vertical wires and buses only" ); _( "Draw horizontal and vertical wires and buses only" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, g_HVLines ); aEvent.Check( g_HVLines );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip ); m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip );
} }
void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
{ {
wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) : wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) :
_( "Show hidden pins" ); _( "Show hidden pins" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, m_ShowAllPins ); aEvent.Check( m_ShowAllPins );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip ); m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
} }
void SCH_EDIT_FRAME::OnUpdateSelectCursor( wxUpdateUIEvent& event )
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_CursorShape );
}
void SCH_EDIT_FRAME::OnUpdateUnits( wxUpdateUIEvent& event )
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, g_UserUnit == MILLIMETRES );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, g_UserUnit == INCHES );
DisplayUnitsMsg();
}
void SCH_EDIT_FRAME::OnUpdateGrid( wxUpdateUIEvent& event )
{
wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, IsGridVisible() );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
}
void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event )
{ {
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this ); DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
@ -630,10 +585,7 @@ void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) ); fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
if( fn != wxEmptyString ) if( fn != wxEmptyString )
{
LoadOneEEProject( fn, false ); LoadOneEEProject( fn, false );
SetToolbars();
}
} }
@ -724,10 +676,7 @@ void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
Close( true ); Close( true );
} }
/**
* Function SetLanguage
* called on a language menu selection
*/
void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event ) void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
{ {
EDA_BASE_FRAME::SetLanguage( event ); EDA_BASE_FRAME::SetLanguage( event );
@ -757,8 +706,6 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
} }
/* Creates the SVG print file for the current edited component.
*/
void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
{ {
DIALOG_SVG_PRINT frame( this ); DIALOG_SVG_PRINT frame( this );

View File

@ -256,7 +256,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
if( sheet == NULL ) if( sheet == NULL )
return; return;
if( sheet->m_Flags & IS_NEW ) if( sheet->IsNew() )
{ {
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
SAFE_DELETE( sheet ); SAFE_DELETE( sheet );
@ -312,7 +312,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
{ {
if( aSheet == NULL || aSheet->m_Flags & IS_NEW ) if( aSheet == NULL || aSheet->IsNew() )
return; return;
if( aSheet->Type() != SCH_SHEET_T ) if( aSheet->Type() != SCH_SHEET_T )
@ -340,7 +340,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo if( aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = DuplicateStruct( aSheet, true ); g_ItemToUndoCopy = DuplicateStruct( aSheet, true );
@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CrossHairOn( aDC ); DrawPanel->CrossHairOn( aDC );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo if( !aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = DuplicateStruct( aSheet, true ); g_ItemToUndoCopy = DuplicateStruct( aSheet, true );

View File

@ -40,7 +40,7 @@ static void ExitPinSheet( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( SheetLabel == NULL ) if( SheetLabel == NULL )
return; return;
if( SheetLabel->m_Flags & IS_NEW ) if( SheetLabel->IsNew() )
{ {
SheetLabel->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode ); SheetLabel->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
SAFE_DELETE( SheetLabel ); SAFE_DELETE( SheetLabel );

View File

@ -35,52 +35,37 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false ); m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
wxBitmap( cursor_xpm ),
_( "Deselect current tool" ), wxITEM_CHECK ); _( "Deselect current tool" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, wxBitmap( pin_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString,
wxBitmap( pin_xpm ),
HELP_ADD_PIN, wxITEM_CHECK ); HELP_ADD_PIN, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString, wxBitmap( add_text_xpm ),
wxBitmap( add_text_xpm ),
HELP_ADD_BODYTEXT, wxITEM_CHECK ); HELP_ADD_BODYTEXT, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString, wxBitmap( add_rectangle_xpm ),
wxBitmap( add_rectangle_xpm ),
HELP_ADD_BODYRECT, wxITEM_CHECK ); HELP_ADD_BODYRECT, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString, wxBitmap( add_circle_xpm ),
wxBitmap( add_circle_xpm ),
HELP_ADD_BODYCIRCLE, wxITEM_CHECK ); HELP_ADD_BODYCIRCLE, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString, wxBitmap( add_arc_xpm ),
wxBitmap( add_arc_xpm ),
HELP_ADD_BODYARC, wxITEM_CHECK ); HELP_ADD_BODYARC, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString, wxBitmap( add_polygon_xpm ),
wxBitmap( add_polygon_xpm ),
HELP_ADD_BODYPOLYGON, wxITEM_CHECK ); HELP_ADD_BODYPOLYGON, wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString, wxBitmap( anchor_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString,
wxBitmap( anchor_xpm ),
_( "Move part anchor" ), wxITEM_CHECK ); _( "Move part anchor" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString, wxBitmap( import_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString,
wxBitmap( import_xpm ),
_( "Import existing drawings" ), wxITEM_CHECK ); _( "Import existing drawings" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString, wxBitmap( export_xpm ),
wxBitmap( export_xpm ),
_( "Export current drawing" ), wxITEM_CHECK ); _( "Export current drawing" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
m_VToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString,
wxBitmap( delete_body_xpm ),
HELP_DELETE_ITEMS, wxITEM_CHECK ); HELP_DELETE_ITEMS, wxITEM_CHECK );
m_VToolBar->Realize(); m_VToolBar->Realize();

View File

@ -34,8 +34,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, wxBitmap( open_xpm ), m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, wxBitmap( open_xpm ),
_( "Open schematic project" ) ); _( "Open schematic project" ) );
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, wxBitmap( save_project_xpm ),
wxBitmap( save_project_xpm ),
_( "Save schematic project" ) ); _( "Save schematic project" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
@ -46,13 +45,11 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, wxBitmap( libedit_xpm ), m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, wxBitmap( libedit_xpm ),
_( "Library editor" ) ); _( "Library editor" ) );
m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, wxBitmap( library_browse_xpm ),
wxBitmap( library_browse_xpm ),
_( "Library browser" ) ); _( "Library browser" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString, m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString, wxBitmap( hierarchy_nav_xpm ),
wxBitmap( hierarchy_nav_xpm ),
_( "Navigate schematic hierarchy" ) ); _( "Navigate schematic hierarchy" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
@ -67,15 +64,11 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
_( "Paste" ) ); _( "Paste" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( HELP_UNDO, s_Schematic_Hokeys_Descr, msg = AddHotkeyName( HELP_UNDO, s_Schematic_Hokeys_Descr, HK_UNDO, false );
HK_UNDO, false ); m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg );
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString,
wxBitmap( undo_xpm ), msg );
msg = AddHotkeyName( HELP_REDO, msg = AddHotkeyName( HELP_REDO, s_Schematic_Hokeys_Descr, HK_REDO, false );
s_Schematic_Hokeys_Descr, HK_REDO, false ); m_HToolBar->AddTool( wxID_REDO, wxEmptyString, wxBitmap( redo_xpm ), msg );
m_HToolBar->AddTool( wxID_REDO, wxEmptyString,
wxBitmap( redo_xpm ), msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ), m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
@ -90,36 +83,26 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( HELP_ZOOM_IN, s_Schematic_Hokeys_Descr, HK_ZOOM_IN, false ); msg = AddHotkeyName( HELP_ZOOM_IN, s_Schematic_Hokeys_Descr, HK_ZOOM_IN, false );
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ), m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ), msg );
msg );
msg = AddHotkeyName( HELP_ZOOM_OUT, s_Schematic_Hokeys_Descr, msg = AddHotkeyName( HELP_ZOOM_OUT, s_Schematic_Hokeys_Descr, HK_ZOOM_OUT, false );
HK_ZOOM_OUT, false ); m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
msg );
msg = AddHotkeyName( HELP_ZOOM_REDRAW, s_Schematic_Hokeys_Descr, msg = AddHotkeyName( HELP_ZOOM_REDRAW, s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW, false );
HK_ZOOM_REDRAW, false ); m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( HELP_ZOOM_FIT, s_Schematic_Hokeys_Descr, msg = AddHotkeyName( HELP_ZOOM_FIT, s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO, false );
HK_ZOOM_AUTO, false ); m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( HELP_FIND, s_Schematic_Hokeys_Descr, msg = AddHotkeyName( HELP_FIND, s_Schematic_Hokeys_Descr, HK_FIND_ITEM, false );
HK_FIND_ITEM, false ); m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ), msg );
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ),
msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ), m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
_( "Netlist generation" ) ); _( "Netlist generation" ) );
m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, wxBitmap( annotate_xpm ),
wxBitmap( annotate_xpm ),
_( "Annotate schematic" ) ); _( "Annotate schematic" ) );
m_HToolBar->AddTool( ID_GET_ERC, wxEmptyString, wxBitmap( erc_xpm ), m_HToolBar->AddTool( ID_GET_ERC, wxEmptyString, wxBitmap( erc_xpm ),
@ -128,14 +111,11 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, wxBitmap( tools_xpm ), m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, wxBitmap( tools_xpm ),
_( "Bill of material and/or Cross references" ) ); _( "Bill of material and/or Cross references" ) );
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, wxBitmap( backanno_xpm ),
wxBitmap( backanno_xpm ),
_( "Backannotate footprint" ) ); _( "Backannotate footprint" ) );
// after adding the tools to the toolbar, must call Realize() to // after adding the tools to the toolbar, must call Realize() to reflect the changes
// reflect the changes
m_HToolBar->Realize(); m_HToolBar->Realize();
SetToolbars();
} }
@ -145,63 +125,48 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
{ {
if( m_VToolBar ) if( m_VToolBar )
return; return;
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_CANCEL_CURRENT_COMMAND, wxEmptyString, m_VToolBar->AddTool( ID_SCH_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );
m_VToolBar->AddTool( ID_HIERARCHY_PUSH_POP_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_HIERARCHY_PUSH_POP_BUTT, wxEmptyString,
wxBitmap( hierarchy_cursor_xpm ), wxBitmap( hierarchy_cursor_xpm ),
_( "Hierarchy Push/Pop" ), wxITEM_CHECK ); _( "Ascend or descend hierarchy" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_SCH_PLACE_COMPONENT, wxEmptyString, wxBitmap( add_component_xpm ),
m_VToolBar->AddTool( ID_COMPONENT_BUTT, wxEmptyString,
wxBitmap( add_component_xpm ),
HELP_PLACE_COMPONENTS, wxITEM_CHECK ); HELP_PLACE_COMPONENTS, wxITEM_CHECK );
m_VToolBar->AddTool( ID_PLACE_POWER_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PLACE_POWER_BUTT, wxEmptyString, wxBitmap( add_power_xpm ),
wxBitmap( add_power_xpm ),
HELP_PLACE_POWERPORT, wxITEM_CHECK ); HELP_PLACE_POWERPORT, wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_WIRE_BUTT, wxEmptyString, wxBitmap( add_line_xpm ),
m_VToolBar->AddTool( ID_WIRE_BUTT, wxEmptyString,
wxBitmap( add_line_xpm ),
HELP_PLACE_WIRE, wxITEM_CHECK ); HELP_PLACE_WIRE, wxITEM_CHECK );
m_VToolBar->AddTool( ID_BUS_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_BUS_BUTT, wxEmptyString, wxBitmap( add_bus_xpm ),
wxBitmap( add_bus_xpm ),
HELP_PLACE_BUS, wxITEM_CHECK ); HELP_PLACE_BUS, wxITEM_CHECK );
m_VToolBar->AddTool( ID_WIRETOBUS_ENTRY_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_WIRETOBUS_ENTRY_BUTT, wxEmptyString, wxBitmap( add_line2bus_xpm ),
wxBitmap( add_line2bus_xpm ),
HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_CHECK ); HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_CHECK );
m_VToolBar->AddTool( ID_BUSTOBUS_ENTRY_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_BUSTOBUS_ENTRY_BUTT, wxEmptyString, wxBitmap( add_bus2bus_xpm ),
wxBitmap( add_bus2bus_xpm ),
HELP_PLACE_BUS2BUS_ENTRY, wxITEM_CHECK ); HELP_PLACE_BUS2BUS_ENTRY, wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_NOCONN_BUTT, wxEmptyString, wxBitmap( noconn_button ),
m_VToolBar->AddTool( ID_NOCONN_BUTT, wxEmptyString,
wxBitmap( noconn_button ),
HELP_PLACE_NC_FLAG, wxITEM_CHECK ); HELP_PLACE_NC_FLAG, wxITEM_CHECK );
m_VToolBar->AddTool( ID_LABEL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LABEL_BUTT, wxEmptyString, wxBitmap( add_line_label_xpm ),
wxBitmap( add_line_label_xpm ),
HELP_PLACE_NETLABEL, wxITEM_CHECK ); HELP_PLACE_NETLABEL, wxITEM_CHECK );
m_VToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString, wxBitmap( add_glabel_xpm ),
wxBitmap( add_glabel_xpm ), HELP_PLACE_GLOBALLABEL, wxITEM_CHECK );
HELP_PLACE_GLOBALLABEL,
wxITEM_CHECK );
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString, wxBitmap( add_junction_xpm ),
wxBitmap( add_junction_xpm ),
HELP_PLACE_JUNCTION, wxITEM_CHECK ); HELP_PLACE_JUNCTION, wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString, wxBitmap( add_hierarchical_label_xpm ),
m_VToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
wxBitmap( add_hierarchical_label_xpm ),
HELP_PLACE_HIER_LABEL, wxITEM_CHECK ); HELP_PLACE_HIER_LABEL, wxITEM_CHECK );
m_VToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString,
@ -216,22 +181,17 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
wxBitmap( add_hierar_pin_xpm ), wxBitmap( add_hierar_pin_xpm ),
HELP_PLACE_PINSHEET, wxITEM_CHECK ); HELP_PLACE_PINSHEET, wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString,
wxBitmap( add_dashed_line_xpm ), wxBitmap( add_dashed_line_xpm ),
HELP_PLACE_GRAPHICLINES, wxITEM_CHECK ); HELP_PLACE_GRAPHICLINES, wxITEM_CHECK );
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString, wxBitmap( add_text_xpm ),
wxBitmap( add_text_xpm ),
HELP_PLACE_GRAPHICTEXTS, wxITEM_CHECK ); HELP_PLACE_GRAPHICTEXTS, wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddTool( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
m_VToolBar->AddTool( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxEmptyString,
wxBitmap( delete_body_xpm ),
HELP_DELETE_ITEMS, wxITEM_CHECK ); HELP_DELETE_ITEMS, wxITEM_CHECK );
m_VToolBar->Realize(); m_VToolBar->Realize();
SetToolbars();
} }
@ -242,8 +202,7 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false );
ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
wxBitmap( grid_xpm ), wxBitmap( grid_xpm ),
@ -273,8 +232,6 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->Realize(); m_OptionsToolBar->Realize();
SetToolbars();
} }
@ -283,32 +240,10 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
if( DrawPanel == NULL ) if( DrawPanel == NULL )
return; return;
int id = event.GetId(); int id = event.GetId();
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID:
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh();
break;
case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UserUnit = MILLIMETRES;
UpdateStatusBar();
DrawPanel->Refresh();
break;
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
g_UserUnit = INCHES;
UpdateStatusBar();
DrawPanel->Refresh();
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_HIDDEN_PINS: case ID_TB_OPTIONS_HIDDEN_PINS:
m_ShowAllPins = m_OptionsToolBar->GetToolState( id ); m_ShowAllPins = m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
@ -322,6 +257,4 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
DisplayError( this, wxT( "OnSelectOptionToolbar() error" ) ); DisplayError( this, wxT( "OnSelectOptionToolbar() error" ) );
break; break;
} }
SetToolbars();
} }

View File

@ -49,7 +49,7 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
LIB_VIEW_FRAME::Process_Special_Functions ) LIB_VIEW_FRAME::Process_Special_Functions )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, LIB_VIEW_FRAME::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, LIB_VIEW_FRAME::OnZoom )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
LIB_VIEW_FRAME::ExportToSchematicLibraryPart ) LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER, EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,

View File

@ -7,11 +7,6 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "gerbview.h" #include "gerbview.h"
GERBER_DRAW_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
{
return Locate( CURSEUR_OFF_GRILLE );
}
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{ {

View File

@ -20,7 +20,7 @@
/* Process the command triggered by the left button of the mouse when a tool /* Process the command triggered by the left button of the mouse when a tool
* is already selected. * is already selected.
*/ */
void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{ {
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
@ -36,7 +36,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else else
{ {
DrawStruct = GerberGeneralLocateAndDisplay(); DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
GetScreen()->SetCurItem( DrawStruct ); GetScreen()->SetCurItem( DrawStruct );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
{ {
@ -50,14 +50,13 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case 0: case 0:
break; case ID_GERBVIEW_NO_TOOL:
case ID_NO_SELECT_BUTT:
break; break;
case ID_GERBVIEW_DELETE_ITEM_BUTT: case ID_GERBVIEW_DELETE_ITEM_BUTT:
DrawStruct = GerberGeneralLocateAndDisplay(); DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
/* TODO: /* TODO:
@ -132,7 +131,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
ClearMsgPanel(); ClearMsgPanel();
break; break;
case ID_NO_SELECT_BUTT: case ID_GERBVIEW_NO_TOOL:
SetToolID( 0, 0, wxEmptyString ); SetToolID( 0, 0, wxEmptyString );
break; break;
@ -209,14 +208,12 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
wxMessageBox( wxT( "WinEDA_GerberFrame::Process_Special_Functions error" ) ); wxMessageBox( wxT( "WinEDA_GerberFrame::Process_Special_Functions error" ) );
break; break;
} }
SetToolbars();
} }
/* Called on a double click of left mouse button. /* Called on a double click of left mouse button.
*/ */
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
{ {
// Currently: no nothing // Currently: no nothing
} }

View File

@ -53,9 +53,9 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
{ {
setActiveLayer(origLayer+1); setActiveLayer(origLayer+1);
Erase_Current_Layer( false ); Erase_Current_Layer( false );
if( !LoadGerberFiles( wxEmptyString ) ) if( !LoadGerberFiles( wxEmptyString ) )
setActiveLayer(origLayer); setActiveLayer( origLayer );
SetToolbars();
} }
else else
{ {

View File

@ -29,7 +29,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize ) EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_GerberFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, WinEDA_GerberFrame::OnZoom )
EVT_TOOL( wxID_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( wxID_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
@ -51,8 +51,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
// menu Preferences // menu Preferences
EVT_MENU( ID_CONFIG_REQ, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_CONFIG_REQ, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_CONFIG_SAVE, WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
ID_PREFERENCES_HOTKEY_END,
WinEDA_GerberFrame::Process_Config ) WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
@ -86,7 +85,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
// Vertical toolbar: // Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_GERBVIEW_NO_TOOL, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
@ -103,15 +102,30 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_0, WinEDA_GerberFrame::OnSelectDisplayMode ) EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_1, WinEDA_GerberFrame::OnSelectDisplayMode ) WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_2, WinEDA_GerberFrame::OnSelectDisplayMode )
END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
const wxString& title, WinEDA_GerberFrame::OnUpdateFlashedItemsDrawMode )
const wxPoint& pos, EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, WinEDA_GerberFrame::OnUpdateLinesDrawMode )
const wxSize& size, EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
long style ) : 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,
long style ) :
WinEDA_BasePcbFrame( father, GERBER_FRAME, title, pos, size, style ) WinEDA_BasePcbFrame( father, GERBER_FRAME, title, pos, size, style )
{ {
m_FrameName = wxT( "GerberFrame" ); m_FrameName = wxT( "GerberFrame" );
@ -204,8 +218,6 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
SetToolbars();
m_auimgr.Update(); m_auimgr.Update();
} }
@ -579,8 +591,6 @@ void WinEDA_GerberFrame::OnSelectDisplayMode( wxCommandEvent& event )
break; break;
} }
SetToolbars();
if( GetDisplayMode() != oldMode ) if( GetDisplayMode() != oldMode )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }

View File

@ -18,6 +18,7 @@ enum gerbview_ids
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER, ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
ID_GERBVIEW_NO_TOOL,
ID_GERBVIEW_DELETE_ITEM_BUTT, ID_GERBVIEW_DELETE_ITEM_BUTT,
ID_GERBVIEW_GLOBAL_DELETE, ID_GERBVIEW_GLOBAL_DELETE,
ID_GERBVIEW_OPTIONS_SETUP, ID_GERBVIEW_OPTIONS_SETUP,

View File

@ -10,27 +10,28 @@
/* localize a gerber item and return a pointer to it. /* localize a gerber item and return a pointer to it.
* Display info about this item * Display info about this item
*/ */
GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc ) GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( const wxPoint& aPosition, int aTypeloc )
{ {
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
wxPoint ref; wxPoint ref = aPosition;
bool found = false; bool found = false;
if( aTypeloc == CURSEUR_ON_GRILLE ) if( aTypeloc == CURSEUR_ON_GRILLE )
ref = GetScreen()->GetCrossHairPosition(); ref = GetScreen()->GetNearestGridPosition( ref );
else
ref = GetScreen()->m_MousePosition;
int layer = GetScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
// Search first on active layer // Search first on active layer
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
GERBER_DRAW_ITEM* gerb_item = NULL; GERBER_DRAW_ITEM* gerb_item = NULL;
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
gerb_item = (GERBER_DRAW_ITEM*) item; gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer()!= layer ) if( gerb_item->GetLayer()!= layer )
continue; continue;
if( gerb_item->HitTest( ref ) ) if( gerb_item->HitTest( ref ) )
{ {
found = true; found = true;
@ -41,9 +42,11 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
if( !found ) // Search on all layers if( !found ) // Search on all layers
{ {
item = GetBoard()->m_Drawings; item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
gerb_item = (GERBER_DRAW_ITEM*) item; gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( ref ) ) if( gerb_item->HitTest( ref ) )
{ {
found = true; found = true;
@ -51,10 +54,12 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
} }
} }
} }
if( found ) if( found )
{ {
gerb_item->DisplayInfo( this ); gerb_item->DisplayInfo( this );
return gerb_item; return gerb_item;
} }
return NULL; return NULL;
} }

View File

@ -13,8 +13,7 @@
/* Prepare the right-click pullup menu. /* Prepare the right-click pullup menu.
* The menu already has a list of zoom commands. * The menu already has a list of zoom commands.
*/ */
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, bool WinEDA_GerberFrame::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
wxMenu* PopMenu )
{ {
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
@ -27,7 +26,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos,
// Simple location of elements where possible. // Simple location of elements where possible.
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) ) if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{ {
DrawStruct = GerberGeneralLocateAndDisplay(); DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
} }
// If command in progress, end command. // If command in progress, end command.

View File

@ -38,32 +38,6 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID:
SetGridVisibility( state );
DrawPanel->Refresh( TRUE );
break;
case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UserUnit = MILLIMETRES;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
g_UserUnit = INCHES;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = state;
DrawPanel->Refresh( TRUE );
break;
case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH: case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH:
if( state ) if( state )
{ {
@ -73,21 +47,21 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
DisplayOpt.DisplayPadFill = m_DisplayPadFill = true; DisplayOpt.DisplayPadFill = m_DisplayPadFill = true;
} }
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_LINES_SKETCH: case ID_TB_OPTIONS_SHOW_LINES_SKETCH:
if(state ) if(state )
{ {
m_DisplayPcbTrackFill = FALSE; m_DisplayPcbTrackFill = false;
DisplayOpt.DisplayPcbTrackFill = FALSE; DisplayOpt.DisplayPcbTrackFill = false;
} }
else else
{ {
m_DisplayPcbTrackFill = TRUE; m_DisplayPcbTrackFill = true;
DisplayOpt.DisplayPcbTrackFill = TRUE; DisplayOpt.DisplayPcbTrackFill = true;
} }
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH: case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
@ -95,12 +69,12 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
g_DisplayPolygonsModeSketch = 1; g_DisplayPolygonsModeSketch = 1;
else else
g_DisplayPolygonsModeSketch = 0; g_DisplayPolygonsModeSketch = 0;
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_DCODES: case ID_TB_OPTIONS_SHOW_DCODES:
SetElementVisibility( DCODES_VISIBLE, state ); SetElementVisibility( DCODES_VISIBLE, state );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR: case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
@ -111,11 +85,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, DisplayError( this, wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
break; break;
} }
SetToolbars();
} }

View File

@ -23,7 +23,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
int ii; int ii;
wxString msg; wxString msg;
// delete and recreate the toolbar
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
return; return;
@ -36,59 +35,44 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ),
wxBitmap( new_xpm ),
_( "Erase all layers" ) ); _( "Erase all layers" ) );
m_HToolBar->AddTool( wxID_FILE, wxEmptyString, m_HToolBar->AddTool( wxID_FILE, wxEmptyString, wxBitmap( open_xpm ),
wxBitmap( open_xpm ),
_( "Load a new Gerber file on the current layer. Previous data will be deleted" ) ); _( "Load a new Gerber file on the current layer. Previous data will be deleted" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
wxBitmap( print_button ),
_( "Print layers" ) ); _( "Print layers" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_IN ); msg = AddHotkeyName( _( "Zoom in" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ), msg );
wxBitmap( zoom_in_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_OUT ); msg = AddHotkeyName( _( "Zoom out" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ), msg );
wxBitmap( zoom_out_xpm ),
msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Gerbview_Hokeys_Descr, msg = AddHotkeyName( _( "Redraw view" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_REDRAW );
HK_ZOOM_REDRAW ); m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Gerbview_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom auto" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_AUTO );
HK_ZOOM_AUTO ); m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ), _( "Find D-codes" ) );
wxBitmap( find_xpm ),
_( "Find D-codes" ) );
wxArrayString choices; wxArrayString choices;
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
for( ii = 0; ii < 32; ii++ ) for( ii = 0; ii < 32; ii++ )
{ {
wxString msg; wxString msg;
msg = _( "Layer " ); msg << ii + 1; msg = _( "Layer " ); msg << ii + 1;
choices.Add( msg ); choices.Add( msg );
} }
m_SelLayerBox = new WinEDALayerChoiceBox( m_HToolBar,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER, m_SelLayerBox = new WinEDALayerChoiceBox( m_HToolBar, ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
wxDefaultPosition, wxSize( 150, -1 ), wxDefaultPosition, wxSize( 150, -1 ), choices );
choices );
m_HToolBar->AddControl( m_SelLayerBox ); m_HToolBar->AddControl( m_SelLayerBox );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
@ -98,25 +82,24 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
msg = _( "Tool " ); msg = _( "Tool " );
wxString text; wxString text;
for( ii = FIRST_DCODE; ii < TOOLS_MAX_COUNT; ii++ ) for( ii = FIRST_DCODE; ii < TOOLS_MAX_COUNT; ii++ )
{ {
text = msg; text = msg;
text << ii; text << ii;
m_DCodesList.Add( text ); m_DCodesList.Add( text );
} }
m_DCodeSelector = new DCODE_SELECTION_BOX( m_HToolBar,
ID_TOOLBARH_GERBER_SELECT_TOOL, m_DCodeSelector = new DCODE_SELECTION_BOX( m_HToolBar, ID_TOOLBARH_GERBER_SELECT_TOOL,
wxDefaultPosition, wxSize( 150, -1 ), wxDefaultPosition, wxSize( 150, -1 ),
m_DCodesList ); m_DCodesList );
m_HToolBar->AddControl( m_DCodeSelector ); m_HToolBar->AddControl( m_DCodeSelector );
m_TextInfo = new wxTextCtrl(m_HToolBar, wxID_ANY, wxEmptyString, m_TextInfo = new wxTextCtrl( m_HToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxDefaultPosition, wxSize(150,-1), wxSize(150,-1), wxTE_READONLY );
wxTE_READONLY );
m_HToolBar->AddControl( m_TextInfo ); m_HToolBar->AddControl( m_TextInfo );
// after adding the buttons to the toolbar, must call Realize() to reflect // after adding the buttons to the toolbar, must call Realize() to reflect the changes
// the changes
m_HToolBar->Realize(); m_HToolBar->Realize();
} }
@ -132,11 +115,9 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void )
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE ); m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString, wxBitmap( cursor_xpm ) ); m_VToolBar->AddTool( ID_GERBVIEW_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ) );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_GERBVIEW_DELETE_ITEM_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_GERBVIEW_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
wxBitmap( delete_body_xpm ),
_( "Delete items" ) ); _( "Delete items" ) );
m_VToolBar->Realize(); m_VToolBar->Realize();
@ -154,8 +135,7 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
// creation of tool bar options // creation of tool bar options
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE ); m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, wxBitmap( grid_xpm ),
wxBitmap( grid_xpm ),
_( "Turn grid off" ), wxITEM_CHECK ); _( "Turn grid off" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
@ -196,17 +176,17 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_0, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_0, wxEmptyString,
wxBitmap( gbr_select_mode0_xpm ), wxBitmap( gbr_select_mode0_xpm ),
_( "Show layers in raw mode\ _( "Show layers in raw mode \
(could have problems with negative items when more than one gerber file is shown)" ), (could have problems with negative items when more than one gerber file is shown)" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, wxEmptyString,
wxBitmap( gbr_select_mode1_xpm ), wxBitmap( gbr_select_mode1_xpm ),
_( "Show layers in stacked mode\ _( "Show layers in stacked mode \
(show negative items without artefact, sometimes slow)" ), (show negative items without artefact, sometimes slow)" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString,
wxBitmap( gbr_select_mode2_xpm ), wxBitmap( gbr_select_mode2_xpm ),
_( "Show layers in tranparency mode\ _( "Show layers in tranparency mode \
(show negative items without artefact, sometimes slow)" ), (show negative items without artefact, sometimes slow)" ),
wxITEM_CHECK ); wxITEM_CHECK );
@ -223,89 +203,83 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
} }
/** void WinEDA_GerberFrame::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
* Function SetToolbars
* Set the tools state for the toolbars, according to display options
*/
void WinEDA_GerberFrame::SetToolbars()
{ {
PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen(); switch( aEvent.GetId() )
int layer = screen->m_Active_Layer;
GERBER_IMAGE* gerber = g_GERBER_List[layer];
if( m_HToolBar == NULL )
return;
if( m_SelLayerBox && (m_SelLayerBox->GetSelection() != screen->m_Active_Layer) )
{ {
m_SelLayerBox->SetSelection( screen->m_Active_Layer ); case ID_TB_OPTIONS_SHOW_GBR_MODE_0:
} aEvent.Check( GetDisplayMode() == 0 );
break;
if( m_DCodeSelector ) case ID_TB_OPTIONS_SHOW_GBR_MODE_1:
{ aEvent.Check( GetDisplayMode() == 1 );
if( gerber ) break;
{
int dcodeSelected;
m_DCodeSelector->Enable( true );
dcodeSelected = gerber->m_Selected_Tool;
if( dcodeSelected != m_DCodeSelector->GetSelectedDCodeId() ) case ID_TB_OPTIONS_SHOW_GBR_MODE_2:
m_DCodeSelector->SetDCodeSelection( dcodeSelected ); aEvent.Check( GetDisplayMode() == 2 );
} break;
else
{ default:
m_DCodeSelector->SetDCodeSelection( 0 ); break;
m_DCodeSelector->Enable( false );
}
} }
}
void WinEDA_GerberFrame::OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayPadFill );
}
void WinEDA_GerberFrame::OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayPcbTrackFill );
}
void WinEDA_GerberFrame::OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( g_DisplayPolygonsModeSketch != 0 );
}
void WinEDA_GerberFrame::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent )
{
aEvent.Check( IsElementVisible( DCODES_VISIBLE ) );
}
void WinEDA_GerberFrame::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_show_layer_manager_tools );
if( m_OptionsToolBar ) if( m_OptionsToolBar )
{ {
m_OptionsToolBar->ToggleTool(
ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UserUnit == MILLIMETRES ? true : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UserUnit == INCHES ? true : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
IsGridVisible() );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
m_CursorShape );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
!m_DisplayPadFill );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_LINES_SKETCH,
!m_DisplayPcbTrackFill );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
g_DisplayPolygonsModeSketch == 0 ? 0 : 1 );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_DCODES,
IsElementVisible( DCODES_VISIBLE ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GBR_MODE_0, GetDisplayMode() == 0 );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, GetDisplayMode() == 1 );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, GetDisplayMode() == 2 );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
m_show_layer_manager_tools );
if( m_show_layer_manager_tools ) if( m_show_layer_manager_tools )
GetMenuBar()->SetLabel( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, m_OptionsToolBar->SetToolShortHelp( aEvent.GetId(), _("Hide layers manager" ) );
_("Hide &Layers Manager" ) );
else else
GetMenuBar()->SetLabel( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, m_OptionsToolBar->SetToolShortHelp( aEvent.GetId(), _("Show layers manager" ) );
_("Show &Layers Manager" ) );
} }
DisplayUnitsMsg();
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
} }
void WinEDA_GerberFrame::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
{
int layer = GetScreen()->m_Active_Layer;
GERBER_IMAGE* gerber = g_GERBER_List[layer];
int selected = ( gerber ) ? gerber->m_Selected_Tool : 0;
if( m_DCodeSelector && m_DCodeSelector->GetSelectedDCodeId() != selected )
m_DCodeSelector->SetDCodeSelection( selected );
aEvent.Enable( gerber != NULL );
}
void WinEDA_GerberFrame::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
{
if( m_SelLayerBox && (m_SelLayerBox->GetSelection() != GetScreen()->m_Active_Layer) )
{
m_SelLayerBox->SetSelection( GetScreen()->m_Active_Layer );
}
}

View File

@ -46,10 +46,10 @@ protected:
public: public:
WinEDALayerChoiceBox* m_SelLayerBox; WinEDALayerChoiceBox* m_SelLayerBox;
DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to hightlight. DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to highlight.
wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about
// gerber data (format..) // gerber data (format..)
wxArrayString m_DCodesList; // an array string containint all decodes Id (10 to 999) wxArrayString m_DCodesList; // an array string containing all decodes Id (10 to 999)
private: private:
int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn: int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn:
@ -77,7 +77,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
* Function ReportMessage * Function ReportMessage
* Add a message (a string) in message list * Add a message (a string) in message list
* for instance when reading a Gerber file * for instance when reading a Gerber file
* @param aMessage = the straing to add in list * @param aMessage = the string to add in list
*/ */
void ReportMessage( const wxString aMessage ) void ReportMessage( const wxString aMessage )
{ {
@ -121,7 +121,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
/** /**
* Function SetGridVisibility() , virtual * Function SetGridVisibility() , virtual
* It may be overloaded by derived classes * It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration. * if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown * @param aVisible = true if the grid must be shown
*/ */
virtual void SetGridVisibility( bool aVisible ); virtual void SetGridVisibility( bool aVisible );
@ -277,16 +277,23 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay(); GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay();
GERBER_DRAW_ITEM* Locate( int typeloc ); GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
void SetToolbars();
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void InstallConfigFrame( const wxPoint& pos ); void InstallConfigFrame( const wxPoint& pos );
void InstallGerberOptionsDialog( wxCommandEvent& event ); void InstallGerberOptionsDialog( wxCommandEvent& event );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
/* handlers for block commands */ /* handlers for block commands */
virtual int ReturnBlockCommand( int key ); virtual int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC ); virtual void HandleBlockPlace( wxDC* DC );

View File

@ -63,6 +63,7 @@ class BASE_SCREEN : public EDA_ITEM
EDA_ITEM* m_CurrentItem; ///< Currently selected object EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection. GRID_TYPE m_Grid; ///< Current grid selection.
wxPoint m_scrollCenter; ///< Current scroll center point in logical units. wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
/** /**
* The cross hair position in logical (drawing) units. The cross hair is not the cursor * The cross hair position in logical (drawing) units. The cross hair is not the cursor
@ -74,7 +75,6 @@ class BASE_SCREEN : public EDA_ITEM
public: public:
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */ wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid) wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units. (coordinates from last reset position)*/ * in user units. (coordinates from last reset position)*/
@ -362,6 +362,8 @@ public:
*/ */
void GetGrids( GRIDS& aList ); void GetGrids( GRIDS& aList );
void SetMousePosition( const wxPoint& aPosition ) { m_MousePosition = aPosition; }
/** /**
* Function RefPos * Function RefPos
* Return the reference position, coming from either the mouse position * Return the reference position, coming from either the mouse position

View File

@ -19,7 +19,7 @@ class PCB_SCREEN;
* Mouse capture callback function prototype. * Mouse capture callback function prototype.
*/ */
typedef void ( *MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC, typedef void ( *MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase ); const wxPoint& aPosition, bool aErase );
/** /**
* End mouse capture callback function prototype. * End mouse capture callback function prototype.
@ -33,7 +33,7 @@ private:
int m_cursor; ///< Current mouse cursor shape id. int m_cursor; ///< Current mouse cursor shape id.
int m_defaultCursor; ///< The default mouse cursor shape id. int m_defaultCursor; ///< The default mouse cursor shape id.
bool m_showCrossHair; ///< Indicate if cross hair is to be shown. bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
int m_cursorLevel; // Index for cursor redraw in XOR mode. int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
public: public:
EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the
@ -221,7 +221,7 @@ public:
*/ */
void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL ); void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL );
void ReDraw( wxDC* DC, bool erasebg = TRUE ); void ReDraw( wxDC* aDC, bool aEraseBackground = true );
/** /**
* Function RefreshDrawingRect * Function RefreshDrawingRect

View File

@ -180,13 +180,12 @@ enum main_id
ID_SHEET_SET, ID_SHEET_SET,
ID_TO_LIBRARY, ID_TO_LIBRARY,
ID_NO_SELECT_BUTT,
ID_COMPONENT_BUTT, ID_COMPONENT_BUTT,
ID_ZOOM_IN, ID_ZOOM_IN,
ID_ZOOM_OUT, ID_ZOOM_OUT,
ID_ZOOM_REDRAW,
ID_ZOOM_PAGE, ID_ZOOM_PAGE,
ID_ZOOM_REDRAW,
/* Panning command event IDs. */ /* Panning command event IDs. */
ID_PAN_UP, ID_PAN_UP,
@ -204,21 +203,23 @@ enum main_id
/* Command IDs common to PCBNew and GerbView. */ /* Command IDs common to PCBNew and GerbView. */
ID_PCB_DISPLAY_FOOTPRINT_DOC, ID_PCB_DISPLAY_FOOTPRINT_DOC,
ID_TB_OPTIONS_START,
ID_TB_OPTIONS_DRC_OFF,
ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_MM,
ID_TB_OPTIONS_SELECT_UNIT_INCH, ID_TB_OPTIONS_SELECT_UNIT_INCH,
ID_TB_OPTIONS_SELECT_CURSOR, ID_TB_OPTIONS_SELECT_CURSOR,
ID_TB_OPTIONS_SHOW_POLAR_COORD, ID_TB_OPTIONS_SHOW_POLAR_COORD,
ID_TB_OPTIONS_SHOW_GRID, ID_TB_OPTIONS_SHOW_GRID,
ID_TB_OPTIONS_SHOW_RATSNEST,
ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
ID_TB_OPTIONS_AUTO_DEL_TRACK,
ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES,
ID_TB_OPTIONS_SHOW_ZONES_DISABLE, ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
ID_TB_OPTIONS_START,
ID_TB_OPTIONS_DRC_OFF,
ID_TB_OPTIONS_SHOW_RATSNEST,
ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
ID_TB_OPTIONS_AUTO_DEL_TRACK,
ID_TB_OPTIONS_HIDDEN_PINS, ID_TB_OPTIONS_HIDDEN_PINS,
ID_TB_OPTIONS_BUS_WIRES_ORIENT, ID_TB_OPTIONS_BUS_WIRES_ORIENT,
ID_TB_OPTIONS_SHOW_PADS_SKETCH, ID_TB_OPTIONS_SHOW_PADS_SKETCH,

View File

@ -50,7 +50,6 @@ class GENERAL_COLLECTORS_GUIDE;
class WinEDA_BasePcbFrame : public EDA_DRAW_FRAME class WinEDA_BasePcbFrame : public EDA_DRAW_FRAME
{ {
public: public:
bool m_DisplayPadFill; // How show pads bool m_DisplayPadFill; // How show pads
bool m_DisplayViaFill; // How show vias bool m_DisplayViaFill; // How show vias
bool m_DisplayPadNum; // show pads numbers bool m_DisplayPadNum; // show pads numbers
@ -69,6 +68,9 @@ protected:
BOARD* m_Pcb; BOARD* m_Pcb;
GENERAL_COLLECTOR* m_Collector; GENERAL_COLLECTOR* m_Collector;
void updateGridSelectBox();
void updateZoomSelectBox();
public: public:
WinEDA_BasePcbFrame( wxWindow* father, int idtype, WinEDA_BasePcbFrame( wxWindow* father, int idtype,
const wxString& title, const wxString& title,
@ -494,6 +496,15 @@ public:
*/ */
virtual void SaveSettings(); virtual void SaveSettings();
void OnTogglePolarCoords( wxCommandEvent& aEvent );
void OnTogglePadDrawMode( wxCommandEvent& aEvent );
/* User interface update event handlers. */
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
void OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -107,6 +107,7 @@ public:
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void OnColorConfig( wxCommandEvent& aEvent ); void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition ); void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
@ -426,13 +427,9 @@ private:
/* User interface update event handlers. */ /* User interface update event handlers. */
void OnUpdateBlockSelected( wxUpdateUIEvent& event ); void OnUpdateBlockSelected( wxUpdateUIEvent& event );
void OnUpdatePaste( wxUpdateUIEvent& event ); void OnUpdatePaste( wxUpdateUIEvent& event );
void OnUpdateSchematicUndo( wxUpdateUIEvent& event );
void OnUpdateSchematicRedo( wxUpdateUIEvent& event );
void OnUpdateGrid( wxUpdateUIEvent& event );
void OnUpdateUnits( wxUpdateUIEvent& event );
void OnUpdateSelectCursor( wxUpdateUIEvent& event );
void OnUpdateHiddenPins( wxUpdateUIEvent& event ); void OnUpdateHiddenPins( wxUpdateUIEvent& event );
void OnUpdateBusOrientation( wxUpdateUIEvent& event ); void OnUpdateBusOrientation( wxUpdateUIEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
/** /**
* Function SetLanguage * Function SetLanguage

View File

@ -53,11 +53,15 @@ class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
{ {
friend class PCB_LAYER_WIDGET; friend class PCB_LAYER_WIDGET;
void updateTraceWidthSelectBox();
void updateViaSizeSelectBox();
void updateDesignRulesSelectBoxes();
protected: protected:
PCB_LAYER_WIDGET* m_Layers; PCB_LAYER_WIDGET* m_Layers;
DRC* m_drc; ///< the DRC controller, see drc.cpp DRC* m_drc; ///< the DRC controller, see drc.cpp
PARAM_CFG_ARRAY m_projectFileParams; ///< List of PCBNew project file settings. PARAM_CFG_ARRAY m_projectFileParams; ///< List of PCBNew project file settings.
PARAM_CFG_ARRAY m_configSettings; ///< List of PCBNew configuration settings. PARAM_CFG_ARRAY m_configSettings; ///< List of PCBNew configuration settings.
@ -103,6 +107,7 @@ protected:
* <p> * <p>
* This function cannot be inline without including layer_widget.h in * This function cannot be inline without including layer_widget.h in
* here and we do not want to do that. * here and we do not want to do that.
* </p>
*/ */
void syncLayerWidget( ); void syncLayerWidget( );
@ -157,6 +162,20 @@ public:
void SVG_Print( wxCommandEvent& event ); void SVG_Print( wxCommandEvent& event );
// User interface update command event handlers.
void OnUpdateSave( wxUpdateUIEvent& aEvent );
void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
void OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent );
void OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent );
void OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent );
void OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateAuxilaryToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
/** /**
* Function PrintPage , virtual * Function PrintPage , virtual
* used to print a page * used to print a page
@ -310,6 +329,7 @@ public:
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( wxCommandEvent& event ); void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void ProcessMuWaveFunctions( wxCommandEvent& event ); void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
@ -379,28 +399,13 @@ public:
void PrepareLayerIndicator(); void PrepareLayerIndicator();
/**
* Function AuxiliaryToolBar_Update_UI
* update the displayed values on auxiliary horizontal toolbar
* (track width, via sizes, clearance ...
*/
void AuxiliaryToolBar_Update_UI();
/**
* Function AuxiliaryToolBar_DesignRules_Update_UI
* update the displayed values: track width, via sizes, clearance
* used when a new netclass is selected
*/
void AuxiliaryToolBar_DesignRules_Update_UI();
/* mouse functions events: */ /* mouse functions events: */
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
/** /**
* Function OnRightClick * Function OnRightClick
* populates a popup menu with the choices appropriate for the current * populates a popup menu with the choices appropriate for the current context.
*context.
* The caller will add the ZOOM menu choices afterward. * The caller will add the ZOOM menu choices afterward.
* @param aMousePos The current mouse position * @param aMousePos The current mouse position
* @param aPopMenu The menu to add to. * @param aPopMenu The menu to add to.
@ -417,7 +422,7 @@ public:
* @param aItemToCopy = the board item modified by the command to undo * @param aItemToCopy = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType) * @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for * @param aTransformPoint = the reference point of the transformation, for
*commands like move * commands like move
*/ */
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
UndoRedoOpType aTypeCommand, UndoRedoOpType aTypeCommand,
@ -430,7 +435,7 @@ public:
* @param aItemsList = the list of items modified by the command to undo * @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType) * @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for * @param aTransformPoint = the reference point of the transformation, for
*commands like move * commands like move
*/ */
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand, UndoRedoOpType aTypeCommand,
@ -439,13 +444,10 @@ public:
/** /**
* Function PutDataInPreviousState * Function PutDataInPreviousState
* Used in undo or redo command. * Used in undo or redo command.
* Put data pointed by List in the previous state, i.e. the state memorized * Put data pointed by List in the previous state, i.e. the state memorized by List
* by List * @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to
* undo/redo
* @param aRedoCommand = a bool: true for redo, false for undo * @param aRedoCommand = a bool: true for redo, false for undo
* @param aRebuildRatsnet = a bool: true to rebuild ratsnet (normal use), * @param aRebuildRatsnet = a bool: true to rebuild ratsnet (normal use), false
* false
* to just retrieve last state (used in abort commands that do not need to * to just retrieve last state (used in abort commands that do not need to
* rebuild ratsnest) * rebuild ratsnest)
*/ */
@ -554,8 +556,6 @@ public:
*/ */
void Block_Duplicate(); void Block_Duplicate();
void SetToolbars();
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
void OnConfigurePcbOptions( wxCommandEvent& aEvent ); void OnConfigurePcbOptions( wxCommandEvent& aEvent );
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent ); void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
@ -582,7 +582,7 @@ public:
* @param aForceFileDialog - Display the file open dialog even if aFullFileName is * @param aForceFileDialog - Display the file open dialog even if aFullFileName is
* valid if true; Default = false. * valid if true; Default = false.
* *
* @return False if file load fails or is cancelled by the user, otherwise true. * @return False if file load fails or is canceled by the user, otherwise true.
*/ */
bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false, bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
bool aForceFileDialog = false ); bool aForceFileDialog = false );
@ -606,8 +606,7 @@ public:
/** /**
* Function Clear_Pcb * Function Clear_Pcb
* delete all and reinitialize the current board * delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to * @param aQuery = true to prompt user for confirmation, false to initialize silently
* initialize silently
*/ */
bool Clear_Pcb( bool aQuery ); bool Clear_Pcb( bool aQuery );
@ -1045,13 +1044,14 @@ public:
* @param aNetlistFullFilename = netlist file name (*.net) * @param aNetlistFullFilename = netlist file name (*.net)
* @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found, * @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found,
* only the netlist will be used * only the netlist will be used
* @param aMessageWindow = a reference to a wxTextCtrl where to dislay messages. * @param aMessageWindow = a reference to a wxTextCtrl where to display messages.
* can be NULL * can be NULL
* @param aChangeFootprint if true, footprints that have changed in netlist will be changed * @param aChangeFootprint if true, footprints that have changed in netlist will be changed
* @param aDeleteBadTracks if true, erroneous tracks will be deleted * @param aDeleteBadTracks if true, erroneous tracks will be deleted
* @param aDeleteExtraFootprints if true, remove unlocked footprints that are not in netlist * @param aDeleteExtraFootprints if true, remove unlocked footprints that are not in netlist
* @param aSelect_By_Timestamp if true, use timestamp instead of reference to identify footprints * @param aSelect_By_Timestamp if true, use timestamp instead of reference to identify
* from components (use after reannotation of the chematic) * footprints from components (use after reannotation of the
* schematic)
* @return true if Ok * @return true if Ok
* *
* the format of the netlist is something like: * the format of the netlist is something like:

View File

@ -283,7 +283,6 @@ public:
void EraseMsgBox(); void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event ); void Process_PageSettings( wxCommandEvent& event );
virtual void SetToolbars();
/** /**
* Function SetLanguage * Function SetLanguage
@ -377,6 +376,19 @@ public:
virtual void OnSelectGrid( wxCommandEvent& event ); virtual void OnSelectGrid( wxCommandEvent& event );
virtual void OnSelectZoom( wxCommandEvent& event ); virtual void OnSelectZoom( wxCommandEvent& event );
// Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
void OnToggleGridState( wxCommandEvent& aEvent );
void OnSelectUnits( wxCommandEvent& aEvent );
void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
// Update user interface event handlers shared by all applications derived from
// EDA_DRAW_FRAME.
void OnUpdateUndo( wxUpdateUIEvent& aEvent );
void OnUpdateRedo( wxUpdateUIEvent& aEvent );
void OnUpdateGrid( wxUpdateUIEvent& aEvent );
void OnUpdateUnits( wxUpdateUIEvent& aEvent );
void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
/** /**
* Function GeneralControle * Function GeneralControle
* performs application specific control using \a aDC at \a aPosition in logical units. * performs application specific control using \a aDC at \a aPosition in logical units.

View File

@ -11,6 +11,8 @@
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "dialog_helpers.h"
#include "kicad_device_context.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "bitmaps.h" #include "bitmaps.h"
@ -32,14 +34,25 @@ static const wxString DisplayModuleEdgeEntry( wxT( "DiModEd" ) );
static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) ); static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) );
/*******************************/ /*****************************/
/* class WinEDA_BasePcbFrame */ /* class WinEDA_BasePcbFrame */
/*******************************/ /*****************************/
BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, EDA_DRAW_FRAME ) BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection ) WinEDA_BasePcbFrame::ProcessItemSelection )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, WinEDA_BasePcbFrame::OnTogglePolarCoords )
EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, WinEDA_BasePcbFrame::OnTogglePadDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, WinEDA_BasePcbFrame::OnUpdateCoordType )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, WinEDA_BasePcbFrame::OnUpdatePadDrawMode )
EVT_UPDATE_UI_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
WinEDA_BasePcbFrame::OnUpdateSelectGrid )
EVT_UPDATE_UI_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
WinEDA_BasePcbFrame::OnUpdateSelectZoom )
EVT_UPDATE_UI_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE,
WinEDA_BasePcbFrame::OnUpdateSelectZoom )
END_EVENT_TABLE() END_EVENT_TABLE()
@ -101,16 +114,18 @@ int WinEDA_BasePcbFrame::BestZoom( void )
dx = m_Pcb->m_BoundaryBox.GetWidth(); dx = m_Pcb->m_BoundaryBox.GetWidth();
dy = m_Pcb->m_BoundaryBox.GetHeight(); dy = m_Pcb->m_BoundaryBox.GetHeight();
size = DrawPanel->GetClientSize();
size = DrawPanel->GetClientSize();
if( size.x ) if( size.x )
ii = ( dx + (size.x / 2) ) / size.x; ii = ( dx + (size.x / 2) ) / size.x;
else else
ii = 31; ii = 31;
if ( size.y ) if ( size.y )
jj = ( dy + (size.y / 2) ) / size.y; jj = ( dy + (size.y / 2) ) / size.y;
else else
jj = 31; jj = 31;
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
GetScreen()->SetScrollCenterPosition( m_Pcb->m_BoundaryBox.Centre() ); GetScreen()->SetScrollCenterPosition( m_Pcb->m_BoundaryBox.Centre() );
@ -155,7 +170,6 @@ void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
} }
// Note: virtual, overridden in WinEDA_PcbFrame; // Note: virtual, overridden in WinEDA_PcbFrame;
void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer ) void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
{ {
@ -206,17 +220,99 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
} }
/**********************************************************************/ void WinEDA_BasePcbFrame::OnTogglePolarCoords( wxCommandEvent& aEvent )
void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event )
/**********************************************************************/
{ {
int id = event.GetId(); SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = !DisplayOpt.DisplayPolarCood;
UpdateStatusBar();
}
void WinEDA_BasePcbFrame::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
m_DisplayPadFill = DisplayOpt.DisplayPadFill = !m_DisplayPadFill;
DrawPanel->Refresh();
}
void WinEDA_BasePcbFrame::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
{
aEvent.Check( DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ?
_( "Display rectangular coordinates" ) :
_( "Display polar coordinates" ) );
}
void WinEDA_BasePcbFrame::OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayPadFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ?
_( "Show pads in outline mode" ) :
_( "Show pads in fill mode" ) );
}
void WinEDA_BasePcbFrame::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
{
// No need to update the grid select box if it doesn't exist or the grid setting change
// was made using the select box.
if( m_SelGridBox == NULL || m_AuxiliaryToolBar == NULL )
return;
int select = wxNOT_FOUND;
if( aEvent.GetId() == ID_POPUP_GRID_USER )
{
select = 0;
}
else
{
for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
{
if( aEvent.GetId() == GetScreen()->GetGrid( i ).m_Id )
{
select = (int) i;
break;
}
}
}
m_SelGridBox->SetSelection( select );
}
void WinEDA_BasePcbFrame::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
{
if( m_SelZoomBox == NULL || m_AuxiliaryToolBar == NULL )
return;
int current = 0;
for( size_t i = 0; i < GetScreen()->m_ZoomList.GetCount(); i++ )
{
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[i] )
{
current = i + 1;
break;
}
}
if( current != m_SelZoomBox->GetSelection() )
m_SelZoomBox->SetSelection( current );
}
void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
// index into the collector list: // index into the collector list:
int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START; int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START;
if( id >= ID_POPUP_PCB_ITEM_SELECTION_START if( id >= ID_POPUP_PCB_ITEM_SELECTION_START && id <= ID_POPUP_PCB_ITEM_SELECTION_END )
&& id <= ID_POPUP_PCB_ITEM_SELECTION_END )
{ {
BOARD_ITEM* item = (*m_Collector)[itemNdx]; BOARD_ITEM* item = (*m_Collector)[itemNdx];
DrawPanel->m_AbortRequest = false; DrawPanel->m_AbortRequest = false;
@ -350,19 +446,11 @@ void WinEDA_BasePcbFrame::UpdateStatusBar()
break; break;
} }
Line.Printf( formatter, To_User_Unit( g_UserUnit, ro, m_InternalUnits ), Line.Printf( formatter, To_User_Unit( g_UserUnit, ro, m_InternalUnits ), theta );
theta );
// overwrite the absolute cartesian coordinates // overwrite the absolute cartesian coordinates
SetStatusText( Line, 2 ); SetStatusText( Line, 2 );
} }
/* not this, because status field no. 0 is reserved for actual fleeting
status information. If this is enabled, then that text is erased on
every DrawPanel redraw. Field no. 0 is set with Affiche_Message() and it
should persist until called again.
SetStatusText( Line, 0 );
*/
} }
@ -379,6 +467,7 @@ void WinEDA_BasePcbFrame::LoadSettings()
wxConfig* cfg = wxGetApp().m_EDA_Config; wxConfig* cfg = wxGetApp().m_EDA_Config;
EDA_DRAW_FRAME::LoadSettings(); EDA_DRAW_FRAME::LoadSettings();
// Ensure grid id is an existent grid id: // Ensure grid id is an existent grid id:
if( (m_LastGridSizeId <= 0) || if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) ) (m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
@ -386,17 +475,17 @@ void WinEDA_BasePcbFrame::LoadSettings()
cfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 ); cfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 ); cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
cfg->Read( m_FrameName + UserGridUnitsEntry, (long*)&m_UserGridUnit, cfg->Read( m_FrameName + UserGridUnitsEntry, (long*)&m_UserGridUnit, ( long )INCHES );
( long )INCHES );
cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true ); cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true ); cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true );
cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true ); cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );
cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, ( long )FILLED );
( long )FILLED );
if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH ) if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH )
m_DisplayModEdge = FILLED; m_DisplayModEdge = FILLED;
cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText,
( long )FILLED ); cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText, ( long )FILLED );
if( m_DisplayModText < FILAIRE || m_DisplayModText > SKETCH ) if( m_DisplayModText < FILAIRE || m_DisplayModText > SKETCH )
m_DisplayModText = FILLED; m_DisplayModText = FILLED;
} }
@ -426,7 +515,6 @@ void WinEDA_BasePcbFrame::SaveSettings()
} }
/** /**
* Function OnModify * Function OnModify
* Must be called after a schematic change * Must be called after a schematic change
@ -442,3 +530,95 @@ void WinEDA_BasePcbFrame::OnModify( )
wxString date = GenDate(); wxString date = GenDate();
GetScreen()->m_Date = date; GetScreen()->m_Date = date;
} }
void WinEDA_BasePcbFrame::updateGridSelectBox()
{
UpdateStatusBar();
DisplayUnitsMsg();
if( m_SelGridBox == NULL )
return;
// Update grid values with the current units setting.
m_SelGridBox->Clear();
wxString msg;
wxString format = _( "Grid");
switch( g_UserUnit )
{
case INCHES:
format += wxT( " %.1f" );
break;
case MILLIMETRES:
format += wxT( " %.3f" );
break;
case UNSCALED_UNITS:
format += wxT( " %f" );
break;
}
for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
{
GRID_TYPE& grid = GetScreen()->GetGrid( i );
double value = To_User_Unit( g_UserUnit, grid.m_Size.x, m_InternalUnits );
if( grid.m_Id != ID_POPUP_GRID_USER )
{
switch( g_UserUnit )
{
case INCHES:
msg.Printf( format.GetData(), value * 1000 );
break;
case MILLIMETRES:
case UNSCALED_UNITS:
msg.Printf( format.GetData(), value );
break;
}
}
else
msg = _( "User Grid" );
m_SelGridBox->Append( msg, (void*) &grid.m_Id );
if( ( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) == GetScreen()->GetGrid( i ).m_Id )
m_SelGridBox->SetSelection( i );
}
}
void WinEDA_BasePcbFrame::updateZoomSelectBox()
{
if( m_SelZoomBox == NULL )
return;
wxString msg;
m_SelZoomBox->Clear();
m_SelZoomBox->Append( _( "Auto" ) );
m_SelZoomBox->SetSelection( 0 );
for( int i = 0; i < (int)GetScreen()->m_ZoomList.GetCount(); i++ )
{
msg = _( "Zoom " );
if ( ( GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar ) == 0 )
msg << GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar;
else
{
wxString value;
value.Printf( wxT( "%.1f" ),
(float)GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar );
msg += value;
}
m_SelZoomBox->Append( msg );
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[i] )
m_SelZoomBox->SetSelection( i + 1 );
}
}

View File

@ -598,9 +598,6 @@ void WinEDA_PcbFrame::GetBoardFromUndoList( wxCommandEvent& event )
GetScreen()->PushCommandToRedoList( List ); GetScreen()->PushCommandToRedoList( List );
OnModify(); OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
@ -629,9 +626,6 @@ void WinEDA_PcbFrame::GetBoardFromRedoList( wxCommandEvent& event )
GetScreen()->PushCommandToUndoList( List ); GetScreen()->PushCommandToUndoList( List );
OnModify(); OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }

View File

@ -103,7 +103,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
scanList = GENERAL_COLLECTOR::Tracks; scanList = GENERAL_COLLECTOR::Tracks;
break; break;
case ID_COMPONENT_BUTT: case ID_PCB_MODULE_BUTT:
scanList = GENERAL_COLLECTOR::ModuleItems; scanList = GENERAL_COLLECTOR::ModuleItems;
break; break;
@ -376,6 +376,5 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxSafeYield(); wxSafeYield();
} }
SetToolbars();
UpdateStatusBar(); /* Display new cursor coordinates */ UpdateStatusBar(); /* Display new cursor coordinates */
} }

View File

@ -25,7 +25,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
if( aTrack == NULL ) if( aTrack == NULL )
return NULL; return NULL;
if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last segment if( aTrack->IsNew() ) // Trace in progress, erase the last segment
{ {
if( g_CurrentTrackList.GetCount() > 0 ) if( g_CurrentTrackList.GetCount() > 0 )
{ {

View File

@ -710,7 +710,6 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
m_Pcb->SetCurrentNetClass( NETCLASS::Default ); m_Pcb->SetCurrentNetClass( NETCLASS::Default );
m_Parent->m_TrackAndViasSizesList_Changed = true; m_Parent->m_TrackAndViasSizesList_Changed = true;
m_Parent->AuxiliaryToolBar_Update_UI();
} }

View File

@ -72,7 +72,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
UserUnitType ii; UserUnitType ii;
DisplayOpt.DisplayPolarCood = DisplayOpt.DisplayPolarCood =
( m_PolarDisplay->GetSelection() == 0 ) ? FALSE : true; ( m_PolarDisplay->GetSelection() == 0 ) ? false : true;
ii = g_UserUnit; ii = g_UserUnit;
g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES; g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
if( ii != g_UserUnit ) if( ii != g_UserUnit )
@ -114,45 +114,18 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_DRC_OFF: case ID_TB_OPTIONS_DRC_OFF:
Drc_On = state ? FALSE : true; Drc_On = !state;
break;
case ID_TB_OPTIONS_SHOW_GRID:
SetElementVisibility(GRID_VISIBLE, state);
DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SHOW_RATSNEST: case ID_TB_OPTIONS_SHOW_RATSNEST:
SetElementVisibility(RATSNEST_VISIBLE, state); SetElementVisibility( RATSNEST_VISIBLE, state );
DrawPanel->Refresh( ); DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST: case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
g_Show_Module_Ratsnest = state; // TODO: use the visibility list g_Show_Module_Ratsnest = state; // TODO: use the visibility list
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UserUnit = MILLIMETRES;
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UserUnit = INCHES;
m_TrackAndViasSizesList_Changed = true;
UpdateStatusBar();
ReCreateAuxiliaryToolbar();
DisplayUnitsMsg();
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = state;
break;
case ID_TB_OPTIONS_AUTO_DEL_TRACK: case ID_TB_OPTIONS_AUTO_DEL_TRACK:
g_AutoDeleteOldTrack = state; g_AutoDeleteOldTrack = state;
break; break;
@ -172,27 +145,8 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
if( state )
{
m_DisplayPadFill = DisplayOpt.DisplayPadFill = false;
}
else
{
m_DisplayPadFill = DisplayOpt.DisplayPadFill = true;
}
DrawPanel->Refresh();
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
if( state ) m_DisplayViaFill = DisplayOpt.DisplayViaFill = !state;
{
m_DisplayViaFill = DisplayOpt.DisplayViaFill = false;
}
else
{
m_DisplayViaFill = DisplayOpt.DisplayViaFill = true;
}
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
@ -217,12 +171,13 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
m_show_layer_manager_tools = state; m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update(); m_auimgr.Update();
if( m_show_layer_manager_tools ) if( m_show_layer_manager_tools )
GetMenuBar()->SetLabel(ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Hide &Layers Manager" ) ); _("Hide &Layers Manager" ) );
else else
GetMenuBar()->SetLabel(ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Show &Layers Manager" ) ); _("Show &Layers Manager" ) );
break; break;
default: default:
@ -230,6 +185,4 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)" ) ); wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)" ) );
break; break;
} }
SetToolbars();
} }

View File

@ -199,7 +199,7 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Dimension ) if( Dimension )
{ {
if( Dimension->m_Flags & IS_NEW ) if( Dimension->IsNew() )
{ {
Dimension->Draw( Panel, DC, GR_XOR ); Dimension->Draw( Panel, DC, GR_XOR );
Dimension->DeleteStructure(); Dimension->DeleteStructure();

View File

@ -280,7 +280,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Edge && ( Edge->Type() == TYPE_EDGE_MODULE ) ) if( Edge && ( Edge->Type() == TYPE_EDGE_MODULE ) )
{ {
if( Edge->m_Flags & IS_NEW ) // On aborting, delete new outline. if( Edge->IsNew() ) // On aborting, delete new outline.
{ {
MODULE* Module = (MODULE*) Edge->GetParent(); MODULE* Module = (MODULE*) Edge->GetParent();
Edge->Draw( Panel, DC, GR_XOR, MoveVector ); Edge->Draw( Panel, DC, GR_XOR, MoveVector );

View File

@ -49,8 +49,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
case wxID_CUT: case wxID_CUT:
case wxID_COPY: case wxID_COPY:
case ID_ON_GRID_SELECT:
case ID_ON_ZOOM_SELECT:
case ID_PCB_USER_GRID_SETUP: case ID_PCB_USER_GRID_SETUP:
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
@ -231,66 +229,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
InstallFindFrame( pos, &dc ); InstallFindFrame( pos, &dc );
break; break;
case ID_TRACK_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Tracks" ) );
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
{
Compile_Ratsnest( &dc, true );
}
break;
case ID_PCB_ZONES_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Zones" ) );
if( DisplayOpt.DisplayZonesMode != 0 )
DisplayInfoMessage( this, _( "Warning: Display Zone is OFF!!!" ) );
if( !g_HighLight_Status && (g_HighLight_NetCode > 0 ) )
High_Light( &dc );
break;
case ID_PCB_MIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Layer Alignment Target" ) );
break;
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Zero" ) );
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Grid Origin" ) );
break;
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Graphic" ) );
break;
case ID_PCB_ADD_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
break;
case ID_COMPONENT_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Add Modules" ) );
break;
case ID_PCB_DIMENSION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Dimension" ) );
break;
case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_PCB_HIGHLIGHT_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Net Highlight" ) );
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Local Ratsnest" ) );
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
Compile_Ratsnest( &dc, true );
break;
case ID_POPUP_CLOSE_CURRENT_TOOL: case ID_POPUP_CLOSE_CURRENT_TOOL:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
@ -593,10 +531,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_PCB_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST: case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
Process_Move_Item( this, GetCurItem(), &dc ); Process_Move_Item( this, GetCurItem(), &dc );
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
@ -952,7 +886,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->IsNew()) )
{ {
End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc ); End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
SetCurItem( NULL ); SetCurItem( NULL );
@ -961,7 +895,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->IsNew()) )
{ {
if( End_Zone( &dc ) ) if( End_Zone( &dc ) )
SetCurItem( NULL ); SetCurItem( NULL );
@ -971,7 +905,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER: case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->IsNew()) )
{ {
if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline, if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
SetCurItem( NULL ); SetCurItem( NULL );
@ -1060,7 +994,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
SetToolbars();
DrawPanel->CrossHairOn( &dc ); DrawPanel->CrossHairOn( &dc );
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
} }
@ -1222,7 +1155,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// See if we are drawing a segment; if so, add a via? // See if we are drawing a segment; if so, add a via?
if( m_ID_current_state == ID_TRACK_BUTT && current != NULL ) if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
{ {
if( current->Type() == TYPE_TRACK && ( current->m_Flags & IS_NEW ) ) if( current->Type() == TYPE_TRACK && ( current->IsNew() ) )
{ {
// Want to set the routing layers so that it switches properly - // Want to set the routing layers so that it switches properly -
// see the implementation of Other_Layer_Route - the working // see the implementation of Other_Layer_Route - the working
@ -1255,3 +1188,104 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq();
} }
void WinEDA_PcbFrame::OnSelectTool( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
if( m_ID_current_state == id )
return;
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
// Stop the current command and deselect the current tool.
DrawPanel->EndMouseCapture( ID_PCB_NO_TOOL, DrawPanel->GetDefaultCursor() );
switch( id )
{
case ID_PCB_NO_TOOL:
SetToolID( id, DrawPanel->GetDefaultCursor(), wxEmptyString );
break;
case ID_TRACK_BUTT:
if( Drc_On )
SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
else
SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
{
Compile_Ratsnest( &dc, true );
}
break;
case ID_PCB_MODULE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add module" ) );
break;
case ID_PCB_ZONES_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add zones" ) );
if( DisplayOpt.DisplayZonesMode != 0 )
DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
if( !g_HighLight_Status && (g_HighLight_NetCode > 0 ) )
High_Light( &dc );
break;
case ID_PCB_MIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
break;
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust zero" ) );
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
break;
case ID_PCB_ADD_LINE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic line" ) );
break;
case ID_PCB_ARC_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
break;
case ID_PCB_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
break;
case ID_PCB_ADD_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_COMPONENT_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Add module" ) );
break;
case ID_PCB_DIMENSION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add dimension" ) );
break;
case ID_PCB_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_PCB_HIGHLIGHT_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Highlight net" ) );
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
Compile_Ratsnest( &dc, true );
break;
}
}

View File

@ -42,7 +42,7 @@ void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC )
TextePcb->Draw( Panel, DC, GR_XOR ); TextePcb->Draw( Panel, DC, GR_XOR );
if( (TextePcb->m_Flags & IS_NEW) ) // If new: remove it if( TextePcb->IsNew() ) // If new: remove it
{ {
TextePcb->DeleteStructure(); TextePcb->DeleteStructure();
return; return;
@ -69,7 +69,7 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( DrawPanel, DC, GR_OR ); TextePcb->Draw( DrawPanel, DC, GR_OR );
OnModify(); OnModify();
if( (TextePcb->m_Flags & IS_NEW) ) // If new: prepare undo command if( TextePcb->IsNew() ) // If new: prepare undo command
{ {
SaveCopyInUndoList( TextePcb, UR_NEW ); SaveCopyInUndoList( TextePcb, UR_NEW );
TextePcb->m_Flags = 0; TextePcb->m_Flags = 0;
@ -100,7 +100,7 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
return; return;
// if it is an existing item: prepare a copy to undo/abort command // if it is an existing item: prepare a copy to undo/abort command
if( (TextePcb->m_Flags & IS_NEW) == 0 ) if( !TextePcb->IsNew() )
s_TextCopy.Copy( TextePcb ); s_TextCopy.Copy( TextePcb );
TextePcb->Draw( DrawPanel, DC, GR_XOR ); TextePcb->Draw( DrawPanel, DC, GR_XOR );

View File

@ -88,7 +88,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
if( Segment == NULL ) if( Segment == NULL )
return; return;
if( Segment->m_Flags & IS_NEW ) // Trace in progress. if( Segment->IsNew() ) // Trace in progress.
{ {
/* Delete current segment. */ /* Delete current segment. */
DisplayOpt.DisplayDrawItems = SKETCH; DisplayOpt.DisplayDrawItems = SKETCH;
@ -175,7 +175,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
return; return;
} }
if( Segment->m_Flags & IS_NEW ) if( Segment->IsNew() )
{ {
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false ); Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
Segment ->DeleteStructure(); Segment ->DeleteStructure();

View File

@ -104,7 +104,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM ); setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM );
UpdateStatusBar(); UpdateStatusBar();
SetToolbars();
return true; return true;
} }
@ -257,7 +256,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
via->DisplayInfo( this ); via->DisplayInfo( this );
UpdateStatusBar(); UpdateStatusBar();
SetToolbars();
return true; return true;
} }

View File

@ -152,7 +152,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->SetNet( g_HighLight_NetCode ); g_CurrentTrackSegment->SetNet( g_HighLight_NetCode );
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() ); GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth(); g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth();

View File

@ -37,20 +37,17 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth =
not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth; not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth;
AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES: case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0; GetBoard()->m_TrackWidthSelector = 0;
GetBoard()->m_ViaSizeSelector = 0; GetBoard()->m_ViaSizeSelector = 0;
AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH: case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true;
AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection
@ -65,7 +62,6 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1; ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii; GetBoard()->m_TrackWidthSelector = ii;
AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection
@ -79,7 +75,6 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1; ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetBoard()->m_ViaSizeSelector = ii; GetBoard()->m_ViaSizeSelector = ii;
AuxiliaryToolBar_Update_UI( );
break; break;

View File

@ -30,8 +30,6 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
::wxSetWorkingDirectory( ::wxPathOnly( fn ) ); ::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
LoadOnePcbFile( fn ); LoadOnePcbFile( fn );
ReCreateAuxiliaryToolbar();
SetToolbars();
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
} }
} }
@ -55,8 +53,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
{ {
case ID_LOAD_FILE: case ID_LOAD_FILE:
LoadOnePcbFile( GetScreen()->GetFileName(), false, true ); LoadOnePcbFile( GetScreen()->GetFileName(), false, true );
ReCreateAuxiliaryToolbar();
SetToolbars();
break; break;
case ID_MENU_READ_LAST_SAVED_VERSION_BOARD: case ID_MENU_READ_LAST_SAVED_VERSION_BOARD:
@ -91,8 +87,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
fn.SetExt( PcbFileExtension ); fn.SetExt( PcbFileExtension );
GetScreen()->SetFileName( fn.GetFullPath() ); GetScreen()->SetFileName( fn.GetFullPath() );
SetTitle( GetScreen()->GetFileName() ); SetTitle( GetScreen()->GetFileName() );
ReCreateAuxiliaryToolbar();
SetToolbars();
break; break;
} }
@ -103,11 +97,10 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
case ID_NEW_BOARD: case ID_NEW_BOARD:
Clear_Pcb( true ); Clear_Pcb( true );
GetScreen()->GetFileName().Printf( wxT( "%s%cnoname%s" ), GetScreen()->GetFileName().Printf( wxT( "%s%cnoname%s" ),
GetChars( wxGetCwd() ), DIR_SEP, GetChars( wxGetCwd() ), DIR_SEP,
GetChars( PcbFileExtension ) ); GetChars( PcbFileExtension ) );
SetTitle( GetScreen()->GetFileName() ); SetTitle( GetScreen()->GetFileName() );
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
SetToolbars();
break; break;
case ID_SAVE_BOARD: case ID_SAVE_BOARD:
@ -286,7 +279,6 @@ this file again." ) );
ReFillLayerWidget(); ReFillLayerWidget();
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
AuxiliaryToolBar_Update_UI();
syncLayerWidget(); syncLayerWidget();
// Display the loaded board: // Display the loaded board:

View File

@ -152,7 +152,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break; break;
case HK_ADD_MODULE: case HK_ADD_MODULE:
evt_type = ID_COMPONENT_BUTT; evt_type = ID_PCB_MODULE_BUTT;
break; break;
case HK_UNDO: case HK_UNDO:
@ -214,8 +214,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break; break;
case HK_END_TRACK: case HK_END_TRACK:
if( itemCurrentlyEdited && (GetCurItem()->IsTrack() ) if( itemCurrentlyEdited && GetCurItem()->IsTrack() && GetCurItem()->IsNew() )
&& ( (GetCurItem()->m_Flags & IS_NEW) != 0 ) )
{ {
// A new track is in progress: call to End_Route() // A new track is in progress: call to End_Route()
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
@ -250,7 +249,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break; break;
if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur
return; return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 ) if( !GetCurItem()->IsNew() )
return; return;
// place micro via and switch layer // place micro via and switch layer
@ -268,7 +267,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
return; return;
if( GetCurItem()->Type() != TYPE_TRACK ) if( GetCurItem()->Type() != TYPE_TRACK )
return; return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 ) if( !GetCurItem()->IsNew() )
return; return;
evt_type = ID_POPUP_PCB_PLACE_VIA; evt_type = ID_POPUP_PCB_PLACE_VIA;
break; break;
@ -300,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
if( track ) if( track )
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
} }
else if( GetCurItem()->m_Flags & IS_NEW ) else if( GetCurItem()->IsNew() )
{ {
TRACK* track = Begin_Route( (TRACK*) GetCurItem(), aDC ); TRACK* track = Begin_Route( (TRACK*) GetCurItem(), aDC );
@ -404,7 +403,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC )
} }
break; break;
case ID_COMPONENT_BUTT: case ID_PCB_MODULE_BUTT:
if( ItemFree ) if( ItemFree )
{ {
wxPoint pos = GetScreen()->RefPos( false ); wxPoint pos = GetScreen()->RefPos( false );

View File

@ -66,7 +66,6 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery )
ReFillLayerWidget(); ReFillLayerWidget();
SetToolbars();
Zoom_Automatique( true ); Zoom_Automatique( true );
return true; return true;

View File

@ -1121,7 +1121,6 @@ int WinEDA_PcbFrame::ReadPcbFile( LINE_READER* aReader, bool Append )
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
SetStatusText( wxEmptyString ); SetStatusText( wxEmptyString );
BestZoom(); BestZoom();
SetToolbars();
return 1; return 1;
} }
@ -1156,10 +1155,8 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
// Select default Netclass before writing file. // Select default Netclass before writing file.
// Useful to save default values in headers // Useful to save default values in headers
GetBoard()->SetCurrentNetClass( GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
GetBoard()->m_NetClasses.GetDefault()->GetName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
WriteGeneralDescrPcb( aFile ); WriteGeneralDescrPcb( aFile );
WriteSheetDescr( GetScreen(), aFile ); WriteSheetDescr( GetScreen(), aFile );

View File

@ -132,7 +132,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Delete items */ /* Delete items */
item = new wxMenuItem( editMenu, item = new wxMenuItem( editMenu,
ID_MODEDIT_DELETE_ITEM_BUTT, ID_MODEDIT_DELETE_TOOL,
_( "Delete" ), _( "Delete" ),
_( "Delete objects with the eraser" ) ); _( "Delete objects with the eraser" ) );
item->SetBitmap( delete_body_xpm ); item->SetBitmap( delete_body_xpm );
@ -236,9 +236,9 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Pad */ /* Pad */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_ADD_PAD, ID_MODEDIT_PAD_TOOL,
_( "Pad" ), _( "Pad" ),
_( "Add Pads" ) ); _( "Add pad" ) );
item->SetBitmap( pad_xpm ); item->SetBitmap( pad_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
@ -247,7 +247,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Circle */ /* Circle */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_PCB_CIRCLE_BUTT, ID_MODEDIT_CIRCLE_TOOL,
_( "Circle" ), _( "Circle" ),
_( "Add graphic circle" ) ); _( "Add graphic circle" ) );
item->SetBitmap( add_circle_xpm ); item->SetBitmap( add_circle_xpm );
@ -255,7 +255,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Line or Polygon */ /* Line or Polygon */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_PCB_ADD_LINE_BUTT, ID_MODEDIT_LINE_TOOL,
_( "Line or Polygon" ), _( "Line or Polygon" ),
_( "Add graphic line or polygon" ) ); _( "Add graphic line or polygon" ) );
item->SetBitmap( add_polygon_xpm ); item->SetBitmap( add_polygon_xpm );
@ -263,7 +263,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Arc */ /* Arc */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_PCB_ARC_BUTT, ID_MODEDIT_ARC_TOOL,
_( "Arc" ), _( "Arc" ),
_( "Add graphic arc" ) ); _( "Add graphic arc" ) );
item->SetBitmap( add_arc_xpm ); item->SetBitmap( add_arc_xpm );
@ -271,7 +271,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Text */ /* Text */
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_PCB_ADD_TEXT_BUTT, ID_MODEDIT_TEXT_TOOL,
_( "Text" ), _( "Text" ),
_( "Add graphic text" ) ); _( "Add graphic text" ) );
item->SetBitmap( add_text_xpm ); item->SetBitmap( add_text_xpm );
@ -280,7 +280,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/* Anchor */ /* Anchor */
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_PLACE_ANCHOR, ID_MODEDIT_ANCHOR_TOOL,
_( "Anchor" ), _( "Anchor" ),
_( "Place the footprint module reference anchor" ) ); _( "Place the footprint module reference anchor" ) );
item->SetBitmap( anchor_xpm ); item->SetBitmap( anchor_xpm );

View File

@ -381,9 +381,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
// Module // Module
text = AddHotkeyName( _( "Module" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "Module" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ADD_MODULE, false );
HK_ADD_MODULE, false ); item = new wxMenuItem( placeMenu, ID_PCB_MODULE_BUTT, text,
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text,
_( "Add modules" ), wxITEM_NORMAL ); _( "Add modules" ), wxITEM_NORMAL );
item->SetBitmap( module_xpm ); item->SetBitmap( module_xpm );

View File

@ -184,7 +184,7 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
MirePcb->Draw( Panel, DC, GR_XOR ); MirePcb->Draw( Panel, DC, GR_XOR );
if( MirePcb->m_Flags & IS_NEW ) // If it is new, delete it if( MirePcb->IsNew() ) // If it is new, delete it
{ {
MirePcb->Draw( Panel, DC, GR_XOR ); MirePcb->Draw( Panel, DC, GR_XOR );
MirePcb->DeleteStructure(); MirePcb->DeleteStructure();
@ -250,7 +250,7 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
if( (MirePcb->m_Flags & IS_NEW) ) if( MirePcb->IsNew() )
{ {
SaveCopyInUndoList( MirePcb, UR_NEW ); SaveCopyInUndoList( MirePcb, UR_NEW );
MirePcb->m_Flags = 0; MirePcb->m_Flags = 0;

View File

@ -443,46 +443,12 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
} }
break; break;
case ID_MODEDIT_ADD_PAD:
if( GetBoard()->m_Modules )
SetToolID( id, wxCURSOR_PENCIL, _( "Add Pad" ) );
else
{
SetToolID( id, wxCURSOR_ARROW, _( "Pad Settings" ) );
InstallPadOptionsFrame( NULL );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
}
break;
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT:
case ID_PCB_ADD_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Drawing" ) );
break;
case ID_MODEDIT_PLACE_ANCHOR:
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Grid Origin" ) );
break;
case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_POPUP_CLOSE_CURRENT_TOOL: case ID_POPUP_CLOSE_CURRENT_TOOL:
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
break; break;
case ID_MODEDIT_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true ); Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
@ -708,8 +674,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
SetToolbars();
if( redraw ) if( redraw )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
@ -836,3 +800,57 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
module->Set_Rectangle_Encadrement(); module->Set_Rectangle_Encadrement();
OnModify(); OnModify();
} }
void WinEDA_ModuleEditFrame::OnVerticalToolbar( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
switch( id )
{
case ID_MODEDIT_LINE_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
break;
case ID_MODEDIT_ARC_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
break;
case ID_MODEDIT_CIRCLE_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
break;
case ID_MODEDIT_TEXT_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_MODEDIT_ANCHOR_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
break;
case ID_MODEDIT_PLACE_GRID_COORD:
SetToolID( id, wxCURSOR_PENCIL, _( "Set grid origin" ) );
break;
case ID_MODEDIT_PAD_TOOL:
if( GetBoard()->m_Modules )
SetToolID( id, wxCURSOR_PENCIL, _( "Add pad" ) );
else
{
SetToolID( id, wxCURSOR_ARROW, _( "Pad settings" ) );
InstallPadOptionsFrame( NULL );
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
}
break;
case ID_MODEDIT_DELETE_TOOL:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
default:
wxFAIL_MSG( wxT( "Unknown command id." ) );
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
}
}

View File

@ -60,6 +60,7 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
} }
item = GetCurItem(); item = GetCurItem();
if( !item || (item->m_Flags == 0) ) if( !item || (item->m_Flags == 0) )
{ {
if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT ) if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
@ -71,26 +72,24 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case 0: case 0:
case ID_MODEDIT_NO_TOOL:
break; break;
case ID_NO_SELECT_BUTT: case ID_MODEDIT_CIRCLE_TOOL:
break; case ID_MODEDIT_ARC_TOOL:
case ID_MODEDIT_LINE_TOOL:
case ID_PCB_CIRCLE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_ADD_LINE_BUTT:
if( !item || item->m_Flags == 0 ) if( !item || item->m_Flags == 0 )
{ {
int shape = S_SEGMENT; int shape = S_SEGMENT;
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT ) if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
shape = S_CIRCLE; shape = S_CIRCLE;
if( m_ID_current_state == ID_PCB_ARC_BUTT ) if( m_ID_current_state == ID_PCB_ARC_BUTT )
shape = S_ARC; shape = S_ARC;
SetCurItem( SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
} }
else if( (item->m_Flags & IS_NEW) ) else if( item->IsNew() )
{ {
if( ( (EDGE_MODULE*) item )->m_Shape == S_CIRCLE ) if( ( (EDGE_MODULE*) item )->m_Shape == S_CIRCLE )
{ {
@ -106,33 +105,35 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
} }
else if( ( (EDGE_MODULE*) item )->m_Shape == S_SEGMENT ) else if( ( (EDGE_MODULE*) item )->m_Shape == S_SEGMENT )
{ {
SetCurItem( SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) );
Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) );
} }
else else
DisplayError( this, DisplayError( this, wxT( "ProcessCommand error: item flags error" ) );
wxT( "ProcessCommand error: item flags error" ) );
} }
break; break;
case ID_MODEDIT_DELETE_ITEM_BUTT: case ID_MODEDIT_DELETE_TOOL:
if( item == NULL || // No item to delete if( item == NULL || // No item to delete
(item->m_Flags != 0) ) // Item in edit, cannot delete it (item->m_Flags != 0) ) // Item in edit, cannot delete it
break; break;
if( item->Type() != TYPE_MODULE ) // Cannot delete the module itself if( item->Type() != TYPE_MODULE ) // Cannot delete the module itself
{ {
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
RemoveStruct( item ); RemoveStruct( item );
SetCurItem( NULL ); SetCurItem( NULL );
} }
break; break;
case ID_MODEDIT_PLACE_ANCHOR: case ID_MODEDIT_ANCHOR_TOOL:
{ {
MODULE* module = GetBoard()->m_Modules; MODULE* module = GetBoard()->m_Modules;
if( module == NULL // No module loaded if( module == NULL // No module loaded
|| (module->m_Flags != 0) ) || (module->m_Flags != 0) )
break; break;
module->m_Flags = 0; module->m_Flags = 0;
SaveCopyInUndoList( module, UR_MODEDIT ); SaveCopyInUndoList( module, UR_MODEDIT );
Place_Ancre( module ); // set the new relatives internal coordinates of items Place_Ancre( module ); // set the new relatives internal coordinates of items
@ -146,26 +147,28 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
} }
break; break;
case ID_PCB_PLACE_GRID_COORD_BUTT: case ID_MODEDIT_PLACE_GRID_COORD:
DrawPanel->DrawGridAxis( DC, GR_XOR ); DrawPanel->DrawGridAxis( DC, GR_XOR );
GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition(); GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition();
DrawPanel->DrawGridAxis( DC, GR_COPY ); DrawPanel->DrawGridAxis( DC, GR_COPY );
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
case ID_PCB_ADD_TEXT_BUTT: case ID_MODEDIT_TEXT_TOOL:
if( GetBoard()->m_Modules == NULL ) if( GetBoard()->m_Modules == NULL )
break; break;
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
CreateTextModule( GetBoard()->m_Modules, DC ); CreateTextModule( GetBoard()->m_Modules, DC );
break; break;
case ID_MODEDIT_ADD_PAD: case ID_MODEDIT_PAD_TOOL:
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )
{ {
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
AddPad( GetBoard()->m_Modules, true ); AddPad( GetBoard()->m_Modules, true );
} }
break; break;
default: default:
@ -199,13 +202,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
if( m_ID_current_state ) if( m_ID_current_state )
{ {
if( item && item->m_Flags ) if( item && item->m_Flags )
{ ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
}
else else
ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ), cancel_tool_xpm );
_( "End Tool" ), cancel_tool_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
} }
else else
@ -240,6 +240,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm ); _( "Cancel" ), cancel_xpm );
} }
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
} }
} }
@ -254,16 +255,12 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
case TYPE_MODULE: case TYPE_MODULE:
{ {
wxMenu* transform_choice = new wxMenu; wxMenu* transform_choice = new wxMenu;
ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_ROTATE, ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_ROTATE, _( "Rotate" ),
_( "Rotate" ), rotate_module_pos_xpm ); rotate_module_pos_xpm );
ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_MIRROR, ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ), mirror_H_xpm );
_( "Mirror" ), mirror_H_xpm ); msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_MODULE, msg, edit_module_xpm );
HK_EDIT_ITEM ); ADD_MENUITEM_WITH_SUBMENU( PopMenu, transform_choice, ID_MODEDIT_TRANSFORM_MODULE,
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_MODULE,
msg, edit_module_xpm );
ADD_MENUITEM_WITH_SUBMENU( PopMenu, transform_choice,
ID_MODEDIT_TRANSFORM_MODULE,
_( "Transform Module" ), edit_xpm ); _( "Transform Module" ), edit_xpm );
break; break;
} }
@ -271,29 +268,26 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
case TYPE_PAD: case TYPE_PAD:
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
HK_MOVE_ITEM ); ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST, msg, move_pad_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST,
msg, move_pad_xpm );
} }
msg = AddHotkeyName( _("Edit Pad" ), g_Module_Editor_Hokeys_Descr,
HK_EDIT_ITEM ); msg = AddHotkeyName( _("Edit Pad" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD, msg, options_pad_xpm );
msg, options_pad_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
_( "New Pad Settings" ), options_new_pad_xpm ); _( "New Pad Settings" ), options_new_pad_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
_( "Export Pad Settings" ), export_options_pad_xpm ); _( "Export Pad Settings" ), export_options_pad_xpm );
msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
HK_DELETE ); ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_PAD, msg, delete_pad_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_PAD,
msg, delete_pad_xpm );
if( !flags ) if( !flags )
{ {
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
_( "Global Pad Settings" ), global_options_pad_xpm ); _( "Global Pad Settings" ), global_options_pad_xpm );
} }
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
@ -301,25 +295,24 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
{ {
msg = AddHotkeyName( _("Move Text Mod." ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Move Text Mod." ), g_Module_Editor_Hokeys_Descr,
HK_MOVE_ITEM ); HK_MOVE_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, msg, move_field_xpm );
msg, move_field_xpm );
} }
msg = AddHotkeyName( _("Rotate Text Mod." ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Rotate Text Mod." ), g_Module_Editor_Hokeys_Descr,
HK_ROTATE_ITEM ); HK_ROTATE_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, msg, rotate_field_xpm );
msg, rotate_field_xpm );
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _("Edit Text Mod." ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Edit Text Mod." ), g_Module_Editor_Hokeys_Descr,
HK_EDIT_ITEM ); HK_EDIT_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, edit_text_xpm );
msg, edit_text_xpm );
if( ( (TEXTE_MODULE*) item )->m_Type == TEXT_is_DIVERS ) if( ( (TEXTE_MODULE*) item )->m_Type == TEXT_is_DIVERS )
{ {
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
HK_DELETE ); HK_DELETE );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, msg, delete_text_xpm );
msg, delete_text_xpm );
} }
} }
break; break;
@ -327,22 +320,19 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
{ {
if( (flags & IS_NEW) ) if( (flags & IS_NEW) )
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End edge" ), apply_xpm );
_( "End edge" ), apply_xpm );
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
HK_MOVE_ITEM ); ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, move_line_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_EDGE,
msg, move_line_xpm );
} }
if( ( flags & (IS_NEW | IS_MOVED) ) == IS_MOVED ) if( ( flags & (IS_NEW | IS_MOVED) ) == IS_MOVED )
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_PLACE_EDGE, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place edge" ), apply_xpm );
_( "Place edge" ), apply_xpm );
wxMenu* edit_mnu = new wxMenu; wxMenu* edit_mnu = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( PopMenu, edit_mnu, ADD_MENUITEM_WITH_SUBMENU( PopMenu, edit_mnu, ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ),
ID_POPUP_PCB_EDIT_EDGE, _( edit_xpm );
"Edit" ), edit_xpm );
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE, ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
_( "Edit Width (Current)" ), width_segment_xpm ); _( "Edit Width (Current)" ), width_segment_xpm );
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE, ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE,
@ -351,10 +341,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
_( "Edit Layer (Current)" ), select_layer_pair_xpm ); _( "Edit Layer (Current)" ), select_layer_pair_xpm );
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE, ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE,
_( "Edit Layer (All)" ), select_layer_pair_xpm ); _( "Edit Layer (All)" ), select_layer_pair_xpm );
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
HK_DELETE ); ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, delete_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_EDGE,
msg, delete_xpm );
append_set_width = TRUE; append_set_width = TRUE;
} }
break; break;
@ -412,6 +400,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case 0: case 0:
case ID_MODEDIT_NO_TOOL:
if( ( item == NULL ) || ( item->m_Flags == 0 ) ) if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{ {
item = ModeditLocateAndDisplay(); item = ModeditLocateAndDisplay();
@ -454,7 +443,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_ADD_LINE_BUTT: case ID_PCB_ADD_LINE_BUTT:
{ {
if( item && ( item->m_Flags & IS_NEW ) ) if( item && item->IsNew() )
{ {
End_Edge_Module( (EDGE_MODULE*) item ); End_Edge_Module( (EDGE_MODULE*) item );
SetCurItem( NULL ); SetCurItem( NULL );

View File

@ -95,8 +95,6 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList( wxCommandEvent& event )
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
@ -133,7 +131,5 @@ void WinEDA_ModuleEditFrame::GetComponentFromUndoList( wxCommandEvent& event )
SetCurItem( NULL );; SetCurItem( NULL );;
OnModify(); OnModify();
ReCreateHToolbar();
SetToolbars();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }

View File

@ -22,31 +22,6 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID:
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UserUnit = MILLIMETRES;
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UserUnit = INCHES;
UpdateStatusBar();
ReCreateAuxiliaryToolbar();
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = m_OptionsToolBar->GetToolState( id );
break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH: case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id ); m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
@ -74,6 +49,4 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
wxT( "WinEDA_ModuleEditFrame::OnSelectOptionToolbar error" ) ); wxT( "WinEDA_ModuleEditFrame::OnSelectOptionToolbar error" ) );
break; break;
} }
SetToolbars();
} }

View File

@ -36,7 +36,6 @@ public:
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void ReCreateMenuBar(); void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
@ -48,6 +47,15 @@ public:
bool OnHotkeyRotateItem( int aIdCommand ); bool OnHotkeyRotateItem( int aIdCommand );
void Show3D_Frame( wxCommandEvent& event ); void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition ); void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void OnVerticalToolbar( wxCommandEvent& aEvent );
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateLibSelected( wxUpdateUIEvent& aEvent );
void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent );
void OnUpdateLibAndModuleSelected( wxUpdateUIEvent& aEvent );
void OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent );
void OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent );
void OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent );
/** /**
* Function LoadModuleFromBoard * Function LoadModuleFromBoard
@ -78,9 +86,8 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (NULL if not used) * @param aData = a pointer on an auxiliary data (NULL if not used)
*/ */
virtual void PrintPage( wxDC* aDC, virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode,
int aPrintMaskLayer, bool aPrintMirrorMode, void * aData = NULL);
void * aData = NULL);
// BOARD handling // BOARD handling

View File

@ -29,121 +29,80 @@ static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting;
/* class WinEDA_ModuleEditFrame */ /* class WinEDA_ModuleEditFrame */
/********************************/ /********************************/
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame ) BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
ID_POPUP_PCB_ITEM_SELECTION_END, WinEDA_BasePcbFrame::ProcessItemSelection )
WinEDA_BasePcbFrame::ProcessItemSelection ) EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow ) EVT_MENU( wxID_EXIT, WinEDA_ModuleEditFrame::CloseModuleEditor )
EVT_MENU( wxID_EXIT, WinEDA_ModuleEditFrame::CloseModuleEditor )
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize ) EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_ModuleEditFrame::OnSelectZoom )
WinEDA_ModuleEditFrame::OnSelectZoom ) EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_ModuleEditFrame::OnSelectGrid )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT,
WinEDA_ModuleEditFrame::OnSelectGrid )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ModuleEditFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, WinEDA_ModuleEditFrame::OnZoom )
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, WinEDA_ModuleEditFrame::Process_Special_Functions )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, EVT_TOOL( ID_MODEDIT_DELETE_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_NEW_MODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_PART, EVT_TOOL( ID_MODEDIT_LOAD_MODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_IMPORT_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE, EVT_TOOL( ID_MODEDIT_EXPORT_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_SHEET_SET, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_IMPORT_PART, EVT_TOOL( wxID_PRINT, WinEDA_ModuleEditFrame::ToPrinter )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_LOAD_MODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EXPORT_PART, EVT_TOOL( ID_MODEDIT_CHECK, WinEDA_ModuleEditFrame::Process_Special_Functions )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_PAD_SETTINGS, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, WinEDA_ModuleEditFrame::LoadModuleFromBoard )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SHEET_SET, EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, WinEDA_ModuleEditFrame::Process_Special_Functions )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( wxID_PRINT, WinEDA_ModuleEditFrame::ToPrinter ) EVT_TOOL( wxID_UNDO, WinEDA_ModuleEditFrame::GetComponentFromUndoList )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, EVT_TOOL( wxID_REDO, WinEDA_ModuleEditFrame::GetComponentFromRedoList )
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CHECK,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PAD_SETTINGS,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
WinEDA_ModuleEditFrame::LoadModuleFromBoard )
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( wxID_UNDO,
WinEDA_ModuleEditFrame::GetComponentFromUndoList )
EVT_TOOL( wxID_REDO,
WinEDA_ModuleEditFrame::GetComponentFromRedoList )
// Vertical toolbar (left click): // Vertical tool bar button click event handler.
EVT_TOOL( ID_NO_SELECT_BUTT, EVT_TOOL_RANGE( ID_MODEDIT_NO_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::OnVerticalToolbar )
EVT_TOOL( ID_MODEDIT_ADD_PAD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_LINE_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_PLACE_GRID_COORD_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
// Vertical toolbar (right click): // Options Toolbar
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::OnSelectOptionToolbar )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_DIMENSION_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
// Options Toolbar // popup commands
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_ModuleEditFrame::OnSelectOptionToolbar ) WinEDA_ModuleEditFrame::Process_Special_Functions )
// popup commands EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE, WinEDA_ModuleEditFrame::Process_Special_Functions )
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, // Module transformations
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_MENU( ID_MODEDIT_MODULE_ROTATE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR, WinEDA_ModuleEditFrame::Process_Special_Functions )
// Module transformations EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_ROTATE, EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_ModuleEditFrame::Process_Special_Functions )
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_MENU( ID_PCB_USER_GRID_SETUP, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, // Menu 3D Frame
WinEDA_ModuleEditFrame::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
EVT_MENU( ID_PCB_PAD_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_USER_GRID_SETUP,
WinEDA_PcbFrame::Process_Special_Functions )
// Menu 3D Frame EVT_UPDATE_UI( ID_MODEDIT_SAVE_LIBMODULE, WinEDA_ModuleEditFrame::OnUpdateLibSelected )
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame ) EVT_UPDATE_UI( ID_MODEDIT_DELETE_PART, WinEDA_ModuleEditFrame::OnUpdateLibSelected )
EVT_UPDATE_UI( ID_MODEDIT_EXPORT_PART, WinEDA_ModuleEditFrame::OnUpdateModuleSelected )
EVT_UPDATE_UI( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
WinEDA_ModuleEditFrame::OnUpdateModuleSelected )
EVT_UPDATE_UI( ID_MODEDIT_SAVE_LIBMODULE,
WinEDA_ModuleEditFrame::OnUpdateLibAndModuleSelected )
EVT_UPDATE_UI( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
WinEDA_ModuleEditFrame::OnUpdateLoadModuleFromBoard )
EVT_UPDATE_UI( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::OnUpdateInsertModuleInBoard )
EVT_UPDATE_UI( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::OnUpdateReplaceModuleInBoard )
EVT_UPDATE_UI_RANGE( ID_MODEDIT_NO_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
WinEDA_ModuleEditFrame::OnUpdateVerticalToolbar )
END_EVENT_TABLE() END_EVENT_TABLE()
@ -153,8 +112,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
WinEDA_BasePcbFrame( father, MODULE_EDITOR_FRAME, WinEDA_BasePcbFrame( father, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style )
wxEmptyString, pos, size, style )
{ {
m_FrameName = wxT( "ModEditFrame" ); m_FrameName = wxT( "ModEditFrame" );
m_Draw_Sheet_Ref = false; // true to show the frame references m_Draw_Sheet_Ref = false; // true to show the frame references
@ -175,6 +133,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
if( s_screenModule == NULL ) if( s_screenModule == NULL )
s_screenModule = new PCB_SCREEN(); s_screenModule = new PCB_SCREEN();
SetScreen( s_screenModule ); SetScreen( s_screenModule );
GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting ); GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
@ -209,29 +168,24 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
horiz.LeftDockable( false ).RightDockable( false ); horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) );
Row( 0 ) );
m_auimgr.AddPane( m_AuxiliaryToolBar, m_auimgr.AddPane( m_AuxiliaryToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ). wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
Top().Row( 1 ) );
m_auimgr.AddPane( m_VToolBar, m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() ); wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane( m_OptionsToolBar, m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ). wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ). Left() );
Left() );
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update(); m_auimgr.Update();
SetToolbars();
} }
@ -270,49 +224,53 @@ void WinEDA_ModuleEditFrame::CloseModuleEditor( wxCommandEvent& Event )
Close(); Close();
} }
/**
* Function SetToolbars void WinEDA_ModuleEditFrame::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
* Enable or disable some tools and menus, according to
* the current state of the footprint editor:
* >> a footprint is loaded or not
* >> a working library is selected or not
*/
void WinEDA_ModuleEditFrame::SetToolbars()
{ {
bool active, islib = true; if( m_ID_current_state == 0 )
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) wxGetApp().GetTopWindow(); m_ID_current_state = ID_MODEDIT_NO_TOOL;
if( m_HToolBar == NULL ) aEvent.Enable( GetBoard()->m_Modules != NULL );
return;
wxMenuBar* menuBar = GetMenuBar();
if( menuBar == NULL )
return;
if( m_VToolBar == NULL )
return;
if( m_OptionsToolBar == NULL )
return;
if( m_CurrentLib == wxEmptyString ) if( aEvent.GetEventObject() == m_VToolBar )
islib = false; aEvent.Check( m_ID_current_state == aEvent.GetId() );
}
m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, islib );
m_HToolBar->EnableTool( ID_MODEDIT_DELETE_PART, islib );
if( GetBoard()->m_Modules == NULL ) void WinEDA_ModuleEditFrame::OnUpdateLibSelected( wxUpdateUIEvent& aEvent )
active = false; {
else aEvent.Enable( m_CurrentLib != wxEmptyString );
active = true; }
m_HToolBar->EnableTool( ID_MODEDIT_EXPORT_PART, active );
menuBar->Enable( ID_MODEDIT_EXPORT_PART, active );
m_HToolBar->EnableTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, active ); void WinEDA_ModuleEditFrame::OnUpdateModuleSelected( wxUpdateUIEvent& aEvent )
menuBar->Enable( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, active ); {
aEvent.Enable( GetBoard()->m_Modules != NULL );
}
m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, active && islib );
menuBar->Enable( ID_MODEDIT_SAVE_LIBMODULE, active && islib ); void WinEDA_ModuleEditFrame::OnUpdateLibAndModuleSelected( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( ( m_CurrentLib != wxEmptyString ) && ( GetBoard()->m_Modules != NULL ) );
}
void WinEDA_ModuleEditFrame::OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent )
{
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent();
aEvent.Enable( frame->GetBoard()->m_Modules != NULL );
}
void WinEDA_ModuleEditFrame::OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent )
{
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent();
MODULE* module_in_edit = GetBoard()->m_Modules; MODULE* module_in_edit = GetBoard()->m_Modules;
bool canInsert = ( module_in_edit && !module_in_edit->m_Link );
// If the source was deleted, the module can inserted but not updated in the board.
if( module_in_edit && module_in_edit->m_Link ) // this is not a new module if( module_in_edit && module_in_edit->m_Link ) // this is not a new module
{ {
BOARD* mainpcb = frame->GetBoard(); BOARD* mainpcb = frame->GetBoard();
@ -325,116 +283,36 @@ void WinEDA_ModuleEditFrame::SetToolbars()
break; break;
} }
if( source_module ) canInsert = ( source_module == NULL );
{
m_HToolBar->EnableTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, false );
m_HToolBar->EnableTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, true );
}
else // The source was deleted, therefore we can insert but not
// update the module
{
m_HToolBar->EnableTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, true );
m_HToolBar->EnableTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, false );
}
}
else
{
m_HToolBar->EnableTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, active );
m_HToolBar->EnableTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, false );
} }
m_HToolBar->EnableTool( wxID_UNDO, GetScreen()->GetUndoCommandCount()>0 && active ); aEvent.Enable( canInsert );
menuBar->Enable( wxID_UNDO, GetScreen()->GetUndoCommandCount()>0 && active ); }
m_HToolBar->EnableTool( wxID_REDO,
GetScreen()->GetRedoCommandCount()>0 && active );
menuBar->Enable( wxID_REDO, GetScreen()->GetRedoCommandCount()>0 && active );
bool canLoadModuleFromBoard = frame->GetBoard()->m_Modules != NULL;
m_HToolBar->EnableTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, canLoadModuleFromBoard );
menuBar->Enable( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, canLoadModuleFromBoard );
m_HToolBar->Refresh();
// Enable/disable tools to edit module items: void WinEDA_ModuleEditFrame::OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent )
int idtools[] = {
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent();
MODULE* module_in_edit = GetBoard()->m_Modules;
bool canReplace = ( module_in_edit && module_in_edit->m_Link );
if( module_in_edit && module_in_edit->m_Link ) // this is not a new module
{ {
ID_MODEDIT_ADD_PAD, ID_MODEDIT_ADD_PAD, BOARD* mainpcb = frame->GetBoard();
ID_PCB_ADD_LINE_BUTT, ID_PCB_CIRCLE_BUTT, MODULE* source_module = mainpcb->m_Modules;
ID_PCB_ARC_BUTT, ID_PCB_ADD_TEXT_BUTT,
ID_MODEDIT_PLACE_ANCHOR, ID_MODEDIT_DELETE_ITEM_BUTT
};
for( unsigned ii = 0; ii < sizeof(idtools) / sizeof(int); ii++ )
{
m_VToolBar->EnableTool( idtools[ii], active );
menuBar->Enable( idtools[ii], active );
}
m_VToolBar->Refresh(); // search if the source module was not deleted:
for( ; source_module != NULL; source_module = source_module->Next() )
m_OptionsToolBar->ToggleTool(
ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UserUnit == MILLIMETRES ? true : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UserUnit == INCHES ? true : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ?
_( "Display rectangular coordinates" ) :
_( "Display polar coordinates" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
IsGridVisible() );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
IsGridVisible() ?
_( "Hide grid" ) :
_( "Show grid" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
m_CursorShape );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
!m_DisplayPadFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ?
_( "Show pads in sketch mode" ) :
_( "Show pads in filled mode" ) );
m_OptionsToolBar->Refresh();
if( m_AuxiliaryToolBar )
{
unsigned jj;
if( m_SelZoomBox )
{ {
bool not_found = true; if( module_in_edit->m_Link == source_module->m_TimeStamp )
for( jj = 0; jj < GetScreen()->m_ZoomList.GetCount(); jj++ ) break;
{
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[jj] )
{
m_SelZoomBox->SetSelection( jj + 1 );
not_found = false;
break;
}
}
if( not_found )
m_SelZoomBox->SetSelection( -1 );
} }
if( m_SelGridBox ) canReplace = ( source_module != NULL );
m_SelGridBox->SetSelection( m_LastGridSizeId );
m_AuxiliaryToolBar->Refresh();
} }
DisplayUnitsMsg(); aEvent.Enable( canReplace );
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
} }
@ -537,7 +415,6 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
wxSafeYield(); wxSafeYield();
} }
SetToolbars();
UpdateStatusBar(); UpdateStatusBar();
} }
@ -552,6 +429,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
void WinEDA_ModuleEditFrame::OnModify() void WinEDA_ModuleEditFrame::OnModify()
{ {
WinEDA_BasePcbFrame::OnModify(); WinEDA_BasePcbFrame::OnModify();
if( m_Draw3DFrame ) if( m_Draw3DFrame )
m_Draw3DFrame->ReloadRequest(); m_Draw3DFrame->ReloadRequest();
} }

View File

@ -156,7 +156,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
module->m_Flags = 0; module->m_Flags = 0;
} }
if( (module->m_Flags & IS_NEW) ) // Copy command: delete new footprint if( (module->IsNew()) ) // Copy command: delete new footprint
{ {
module->DeleteStructure(); module->DeleteStructure();
module = NULL; module = NULL;
@ -396,7 +396,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
OnModify(); OnModify();
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK); GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
if( module->m_Flags & IS_NEW ) if( module->IsNew() )
{ {
SaveCopyInUndoList( module, UR_NEW ); SaveCopyInUndoList( module, UR_NEW );
} }

View File

@ -71,7 +71,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( NewTrack ) if( NewTrack )
{ {
if( NewTrack->m_Flags & IS_NEW ) if( NewTrack->IsNew() )
{ {
for( ii = 0; ii < NbPtNewTrack; ii++, NewTrack = NextS ) for( ii = 0; ii < NbPtNewTrack; ii++, NewTrack = NextS )
{ {

View File

@ -64,8 +64,6 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
wxT( "WinEDA_PcbFrame::ProcessMuWaveFunctions() id error" ) ); wxT( "WinEDA_PcbFrame::ProcessMuWaveFunctions() id error" ) );
break; break;
} }
SetToolbars();
} }

View File

@ -33,7 +33,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case TYPE_ZONE_CONTAINER: case TYPE_ZONE_CONTAINER:
if( (DrawStruct->m_Flags & IS_NEW) ) if( DrawStruct->IsNew() )
{ {
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( aDC ); Begin_Zone( aDC );
@ -127,7 +127,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
GetBoard()->SetCurrentNetClass( GetBoard()->SetCurrentNetClass(
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() ); ((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
break; break;
default: default:
@ -138,12 +137,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_MAIN_MENUBAR: case ID_MAIN_MENUBAR:
case ID_PCB_NO_TOOL:
case 0: case 0:
break; break;
case ID_NO_SELECT_BUTT:
break;
case ID_PCB_MUWAVE_TOOL_SELF_CMD: case ID_PCB_MUWAVE_TOOL_SELF_CMD:
case ID_PCB_MUWAVE_TOOL_GAP_CMD: case ID_PCB_MUWAVE_TOOL_GAP_CMD:
case ID_PCB_MUWAVE_TOOL_STUB_CMD: case ID_PCB_MUWAVE_TOOL_STUB_CMD:
@ -211,7 +208,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else if( DrawStruct else if( DrawStruct
&& (DrawStruct->Type() == TYPE_DRAWSEGMENT) && (DrawStruct->Type() == TYPE_DRAWSEGMENT)
&& (DrawStruct->m_Flags & IS_NEW) ) && DrawStruct->IsNew() )
{ {
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC ); DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC );
SetCurItem( DrawStruct ); SetCurItem( DrawStruct );
@ -234,7 +231,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( DrawStruct ) if( DrawStruct )
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
} }
else if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) ) else if( DrawStruct && DrawStruct->IsNew() )
{ {
TRACK* track = Begin_Route( (TRACK*) DrawStruct, aDC ); TRACK* track = Begin_Route( (TRACK*) DrawStruct, aDC );
// SetCurItem() must not write to the msg panel // SetCurItem() must not write to the msg panel
@ -284,7 +281,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else if( DrawStruct else if( DrawStruct
&& (DrawStruct->Type() == TYPE_ZONE_CONTAINER) && (DrawStruct->Type() == TYPE_ZONE_CONTAINER)
&& (DrawStruct->m_Flags & IS_NEW) ) && DrawStruct->IsNew() )
{ // Add a new corner to the current outline beeing created: { // Add a new corner to the current outline beeing created:
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( aDC ); Begin_Zone( aDC );
@ -311,7 +308,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) ); DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) );
break; break;
case ID_COMPONENT_BUTT: case ID_PCB_MODULE_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
@ -343,7 +340,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else if( DrawStruct else if( DrawStruct
&& (DrawStruct->Type() == TYPE_DIMENSION) && (DrawStruct->Type() == TYPE_DIMENSION)
&& (DrawStruct->m_Flags & IS_NEW) ) && DrawStruct->IsNew() )
{ {
DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, aDC ); DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, aDC );
SetCurItem( DrawStruct ); SetCurItem( DrawStruct );
@ -395,6 +392,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_PCB_NO_TOOL:
case 0: case 0:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
@ -413,7 +411,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
{ {
case TYPE_TRACK: case TYPE_TRACK:
case TYPE_VIA: case TYPE_VIA:
if( DrawStruct->m_Flags & IS_NEW ) if( DrawStruct->IsNew() )
{ {
End_Route( (TRACK*) DrawStruct, aDC ); End_Route( (TRACK*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
@ -451,7 +449,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break; // end case 0 break; // end case 0
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) ) if( DrawStruct && DrawStruct->IsNew() )
{ {
End_Route( (TRACK*) DrawStruct, aDC ); End_Route( (TRACK*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
@ -471,18 +469,21 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_CIRCLE_BUTT: case ID_PCB_CIRCLE_BUTT:
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() != TYPE_DRAWSEGMENT ) if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
{ {
DisplayError( this, wxT( "DrawStruct Type error" ) ); DisplayError( this, wxT( "DrawStruct Type error" ) );
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
break; break;
} }
if( (DrawStruct->m_Flags & IS_NEW) )
if( DrawStruct->IsNew() )
{ {
End_Edge( (DRAWSEGMENT*) DrawStruct, aDC ); End_Edge( (DRAWSEGMENT*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL ); SetCurItem( NULL );
} }
break; break;
} }
} }

View File

@ -134,8 +134,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
} }
else else
{ {
msg = AddHotkeyName( _( msg = AddHotkeyName( _( "Unlock Module" ), g_Board_Editor_Hokeys_Descr,
"Unlock Module" ), g_Board_Editor_Hokeys_Descr,
HK_LOCK_UNLOCK_FOOTPRINT ); HK_LOCK_UNLOCK_FOOTPRINT );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg,
unlocked_xpm ); unlocked_xpm );
@ -143,7 +142,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( !flags ) if( !flags )
aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE, aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,
_( "Auto Place Module" ) ); _( "Auto Place Module" ) );
} }
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS )
@ -311,7 +310,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
break; break;
case ID_COMPONENT_BUTT: case ID_PCB_MODULE_BUTT:
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC,
_( "Footprint Documentation" ), book_xpm ); _( "Footprint Documentation" ), book_xpm );
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
@ -408,9 +407,9 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
GetBoard()->SetCurrentNetClass( Track->GetNetClassName() ); GetBoard()->SetCurrentNetClass( Track->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
int flags = Track->m_Flags; int flags = Track->m_Flags;
if( flags == 0 ) if( flags == 0 )
{ {
if( Track->Type() == TYPE_VIA ) if( Track->Type() == TYPE_VIA )
@ -737,7 +736,6 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() ); GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
wxString msg = Pad->MenuText( GetBoard() ); wxString msg = Pad->MenuText( GetBoard() );

View File

@ -74,7 +74,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_PcbFrame::OnSize ) EVT_SIZE( WinEDA_PcbFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_PcbFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, WinEDA_PcbFrame::OnZoom )
EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io )
@ -86,9 +86,6 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
// Menu Files: // Menu Files:
EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions ) EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_NEW_BOARD, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_APPEND_FILE, WinEDA_PcbFrame::Files_io ) EVT_MENU( ID_APPEND_FILE, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_SAVE_BOARD_AS, WinEDA_PcbFrame::Files_io ) EVT_MENU( ID_SAVE_BOARD_AS, WinEDA_PcbFrame::Files_io )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_PcbFrame::OnFileHistory ) EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_PcbFrame::OnFileHistory )
@ -181,39 +178,19 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
// Option toolbar // Option toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_PcbFrame::OnSelectOptionToolbar ) WinEDA_PcbFrame::OnSelectOptionToolbar )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
WinEDA_PcbFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, EVT_TOOL( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
WinEDA_PcbFrame::OnSelectOptionToolbar) WinEDA_PcbFrame::OnSelectOptionToolbar )
// Vertical toolbar: // Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL_RANGE( ID_PCB_NO_TOOL, ID_PCB_PLACE_GRID_COORD_BUTT, WinEDA_PcbFrame::OnSelectTool )
EVT_TOOL( ID_PCB_HIGHLIGHT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TRACK_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_MIRE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DIMENSION_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_SHOW_1_RATSNEST_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_PLACE_OFFSET_COORD_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD, EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
WinEDA_PcbFrame::ProcessMuWaveFunctions ) WinEDA_PcbFrame::ProcessMuWaveFunctions )
EVT_TOOL( ID_PCB_PLACE_GRID_COORD_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT, WinEDA_PcbFrame::ToolOnRightClick ) EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE, ID_POPUP_PCB_AUTOPLACE_END_RANGE,
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_DIMENSION_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_PLACE_GRID_COORD_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE,
ID_POPUP_PCB_AUTOPLACE_END_RANGE,
WinEDA_PcbFrame::AutoPlace ) WinEDA_PcbFrame::AutoPlace )
EVT_MENU( ID_POPUP_PCB_REORIENT_ALL_MODULES, WinEDA_PcbFrame::OnOrientFootprints ) EVT_MENU( ID_POPUP_PCB_REORIENT_ALL_MODULES, WinEDA_PcbFrame::OnOrientFootprints )
@ -231,14 +208,30 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
// User interface update event handlers.
EVT_UPDATE_UI( ID_SAVE_BOARD, WinEDA_PcbFrame::OnUpdateSave )
EVT_UPDATE_UI( ID_TB_OPTIONS_DRC_OFF, WinEDA_PcbFrame::OnUpdateDrcEnable )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_RATSNEST, WinEDA_PcbFrame::OnUpdateShowBoardRatsnest )
EVT_UPDATE_UI( ID_TB_OPTIONS_AUTO_DEL_TRACK, WinEDA_PcbFrame::OnUpdateAutoDeleteTrack )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, WinEDA_PcbFrame::OnUpdateViaDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, WinEDA_PcbFrame::OnUpdateTraceDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
WinEDA_PcbFrame::OnUpdateHighContrastDisplayMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
WinEDA_PcbFrame::OnUpdateShowLayerManager )
EVT_UPDATE_UI_RANGE( ID_PCB_NO_TOOL, ID_PCB_PLACE_GRID_COORD_BUTT,
WinEDA_PcbFrame::OnUpdateVerticalToolbar )
EVT_UPDATE_UI_RANGE( ID_AUX_TOOLBAR_PCB_VIA_SIZE, ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
WinEDA_PcbFrame::OnUpdateAuxilaryToolbar )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
WinEDA_PcbFrame::OnUpdateZoneDisplayStyle )
END_EVENT_TABLE() END_EVENT_TABLE()
///////****************************///////////: ///////****************************///////////:
WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* parent, WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* parent, const wxString& title,
const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style ) : long style ) :
WinEDA_BasePcbFrame( parent, PCB_FRAME, title, pos, size, style ) WinEDA_BasePcbFrame( parent, PCB_FRAME, title, pos, size, style )
@ -386,7 +379,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* parent,
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
SetToolbars();
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
syncLayerWidget(); syncLayerWidget();
m_auimgr.Update(); m_auimgr.Update();
@ -399,6 +391,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
delete m_drc; delete m_drc;
} }
void WinEDA_PcbFrame::ReFillLayerWidget() void WinEDA_PcbFrame::ReFillLayerWidget()
{ {
m_Layers->ReFill(); m_Layers->ReFill();
@ -423,6 +416,7 @@ void WinEDA_PcbFrame::OnQuit( wxCommandEvent& event )
Close( true ); Close( true );
} }
void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
{ {
DrawPanel->m_AbortRequest = true; DrawPanel->m_AbortRequest = true;
@ -432,8 +426,7 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
unsigned ii; unsigned ii;
wxMessageDialog dialog( this, _( "Board modified, Save before exit ?" ), wxMessageDialog dialog( this, _( "Board modified, Save before exit ?" ),
_( "Confirmation" ), _( "Confirmation" ),
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
wxYES_DEFAULT );
ii = dialog.ShowModal(); ii = dialog.ShowModal();
@ -549,29 +542,31 @@ void WinEDA_PcbFrame::SaveSettings()
config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption ); config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption );
config->Write( SHOW_MICROWAVE_TOOLS, (long) m_show_microwave_tools ); config->Write( SHOW_MICROWAVE_TOOLS, (long) m_show_microwave_tools );
config->Write( SHOW_LAYER_MANAGER_TOOLS, (long)m_show_layer_manager_tools ); config->Write( SHOW_LAYER_MANAGER_TOOLS, (long)m_show_layer_manager_tools );
} }
/** /**
* Function IsGridVisible() , virtual * Function IsGridVisible() , virtual
* @return true if the grid must be shown * @return true if the grid must be shown
*/ */
bool WinEDA_PcbFrame::IsGridVisible() bool WinEDA_PcbFrame::IsGridVisible()
{ {
return IsElementVisible(GRID_VISIBLE); return IsElementVisible( GRID_VISIBLE );
} }
/** /**
* Function SetGridVisibility() , virtual * Function SetGridVisibility() , virtual
* It may be overloaded by derived classes * It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration. * if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown * @param aVisible = true if the grid must be shown
*/ */
void WinEDA_PcbFrame::SetGridVisibility(bool aVisible) void WinEDA_PcbFrame::SetGridVisibility(bool aVisible)
{ {
SetElementVisibility(GRID_VISIBLE, aVisible); SetElementVisibility( GRID_VISIBLE, aVisible );
} }
/** /**
* Function GetGridColor() , virtual * Function GetGridColor() , virtual
* @return the color of the grid * @return the color of the grid
@ -581,6 +576,7 @@ int WinEDA_PcbFrame::GetGridColor()
return GetBoard()->GetVisibleElementColor( GRID_VISIBLE ); return GetBoard()->GetVisibleElementColor( GRID_VISIBLE );
} }
/** /**
* Function SetGridColor() , virtual * Function SetGridColor() , virtual
* @param aColor = the new color of the grid * @param aColor = the new color of the grid
@ -590,8 +586,9 @@ void WinEDA_PcbFrame::SetGridColor(int aColor)
GetBoard()->SetVisibleElementColor( GRID_VISIBLE, aColor ); GetBoard()->SetVisibleElementColor( GRID_VISIBLE, aColor );
} }
/* Return true if a microvia can be put on board /* Return true if a microvia can be put on board
* A microvia ia a small via restricted to 2 near neighbour layers * A microvia is a small via restricted to 2 near neighbor layers
* because its is hole is made by laser which can penetrate only one layer * because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer * It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer * And it is allowed from an external layer to the first inner layer
@ -622,6 +619,7 @@ void WinEDA_PcbFrame::syncLayerWidget( )
m_Layers->SelectLayer( getActiveLayer() ); m_Layers->SelectLayer( getActiveLayer() );
} }
/** /**
* Function SetElementVisibility * Function SetElementVisibility
* changes the visibility of an element category * changes the visibility of an element category
@ -635,6 +633,7 @@ void WinEDA_PcbFrame::SetElementVisibility( int aPCB_VISIBLE, bool aNewState )
m_Layers->SetRenderState( aPCB_VISIBLE, aNewState ); m_Layers->SetRenderState( aPCB_VISIBLE, aNewState );
} }
/** /**
* Function SetVisibleAlls * Function SetVisibleAlls
* Set the status of all visible element categories and layers to VISIBLE * Set the status of all visible element categories and layers to VISIBLE
@ -642,10 +641,12 @@ void WinEDA_PcbFrame::SetElementVisibility( int aPCB_VISIBLE, bool aNewState )
void WinEDA_PcbFrame::SetVisibleAlls( ) void WinEDA_PcbFrame::SetVisibleAlls( )
{ {
GetBoard()->SetVisibleAlls( ); GetBoard()->SetVisibleAlls( );
for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ )
for( int ii = 0; ii < PCB_VISIBLE( END_PCB_VISIBLE_LIST ); ii++ )
m_Layers->SetRenderState( ii, true ); m_Layers->SetRenderState( ii, true );
} }
/** /**
* Function SetLanguage * Function SetLanguage
* called on a language menu selection * called on a language menu selection
@ -653,8 +654,8 @@ void WinEDA_PcbFrame::SetVisibleAlls( )
void WinEDA_PcbFrame::SetLanguage( wxCommandEvent& event ) void WinEDA_PcbFrame::SetLanguage( wxCommandEvent& event )
{ {
EDA_DRAW_FRAME::SetLanguage( event ); EDA_DRAW_FRAME::SetLanguage( event );
m_Layers->SetLayersManagerTabsText( ); m_Layers->SetLayersManagerTabsText();
wxAuiPaneInfo& pane_info = m_auimgr.GetPane(m_Layers); wxAuiPaneInfo& pane_info = m_auimgr.GetPane( m_Layers );
pane_info.Caption( _( "Visibles" ) ); pane_info.Caption( _( "Visibles" ) );
m_auimgr.Update(); m_auimgr.Update();
ReFillLayerWidget(); ReFillLayerWidget();
@ -669,8 +670,7 @@ wxString WinEDA_PcbFrame::GetLastNetListRead()
wxFileName absoluteFileName = m_lastNetListRead; wxFileName absoluteFileName = m_lastNetListRead;
wxFileName pcbFileName = GetScreen()->GetFileName(); wxFileName pcbFileName = GetScreen()->GetFileName();
if( !absoluteFileName.MakeAbsolute( pcbFileName.GetPath() ) if( !absoluteFileName.MakeAbsolute( pcbFileName.GetPath() ) || !absoluteFileName.FileExists() )
|| !absoluteFileName.FileExists() )
{ {
absoluteFileName.Clear(); absoluteFileName.Clear();
m_lastNetListRead = wxEmptyString; m_lastNetListRead = wxEmptyString;
@ -692,6 +692,7 @@ void WinEDA_PcbFrame::SetLastNetListRead( const wxString& aLastNetListRead )
} }
} }
/** /**
* Function OnModify() (virtual) * Function OnModify() (virtual)
* Must be called after a change * Must be called after a change
@ -701,9 +702,10 @@ void WinEDA_PcbFrame::SetLastNetListRead( const wxString& aLastNetListRead )
*/ */
void WinEDA_PcbFrame::OnModify( ) void WinEDA_PcbFrame::OnModify( )
{ {
WinEDA_BasePcbFrame::OnModify( ); WinEDA_BasePcbFrame::OnModify();
if( m_Draw3DFrame ) if( m_Draw3DFrame )
m_Draw3DFrame->ReloadRequest( ); m_Draw3DFrame->ReloadRequest();
} }

View File

@ -17,17 +17,26 @@ enum pcbnew_ids
ID_MICROWAVE_V_TOOLBAR, ID_MICROWAVE_V_TOOLBAR,
ID_OPEN_MODULE_EDITOR, ID_OPEN_MODULE_EDITOR,
ID_READ_NETLIST, ID_READ_NETLIST,
// Right vertical tool bar command IDs.
ID_PCB_NO_TOOL,
ID_PCB_HIGHLIGHT_BUTT,
ID_PCB_SHOW_1_RATSNEST_BUTT,
ID_PCB_MODULE_BUTT,
ID_TRACK_BUTT,
ID_PCB_ZONES_BUTT,
ID_PCB_ADD_LINE_BUTT,
ID_PCB_CIRCLE_BUTT, ID_PCB_CIRCLE_BUTT,
ID_PCB_ARC_BUTT, ID_PCB_ARC_BUTT,
ID_PCB_HIGHLIGHT_BUTT, ID_PCB_ADD_TEXT_BUTT,
ID_PCB_DIMENSION_BUTT,
ID_PCB_MIRE_BUTT, ID_PCB_MIRE_BUTT,
ID_PCB_SHOW_1_RATSNEST_BUTT, ID_PCB_DELETE_ITEM_BUTT,
ID_PCB_PLACE_OFFSET_COORD_BUTT, ID_PCB_PLACE_OFFSET_COORD_BUTT,
ID_PCB_PLACE_GRID_COORD_BUTT, ID_PCB_PLACE_GRID_COORD_BUTT,
ID_PCB_MASK_CLEARANCE, ID_PCB_MASK_CLEARANCE,
ID_PCB_LAYERS_SETUP, ID_PCB_LAYERS_SETUP,
ID_PCB_ADD_LINE_BUTT,
ID_PCB_ADD_TEXT_BUTT,
ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_START_RANGE,
ID_POPUP_PCB_MOVE_MODULE_REQUEST, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
@ -228,7 +237,6 @@ enum pcbnew_ids
ID_PCB_PAD_SETUP, ID_PCB_PAD_SETUP,
ID_PCB_DIMENSION_BUTT,
ID_PCB_DRAWINGS_WIDTHS_SETUP, ID_PCB_DRAWINGS_WIDTHS_SETUP,
ID_PCB_GEN_CMP_FILE, ID_PCB_GEN_CMP_FILE,
@ -251,13 +259,21 @@ enum pcbnew_ids
ID_DRC_CONTROL, ID_DRC_CONTROL,
ID_PCB_GLOBAL_DELETE, ID_PCB_GLOBAL_DELETE,
ID_TRACK_BUTT,
ID_PCB_ZONES_BUTT,
ID_PCB_DELETE_ITEM_BUTT,
ID_POPUP_PCB_DELETE_TRACKSEG, ID_POPUP_PCB_DELETE_TRACKSEG,
ID_TOOLBARH_PCB_SELECT_LAYER, ID_TOOLBARH_PCB_SELECT_LAYER,
ID_PCB_DISPLAY_OPTIONS_SETUP, ID_PCB_DISPLAY_OPTIONS_SETUP,
// Module editor right vertical tool bar commands.
ID_MODEDIT_NO_TOOL,
ID_MODEDIT_PAD_TOOL,
ID_MODEDIT_LINE_TOOL,
ID_MODEDIT_CIRCLE_TOOL,
ID_MODEDIT_ARC_TOOL,
ID_MODEDIT_TEXT_TOOL,
ID_MODEDIT_ANCHOR_TOOL,
ID_MODEDIT_DELETE_TOOL,
ID_MODEDIT_PLACE_GRID_COORD,
// ID used in module editor: // ID used in module editor:
ID_MODEDIT_CHECK, ID_MODEDIT_CHECK,
ID_MODEDIT_SELECT_CURRENT_LIB, ID_MODEDIT_SELECT_CURRENT_LIB,
@ -266,9 +282,6 @@ enum pcbnew_ids
ID_MODEDIT_NEW_MODULE, ID_MODEDIT_NEW_MODULE,
ID_MODEDIT_SHEET_SET, ID_MODEDIT_SHEET_SET,
ID_MODEDIT_LOAD_MODULE, ID_MODEDIT_LOAD_MODULE,
ID_MODEDIT_ADD_PAD,
ID_MODEDIT_PLACE_ANCHOR,
ID_MODEDIT_DELETE_ITEM_BUTT,
ID_MODEDIT_PAD_SETTINGS, ID_MODEDIT_PAD_SETTINGS,
ID_MODEDIT_LOAD_MODULE_FROM_BOARD, ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
ID_MODEDIT_INSERT_MODULE_IN_BOARD, ID_MODEDIT_INSERT_MODULE_IN_BOARD,

View File

@ -235,7 +235,6 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
int result = frame->ShowModal(); int result = frame->ShowModal();
frame->Destroy(); frame->Destroy();
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
SetToolbars();
// if user changed colors and we are in high contrast mode, then redraw // if user changed colors and we are in high contrast mode, then redraw
// because the PAD_SMD pads may change color. // because the PAD_SMD pads may change color.

View File

@ -30,34 +30,29 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
wxString msg; wxString msg;
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString,
wxBitmap( open_library_xpm ), wxBitmap( open_library_xpm ),
_( "Select working library" ) ); _( "Select working library" ) );
m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, wxBitmap( save_library_xpm ),
wxBitmap( save_library_xpm ),
_( "Save Module in working library" ) ); _( "Save Module in working library" ) );
m_HToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, m_HToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString,
wxEmptyString,
wxBitmap( new_library_xpm ), wxBitmap( new_library_xpm ),
_( "Create new library and save current module" ) ); _( "Create new library and save current module" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, wxBitmap( delete_xpm ),
wxBitmap( delete_xpm ),
_( "Delete part in current library" ) ); _( "Delete part in current library" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, wxBitmap( new_footprint_xpm ),
wxBitmap( new_footprint_xpm ),
_( "New Module" ) ); _( "New Module" ) );
m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString, wxBitmap( module_xpm ),
wxBitmap( module_xpm ),
_( "Load module from lib" ) ); _( "Load module from lib" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
@ -74,12 +69,10 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
_( "Insert module into current board" ) ); _( "Insert module into current board" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, wxBitmap( import_module_xpm ),
wxBitmap( import_module_xpm ),
_( "import module" ) ); _( "import module" ) );
m_HToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, wxBitmap( export_module_xpm ),
wxBitmap( export_module_xpm ),
_( "export module" ) ); _( "export module" ) );
@ -99,29 +92,20 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
_( "Print Module" ) ); _( "Print Module" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_IN, false );
HK_ZOOM_IN, false ); m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_OUT, false );
HK_ZOOM_OUT, false ); m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, false );
HK_ZOOM_REDRAW, false ); m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_AUTO, false );
HK_ZOOM_AUTO, false ); m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, wxBitmap( options_pad_xpm ),
wxBitmap( options_pad_xpm ),
_( "Pad Settings" ) ); _( "Pad Settings" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
@ -140,47 +124,39 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar()
if( m_VToolBar ) if( m_VToolBar )
return; return;
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE ); m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_MODEDIT_ADD_PAD, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_PAD_TOOL, wxEmptyString, wxBitmap( pad_xpm ),
wxBitmap( pad_xpm ), _( "Add pads" ), wxITEM_CHECK );
_( "Add Pads" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_LINE_TOOL, wxEmptyString, wxBitmap( add_polygon_xpm ),
wxBitmap( add_polygon_xpm ),
_( "Add graphic line or polygon" ), wxITEM_CHECK ); _( "Add graphic line or polygon" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_CIRCLE_TOOL, wxEmptyString, wxBitmap( add_circle_xpm ),
wxBitmap( add_circle_xpm ),
_( "Add graphic circle" ), wxITEM_CHECK ); _( "Add graphic circle" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_ARC_TOOL, wxEmptyString, wxBitmap( add_arc_xpm ),
wxBitmap( add_arc_xpm ),
_( "Add graphic arc" ), wxITEM_CHECK ); _( "Add graphic arc" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_TEXT_TOOL, wxEmptyString, wxBitmap( add_text_xpm ),
wxBitmap( add_text_xpm ),
_( "Add Text" ), wxITEM_CHECK ); _( "Add Text" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_MODEDIT_PLACE_ANCHOR, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_ANCHOR_TOOL, wxEmptyString, wxBitmap( anchor_xpm ),
wxBitmap( anchor_xpm ),
_( "Place the footprint module reference anchor" ), _( "Place the footprint module reference anchor" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_MODEDIT_DELETE_ITEM_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_DELETE_TOOL, wxEmptyString, wxBitmap( delete_body_xpm ),
wxBitmap( delete_body_xpm ),
_( "Delete items" ), wxITEM_CHECK ); _( "Delete items" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_PLACE_GRID_COORD_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_PLACE_GRID_COORD, wxEmptyString,
wxBitmap( grid_select_axis_xpm ), wxBitmap( grid_select_axis_xpm ),
_( "Set the origin point for the grid" ), _( "Set the origin point for the grid" ),
wxITEM_CHECK ); wxITEM_CHECK );
@ -195,13 +171,9 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
return; return;
// Create options tool bar. // Create options tool bar.
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false );
ID_OPT_TOOLBAR, FALSE ); m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, wxBitmap( grid_xpm ),
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
wxBitmap( grid_xpm ),
_( "Hide grid" ), wxITEM_CHECK ); _( "Hide grid" ), wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,IsGridVisible() );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
wxBitmap( polar_coord_xpm ), wxBitmap( polar_coord_xpm ),
@ -224,13 +196,11 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
wxBitmap( pad_sketch_xpm ), wxBitmap( pad_sketch_xpm ),
_( "Show Pads Sketch" ), wxITEM_CHECK ); _( "Show Pads Sketch" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString,
wxEmptyString,
wxBitmap( text_sketch_xpm ), wxBitmap( text_sketch_xpm ),
_( "Show Texts Sketch" ), wxITEM_CHECK ); _( "Show Texts Sketch" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString,
wxEmptyString,
wxBitmap( show_mod_edge_xpm ), wxBitmap( show_mod_edge_xpm ),
_( "Show Edges Sketch" ), wxITEM_CHECK ); _( "Show Edges Sketch" ), wxITEM_CHECK );
@ -240,91 +210,35 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
{ {
size_t i;
wxString msg; wxString msg;
if( m_AuxiliaryToolBar == NULL ) if( m_AuxiliaryToolBar )
{ return;
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this,
ID_AUX_TOOLBAR, TRUE );
// Set up toolbar m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this, ID_AUX_TOOLBAR, true );
m_AuxiliaryToolBar->AddSeparator();
// Grid selection choice box. // Set up toolbar
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_AuxiliaryToolBar->AddSeparator();
ID_ON_GRID_SELECT,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelGridBox );
// Zoom selection choice box. // Grid selection choice box.
m_AuxiliaryToolBar->AddSeparator(); m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, ID_ON_GRID_SELECT,
ID_ON_ZOOM_SELECT, wxPoint( -1, -1 ),
wxPoint( -1, -1 ), wxSize( LISTBOX_WIDTH, -1 ) );
wxSize( LISTBOX_WIDTH, -1 ) ); m_AuxiliaryToolBar->AddControl( m_SelGridBox );
msg = _( "Auto" );
m_SelZoomBox->Append( msg );
for( int i = 0; i < (int)GetScreen()->m_ZoomList.GetCount(); i++ ) // Zoom selection choice box.
{ m_AuxiliaryToolBar->AddSeparator();
msg = _( "Zoom " ); m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT,
if ( GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar == 0 ) wxPoint( -1, -1 ),
msg << GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar; wxSize( LISTBOX_WIDTH, -1 ) );
else m_AuxiliaryToolBar->AddControl( m_SelZoomBox );
{
wxString value;
value.Printf( wxT( "%.1f" ),
(float)GetScreen()->m_ZoomList[i] /
GetScreen()->m_ZoomScalar );
msg += value;
}
m_SelZoomBox->Append( msg );
}
m_AuxiliaryToolBar->AddControl( m_SelZoomBox );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
m_AuxiliaryToolBar->Realize();
}
// Update tool bar to reflect setting. // Update tool bar to reflect setting.
m_SelGridBox->Clear(); updateGridSelectBox();
updateZoomSelectBox();
for( i = 0; i < GetScreen()->GetGridCount(); i++ ) // after adding the buttons to the toolbar, must call Realize() to reflect the changes
{ m_AuxiliaryToolBar->Realize();
double value = To_User_Unit( g_UserUnit,
GetScreen()->GetGrid( i ).m_Size.x,
PCB_INTERNAL_UNIT );
if( GetScreen()->GetGrid( i ).m_Id != ID_POPUP_GRID_USER )
{
switch( g_UserUnit )
{
case INCHES:
msg.Printf( _( "Grid %.1f" ), value * 1000 );
break;
case MILLIMETRES:
msg.Printf( _( "Grid %.3f" ), value );
break;
case UNSCALED_UNITS:
msg.Printf( _( "Grid %f" ), value );
break;
}
}
else
{
msg = _( "User Grid" );
}
m_SelGridBox->Append( msg, (void*) &GetScreen()->GetGrid( i ).m_Id );
if( m_LastGridSizeId == GetScreen()->GetGrid( i ).m_Id )
m_SelGridBox->SetSelection( i );
}
} }

View File

@ -29,7 +29,7 @@ void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
break; break;
} }
case ID_COMPONENT_BUTT: case ID_PCB_MODULE_BUTT:
break; break;
case ID_PCB_CIRCLE_BUTT: case ID_PCB_CIRCLE_BUTT:
@ -61,15 +61,14 @@ void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_MODEDIT_ADD_PAD: case ID_MODEDIT_PAD_TOOL:
InstallPadOptionsFrame( NULL ); InstallPadOptionsFrame( NULL );
break; break;
case ID_PCB_CIRCLE_BUTT: case ID_MODEDIT_CIRCLE_TOOL:
case ID_PCB_ARC_BUTT: case ID_MODEDIT_ARC_TOOL:
case ID_PCB_ADD_LINE_BUTT: case ID_MODEDIT_LINE_TOOL:
case ID_PCB_DIMENSION_BUTT: case ID_MODEDIT_TEXT_TOOL:
case ID_PCB_ADD_TEXT_BUTT:
InstallOptionsFrame( pos ); InstallOptionsFrame( pos );
break; break;

View File

@ -73,18 +73,23 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
/* get colors, and redraw bitmap button only on changes */ /* get colors, and redraw bitmap button only on changes */
active_layer_color = GetBoard()->GetLayerColor(getActiveLayer()); active_layer_color = GetBoard()->GetLayerColor(getActiveLayer());
if( previous_active_layer_color != active_layer_color ) if( previous_active_layer_color != active_layer_color )
{ {
previous_active_layer_color = active_layer_color; previous_active_layer_color = active_layer_color;
change = true; change = true;
} }
Route_Layer_TOP_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP); Route_Layer_TOP_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP);
if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color ) if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color )
{ {
previous_Route_Layer_TOP_color = Route_Layer_TOP_color; previous_Route_Layer_TOP_color = Route_Layer_TOP_color;
change = true; change = true;
} }
Route_Layer_BOTTOM_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM); Route_Layer_BOTTOM_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM);
if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color ) if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color )
{ {
previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color; previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color;
@ -93,6 +98,7 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
int via_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType; int via_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type); via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type);
if( previous_via_color != via_color ) if( previous_via_color != via_color )
{ {
previous_via_color = via_color; previous_via_color = via_color;
@ -145,11 +151,9 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
} }
color &= MASKCOLOR; color &= MASKCOLOR;
pen.SetColour( pen.SetColour( ColorRefs[color].m_Red,
ColorRefs[color].m_Red, ColorRefs[color].m_Green,
ColorRefs[color].m_Green, ColorRefs[color].m_Blue );
ColorRefs[color].m_Blue
);
iconDC.SetPen( pen ); iconDC.SetPen( pen );
} }
iconDC.DrawPoint( jj, ii ); iconDC.DrawPoint( jj, ii );
@ -162,8 +166,7 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
if( m_HToolBar ) if( m_HToolBar )
{ {
m_HToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, m_HToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap );
*LayerPairBitmap );
m_HToolBar->Realize(); m_HToolBar->Realize();
} }
} }
@ -175,13 +178,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
{ {
wxString msg; wxString msg;
if( m_HToolBar != NULL ) if( m_HToolBar )
{
SetToolbars();
return; return;
}
wxWindowUpdateLocker dummy(this); wxWindowUpdateLocker dummy( this );
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
m_HToolBar->SetRows( 1 ); m_HToolBar->SetRows( 1 );
@ -199,8 +199,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
_( "Page settings (size, texts)" ) ); _( "Page settings (size, texts)" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, wxBitmap( modedit_xpm ),
wxBitmap( modedit_xpm ),
_( "Open module editor" ) ); _( "Open module editor" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
@ -216,14 +215,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
#endif #endif
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, false );
HK_UNDO, false ); m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ), HELP_UNDO );
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg = AddHotkeyName( HELP_REDO, g_Board_Editor_Hokeys_Descr, HK_REDO, false );
HELP_UNDO ); m_HToolBar->AddTool( wxID_REDO, wxEmptyString, wxBitmap( redo_xpm ), HELP_REDO );
msg = AddHotkeyName( HELP_REDO, g_Board_Editor_Hokeys_Descr,
HK_REDO, false );
m_HToolBar->AddTool( wxID_REDO, wxEmptyString, wxBitmap( redo_xpm ),
HELP_REDO );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ), m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
@ -232,32 +227,21 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
_( "Plot (HPGL, PostScript, or GERBER format)" ) ); _( "Plot (HPGL, PostScript, or GERBER format)" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( HELP_ZOOM_IN, g_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( HELP_ZOOM_IN, g_Board_Editor_Hokeys_Descr, HK_ZOOM_IN, false );
HK_ZOOM_IN, false ); m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
msg );
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( HELP_ZOOM_OUT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_OUT, false );
HK_ZOOM_OUT, false ); m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, false );
HK_ZOOM_REDRAW, false ); m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( HELP_ZOOM_FIT, g_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( HELP_ZOOM_FIT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_AUTO, false );
HK_ZOOM_AUTO, false ); m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( HELP_FIND, // Find components and texts msg = AddHotkeyName( HELP_FIND, g_Board_Editor_Hokeys_Descr, HK_FIND_ITEM, false );
g_Board_Editor_Hokeys_Descr, m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ), msg );
HK_FIND_ITEM, false );
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ),
msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ), m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
@ -267,8 +251,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
if(m_SelLayerBox == NULL) if( m_SelLayerBox == NULL )
m_SelLayerBox = new WinEDALayerChoiceBox( m_HToolBar, ID_TOOLBARH_PCB_SELECT_LAYER); m_SelLayerBox = new WinEDALayerChoiceBox( m_HToolBar, ID_TOOLBARH_PCB_SELECT_LAYER );
ReCreateLayerBox( m_HToolBar ); ReCreateLayerBox( m_HToolBar );
m_HToolBar->AddControl( m_SelLayerBox ); m_HToolBar->AddControl( m_SelLayerBox );
@ -279,12 +263,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
*LayerPairBitmap, SEL_LAYER_HELP ); *LayerPairBitmap, SEL_LAYER_HELP );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString, m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString, wxBitmap( mode_module_xpm ),
wxBitmap( mode_module_xpm ),
_( "Mode footprint: manual and automatic move and place modules" ), _( "Mode footprint: manual and automatic move and place modules" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString, m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString, wxBitmap( mode_track_xpm ),
wxBitmap( mode_track_xpm ),
_( "Mode track: autorouting" ), wxITEM_CHECK ); _( "Mode track: autorouting" ), wxITEM_CHECK );
// Fast call to FreeROUTE Web Bases router // Fast call to FreeROUTE Web Bases router
@ -294,9 +276,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
_( "Fast access to the Web Based FreeROUTE advanced router" ) ); _( "Fast access to the Web Based FreeROUTE advanced router" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
m_HToolBar->Realize(); m_HToolBar->Realize();
} }
@ -306,17 +287,13 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
wxWindowUpdateLocker dummy(this); wxWindowUpdateLocker dummy( this );
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false );
ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, wxBitmap( drc_off_xpm ),
wxBitmap( drc_off_xpm ), _( "Enable design rule checking" ), wxITEM_CHECK );
_( "Enable design rule checking" ), m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, wxBitmap( grid_xpm ),
wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
wxBitmap( grid_xpm ),
_( "Hide grid" ), wxITEM_CHECK ); _( "Hide grid" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
wxBitmap( polar_coord_xpm ), wxBitmap( polar_coord_xpm ),
@ -350,15 +327,11 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString,
wxBitmap( show_zone_xpm ), wxNullBitmap, wxBitmap( show_zone_xpm ), wxNullBitmap,
_( "Show filled areas in zones" ) ); _( "Show filled areas in zones" ) );
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString,
wxEmptyString,
wxBitmap( show_zone_disable_xpm ), wxBitmap( show_zone_disable_xpm ),
wxNullBitmap, wxNullBitmap, _( "Do not show filled areas in zones" ));
_( "Do not show filled areas in zones" )); m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString,
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxBitmap( show_zone_outline_only_xpm ), wxNullBitmap,
wxEmptyString,
wxBitmap( show_zone_outline_only_xpm ),
wxNullBitmap,
_( "Show outlines of filled areas only in zones" ) ); _( "Show outlines of filled areas only in zones" ) );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
@ -375,21 +348,18 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
_( "Show tracks in outline mode" ), _( "Show tracks in outline mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString,
wxEmptyString,
wxBitmap( palette_xpm ), wxBitmap( palette_xpm ),
_( "Enable high contrast display mode" ), _( "Enable high contrast display mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay );
// Tools to show/hide toolbars: // Tools to show/hide toolbars:
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
wxEmptyString, wxEmptyString,
wxBitmap( layers_manager_xpm ), wxBitmap( layers_manager_xpm ),
HELP_SHOW_HIDE_LAYERMANAGER, HELP_SHOW_HIDE_LAYERMANAGER,
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
wxEmptyString, wxEmptyString,
wxBitmap( mw_toolbar_xpm ), wxBitmap( mw_toolbar_xpm ),
@ -409,72 +379,57 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
if( m_VToolBar ) if( m_VToolBar )
return; return;
wxWindowUpdateLocker dummy(this); wxWindowUpdateLocker dummy( this );
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE ); m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, true );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString, wxBitmap( net_highlight_xpm ),
wxBitmap( net_highlight_xpm ), _( "Highlight net" ), _( "Highlight net" ), wxITEM_CHECK );
wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString, wxBitmap( tool_ratsnet_xpm ),
wxBitmap( tool_ratsnet_xpm ), _( "Display local ratsnest" ), wxITEM_CHECK );
_( "Display local ratsnest" ),
wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_COMPONENT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_MODULE_BUTT, wxEmptyString, wxBitmap( module_xpm ),
wxBitmap( module_xpm ),
_( "Add modules" ), wxITEM_CHECK ); _( "Add modules" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, wxBitmap( add_tracks_xpm ),
wxBitmap( add_tracks_xpm ),
_( "Add tracks and vias" ), wxITEM_CHECK ); _( "Add tracks and vias" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, wxBitmap( add_zone_xpm ),
wxBitmap( add_zone_xpm ),
_( "Add filled zones" ), wxITEM_CHECK ); _( "Add filled zones" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, wxBitmap( add_dashed_line_xpm ),
wxBitmap( add_dashed_line_xpm ),
_( "Add graphic line or polygon" ), wxITEM_CHECK ); _( "Add graphic line or polygon" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString, wxBitmap( add_circle_xpm ),
wxBitmap( add_circle_xpm ),
_( "Add graphic circle" ), wxITEM_CHECK ); _( "Add graphic circle" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString, wxBitmap( add_arc_xpm ),
wxBitmap( add_arc_xpm ),
_( "Add graphic arc" ), wxITEM_CHECK ); _( "Add graphic arc" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString, wxBitmap( add_text_xpm ),
wxBitmap( add_text_xpm ),
_( "Add text on copper layers or graphic text" ), wxITEM_CHECK ); _( "Add text on copper layers or graphic text" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString, wxBitmap( add_dimension_xpm ),
wxBitmap( add_dimension_xpm ),
_( "Add dimension" ), wxITEM_CHECK ); _( "Add dimension" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_MIRE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_MIRE_BUTT, wxEmptyString, wxBitmap( add_mires_xpm ),
wxBitmap( add_mires_xpm ),
_( "Add layer alignment target" ), wxITEM_CHECK ); _( "Add layer alignment target" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
wxBitmap( delete_body_xpm ),
_( "Delete items" ), wxITEM_CHECK ); _( "Delete items" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString, wxBitmap( pcb_offset_xpm ),
wxBitmap( pcb_offset_xpm ),
_( "Place the origin point for drill and place files" ), _( "Place the origin point for drill and place files" ),
wxITEM_CHECK ); wxITEM_CHECK );
@ -497,8 +452,7 @@ void WinEDA_PcbFrame::ReCreateMicrowaveVToolbar()
wxWindowUpdateLocker dummy(this); wxWindowUpdateLocker dummy(this);
m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_MICROWAVE_V_TOOLBAR, false );
ID_MICROWAVE_V_TOOLBAR, FALSE );
// Set up toolbar // Set up toolbar
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString, m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString,
@ -539,152 +493,192 @@ void WinEDA_PcbFrame::ReCreateMicrowaveVToolbar()
*/ */
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
{ {
size_t i;
wxString msg; wxString msg;
wxWindowUpdateLocker dummy(this); wxWindowUpdateLocker dummy( this );
if( m_AuxiliaryToolBar == NULL ) if( m_AuxiliaryToolBar )
{ return;
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this,
ID_AUX_TOOLBAR, true );
m_TrackAndViasSizesList_Changed = true; m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this, ID_AUX_TOOLBAR, true );
/* Set up toolbar items */ m_TrackAndViasSizesList_Changed = true;
// Creates box to display and choose tracks widths: /* Set up toolbar items */
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_AuxiliaryToolBar->AddSeparator();
// Creates box to display and choose vias diameters: // Creates box to display and choose tracks widths:
m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( (LISTBOX_WIDTH*12)/10, -1 ) ); wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox ); m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
// Creates box to display tracks and vias clearance: // Creates box to display and choose vias diameters:
m_ClearanceBox = new wxTextCtrl( m_AuxiliaryToolBar, -1, m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
wxEmptyString, wxPoint( -1, -1 ), ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxSize( LISTBOX_WIDTH + 10, -1 ), wxPoint( -1, -1 ),
wxTE_READONLY ); wxSize( (LISTBOX_WIDTH*12)/10, -1 ) );
m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") ); m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_AuxiliaryToolBar->AddControl( m_ClearanceBox ); m_AuxiliaryToolBar->AddSeparator();
m_AuxiliaryToolBar->AddSeparator();
// Creates box to display the current NetClass: // Creates box to display tracks and vias clearance:
m_NetClassSelectedBox = new wxTextCtrl( m_AuxiliaryToolBar, -1, m_ClearanceBox = new wxTextCtrl( m_AuxiliaryToolBar, -1,
wxEmptyString, wxPoint( -1, -1 ), wxEmptyString, wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ), wxSize( LISTBOX_WIDTH + 10, -1 ),
wxTE_READONLY ); wxTE_READONLY );
m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") ); m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") );
m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox ); m_AuxiliaryToolBar->AddControl( m_ClearanceBox );
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
// Creates box to display and choose strategy to handle tracks an // Creates box to display the current NetClass:
// vias sizes: m_NetClassSelectedBox = new wxTextCtrl( m_AuxiliaryToolBar, -1,
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, wxEmptyString, wxPoint( -1, -1 ),
wxEmptyString, wxSize( LISTBOX_WIDTH, -1 ),
wxBitmap( auto_track_width_xpm ), wxTE_READONLY );
_( "Auto track width: when starting on \ m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") );
m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox );
m_AuxiliaryToolBar->AddSeparator();
// Creates box to display and choose strategy to handle tracks an vias sizes:
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString,
wxBitmap( auto_track_width_xpm ),
_( "Auto track width: when starting on \
an existing track use its width\notherwise, use current width setting" ), an existing track use its width\notherwise, use current width setting" ),
wxITEM_CHECK ); wxITEM_CHECK );
// Add the box to display and select the current grid size: // Add the box to display and select the current grid size:
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT, ID_ON_GRID_SELECT,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) ); wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelGridBox ); m_AuxiliaryToolBar->AddControl( m_SelGridBox );
// Add the box to display and select the current Zoom // Add the box to display and select the current Zoom
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT, ID_ON_ZOOM_SELECT,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) ); wxSize( LISTBOX_WIDTH, -1 ) );
msg = _( "Auto" ); m_AuxiliaryToolBar->AddControl( m_SelZoomBox );
m_SelZoomBox->Append( msg );
for( int i = 0; i < (int)GetScreen()->m_ZoomList.GetCount(); i++ )
{
msg = _( "Zoom " );
if ( (GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar) == 0 )
msg << GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar;
else
{
wxString value;
value.Printf( wxT( "%.1f" ),
(float)GetScreen()->m_ZoomList[i] /
GetScreen()->m_ZoomScalar );
msg += value;
}
m_SelZoomBox->Append( msg );
}
m_AuxiliaryToolBar->AddControl( m_SelZoomBox ); updateZoomSelectBox();
updateGridSelectBox();
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
updateDesignRulesSelectBoxes();
// after adding the buttons to the toolbar, must call Realize() // after adding the buttons to the toolbar, must call Realize()
m_AuxiliaryToolBar->Realize(); m_AuxiliaryToolBar->Realize();
}
// Update displayed values
m_SelGridBox->Clear();
wxString format = _( "Grid");
switch( g_UserUnit )
{
case INCHES:
format += wxT( " %.1f" );
break;
case MILLIMETRES:
format += wxT( " %.3f" );
break;
case UNSCALED_UNITS:
format += wxT( " %f" );
break;
}
for( i = 0; i < GetScreen()->GetGridCount(); i++ )
{
GRID_TYPE& grid = GetScreen()->GetGrid( i );
double value = To_User_Unit( g_UserUnit, grid.m_Size.x, m_InternalUnits );
if( grid.m_Id != ID_POPUP_GRID_USER )
{
switch( g_UserUnit )
{
case INCHES:
msg.Printf( format.GetData(), value * 1000 );
break;
case MILLIMETRES:
case UNSCALED_UNITS:
msg.Printf( format.GetData(), value );
break;
}
}
else
msg = _( "User Grid" );
m_SelGridBox->Append( msg, (void*) &grid.m_Id );
if( m_LastGridSizeId == GetScreen()->GetGrid( i ).m_Id )
m_SelGridBox->SetSelection( i );
}
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
} }
/* helper to convert an integer value to a string, using mils or mm
* according to g_UserUnit value
*/
static wxString ReturnStringValue( int aValue )
{
wxString text;
const wxChar* format;
double value = To_User_Unit( g_UserUnit, aValue, PCB_INTERNAL_UNIT );
if( g_UserUnit == INCHES )
{
format = wxT( " %.1f" );
value *= 1000;
}
else
format = wxT( " %.3f" );
text.Printf( format, value );
if( g_UserUnit == INCHES )
text += _( " mils" );
else
text += _( " mm" );
return text;
}
void WinEDA_PcbFrame::updateTraceWidthSelectBox()
{
if( m_SelTrackWidthBox == NULL )
return;
wxString msg;
m_SelTrackWidthBox->Clear();
for( unsigned ii = 0; ii < GetBoard()->m_TrackWidthList.size(); ii++ )
{
msg = _( "Track" ) + ReturnStringValue( GetBoard()->m_TrackWidthList[ii] );
if( ii == 0 )
msg << _( " *" );
m_SelTrackWidthBox->Append( msg );
}
}
void WinEDA_PcbFrame::updateViaSizeSelectBox()
{
if( m_SelViaSizeBox == NULL )
return;
wxString msg;
m_SelViaSizeBox->Clear();
for( unsigned ii = 0; ii < GetBoard()->m_ViasDimensionsList.size(); ii++ )
{
msg = _( "Via" );
msg << ReturnStringValue( GetBoard()->m_ViasDimensionsList[ii].m_Diameter );
if( GetBoard()->m_ViasDimensionsList[ii].m_Drill )
msg << wxT("/") << ReturnStringValue( GetBoard()->m_ViasDimensionsList[ii].m_Drill );
if( ii == 0 )
msg << _( " *" );
m_SelViaSizeBox->Append( msg );
}
}
/**
* Function updateDesignRulesSelectBoxes
* update the displayed values: track widths, via sizes, clearance, Netclass name
* used when a netclass is selected
*/
void WinEDA_PcbFrame::updateDesignRulesSelectBoxes()
{
wxString nclname = GetBoard()->m_CurrentNetClassName;
wxString msg = _( "NetClass: " ) + nclname;
if( m_NetClassSelectedBox )
{
m_NetClassSelectedBox->Clear();
m_NetClassSelectedBox->AppendText( msg );
}
NETCLASS* netclass = GetBoard()->m_NetClasses.Find( nclname );
if( m_ClearanceBox )
{
wxString msg = _( "Clearance" ) + ReturnStringValue( netclass->GetClearance() );
m_ClearanceBox->Clear();
m_ClearanceBox->AppendText( msg );
}
}
void WinEDA_PcbFrame::syncLayerBox() void WinEDA_PcbFrame::syncLayerBox()
{ {
wxASSERT( m_SelLayerBox ); wxASSERT( m_SelLayerBox );

View File

@ -19,57 +19,9 @@
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "dialog_helpers.h" #include "dialog_helpers.h"
/* helper to convert an integer value to a string, using mils or mm
* according to g_UserUnit value
*/
static wxString ReturnStringValue( int aValue )
{
wxString text;
const wxChar* format;
double value = To_User_Unit( g_UserUnit, aValue, PCB_INTERNAL_UNIT );
if( g_UserUnit == INCHES )
{
format = wxT( " %.1f" );
value *= 1000;
}
else
format = wxT( " %.3f" );
text.Printf( format, value );
if( g_UserUnit == INCHES )
text += _( " mils" );
else
text += _( " mm" );
return text;
}
/** /**
* Function AuxiliaryToolBar_DesignRules_Update_UI * Function OnUpdateAuxilaryToolbar
* update the displayed values: track widths, via sizes, clearance, Netclass name
* used when a netclass is selected
*/
void WinEDA_PcbFrame::AuxiliaryToolBar_DesignRules_Update_UI()
{
wxString nclname = GetBoard()->m_CurrentNetClassName;
wxString msg = _( "NetClass: " ) + nclname;
m_NetClassSelectedBox->Clear();
m_NetClassSelectedBox->AppendText( msg );
NETCLASS* netclass = GetBoard()->m_NetClasses.Find( nclname );
if( m_ClearanceBox )
{
wxString msg = _( "Clearance" ) + ReturnStringValue( netclass->GetClearance() );
m_ClearanceBox->Clear();
m_ClearanceBox->AppendText( msg );
}
}
/**
* Function AuxiliaryToolBar_Update_UI
* update the displayed values on auxiliary horizontal toolbar * update the displayed values on auxiliary horizontal toolbar
* (track width, via sizes, clearance ... * (track width, via sizes, clearance ...
* Display format for track and via lists * Display format for track and via lists
@ -77,207 +29,126 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_DesignRules_Update_UI()
* next items (if any) = ordered list of sizes (extra sizes). * next items (if any) = ordered list of sizes (extra sizes).
* So the current selected class value can be same as an other extra value * So the current selected class value can be same as an other extra value
*/ */
void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI() void WinEDA_PcbFrame::OnUpdateAuxilaryToolbar( wxUpdateUIEvent& aEvent )
{ {
wxString msg; wxString msg;
AuxiliaryToolBar_DesignRules_Update_UI(); if( m_AuxiliaryToolBar == NULL )
m_AuxiliaryToolBar->ToggleTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth );
if( m_SelTrackWidthBox && m_TrackAndViasSizesList_Changed )
{
m_SelTrackWidthBox->Clear();
for( unsigned ii = 0; ii < GetBoard()->m_TrackWidthList.size(); ii++ )
{
msg = _( "Track" ) + ReturnStringValue( GetBoard()->m_TrackWidthList[ii] );
if( ii == 0 )
msg << _( " *" );
m_SelTrackWidthBox->Append( msg );
}
}
if( GetBoard()->m_TrackWidthSelector >= GetBoard()->m_TrackWidthList.size() )
GetBoard()->m_TrackWidthSelector = 0;
m_SelTrackWidthBox->SetSelection( GetBoard()->m_TrackWidthSelector );
if( m_SelViaSizeBox && m_TrackAndViasSizesList_Changed )
{
m_SelViaSizeBox->Clear();
for( unsigned ii = 0; ii < GetBoard()->m_ViasDimensionsList.size(); ii++ )
{
msg = _( "Via" );
msg << ReturnStringValue( GetBoard()->m_ViasDimensionsList[ii].m_Diameter );
if( GetBoard()->m_ViasDimensionsList[ii].m_Drill )
msg << wxT("/") << ReturnStringValue( GetBoard()->m_ViasDimensionsList[ii].m_Drill );
if( ii == 0 )
msg << _( " *" );
m_SelViaSizeBox->Append( msg );
}
}
if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViasDimensionsList.size() )
GetBoard()->m_ViaSizeSelector = 0;
m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector );
if( m_SelZoomBox )
{
bool not_found = true;
for( unsigned jj = 0; jj < GetScreen()->m_ZoomList.GetCount(); jj++ )
{
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[jj] )
{
m_SelZoomBox->SetSelection( jj + 1 );
not_found = false;
break;
}
}
if( not_found )
m_SelZoomBox->SetSelection( -1 );
}
if( m_SelGridBox )
m_SelGridBox->SetSelection( m_LastGridSizeId );
m_TrackAndViasSizesList_Changed = false;
m_AuxiliaryToolBar->Refresh();
}
/*
* Enable or disable the toolbar's controls, depending on the current
* state.
*
* @todo: All of this should be perform in appropriate wxUpdateUIEvent
* handles. This is not how it how updating user interface controls
* is handle in wxWidgets.
*/
void WinEDA_PcbFrame::SetToolbars()
{
bool state;
if( m_ID_current_state == ID_TRACK_BUTT )
{
if( Drc_On )
DrawPanel->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
else
DrawPanel->SetCursor( wxCursor( wxCURSOR_QUESTION_ARROW ) );
}
if( m_HToolBar == NULL )
return; return;
m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() ); aEvent.Check( GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth );
state = GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE; if( GetBoard()->m_TrackWidthSelector >= GetBoard()->m_TrackWidthList.size() )
m_HToolBar->EnableTool( wxID_CUT, state ); GetBoard()->m_TrackWidthSelector = 0;
m_HToolBar->EnableTool( wxID_COPY, state );
m_HToolBar->EnableTool( wxID_PASTE, false ); if( m_SelTrackWidthBox->GetSelection() != (int) GetBoard()->m_TrackWidthSelector )
m_SelTrackWidthBox->SetSelection( GetBoard()->m_TrackWidthSelector );
state = GetScreen()->GetUndoCommandCount() > 0; if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViasDimensionsList.size() )
m_HToolBar->EnableTool( wxID_UNDO, state ); GetBoard()->m_ViaSizeSelector = 0;
state = GetScreen()->GetRedoCommandCount() > 0; if( m_SelViaSizeBox->GetSelection() != (int) GetBoard()->m_ViaSizeSelector )
m_HToolBar->EnableTool( wxID_REDO, state ); m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector );
syncLayerBox(); }
PrepareLayerIndicator();
m_HToolBar->Refresh(true);
void WinEDA_PcbFrame::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent )
if( m_OptionsToolBar ) {
{ int selected = aEvent.GetId() - ID_TB_OPTIONS_SHOW_ZONES;
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_DRC_OFF,
!Drc_On ); if( aEvent.IsChecked() && ( DisplayOpt.DisplayZonesMode == selected ) )
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF, return;
Drc_On ?
_( "Disable design rule checking" ) : aEvent.Check( DisplayOpt.DisplayZonesMode == selected );
_( "Enable design rule checking" ) ); }
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UserUnit == MILLIMETRES ); void WinEDA_PcbFrame::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, {
g_UserUnit == INCHES ); aEvent.Check( !Drc_On );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, Drc_On ?
DisplayOpt.DisplayPolarCood ); _( "Disable design rule checking" ) :
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD, _( "Enable design rule checking" ) );
DisplayOpt.DisplayPolarCood ? }
_( "Display rectangular coordinates" ) :
_( "Display polar coordinates" ) ); void WinEDA_PcbFrame::OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent )
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, IsGridVisible( ) ); aEvent.Check( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
IsGridVisible( ) ? GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ?
_( "Hide grid" ) : _( "Hide board ratsnest" ) :
_( "Show grid" ) ); _( "Show board ratsnest" ) );
}
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
m_CursorShape );
void WinEDA_PcbFrame::OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent )
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST, {
GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ); aEvent.Check( g_Show_Module_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ? g_Show_Module_Ratsnest ?
_( "Hide board ratsnest" ) : _( "Hide module ratsnest" ) :
_( "Show board ratsnest" ) ); _( "Show module ratsnest" ) );
}
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, void WinEDA_PcbFrame::OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent )
g_Show_Module_Ratsnest ? {
_( "Hide module ratsnest" ) : aEvent.Check( g_AutoDeleteOldTrack );
_( "Show module ratsnest" ) ); m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack ?
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, _( "Disable auto delete old track" ) :
g_AutoDeleteOldTrack ); _( "Enable auto delete old track" ) );
}
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack ?
_( "Disable auto delete old track" ) : void WinEDA_PcbFrame::OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent )
_( "Enable auto delete old track" ) ); {
aEvent.Check( !m_DisplayViaFill );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
!m_DisplayPadFill ); m_DisplayViaFill ?
_( "Show vias in outline mode" ) :
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH, _( "Show vias in fill mode" ) );
m_DisplayPadFill ? }
_( "Show pads in outline mode" ) :
_( "Show pads in fill mode" ) );
void WinEDA_PcbFrame::OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent )
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, {
!m_DisplayViaFill ); aEvent.Check( !m_DisplayPcbTrackFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, m_DisplayPcbTrackFill ?
m_DisplayViaFill ? _( "Show tracks in outline mode" ) :
_( "Show vias in outline mode" ) : _( "Show tracks in fill mode" ) );
_( "Show vias in fill mode" ) ); }
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, void WinEDA_PcbFrame::OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent )
!m_DisplayPcbTrackFill ); {
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, aEvent.Check( DisplayOpt.ContrastModeDisplay );
m_DisplayPcbTrackFill ? m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
_( "Show tracks in outline mode" ) : DisplayOpt.ContrastModeDisplay ?
_( "Show tracks in fill mode" ) ); _( "Normal contrast display mode" ) :
_( "High contrast display mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, }
DisplayOpt.ContrastModeDisplay );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay ? void WinEDA_PcbFrame::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
_( "Normal contrast display mode" ) : {
_( "High contrast display mode" ) ); aEvent.Check( m_auimgr.GetPane( wxT( "m_AuxVToolBar" ) ).IsShown() );
}
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
m_auimgr.GetPane(wxT("m_AuxVToolBar")).IsShown() );
m_OptionsToolBar->Refresh(); void WinEDA_PcbFrame::OnUpdateSave( wxUpdateUIEvent& aEvent )
} {
aEvent.Enable( GetScreen()->IsModify() );
if( m_AuxiliaryToolBar ) }
AuxiliaryToolBar_Update_UI();
DisplayUnitsMsg();
void WinEDA_PcbFrame::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
{
if( m_ID_current_state == 0 )
m_ID_current_state = ID_PCB_NO_TOOL;
if( aEvent.GetEventObject() == m_VToolBar )
aEvent.Check( m_ID_current_state == aEvent.GetId() );
} }