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:
parent
c476ae44b5
commit
bdca3c5efb
|
@ -44,13 +44,23 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
|
|||
EDA_DRAW_FRAME::OnZoom )
|
||||
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
|
||||
EDA_DRAW_FRAME::OnSelectGrid )
|
||||
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnToggleGridState )
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
||||
EDA_DRAW_FRAME::OnSelectUnits )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SELECT_CURSOR, EDA_DRAW_FRAME::OnToggleCrossHairStyle )
|
||||
|
||||
EVT_UPDATE_UI( wxID_UNDO, EDA_DRAW_FRAME::OnUpdateUndo )
|
||||
EVT_UPDATE_UI( wxID_REDO, EDA_DRAW_FRAME::OnUpdateRedo )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnUpdateGrid )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, EDA_DRAW_FRAME::OnUpdateCrossHairStyle )
|
||||
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
||||
EDA_DRAW_FRAME::OnUpdateUnits )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype,
|
||||
const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style ) :
|
||||
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, long style ) :
|
||||
EDA_BASE_FRAME( father, idtype, title, pos, size, style )
|
||||
{
|
||||
wxSize minsize;
|
||||
|
@ -154,6 +164,79 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
|
||||
{
|
||||
SetGridVisibility( !IsGridVisible() );
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnSelectUnits( wxCommandEvent& aEvent )
|
||||
{
|
||||
|
||||
if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && g_UserUnit != MILLIMETRES )
|
||||
{
|
||||
g_UserUnit = MILLIMETRES;
|
||||
UpdateStatusBar();
|
||||
}
|
||||
else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && g_UserUnit != INCHES )
|
||||
{
|
||||
g_UserUnit = INCHES;
|
||||
UpdateStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
|
||||
{
|
||||
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||
DrawPanel->CrossHairOff( &dc );
|
||||
m_CursorShape = !m_CursorShape;
|
||||
DrawPanel->CrossHairOn( &dc );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnUpdateUndo( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( GetScreen() )
|
||||
aEvent.Enable( GetScreen()->GetUndoCommandCount() > 0 );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnUpdateRedo( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( GetScreen() )
|
||||
aEvent.Enable( GetScreen()->GetRedoCommandCount() > 0 );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnUpdateUnits( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
bool enable;
|
||||
|
||||
enable = ( ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM) && (g_UserUnit == MILLIMETRES))
|
||||
|| ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH) && (g_UserUnit == INCHES)) );
|
||||
|
||||
aEvent.Check( enable );
|
||||
DisplayUnitsMsg();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnUpdateGrid( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
|
||||
|
||||
aEvent.Check( IsGridVisible() );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( m_CursorShape );
|
||||
}
|
||||
|
||||
|
||||
// Virtual function
|
||||
void EDA_DRAW_FRAME::ReCreateAuxiliaryToolbar()
|
||||
{
|
||||
|
@ -177,6 +260,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function PrintPage (virtual)
|
||||
* used to print a page
|
||||
|
@ -307,15 +391,6 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::SetToolbars()
|
||||
{
|
||||
DisplayUnitsMsg();
|
||||
|
||||
if( m_auimgr.GetManagedWindow() )
|
||||
m_auimgr.Update();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
|
||||
{
|
||||
SetStatusText( msg, 5 );
|
||||
|
@ -379,53 +454,14 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
|
|||
|
||||
// Change DrawPanel cursor if requested.
|
||||
if( DrawPanel && aCursor >= 0 )
|
||||
{
|
||||
DrawPanel->SetCursor( aCursor );
|
||||
}
|
||||
|
||||
DisplayToolMsg( aToolMsg );
|
||||
|
||||
if( aId < 0 )
|
||||
return;
|
||||
|
||||
// Old Tool ID_NO_SELECT_BUTT active or inactive if no new tool.
|
||||
if( m_ID_current_state )
|
||||
{
|
||||
if( m_VToolBar )
|
||||
m_VToolBar->ToggleTool( m_ID_current_state, FALSE );
|
||||
|
||||
if( m_AuxVToolBar )
|
||||
m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aId )
|
||||
{
|
||||
if( m_VToolBar )
|
||||
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, FALSE );
|
||||
|
||||
if( m_AuxVToolBar )
|
||||
m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE );
|
||||
}
|
||||
else if( m_VToolBar )
|
||||
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
|
||||
}
|
||||
|
||||
if( aId )
|
||||
{
|
||||
if( m_VToolBar )
|
||||
m_VToolBar->ToggleTool( aId, TRUE );
|
||||
|
||||
if( m_AuxVToolBar )
|
||||
m_AuxVToolBar->ToggleTool( aId, TRUE );
|
||||
}
|
||||
else if( m_VToolBar )
|
||||
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
|
||||
|
||||
m_ID_current_state = aId;
|
||||
|
||||
if( m_VToolBar )
|
||||
m_VToolBar->Refresh( );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#define CURSOR_SIZE 12 // Cursor size in pixels
|
||||
|
||||
#define CLIP_BOX_PADDING 1
|
||||
#define CLIP_BOX_PADDING 2
|
||||
|
||||
/* Definitions for enabling and disabling debugging features in drawpanel.cpp.
|
||||
* Please don't forget to turn these off before making any commits to Launchpad.
|
||||
|
@ -749,6 +749,8 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
|
|||
cmd.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
@ -882,7 +884,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
wxPoint pos = CalcUnscrolledPosition( event.GetPosition() );
|
||||
|
||||
/* Compute the cursor position in drawing (logical) units. */
|
||||
screen->m_MousePosition = event.GetLogicalPosition( DC );
|
||||
screen->SetMousePosition( event.GetLogicalPosition( DC ) );
|
||||
|
||||
int kbstat = 0;
|
||||
|
||||
|
@ -902,7 +904,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
// Calling Double Click and Click functions :
|
||||
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
|
||||
{
|
||||
GetParent()->OnLeftDClick( &DC, screen->m_MousePosition );
|
||||
GetParent()->OnLeftDClick( &DC, screen->RefPos( true ) );
|
||||
|
||||
// inhibit a response to the mouse left button release,
|
||||
// because we have a double click, and we do not want a new
|
||||
|
@ -914,7 +916,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
// A block command is in progress: a left up is the end of block
|
||||
// or this is the end of a double click, already seen
|
||||
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease )
|
||||
GetParent()->OnLeftClick( &DC, screen->m_MousePosition );
|
||||
GetParent()->OnLeftClick( &DC, screen->RefPos( true ) );
|
||||
|
||||
ignoreNextLeftButtonRelease = false;
|
||||
}
|
||||
|
@ -1140,7 +1142,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
|||
|
||||
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
|
||||
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
|
||||
Screen->m_MousePosition = pos;
|
||||
Screen->SetMousePosition( pos );
|
||||
|
||||
GetParent()->GeneralControle( &DC, pos );
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
|
|||
m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection();
|
||||
m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue();
|
||||
m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue();
|
||||
m_Parent->SetToolbars();
|
||||
m_Parent->DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
|
|||
if( firstsegment == NULL )
|
||||
return;
|
||||
|
||||
if( ( firstsegment->m_Flags & IS_NEW ) == 0 )
|
||||
if( !firstsegment->IsNew() )
|
||||
return;
|
||||
|
||||
/* Delete Null segments and Put line it in Drawlist */
|
||||
|
|
|
@ -29,7 +29,7 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
{
|
||||
BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
|
||||
|
||||
if( BusEntry->m_Flags & IS_NEW )
|
||||
if( BusEntry->IsNew() )
|
||||
{
|
||||
delete BusEntry;
|
||||
Panel->GetScreen()->SetCurItem( NULL );
|
||||
|
@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
|
|||
if( BusEntry == NULL )
|
||||
return;
|
||||
|
||||
if( (BusEntry->m_Flags & IS_NEW) == 0 ) // not already in edit, save shape
|
||||
if( !BusEntry->IsNew() ) // not already in edit, save shape
|
||||
{
|
||||
delete g_ItemToUndoCopy;
|
||||
g_ItemToUndoCopy = BusEntry->Clone();
|
||||
|
|
|
@ -204,7 +204,7 @@ LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary )
|
|||
|
||||
BOOST_FOREACH( LIB_DRAW_ITEM& oldItem, aComponent.GetDrawItemList() )
|
||||
{
|
||||
if( ( oldItem.m_Flags & IS_NEW ) != 0 )
|
||||
if( oldItem.IsNew() )
|
||||
continue;
|
||||
|
||||
newItem = oldItem.GenCopy();
|
||||
|
|
|
@ -310,7 +310,6 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
|
|||
}
|
||||
|
||||
UpdateStatusBar(); /* Display cursor coordinates info */
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
@ -473,5 +472,4 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
|
|||
}
|
||||
|
||||
UpdateStatusBar();
|
||||
SetToolbars();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
|
|||
|
||||
m_itemToRepeat = NULL;
|
||||
|
||||
if( (TextStruct->m_Flags & IS_NEW) == 0 )
|
||||
if( !TextStruct->IsNew() )
|
||||
{
|
||||
delete g_ItemToUndoCopy;
|
||||
g_ItemToUndoCopy = TextStruct->Clone();
|
||||
|
@ -227,7 +227,7 @@ static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
* created)*/
|
||||
Struct->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
|
||||
|
||||
if( Struct->m_Flags & IS_NEW )
|
||||
if( Struct->IsNew() )
|
||||
{
|
||||
SAFE_DELETE( Struct );
|
||||
screen->SetCurItem( NULL );
|
||||
|
|
|
@ -23,7 +23,9 @@ enum id_eeschema_frm
|
|||
|
||||
/* Schematic editor veritcal toolbar IDs */
|
||||
ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
|
||||
ID_SCH_NO_TOOL,
|
||||
ID_HIERARCHY_PUSH_POP_BUTT,
|
||||
ID_SCH_PLACE_COMPONENT,
|
||||
ID_PLACE_POWER_BUTT,
|
||||
ID_BUS_BUTT,
|
||||
ID_WIRE_BUTT,
|
||||
|
@ -154,16 +156,17 @@ enum id_eeschema_frm
|
|||
ID_LIBEDIT_SELECT_ALIAS,
|
||||
|
||||
/* Library editor vertical toolbar IDs. */
|
||||
ID_LIBEDIT_NO_TOOL,
|
||||
ID_LIBEDIT_PIN_BUTT,
|
||||
ID_LIBEDIT_BODY_LINE_BUTT,
|
||||
ID_LIBEDIT_BODY_ARC_BUTT,
|
||||
ID_LIBEDIT_BODY_CIRCLE_BUTT,
|
||||
ID_LIBEDIT_BODY_RECT_BUTT,
|
||||
ID_LIBEDIT_BODY_TEXT_BUTT,
|
||||
ID_LIBEDIT_DELETE_ITEM_BUTT,
|
||||
ID_LIBEDIT_ANCHOR_ITEM_BUTT,
|
||||
ID_LIBEDIT_IMPORT_BODY_BUTT,
|
||||
ID_LIBEDIT_EXPORT_BODY_BUTT,
|
||||
ID_LIBEDIT_DELETE_ITEM_BUTT,
|
||||
|
||||
/* Library editor context menu IDs */
|
||||
ID_LIBEDIT_EDIT_PIN,
|
||||
|
|
|
@ -269,7 +269,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
// notBusy == true means no item currently edited and no other command in progress
|
||||
// We can change active tool and ask for editing a new item
|
||||
bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK);
|
||||
bool RefreshToolBar = FALSE;
|
||||
|
||||
if( aHotKey == 0 )
|
||||
return;
|
||||
|
@ -343,7 +342,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
case HK_DELETE:
|
||||
if( notBusy)
|
||||
{
|
||||
RefreshToolBar = LocateAndDeleteItem( this, aDC );
|
||||
LocateAndDeleteItem( this, aDC );
|
||||
OnModify();
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
GetScreen()->TestDanglingEnds( DrawPanel, aDC );
|
||||
|
@ -390,8 +389,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
if( !itemInEdit )
|
||||
{
|
||||
// switch to m_ID_current_state = ID_COMPONENT_BUTT;
|
||||
if( m_ID_current_state != ID_COMPONENT_BUTT )
|
||||
SetToolID( ID_COMPONENT_BUTT, wxCURSOR_PENCIL, _( "Add Component" ) );
|
||||
if( m_ID_current_state != ID_SCH_PLACE_COMPONENT )
|
||||
SetToolID( ID_SCH_PLACE_COMPONENT, wxCURSOR_PENCIL, _( "Add Component" ) );
|
||||
|
||||
OnLeftClick( aDC, aPosition );
|
||||
}
|
||||
|
@ -648,7 +647,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
if( aItem->m_Flags == 0 )
|
||||
{
|
||||
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
|
||||
RefreshToolBar = TRUE;
|
||||
}
|
||||
|
||||
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_Y );
|
||||
|
@ -670,7 +668,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
if( aItem->m_Flags == 0 )
|
||||
{
|
||||
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
|
||||
RefreshToolBar = TRUE;
|
||||
}
|
||||
|
||||
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_X );
|
||||
|
@ -686,7 +683,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
if( aItem->m_Flags == 0 )
|
||||
{
|
||||
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
|
||||
RefreshToolBar = TRUE;
|
||||
}
|
||||
|
||||
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_NORMAL );
|
||||
|
@ -880,9 +876,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( RefreshToolBar )
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
@ -979,7 +972,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
break;
|
||||
|
||||
case HK_EDIT:
|
||||
m_drawItem = LocateItemUsingCursor();
|
||||
m_drawItem = LocateItemUsingCursor( aPosition );
|
||||
|
||||
if( m_drawItem )
|
||||
{
|
||||
|
@ -1011,7 +1004,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
break;
|
||||
|
||||
case HK_ROTATE:
|
||||
m_drawItem = LocateItemUsingCursor();
|
||||
m_drawItem = LocateItemUsingCursor( aPosition );
|
||||
|
||||
if( m_drawItem )
|
||||
{
|
||||
|
@ -1047,7 +1040,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
}
|
||||
|
||||
case HK_DELETE:
|
||||
m_drawItem = LocateItemUsingCursor();
|
||||
m_drawItem = LocateItemUsingCursor( aPosition );
|
||||
|
||||
if( m_drawItem && !m_drawItem->InEditMode() )
|
||||
{
|
||||
|
@ -1058,7 +1051,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
break;
|
||||
|
||||
case HK_LIBEDIT_MOVE_GRAPHIC_ITEM:
|
||||
m_drawItem = LocateItemUsingCursor();
|
||||
m_drawItem = LocateItemUsingCursor( aPosition );
|
||||
|
||||
if( m_drawItem && !m_drawItem->InEditMode() )
|
||||
{
|
||||
|
@ -1069,7 +1062,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
break;
|
||||
|
||||
case HK_DRAG:
|
||||
m_drawItem = LocateItemUsingCursor();
|
||||
m_drawItem = LocateItemUsingCursor( aPosition );
|
||||
|
||||
if( m_drawItem && !m_drawItem->InEditMode() )
|
||||
{
|
||||
|
|
|
@ -328,7 +328,7 @@ int LIB_ARC::GetPenSize()
|
|||
void LIB_ARC::drawEditGraphics( EDA_Rect* aClipBox, wxDC* aDC, int aColor )
|
||||
{
|
||||
// The edit indicators only get drawn when a new arc is being drawn.
|
||||
if( ( m_Flags & IS_NEW ) == 0 )
|
||||
if( !IsNew() )
|
||||
return;
|
||||
|
||||
// Use the last edit state so when the drawing switches from the end mode to the center
|
||||
|
@ -350,7 +350,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
|
|||
{
|
||||
// Don't draw the arc until the end point is selected. Only the edit indicators
|
||||
// get drawn at this time.
|
||||
if( ( m_Flags & IS_NEW ) && m_lastEditState == 1 )
|
||||
if( IsNew() && m_lastEditState == 1 )
|
||||
return;
|
||||
|
||||
wxPoint pos1, pos2, posc;
|
||||
|
|
|
@ -509,7 +509,7 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
|
|||
|
||||
if( ( pinList[i]->m_position == m_position )
|
||||
&& ( pinList[i]->m_orientation == m_orientation )
|
||||
&& ( !( m_Flags & IS_NEW ) )
|
||||
&& !IsNew()
|
||||
&& editPinByPin == false
|
||||
&& enable )
|
||||
pinList[i]->m_Flags |= IS_LINKED | IN_EDIT;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "class_libentry.h"
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
|
||||
{
|
||||
LIB_DRAW_ITEM* DrawEntry = m_drawItem;
|
||||
|
||||
|
@ -43,8 +43,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
}
|
||||
else
|
||||
{
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
||||
GetScreen()->m_MousePosition );
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
||||
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
|
@ -64,7 +63,8 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
switch( m_ID_current_state )
|
||||
{
|
||||
case ID_NO_SELECT_BUTT:
|
||||
case 0:
|
||||
case ID_LIBEDIT_NO_TOOL:
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_PIN_BUTT:
|
||||
|
@ -89,7 +89,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
}
|
||||
else if( m_drawItem )
|
||||
{
|
||||
if( m_drawItem->m_Flags & IS_NEW )
|
||||
if( m_drawItem->IsNew() )
|
||||
GraphicItemBeginDraw( DC );
|
||||
else
|
||||
EndDrawGraphicItem( DC );
|
||||
|
@ -97,14 +97,14 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
break;
|
||||
|
||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
||||
GetScreen()->m_MousePosition );
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
||||
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
||||
GetScreen()->GetCrossHairPosition() );
|
||||
}
|
||||
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DisplayCmpDoc();
|
||||
|
@ -142,7 +142,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
* If an editable item (field, pin, graphic):
|
||||
* Call the suitable dialog editor.
|
||||
*/
|
||||
void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||
void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
|
||||
{
|
||||
wxPoint pos = GetPosition();
|
||||
|
||||
|
@ -151,8 +151,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
|
||||
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
|
||||
{ // We can locate an item
|
||||
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
||||
GetScreen()->m_MousePosition );
|
||||
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
||||
if( m_drawItem == NULL )
|
||||
{
|
||||
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
||||
|
@ -198,7 +197,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
EditGraphicSymbol( DC, m_drawItem );
|
||||
}
|
||||
else if( m_drawItem->m_Flags & IS_NEW )
|
||||
else if( m_drawItem->IsNew() )
|
||||
{
|
||||
EndDrawGraphicItem( DC );
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ static void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame );
|
|||
static void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame );
|
||||
|
||||
|
||||
bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
|
||||
bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
||||
{
|
||||
LIB_DRAW_ITEM* DrawEntry = LocateItemUsingCursor();
|
||||
LIB_DRAW_ITEM* DrawEntry = LocateItemUsingCursor( aPosition );
|
||||
bool BlockActive = GetScreen()->IsBlockActive();
|
||||
|
||||
if( BlockActive )
|
||||
|
|
|
@ -80,7 +80,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate )
|
||||
|
||||
/* Main horizontal toolbar. */
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, LIB_EDIT_FRAME::OnZoom )
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, LIB_EDIT_FRAME::OnZoom )
|
||||
EVT_TOOL( ID_LIBEDIT_SAVE_CURRENT_LIB, LIB_EDIT_FRAME::SaveActiveLibrary )
|
||||
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB, LIB_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_LIBEDIT_DELETE_PART, LIB_EDIT_FRAME::DeleteOnePart )
|
||||
|
@ -106,9 +106,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias )
|
||||
|
||||
/* Right vertical toolbar. */
|
||||
EVT_TOOL( ID_NO_SELECT_BUTT, LIB_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT,
|
||||
LIB_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL_RANGE( ID_LIBEDIT_NO_TOOL, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
||||
LIB_EDIT_FRAME::OnSelectTool )
|
||||
|
||||
/* menubar commands */
|
||||
EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow )
|
||||
|
@ -158,7 +157,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnUpdateSelectAlias )
|
||||
EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal )
|
||||
EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert )
|
||||
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT,
|
||||
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_NO_TOOL, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
||||
LIB_EDIT_FRAME::OnUpdateEditingPart )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
@ -180,6 +179,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
|
|||
m_drawSpecificUnit = false;
|
||||
m_tempCopyComponent = NULL;
|
||||
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
|
||||
m_ID_current_state = ID_LIBEDIT_NO_TOOL;
|
||||
|
||||
// Give an icon
|
||||
SetIcon( wxIcon( libedit_xpm ) );
|
||||
|
@ -251,8 +251,10 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
|
|||
|
||||
frame->m_LibeditFrame = NULL;
|
||||
m_drawItem = m_lastDrawItem = NULL;
|
||||
|
||||
if ( m_tempCopyComponent )
|
||||
delete m_tempCopyComponent;
|
||||
|
||||
m_tempCopyComponent = NULL;
|
||||
}
|
||||
|
||||
|
@ -433,9 +435,18 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
|
|||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::OnUpdateEditingPart( wxUpdateUIEvent& event )
|
||||
void LIB_EDIT_FRAME::OnUpdateEditingPart( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
event.Enable( m_component != NULL );
|
||||
aEvent.Enable( m_component != NULL );
|
||||
|
||||
if( m_component != NULL )
|
||||
{
|
||||
if( m_ID_current_state == 0 )
|
||||
m_ID_current_state = ID_LIBEDIT_NO_TOOL;
|
||||
|
||||
if( aEvent.GetEventObject() == m_VToolBar )
|
||||
aEvent.Check( m_ID_current_state == aEvent.GetId() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -487,8 +498,7 @@ void LIB_EDIT_FRAME::OnUpdatePinByPin( wxUpdateUIEvent& event )
|
|||
event.Enable( ( m_component != NULL )
|
||||
&& ( ( m_component->GetPartCount() > 1 ) || m_showDeMorgan ) );
|
||||
|
||||
if( m_HToolBar )
|
||||
m_HToolBar->ToggleTool( event.GetId(), g_EditPinByPinIsOn );
|
||||
event.Check( g_EditPinByPinIsOn );
|
||||
}
|
||||
|
||||
|
||||
|
@ -510,7 +520,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
|
|||
return;
|
||||
|
||||
event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) );
|
||||
m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 );
|
||||
event.Check( m_convert <= 1 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -520,7 +530,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
|
|||
return;
|
||||
|
||||
event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) );
|
||||
m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 );
|
||||
event.Check( m_convert > 1 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -539,7 +549,7 @@ void LIB_EDIT_FRAME::OnUpdateSelectAlias( wxUpdateUIEvent& event )
|
|||
void LIB_EDIT_FRAME::OnSelectAlias( wxCommandEvent& event )
|
||||
{
|
||||
if( m_SelAliasBox == NULL
|
||||
|| m_SelAliasBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0 )
|
||||
|| ( m_SelAliasBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0) )
|
||||
return;
|
||||
|
||||
m_lastDrawItem = NULL;
|
||||
|
@ -660,61 +670,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
g_EditPinByPinIsOn = m_HToolBar->GetToolState(ID_LIBEDIT_EDIT_PIN_BY_PIN);
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_PIN_BUTT:
|
||||
if( m_component )
|
||||
{
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add pin" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetToolID( id, wxCURSOR_ARROW, _( "Set pin options" ) );
|
||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_NO_SELECT_BUTT:
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_TEXT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_RECT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add rectangle" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_ARC_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_LINE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Set anchor position" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_IMPORT_BODY_BUTT:
|
||||
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
|
||||
LoadOneSymbol();
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_EXPORT_BODY_BUTT:
|
||||
SetToolID( id, wxCURSOR_ARROW, _( "Export" ) );
|
||||
SaveOneSymbol();
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
if( m_drawItem )
|
||||
|
@ -749,17 +704,6 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||
if( m_component == NULL )
|
||||
{
|
||||
wxBell();
|
||||
break;
|
||||
}
|
||||
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
||||
break;
|
||||
|
||||
|
||||
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
|
||||
{
|
||||
// Delete the last created segment, while creating a polyline draw item
|
||||
|
@ -873,8 +817,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
|
||||
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
|
||||
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
|
||||
if( (m_drawItem == NULL )
|
||||
|| (m_drawItem->Type() != LIB_PIN_T) )
|
||||
if( ( m_drawItem == NULL ) || ( m_drawItem->Type() != LIB_PIN_T ) )
|
||||
break;
|
||||
SaveCopyInUndoList( m_component );
|
||||
GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
|
||||
|
@ -1081,3 +1024,86 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
|
|||
DrawPanel->MoveCursorToCrossHair();
|
||||
DrawPanel->CrossHairOn( &dc );
|
||||
}
|
||||
|
||||
void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||
{
|
||||
int id = aEvent.GetId();
|
||||
|
||||
if( m_ID_current_state == 0 )
|
||||
m_lastDrawItem = NULL;
|
||||
|
||||
DrawPanel->EndMouseCapture( ID_LIBEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_LIBEDIT_NO_TOOL:
|
||||
SetToolID( id, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_PIN_BUTT:
|
||||
if( m_component )
|
||||
{
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add pin" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetToolID( id, wxCURSOR_ARROW, _( "Set pin options" ) );
|
||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_TEXT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_RECT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add rectangle" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_ARC_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_LINE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Set anchor position" ) );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_IMPORT_BODY_BUTT:
|
||||
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
|
||||
LoadOneSymbol();
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_EXPORT_BODY_BUTT:
|
||||
SetToolID( id, wxCURSOR_ARROW, _( "Export" ) );
|
||||
SaveOneSymbol();
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||
if( m_component == NULL )
|
||||
{
|
||||
wxBell();
|
||||
break;
|
||||
}
|
||||
|
||||
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DrawPanel->m_IgnoreMouseEvents = false;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
void Process_Config( wxCommandEvent& event );
|
||||
void OnPlotCurrentComponent( wxCommandEvent& event );
|
||||
void Process_Special_Functions( wxCommandEvent& event );
|
||||
void OnSelectTool( wxCommandEvent& aEvent );
|
||||
void OnImportPart( wxCommandEvent& event );
|
||||
void OnExportPart( wxCommandEvent& event );
|
||||
void OnSelectAlias( wxCommandEvent& event );
|
||||
|
@ -75,6 +76,7 @@ public:
|
|||
void OnEditPin( wxCommandEvent& event );
|
||||
void OnRotatePin( wxCommandEvent& event );
|
||||
|
||||
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateEditingPart( wxUpdateUIEvent& event );
|
||||
void OnUpdateNotEditingPart( wxUpdateUIEvent& event );
|
||||
void OnUpdateUndo( wxUpdateUIEvent& event );
|
||||
|
@ -248,7 +250,7 @@ private:
|
|||
void SaveOneSymbol();
|
||||
void EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem );
|
||||
void EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem );
|
||||
LIB_DRAW_ITEM* LocateItemUsingCursor();
|
||||
LIB_DRAW_ITEM* LocateItemUsingCursor( const wxPoint& aPosition );
|
||||
void EditField( wxDC* DC, LIB_FIELD* Field );
|
||||
|
||||
public:
|
||||
|
|
|
@ -154,19 +154,19 @@ this component?" ),
|
|||
}
|
||||
|
||||
|
||||
LIB_DRAW_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor()
|
||||
LIB_DRAW_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor( const wxPoint& aPosition )
|
||||
{
|
||||
if( m_component == NULL )
|
||||
return NULL;
|
||||
|
||||
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
|
||||
{
|
||||
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
||||
GetScreen()->m_MousePosition );
|
||||
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
||||
|
||||
if( m_drawItem == NULL )
|
||||
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
||||
GetScreen()->GetCrossHairPosition() );
|
||||
wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition );
|
||||
|
||||
if( m_drawItem == NULL && aPosition != pos )
|
||||
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, pos );
|
||||
}
|
||||
|
||||
return m_drawItem;
|
||||
|
|
|
@ -45,7 +45,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
|
|||
|
||||
while( DrawList )
|
||||
{
|
||||
if( !SnapPoint2( Screen->m_MousePosition, COMPONENT_T, DrawList ) )
|
||||
if( !SnapPoint2( Screen->RefPos( true ), COMPONENT_T, DrawList ) )
|
||||
{
|
||||
if( !SnapPoint2( Screen->GetCrossHairPosition(), COMPONENT_T, DrawList ) )
|
||||
break;
|
||||
|
|
|
@ -240,7 +240,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
/* Component */
|
||||
text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut
|
||||
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text,
|
||||
item = new wxMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text,
|
||||
HELP_PLACE_COMPONENTS, wxITEM_NORMAL );
|
||||
item->SetBitmap( add_component_xpm );
|
||||
placeMenu->Append( item );
|
||||
|
|
|
@ -31,7 +31,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
SCH_ITEM* item = GetScreen()->GetCurItem();
|
||||
wxPoint gridPosition = GetGridPosition( aPosition );
|
||||
|
||||
if( ( m_ID_current_state == 0 ) || ( item && item->m_Flags ) )
|
||||
if( ( m_ID_current_state == ID_SCH_NO_TOOL )
|
||||
|| ( m_ID_current_state == 0 )
|
||||
|| ( item && item->m_Flags ) )
|
||||
{
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
m_itemToRepeat = NULL;
|
||||
|
@ -84,13 +86,11 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
switch( m_ID_current_state )
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case ID_NO_SELECT_BUTT:
|
||||
case ID_SCH_NO_TOOL:
|
||||
break;
|
||||
|
||||
case ID_HIERARCHY_PUSH_POP_BUTT:
|
||||
if( item && item->m_Flags )
|
||||
if( ( item && item->m_Flags ) || ( g_RootSheet->CountSheets() == 0 ) )
|
||||
break;
|
||||
|
||||
item = LocateAndShowItem( aPosition );
|
||||
|
@ -274,7 +274,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
}
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
case ID_SCH_PLACE_COMPONENT:
|
||||
if( (item == NULL) || (item->m_Flags == 0) )
|
||||
{
|
||||
GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) );
|
||||
|
@ -334,6 +334,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
|
||||
switch( m_ID_current_state )
|
||||
{
|
||||
case ID_SCH_NO_TOOL:
|
||||
case 0:
|
||||
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
||||
{
|
||||
|
@ -380,7 +381,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
case ID_BUS_BUTT:
|
||||
case ID_WIRE_BUTT:
|
||||
case ID_LINE_COMMENT_BUTT:
|
||||
if( item && ( item->m_Flags & IS_NEW ) )
|
||||
if( item && item->IsNew() )
|
||||
EndSegment( aDC );
|
||||
|
||||
break;
|
||||
|
|
|
@ -489,7 +489,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
|
|||
|
||||
void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame )
|
||||
{
|
||||
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE;
|
||||
bool is_new = Junction->IsNew();
|
||||
wxString msg;
|
||||
|
||||
if( !is_new )
|
||||
|
@ -513,7 +513,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM
|
|||
|
||||
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
|
||||
{
|
||||
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
|
||||
bool is_new = Wire->IsNew();
|
||||
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
|
||||
wxString msg;
|
||||
|
||||
|
@ -551,9 +551,10 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
|
|||
|
||||
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
|
||||
{
|
||||
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
|
||||
bool is_new = Bus->IsNew();
|
||||
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
|
||||
wxString msg;
|
||||
|
||||
if( is_new )
|
||||
{
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm );
|
||||
|
|
|
@ -188,7 +188,7 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
if( CurrentPin == NULL || CurrentPin->Type() != LIB_PIN_T )
|
||||
return;
|
||||
|
||||
if( CurrentPin->m_Flags & IS_NEW )
|
||||
if( CurrentPin->IsNew() )
|
||||
delete CurrentPin;
|
||||
else
|
||||
parent->RestoreComponent();
|
||||
|
|
|
@ -602,9 +602,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
|
|||
void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
|
||||
{
|
||||
/* save old text in undo list */
|
||||
if( g_ItemToUndoCopy
|
||||
&& ( g_ItemToUndoCopy->Type() == Type() )
|
||||
&& ( ( m_Flags & IS_NEW ) == 0 ) )
|
||||
if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == Type() ) && !IsNew() )
|
||||
{
|
||||
/* restore old values and save new ones */
|
||||
SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
|
||||
|
|
|
@ -325,7 +325,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
|
|||
void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
|
||||
{
|
||||
/* save old text in undo list */
|
||||
if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) )
|
||||
if( g_ItemToUndoCopy && !IsNew() )
|
||||
{
|
||||
/* restore old values and save new ones */
|
||||
SwapData( (SCH_TEXT*) g_ItemToUndoCopy );
|
||||
|
|
|
@ -159,74 +159,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() );
|
||||
break;
|
||||
|
||||
case ID_HIERARCHY_PUSH_POP_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Push/Pop Hierarchy" ) );
|
||||
break;
|
||||
|
||||
case ID_NOCONN_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add NoConnect Flag" ) );
|
||||
break;
|
||||
|
||||
case ID_WIRE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Wire" ) );
|
||||
break;
|
||||
|
||||
case ID_BUS_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Bus" ) );
|
||||
break;
|
||||
|
||||
case ID_LINE_COMMENT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Lines" ) );
|
||||
break;
|
||||
|
||||
case ID_JUNCTION_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Junction" ) );
|
||||
break;
|
||||
|
||||
case ID_LABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Label" ) );
|
||||
break;
|
||||
|
||||
case ID_GLABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Global label" ) );
|
||||
break;
|
||||
|
||||
case ID_HIERLABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchical label" ) );
|
||||
break;
|
||||
|
||||
case ID_TEXT_COMMENT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
|
||||
break;
|
||||
|
||||
case ID_WIRETOBUS_ENTRY_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Wire to Bus entry" ) );
|
||||
break;
|
||||
|
||||
case ID_BUSTOBUS_ENTRY_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Bus to Bus entry" ) );
|
||||
break;
|
||||
|
||||
case ID_SHEET_SYMBOL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Sheet" ) );
|
||||
break;
|
||||
|
||||
case ID_SHEET_LABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add PinSheet" ) );
|
||||
break;
|
||||
|
||||
case ID_IMPORT_HLABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Import PinSheet" ) );
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Component" ) );
|
||||
break;
|
||||
|
||||
case ID_PLACE_POWER_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Power" ) );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' );
|
||||
|
@ -338,10 +270,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
}
|
||||
break;
|
||||
|
||||
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
||||
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_END_SHEET:
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
screen->GetCurItem()->Place( this, &dc );
|
||||
|
@ -399,7 +327,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_SCH_MOVE_CMP_REQUEST:
|
||||
|
||||
// Ensure the struct is a component (could be a struct of a
|
||||
// component, like Field, text..) or a hierachical sheet
|
||||
// component, like Field, text..) or a hierarchical sheet
|
||||
// or a label
|
||||
if( (screen->GetCurItem()->Type() != SCH_COMPONENT_T)
|
||||
&& (screen->GetCurItem()->Type() != SCH_LABEL_T)
|
||||
|
@ -729,8 +657,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
if( m_ID_current_state == 0 )
|
||||
m_itemToRepeat = NULL;
|
||||
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
@ -805,3 +731,104 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
|
|||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||
{
|
||||
int id = aEvent.GetId();
|
||||
|
||||
// Stop the current command and deselect the current tool.
|
||||
DrawPanel->EndMouseCapture( ID_SCH_NO_TOOL, DrawPanel->GetDefaultCursor() );
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_SCH_NO_TOOL:
|
||||
SetToolID( id, DrawPanel->GetDefaultCursor(), _( "No tool selected" ) );
|
||||
break;
|
||||
|
||||
case ID_HIERARCHY_PUSH_POP_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Descend or ascend hierarchy" ) );
|
||||
break;
|
||||
|
||||
case ID_NOCONN_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add no connect" ) );
|
||||
break;
|
||||
|
||||
case ID_WIRE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire" ) );
|
||||
break;
|
||||
|
||||
case ID_BUS_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus" ) );
|
||||
break;
|
||||
|
||||
case ID_LINE_COMMENT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add lines" ) );
|
||||
break;
|
||||
|
||||
case ID_JUNCTION_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add junction" ) );
|
||||
break;
|
||||
|
||||
case ID_LABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add label" ) );
|
||||
break;
|
||||
|
||||
case ID_GLABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add global label" ) );
|
||||
break;
|
||||
|
||||
case ID_HIERLABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add hierarchical label" ) );
|
||||
break;
|
||||
|
||||
case ID_TEXT_COMMENT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
||||
break;
|
||||
|
||||
case ID_WIRETOBUS_ENTRY_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire to bus entry" ) );
|
||||
break;
|
||||
|
||||
case ID_BUSTOBUS_ENTRY_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus to bus entry" ) );
|
||||
break;
|
||||
|
||||
case ID_SHEET_SYMBOL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet" ) );
|
||||
break;
|
||||
|
||||
case ID_SHEET_LABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet pins" ) );
|
||||
break;
|
||||
|
||||
case ID_IMPORT_HLABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Import sheet pins" ) );
|
||||
break;
|
||||
|
||||
case ID_SCH_PLACE_COMPONENT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add component" ) );
|
||||
break;
|
||||
|
||||
case ID_PLACE_POWER_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add power" ) );
|
||||
break;
|
||||
|
||||
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
||||
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
m_itemToRepeat = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( m_ID_current_state == 0 )
|
||||
m_ID_current_state = ID_SCH_NO_TOOL;
|
||||
|
||||
if( aEvent.GetEventObject() == m_VToolBar )
|
||||
aEvent.Check( m_ID_current_state == aEvent.GetId() );
|
||||
}
|
||||
|
|
|
@ -427,7 +427,6 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
|
|||
OnModify();
|
||||
SetSheetNumberAndCount();
|
||||
ReCreateHToolbar();
|
||||
SetToolbars();
|
||||
|
||||
GetScreen()->TestDanglingEnds();
|
||||
DrawPanel->Refresh();
|
||||
|
@ -453,7 +452,6 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
|
|||
OnModify();
|
||||
SetSheetNumberAndCount();
|
||||
ReCreateHToolbar();
|
||||
SetToolbars();
|
||||
|
||||
GetScreen()->TestDanglingEnds();
|
||||
DrawPanel->Refresh();
|
||||
|
|
|
@ -57,7 +57,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File )
|
||||
EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File )
|
||||
EVT_TOOL( ID_SAVE_PROJECT, SCH_EDIT_FRAME::Save_File )
|
||||
EVT_MENU( wxID_PRINT, SCH_EDIT_FRAME::OnPrint )
|
||||
EVT_MENU( ID_GEN_PLOT_PS, SCH_EDIT_FRAME::ToPlot_PS )
|
||||
EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL )
|
||||
EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print )
|
||||
|
@ -71,8 +70,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU( ID_CONFIG_REQ, SCH_EDIT_FRAME::InstallConfigFrame )
|
||||
EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config )
|
||||
EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config )
|
||||
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START,
|
||||
ID_PREFERENCES_HOTKEY_END,
|
||||
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
|
||||
SCH_EDIT_FRAME::Process_Config )
|
||||
|
||||
EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig )
|
||||
|
@ -80,7 +78,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, SCH_EDIT_FRAME::SetLanguage )
|
||||
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, SCH_EDIT_FRAME::OnZoom )
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, SCH_EDIT_FRAME::OnZoom )
|
||||
|
||||
EVT_TOOL( ID_TO_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor )
|
||||
EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
|
||||
|
@ -102,16 +100,14 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
|
||||
EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
|
||||
EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadStuffFile )
|
||||
EVT_TOOL( ID_COMPONENT_BUTT, SCH_EDIT_FRAME::Process_Special_Functions )
|
||||
|
||||
EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp )
|
||||
EVT_MENU( ID_KICAD_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
|
||||
|
||||
// Tools and buttons for vertical toolbar.
|
||||
EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
|
||||
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
|
||||
ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
||||
SCH_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
||||
SCH_EDIT_FRAME::OnSelectTool )
|
||||
|
||||
EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
|
||||
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
||||
|
@ -128,15 +124,12 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected )
|
||||
EVT_UPDATE_UI( wxID_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected )
|
||||
EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
|
||||
EVT_UPDATE_UI( wxID_UNDO, SCH_EDIT_FRAME::OnUpdateSchematicUndo )
|
||||
EVT_UPDATE_UI( wxID_REDO, SCH_EDIT_FRAME::OnUpdateSchematicRedo )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, SCH_EDIT_FRAME::OnUpdateGrid )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, SCH_EDIT_FRAME::OnUpdateSelectCursor )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
|
||||
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM,
|
||||
ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
||||
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
||||
SCH_EDIT_FRAME::OnUpdateUnits )
|
||||
EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
||||
SCH_EDIT_FRAME::OnUpdateSelectTool )
|
||||
|
||||
/* Search dialog events. */
|
||||
EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
|
||||
|
@ -172,6 +165,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
|
|||
m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr;
|
||||
m_dlgFindReplace = NULL;
|
||||
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
|
||||
m_ID_current_state = ID_SCH_NO_TOOL;
|
||||
|
||||
CreateScreens();
|
||||
|
||||
|
@ -452,6 +446,7 @@ void SCH_EDIT_FRAME::OnModify( )
|
|||
// >> change all sheets.
|
||||
// I believe all sheets in a project must have the same date
|
||||
SCH_SCREEN* screen = s_list.GetFirst();
|
||||
|
||||
for( ; screen != NULL; screen = s_list.GetNext() )
|
||||
screen->m_Date = date;
|
||||
}
|
||||
|
@ -466,76 +461,36 @@ void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
|
|||
bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
|
||||
|
||||
event.Enable( enable );
|
||||
m_HToolBar->EnableTool( wxID_CUT, enable );
|
||||
m_HToolBar->EnableTool( wxID_COPY, enable );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Enable( m_blockItems.GetCount() > 0 );
|
||||
m_HToolBar->EnableTool( wxID_PASTE, m_blockItems.GetCount() > 0 );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
|
||||
{
|
||||
if( GetScreen() )
|
||||
event.Enable( GetScreen()->GetUndoCommandCount() > 0 );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUpdateSchematicRedo( wxUpdateUIEvent& event )
|
||||
{
|
||||
if( GetScreen() )
|
||||
event.Enable( GetScreen()->GetRedoCommandCount() > 0 );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& event )
|
||||
void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxString tool_tip = g_HVLines ?
|
||||
_( "Draw wires and buses in any direction" ) :
|
||||
_( "Draw horizontal and vertical wires and buses only" );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, g_HVLines );
|
||||
aEvent.Check( g_HVLines );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& event )
|
||||
void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) :
|
||||
_( "Show hidden pins" );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, m_ShowAllPins );
|
||||
aEvent.Check( m_ShowAllPins );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUpdateSelectCursor( wxUpdateUIEvent& event )
|
||||
{
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_CursorShape );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUpdateUnits( wxUpdateUIEvent& event )
|
||||
{
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, g_UserUnit == MILLIMETRES );
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, g_UserUnit == INCHES );
|
||||
DisplayUnitsMsg();
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUpdateGrid( wxUpdateUIEvent& event )
|
||||
{
|
||||
wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, IsGridVisible() );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event )
|
||||
{
|
||||
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
|
||||
|
@ -630,10 +585,7 @@ void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
|
|||
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
|
||||
|
||||
if( fn != wxEmptyString )
|
||||
{
|
||||
LoadOneEEProject( fn, false );
|
||||
SetToolbars();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -724,10 +676,7 @@ void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
|
|||
Close( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
*/
|
||||
|
||||
void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
|
||||
{
|
||||
EDA_BASE_FRAME::SetLanguage( event );
|
||||
|
@ -757,8 +706,6 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* Creates the SVG print file for the current edited component.
|
||||
*/
|
||||
void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
|
||||
{
|
||||
DIALOG_SVG_PRINT frame( this );
|
||||
|
|
|
@ -256,7 +256,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
|||
if( sheet == NULL )
|
||||
return;
|
||||
|
||||
if( sheet->m_Flags & IS_NEW )
|
||||
if( sheet->IsNew() )
|
||||
{
|
||||
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
||||
SAFE_DELETE( sheet );
|
||||
|
@ -312,7 +312,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
|
|||
|
||||
void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
|
||||
{
|
||||
if( aSheet == NULL || aSheet->m_Flags & IS_NEW )
|
||||
if( aSheet == NULL || aSheet->IsNew() )
|
||||
return;
|
||||
|
||||
if( aSheet->Type() != SCH_SHEET_T )
|
||||
|
@ -340,7 +340,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
|
|||
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
|
||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
|
||||
|
||||
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo
|
||||
if( aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
|
||||
{
|
||||
delete g_ItemToUndoCopy;
|
||||
g_ItemToUndoCopy = DuplicateStruct( aSheet, true );
|
||||
|
@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
|
|||
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
|
||||
DrawPanel->CrossHairOn( aDC );
|
||||
|
||||
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo
|
||||
if( !aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
|
||||
{
|
||||
delete g_ItemToUndoCopy;
|
||||
g_ItemToUndoCopy = DuplicateStruct( aSheet, true );
|
||||
|
|
|
@ -40,7 +40,7 @@ static void ExitPinSheet( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
if( SheetLabel == NULL )
|
||||
return;
|
||||
|
||||
if( SheetLabel->m_Flags & IS_NEW )
|
||||
if( SheetLabel->IsNew() )
|
||||
{
|
||||
SheetLabel->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
|
||||
SAFE_DELETE( SheetLabel );
|
||||
|
|
|
@ -35,52 +35,37 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
|
|||
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
||||
|
||||
// Set up toolbar
|
||||
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
|
||||
wxBitmap( cursor_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
|
||||
_( "Deselect current tool" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString,
|
||||
wxBitmap( pin_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, wxBitmap( pin_xpm ),
|
||||
HELP_ADD_PIN, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString,
|
||||
wxBitmap( add_text_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString, wxBitmap( add_text_xpm ),
|
||||
HELP_ADD_BODYTEXT, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString,
|
||||
wxBitmap( add_rectangle_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString, wxBitmap( add_rectangle_xpm ),
|
||||
HELP_ADD_BODYRECT, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString,
|
||||
wxBitmap( add_circle_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString, wxBitmap( add_circle_xpm ),
|
||||
HELP_ADD_BODYCIRCLE, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString,
|
||||
wxBitmap( add_arc_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString, wxBitmap( add_arc_xpm ),
|
||||
HELP_ADD_BODYARC, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString,
|
||||
wxBitmap( add_polygon_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString, wxBitmap( add_polygon_xpm ),
|
||||
HELP_ADD_BODYPOLYGON, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString,
|
||||
wxBitmap( anchor_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString, wxBitmap( anchor_xpm ),
|
||||
_( "Move part anchor" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString,
|
||||
wxBitmap( import_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString, wxBitmap( import_xpm ),
|
||||
_( "Import existing drawings" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString,
|
||||
wxBitmap( export_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString, wxBitmap( export_xpm ),
|
||||
_( "Export current drawing" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString,
|
||||
wxBitmap( delete_body_xpm ),
|
||||
m_VToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
|
||||
HELP_DELETE_ITEMS, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->Realize();
|
||||
|
|
|
@ -34,8 +34,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
|
|||
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, wxBitmap( open_xpm ),
|
||||
_( "Open schematic project" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
|
||||
wxBitmap( save_project_xpm ),
|
||||
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, wxBitmap( save_project_xpm ),
|
||||
_( "Save schematic project" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
|
@ -46,13 +45,11 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
|
|||
m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, wxBitmap( libedit_xpm ),
|
||||
_( "Library editor" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString,
|
||||
wxBitmap( library_browse_xpm ),
|
||||
m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, wxBitmap( library_browse_xpm ),
|
||||
_( "Library browser" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString,
|
||||
wxBitmap( hierarchy_nav_xpm ),
|
||||
m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString, wxBitmap( hierarchy_nav_xpm ),
|
||||
_( "Navigate schematic hierarchy" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
|
@ -67,15 +64,11 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
|
|||
_( "Paste" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
msg = AddHotkeyName( HELP_UNDO, s_Schematic_Hokeys_Descr,
|
||||
HK_UNDO, false );
|
||||
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString,
|
||||
wxBitmap( undo_xpm ), msg );
|
||||
msg = AddHotkeyName( HELP_UNDO, s_Schematic_Hokeys_Descr, HK_UNDO, false );
|
||||
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( HELP_REDO,
|
||||
s_Schematic_Hokeys_Descr, HK_REDO, false );
|
||||
m_HToolBar->AddTool( wxID_REDO, wxEmptyString,
|
||||
wxBitmap( redo_xpm ), msg );
|
||||
msg = AddHotkeyName( HELP_REDO, s_Schematic_Hokeys_Descr, HK_REDO, false );
|
||||
m_HToolBar->AddTool( wxID_REDO, wxEmptyString, wxBitmap( redo_xpm ), msg );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
|
||||
|
@ -90,36 +83,26 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
|
|||
|
||||
m_HToolBar->AddSeparator();
|
||||
msg = AddHotkeyName( HELP_ZOOM_IN, s_Schematic_Hokeys_Descr, 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, s_Schematic_Hokeys_Descr,
|
||||
HK_ZOOM_OUT, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
|
||||
msg );
|
||||
msg = AddHotkeyName( HELP_ZOOM_OUT, s_Schematic_Hokeys_Descr, HK_ZOOM_OUT, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( HELP_ZOOM_REDRAW, s_Schematic_Hokeys_Descr,
|
||||
HK_ZOOM_REDRAW, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||
wxBitmap( zoom_redraw_xpm ), msg );
|
||||
msg = AddHotkeyName( HELP_ZOOM_REDRAW, s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( HELP_ZOOM_FIT, s_Schematic_Hokeys_Descr,
|
||||
HK_ZOOM_AUTO, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
|
||||
msg );
|
||||
msg = AddHotkeyName( HELP_ZOOM_FIT, s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ), msg );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
msg = AddHotkeyName( HELP_FIND, s_Schematic_Hokeys_Descr,
|
||||
HK_FIND_ITEM, false );
|
||||
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ),
|
||||
msg );
|
||||
msg = AddHotkeyName( HELP_FIND, s_Schematic_Hokeys_Descr, HK_FIND_ITEM, false );
|
||||
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ), msg );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
|
||||
_( "Netlist generation" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString,
|
||||
wxBitmap( annotate_xpm ),
|
||||
m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, wxBitmap( annotate_xpm ),
|
||||
_( "Annotate schematic" ) );
|
||||
|
||||
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 ),
|
||||
_( "Bill of material and/or Cross references" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString,
|
||||
wxBitmap( backanno_xpm ),
|
||||
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, wxBitmap( backanno_xpm ),
|
||||
_( "Backannotate footprint" ) );
|
||||
|
||||
// after adding the tools to the toolbar, must call Realize() to
|
||||
// reflect the changes
|
||||
// after adding the tools to the toolbar, must call Realize() to reflect the changes
|
||||
m_HToolBar->Realize();
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,63 +125,48 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
|
|||
{
|
||||
if( m_VToolBar )
|
||||
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
|
||||
m_VToolBar->AddTool( ID_CANCEL_CURRENT_COMMAND, wxEmptyString,
|
||||
wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK );
|
||||
m_VToolBar->AddTool( ID_SCH_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
|
||||
wxEmptyString, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_HIERARCHY_PUSH_POP_BUTT, wxEmptyString,
|
||||
wxBitmap( hierarchy_cursor_xpm ),
|
||||
_( "Hierarchy Push/Pop" ), wxITEM_CHECK );
|
||||
_( "Ascend or descend hierarchy" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_COMPONENT_BUTT, wxEmptyString,
|
||||
wxBitmap( add_component_xpm ),
|
||||
m_VToolBar->AddTool( ID_SCH_PLACE_COMPONENT, wxEmptyString, wxBitmap( add_component_xpm ),
|
||||
HELP_PLACE_COMPONENTS, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PLACE_POWER_BUTT, wxEmptyString,
|
||||
wxBitmap( add_power_xpm ),
|
||||
m_VToolBar->AddTool( ID_PLACE_POWER_BUTT, wxEmptyString, wxBitmap( add_power_xpm ),
|
||||
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 );
|
||||
|
||||
m_VToolBar->AddTool( ID_BUS_BUTT, wxEmptyString,
|
||||
wxBitmap( add_bus_xpm ),
|
||||
m_VToolBar->AddTool( ID_BUS_BUTT, wxEmptyString, wxBitmap( add_bus_xpm ),
|
||||
HELP_PLACE_BUS, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_WIRETOBUS_ENTRY_BUTT, wxEmptyString,
|
||||
wxBitmap( add_line2bus_xpm ),
|
||||
m_VToolBar->AddTool( ID_WIRETOBUS_ENTRY_BUTT, wxEmptyString, wxBitmap( add_line2bus_xpm ),
|
||||
HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_BUSTOBUS_ENTRY_BUTT, wxEmptyString,
|
||||
wxBitmap( add_bus2bus_xpm ),
|
||||
m_VToolBar->AddTool( ID_BUSTOBUS_ENTRY_BUTT, wxEmptyString, wxBitmap( add_bus2bus_xpm ),
|
||||
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 );
|
||||
|
||||
m_VToolBar->AddTool( ID_LABEL_BUTT, wxEmptyString,
|
||||
wxBitmap( add_line_label_xpm ),
|
||||
m_VToolBar->AddTool( ID_LABEL_BUTT, wxEmptyString, wxBitmap( add_line_label_xpm ),
|
||||
HELP_PLACE_NETLABEL, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString,
|
||||
wxBitmap( add_glabel_xpm ),
|
||||
HELP_PLACE_GLOBALLABEL,
|
||||
wxITEM_CHECK );
|
||||
m_VToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString, wxBitmap( add_glabel_xpm ),
|
||||
HELP_PLACE_GLOBALLABEL, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
|
||||
wxBitmap( add_junction_xpm ),
|
||||
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString, wxBitmap( add_junction_xpm ),
|
||||
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 );
|
||||
|
||||
m_VToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString,
|
||||
|
@ -216,22 +181,17 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
|
|||
wxBitmap( add_hierar_pin_xpm ),
|
||||
HELP_PLACE_PINSHEET, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString,
|
||||
wxBitmap( add_dashed_line_xpm ),
|
||||
HELP_PLACE_GRAPHICLINES, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString,
|
||||
wxBitmap( add_text_xpm ),
|
||||
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString, wxBitmap( add_text_xpm ),
|
||||
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 );
|
||||
|
||||
m_VToolBar->Realize();
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
@ -242,8 +202,7 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
|
|||
if( m_OptionsToolBar )
|
||||
return;
|
||||
|
||||
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,
|
||||
wxBitmap( grid_xpm ),
|
||||
|
@ -273,8 +232,6 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
|
|||
wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->Realize();
|
||||
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
@ -287,28 +244,6 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
|
||||
switch( id )
|
||||
{
|
||||
case ID_TB_OPTIONS_SHOW_GRID:
|
||||
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
|
||||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
||||
g_UserUnit = MILLIMETRES;
|
||||
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:
|
||||
m_ShowAllPins = m_OptionsToolBar->GetToolState( id );
|
||||
DrawPanel->Refresh( );
|
||||
|
@ -322,6 +257,4 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
DisplayError( this, wxT( "OnSelectOptionToolbar() error" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
|
||||
LIB_VIEW_FRAME::Process_Special_Functions )
|
||||
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, LIB_VIEW_FRAME::OnZoom )
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, LIB_VIEW_FRAME::OnZoom )
|
||||
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
|
||||
LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
|
||||
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
|
||||
|
|
|
@ -7,11 +7,6 @@
|
|||
#include "class_drawpanel.h"
|
||||
#include "gerbview.h"
|
||||
|
||||
GERBER_DRAW_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
|
||||
{
|
||||
return Locate( CURSEUR_OFF_GRILLE );
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/* Process the command triggered by the left button of the mouse when a tool
|
||||
* is already selected.
|
||||
*/
|
||||
void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||
void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
|
||||
{
|
||||
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
|
||||
wxString msg;
|
||||
|
@ -36,7 +36,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
}
|
||||
else
|
||||
{
|
||||
DrawStruct = GerberGeneralLocateAndDisplay();
|
||||
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
|
||||
GetScreen()->SetCurItem( DrawStruct );
|
||||
if( DrawStruct == NULL )
|
||||
{
|
||||
|
@ -50,14 +50,13 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
switch( m_ID_current_state )
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case ID_NO_SELECT_BUTT:
|
||||
case ID_GERBVIEW_NO_TOOL:
|
||||
break;
|
||||
|
||||
|
||||
case ID_GERBVIEW_DELETE_ITEM_BUTT:
|
||||
DrawStruct = GerberGeneralLocateAndDisplay();
|
||||
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
|
||||
|
||||
if( DrawStruct == NULL )
|
||||
break;
|
||||
/* TODO:
|
||||
|
@ -132,7 +131,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
ClearMsgPanel();
|
||||
break;
|
||||
|
||||
case ID_NO_SELECT_BUTT:
|
||||
case ID_GERBVIEW_NO_TOOL:
|
||||
SetToolID( 0, 0, wxEmptyString );
|
||||
break;
|
||||
|
||||
|
@ -209,14 +208,12 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
wxMessageBox( wxT( "WinEDA_GerberFrame::Process_Special_Functions error" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
/* Called on a double click of left mouse button.
|
||||
*/
|
||||
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
|
||||
{
|
||||
// Currently: no nothing
|
||||
}
|
||||
|
|
|
@ -53,9 +53,9 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
|
|||
{
|
||||
setActiveLayer(origLayer+1);
|
||||
Erase_Current_Layer( false );
|
||||
|
||||
if( !LoadGerberFiles( wxEmptyString ) )
|
||||
setActiveLayer( origLayer );
|
||||
SetToolbars();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
|
|||
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
|
||||
EVT_SIZE( WinEDA_GerberFrame::OnSize )
|
||||
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_GerberFrame::OnZoom )
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, WinEDA_GerberFrame::OnZoom )
|
||||
|
||||
EVT_TOOL( wxID_FILE, WinEDA_GerberFrame::Files_io )
|
||||
EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
|
||||
|
@ -51,8 +51,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
|
|||
// menu Preferences
|
||||
EVT_MENU( ID_CONFIG_REQ, WinEDA_GerberFrame::Process_Config )
|
||||
EVT_MENU( ID_CONFIG_SAVE, WinEDA_GerberFrame::Process_Config )
|
||||
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START,
|
||||
ID_PREFERENCES_HOTKEY_END,
|
||||
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
|
||||
WinEDA_GerberFrame::Process_Config )
|
||||
|
||||
EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
||||
|
@ -86,7 +85,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
|
|||
WinEDA_GerberFrame::Process_Special_Functions )
|
||||
|
||||
// Vertical toolbar:
|
||||
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_GERBVIEW_NO_TOOL, WinEDA_GerberFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
|
||||
|
||||
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
||||
|
@ -103,11 +102,26 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
|
|||
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
||||
WinEDA_GerberFrame::OnSelectOptionToolbar )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnSelectOptionToolbar )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_0, WinEDA_GerberFrame::OnSelectDisplayMode )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_1, WinEDA_GerberFrame::OnSelectDisplayMode )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_2, WinEDA_GerberFrame::OnSelectDisplayMode )
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, 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,
|
||||
WinEDA_GerberFrame::OnUpdateFlashedItemsDrawMode )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, WinEDA_GerberFrame::OnUpdateLinesDrawMode )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
|
||||
WinEDA_GerberFrame::OnUpdatePolygonsDrawMode )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnUpdateShowDCodes )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
||||
WinEDA_GerberFrame::OnUpdateShowLayerManager )
|
||||
EVT_UPDATE_UI( ID_TOOLBARH_GERBER_SELECT_TOOL, WinEDA_GerberFrame::OnUpdateSelectDCode )
|
||||
EVT_UPDATE_UI( ID_TOOLBARH_GERBVIEW_SELECT_LAYER, WinEDA_GerberFrame::OnUpdateLayerSelectBox )
|
||||
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
|
||||
WinEDA_GerberFrame::OnUpdateDrawMode )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
|
@ -204,8 +218,6 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father
|
|||
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
||||
|
||||
ReFillLayerWidget(); // this is near end because contents establish size
|
||||
|
||||
SetToolbars();
|
||||
m_auimgr.Update();
|
||||
}
|
||||
|
||||
|
@ -579,8 +591,6 @@ void WinEDA_GerberFrame::OnSelectDisplayMode( wxCommandEvent& event )
|
|||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
|
||||
if( GetDisplayMode() != oldMode )
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ enum gerbview_ids
|
|||
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
||||
|
||||
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
|
||||
ID_GERBVIEW_NO_TOOL,
|
||||
ID_GERBVIEW_DELETE_ITEM_BUTT,
|
||||
ID_GERBVIEW_GLOBAL_DELETE,
|
||||
ID_GERBVIEW_OPTIONS_SETUP,
|
||||
|
|
|
@ -10,27 +10,28 @@
|
|||
/* localize a gerber item and return a pointer to it.
|
||||
* Display info about this item
|
||||
*/
|
||||
GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
|
||||
GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( const wxPoint& aPosition, int aTypeloc )
|
||||
{
|
||||
MsgPanel->EraseMsgBox();
|
||||
wxPoint ref;
|
||||
wxPoint ref = aPosition;
|
||||
bool found = false;
|
||||
|
||||
if( aTypeloc == CURSEUR_ON_GRILLE )
|
||||
ref = GetScreen()->GetCrossHairPosition();
|
||||
else
|
||||
ref = GetScreen()->m_MousePosition;
|
||||
ref = GetScreen()->GetNearestGridPosition( ref );
|
||||
|
||||
int layer = GetScreen()->m_Active_Layer;
|
||||
|
||||
// Search first on active layer
|
||||
BOARD_ITEM* item = GetBoard()->m_Drawings;
|
||||
GERBER_DRAW_ITEM* gerb_item = NULL;
|
||||
|
||||
for( ; item; item = item->Next() )
|
||||
{
|
||||
gerb_item = (GERBER_DRAW_ITEM*) item;
|
||||
|
||||
if( gerb_item->GetLayer()!= layer )
|
||||
continue;
|
||||
|
||||
if( gerb_item->HitTest( ref ) )
|
||||
{
|
||||
found = true;
|
||||
|
@ -41,9 +42,11 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
|
|||
if( !found ) // Search on all layers
|
||||
{
|
||||
item = GetBoard()->m_Drawings;
|
||||
|
||||
for( ; item; item = item->Next() )
|
||||
{
|
||||
gerb_item = (GERBER_DRAW_ITEM*) item;
|
||||
|
||||
if( gerb_item->HitTest( ref ) )
|
||||
{
|
||||
found = true;
|
||||
|
@ -51,10 +54,12 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( found )
|
||||
{
|
||||
gerb_item->DisplayInfo( this );
|
||||
return gerb_item;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
/* Prepare the right-click pullup menu.
|
||||
* The menu already has a list of zoom commands.
|
||||
*/
|
||||
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos,
|
||||
wxMenu* PopMenu )
|
||||
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
||||
{
|
||||
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
|
||||
wxString msg;
|
||||
|
@ -27,7 +26,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos,
|
|||
// Simple location of elements where possible.
|
||||
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||
{
|
||||
DrawStruct = GerberGeneralLocateAndDisplay();
|
||||
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
|
||||
}
|
||||
|
||||
// If command in progress, end command.
|
||||
|
|
|
@ -38,32 +38,6 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
|
||||
switch( id )
|
||||
{
|
||||
case ID_TB_OPTIONS_SHOW_GRID:
|
||||
SetGridVisibility( state );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
||||
g_UserUnit = MILLIMETRES;
|
||||
UpdateStatusBar();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
||||
g_UserUnit = INCHES;
|
||||
UpdateStatusBar();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
|
||||
SetStatusText( wxEmptyString );
|
||||
DisplayOpt.DisplayPolarCood = state;
|
||||
UpdateStatusBar();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_CURSOR:
|
||||
m_CursorShape = state;
|
||||
DrawPanel->Refresh( TRUE );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH:
|
||||
if( state )
|
||||
{
|
||||
|
@ -73,21 +47,21 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
{
|
||||
DisplayOpt.DisplayPadFill = m_DisplayPadFill = true;
|
||||
}
|
||||
DrawPanel->Refresh( TRUE );
|
||||
DrawPanel->Refresh( true );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_LINES_SKETCH:
|
||||
if(state )
|
||||
{
|
||||
m_DisplayPcbTrackFill = FALSE;
|
||||
DisplayOpt.DisplayPcbTrackFill = FALSE;
|
||||
m_DisplayPcbTrackFill = false;
|
||||
DisplayOpt.DisplayPcbTrackFill = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DisplayPcbTrackFill = TRUE;
|
||||
DisplayOpt.DisplayPcbTrackFill = TRUE;
|
||||
m_DisplayPcbTrackFill = true;
|
||||
DisplayOpt.DisplayPcbTrackFill = true;
|
||||
}
|
||||
DrawPanel->Refresh( TRUE );
|
||||
DrawPanel->Refresh( true );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
|
||||
|
@ -95,12 +69,12 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
g_DisplayPolygonsModeSketch = 1;
|
||||
else
|
||||
g_DisplayPolygonsModeSketch = 0;
|
||||
DrawPanel->Refresh( TRUE );
|
||||
DrawPanel->Refresh( true );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_DCODES:
|
||||
SetElementVisibility( DCODES_VISIBLE, state );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
DrawPanel->Refresh( true );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
|
||||
|
@ -111,11 +85,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this,
|
||||
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
|
||||
DisplayError( this, wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
|
|||
int ii;
|
||||
wxString msg;
|
||||
|
||||
// delete and recreate the toolbar
|
||||
if( m_HToolBar != NULL )
|
||||
return;
|
||||
|
||||
|
@ -36,59 +35,44 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
|
|||
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
|
||||
|
||||
// Set up toolbar
|
||||
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString,
|
||||
wxBitmap( new_xpm ),
|
||||
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ),
|
||||
_( "Erase all layers" ) );
|
||||
|
||||
m_HToolBar->AddTool( wxID_FILE, wxEmptyString,
|
||||
wxBitmap( open_xpm ),
|
||||
m_HToolBar->AddTool( wxID_FILE, wxEmptyString, wxBitmap( open_xpm ),
|
||||
_( "Load a new Gerber file on the current layer. Previous data will be deleted" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString,
|
||||
wxBitmap( print_button ),
|
||||
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
|
||||
_( "Print layers" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
msg = AddHotkeyName( _( "Zoom in" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_IN );
|
||||
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" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_OUT );
|
||||
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" ), s_Gerbview_Hokeys_Descr,
|
||||
HK_ZOOM_REDRAW );
|
||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||
wxBitmap( zoom_redraw_xpm ),
|
||||
msg );
|
||||
msg = AddHotkeyName( _( "Redraw view" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_REDRAW );
|
||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom auto" ), s_Gerbview_Hokeys_Descr,
|
||||
HK_ZOOM_AUTO );
|
||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
||||
wxBitmap( zoom_auto_xpm ),
|
||||
msg );
|
||||
msg = AddHotkeyName( _( "Zoom auto" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_AUTO );
|
||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ), msg );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString,
|
||||
wxBitmap( find_xpm ),
|
||||
_( "Find D-codes" ) );
|
||||
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ), _( "Find D-codes" ) );
|
||||
|
||||
wxArrayString choices;
|
||||
m_HToolBar->AddSeparator();
|
||||
|
||||
for( ii = 0; ii < 32; ii++ )
|
||||
{
|
||||
wxString msg;
|
||||
msg = _( "Layer " ); msg << ii + 1;
|
||||
choices.Add( msg );
|
||||
}
|
||||
m_SelLayerBox = new WinEDALayerChoiceBox( m_HToolBar,
|
||||
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
|
||||
wxDefaultPosition, wxSize( 150, -1 ),
|
||||
choices );
|
||||
|
||||
m_SelLayerBox = new WinEDALayerChoiceBox( m_HToolBar, ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
|
||||
wxDefaultPosition, wxSize( 150, -1 ), choices );
|
||||
m_HToolBar->AddControl( m_SelLayerBox );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
|
@ -98,25 +82,24 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
|
|||
|
||||
msg = _( "Tool " );
|
||||
wxString text;
|
||||
|
||||
for( ii = FIRST_DCODE; ii < TOOLS_MAX_COUNT; ii++ )
|
||||
{
|
||||
text = msg;
|
||||
text << ii;
|
||||
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 ),
|
||||
m_DCodesList );
|
||||
m_HToolBar->AddControl( m_DCodeSelector );
|
||||
|
||||
m_TextInfo = new wxTextCtrl(m_HToolBar, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxSize(150,-1),
|
||||
wxTE_READONLY );
|
||||
m_TextInfo = new wxTextCtrl( m_HToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition,
|
||||
wxSize(150,-1), wxTE_READONLY );
|
||||
m_HToolBar->AddControl( m_TextInfo );
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
@ -132,11 +115,9 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void )
|
|||
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
|
||||
|
||||
// Set up toolbar
|
||||
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString, wxBitmap( cursor_xpm ) );
|
||||
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
|
||||
m_VToolBar->AddTool( ID_GERBVIEW_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ) );
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_GERBVIEW_DELETE_ITEM_BUTT, wxEmptyString,
|
||||
wxBitmap( delete_body_xpm ),
|
||||
m_VToolBar->AddTool( ID_GERBVIEW_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
|
||||
_( "Delete items" ) );
|
||||
|
||||
m_VToolBar->Realize();
|
||||
|
@ -154,8 +135,7 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
|
|||
// creation of tool bar options
|
||||
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, 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 ),
|
||||
_( "Turn grid off" ), wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
|
||||
|
@ -223,89 +203,83 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetToolbars
|
||||
* Set the tools state for the toolbars, according to display options
|
||||
*/
|
||||
void WinEDA_GerberFrame::SetToolbars()
|
||||
void WinEDA_GerberFrame::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen();
|
||||
int layer = screen->m_Active_Layer;
|
||||
GERBER_IMAGE* gerber = g_GERBER_List[layer];
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case ID_TB_OPTIONS_SHOW_GBR_MODE_0:
|
||||
aEvent.Check( GetDisplayMode() == 0 );
|
||||
break;
|
||||
|
||||
if( m_HToolBar == NULL )
|
||||
return;
|
||||
case ID_TB_OPTIONS_SHOW_GBR_MODE_1:
|
||||
aEvent.Check( GetDisplayMode() == 1 );
|
||||
break;
|
||||
|
||||
if( m_SelLayerBox && (m_SelLayerBox->GetSelection() != screen->m_Active_Layer) )
|
||||
{
|
||||
m_SelLayerBox->SetSelection( screen->m_Active_Layer );
|
||||
}
|
||||
case ID_TB_OPTIONS_SHOW_GBR_MODE_2:
|
||||
aEvent.Check( GetDisplayMode() == 2 );
|
||||
break;
|
||||
|
||||
if( m_DCodeSelector )
|
||||
{
|
||||
if( gerber )
|
||||
{
|
||||
int dcodeSelected;
|
||||
m_DCodeSelector->Enable( true );
|
||||
dcodeSelected = gerber->m_Selected_Tool;
|
||||
|
||||
if( dcodeSelected != m_DCodeSelector->GetSelectedDCodeId() )
|
||||
m_DCodeSelector->SetDCodeSelection( dcodeSelected );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DCodeSelector->SetDCodeSelection( 0 );
|
||||
m_DCodeSelector->Enable( false );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
GetMenuBar()->SetLabel( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
||||
_("Hide &Layers Manager" ) );
|
||||
m_OptionsToolBar->SetToolShortHelp( aEvent.GetId(), _("Hide layers manager" ) );
|
||||
else
|
||||
GetMenuBar()->SetLabel( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
||||
_("Show &Layers Manager" ) );
|
||||
|
||||
m_OptionsToolBar->SetToolShortHelp( aEvent.GetId(), _("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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,10 +46,10 @@ protected:
|
|||
|
||||
public:
|
||||
WinEDALayerChoiceBox* m_SelLayerBox;
|
||||
DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to hightlight.
|
||||
DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to highlight.
|
||||
wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about
|
||||
// gerber data (format..)
|
||||
wxArrayString m_DCodesList; // an array string containint all decodes Id (10 to 999)
|
||||
wxArrayString m_DCodesList; // an array string containing all decodes Id (10 to 999)
|
||||
|
||||
private:
|
||||
int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn:
|
||||
|
@ -77,7 +77,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
|
|||
* Function ReportMessage
|
||||
* Add a message (a string) in message list
|
||||
* for instance when reading a Gerber file
|
||||
* @param aMessage = the straing to add in list
|
||||
* @param aMessage = the string to add in list
|
||||
*/
|
||||
void ReportMessage( const wxString aMessage )
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
|
|||
/**
|
||||
* Function SetGridVisibility() , virtual
|
||||
* It may be overloaded by derived classes
|
||||
* if you want to store/retrieve the grid visiblity in configuration.
|
||||
* if you want to store/retrieve the grid visibility in configuration.
|
||||
* @param aVisible = true if the grid must be shown
|
||||
*/
|
||||
virtual void SetGridVisibility( bool aVisible );
|
||||
|
@ -277,16 +277,23 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
|
|||
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
|
||||
|
||||
GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay();
|
||||
GERBER_DRAW_ITEM* Locate( int typeloc );
|
||||
GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
|
||||
|
||||
|
||||
void SetToolbars();
|
||||
void Process_Settings( wxCommandEvent& event );
|
||||
void Process_Config( wxCommandEvent& event );
|
||||
void InstallConfigFrame( const wxPoint& pos );
|
||||
void InstallGerberOptionsDialog( wxCommandEvent& event );
|
||||
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
|
||||
|
||||
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/* handlers for block commands */
|
||||
virtual int ReturnBlockCommand( int key );
|
||||
virtual void HandleBlockPlace( wxDC* DC );
|
||||
|
|
|
@ -63,6 +63,7 @@ class BASE_SCREEN : public EDA_ITEM
|
|||
EDA_ITEM* m_CurrentItem; ///< Currently selected object
|
||||
GRID_TYPE m_Grid; ///< Current grid selection.
|
||||
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
|
||||
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
|
||||
|
||||
/**
|
||||
* The cross hair position in logical (drawing) units. The cross hair is not the cursor
|
||||
|
@ -74,7 +75,6 @@ class BASE_SCREEN : public EDA_ITEM
|
|||
public:
|
||||
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
|
||||
|
||||
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
|
||||
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
|
||||
* in user units. (coordinates from last reset position)*/
|
||||
|
||||
|
@ -362,6 +362,8 @@ public:
|
|||
*/
|
||||
void GetGrids( GRIDS& aList );
|
||||
|
||||
void SetMousePosition( const wxPoint& aPosition ) { m_MousePosition = aPosition; }
|
||||
|
||||
/**
|
||||
* Function RefPos
|
||||
* Return the reference position, coming from either the mouse position
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
int m_cursor; ///< Current mouse cursor shape id.
|
||||
int m_defaultCursor; ///< The default mouse cursor shape id.
|
||||
bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
|
||||
int m_cursorLevel; // Index for cursor redraw in XOR mode.
|
||||
int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
|
||||
|
||||
public:
|
||||
EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the
|
||||
|
@ -221,7 +221,7 @@ public:
|
|||
*/
|
||||
void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL );
|
||||
|
||||
void ReDraw( wxDC* DC, bool erasebg = TRUE );
|
||||
void ReDraw( wxDC* aDC, bool aEraseBackground = true );
|
||||
|
||||
/**
|
||||
* Function RefreshDrawingRect
|
||||
|
|
17
include/id.h
17
include/id.h
|
@ -180,13 +180,12 @@ enum main_id
|
|||
|
||||
ID_SHEET_SET,
|
||||
ID_TO_LIBRARY,
|
||||
ID_NO_SELECT_BUTT,
|
||||
ID_COMPONENT_BUTT,
|
||||
|
||||
ID_ZOOM_IN,
|
||||
ID_ZOOM_OUT,
|
||||
ID_ZOOM_REDRAW,
|
||||
ID_ZOOM_PAGE,
|
||||
ID_ZOOM_REDRAW,
|
||||
|
||||
/* Panning command event IDs. */
|
||||
ID_PAN_UP,
|
||||
|
@ -204,21 +203,23 @@ enum main_id
|
|||
/* Command IDs common to PCBNew and GerbView. */
|
||||
ID_PCB_DISPLAY_FOOTPRINT_DOC,
|
||||
|
||||
ID_TB_OPTIONS_START,
|
||||
|
||||
ID_TB_OPTIONS_DRC_OFF,
|
||||
ID_TB_OPTIONS_SELECT_UNIT_MM,
|
||||
ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
||||
ID_TB_OPTIONS_SELECT_CURSOR,
|
||||
ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
||||
ID_TB_OPTIONS_SHOW_GRID,
|
||||
ID_TB_OPTIONS_SHOW_RATSNEST,
|
||||
ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
|
||||
ID_TB_OPTIONS_AUTO_DEL_TRACK,
|
||||
|
||||
ID_TB_OPTIONS_SHOW_ZONES,
|
||||
ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
|
||||
ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
|
||||
|
||||
ID_TB_OPTIONS_START,
|
||||
|
||||
ID_TB_OPTIONS_DRC_OFF,
|
||||
ID_TB_OPTIONS_SHOW_RATSNEST,
|
||||
ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
|
||||
ID_TB_OPTIONS_AUTO_DEL_TRACK,
|
||||
|
||||
ID_TB_OPTIONS_HIDDEN_PINS,
|
||||
ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
||||
ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
||||
|
|
|
@ -50,7 +50,6 @@ class GENERAL_COLLECTORS_GUIDE;
|
|||
class WinEDA_BasePcbFrame : public EDA_DRAW_FRAME
|
||||
{
|
||||
public:
|
||||
|
||||
bool m_DisplayPadFill; // How show pads
|
||||
bool m_DisplayViaFill; // How show vias
|
||||
bool m_DisplayPadNum; // show pads numbers
|
||||
|
@ -69,6 +68,9 @@ protected:
|
|||
BOARD* m_Pcb;
|
||||
GENERAL_COLLECTOR* m_Collector;
|
||||
|
||||
void updateGridSelectBox();
|
||||
void updateZoomSelectBox();
|
||||
|
||||
public:
|
||||
WinEDA_BasePcbFrame( wxWindow* father, int idtype,
|
||||
const wxString& title,
|
||||
|
@ -494,6 +496,15 @@ public:
|
|||
*/
|
||||
virtual void SaveSettings();
|
||||
|
||||
void OnTogglePolarCoords( wxCommandEvent& aEvent );
|
||||
void OnTogglePadDrawMode( wxCommandEvent& aEvent );
|
||||
|
||||
/* User interface update event handlers. */
|
||||
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ public:
|
|||
void Process_Special_Functions( wxCommandEvent& event );
|
||||
void OnColorConfig( wxCommandEvent& aEvent );
|
||||
void Process_Config( wxCommandEvent& event );
|
||||
void OnSelectTool( wxCommandEvent& aEvent );
|
||||
|
||||
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
|
||||
|
||||
|
@ -426,13 +427,9 @@ private:
|
|||
/* User interface update event handlers. */
|
||||
void OnUpdateBlockSelected( wxUpdateUIEvent& event );
|
||||
void OnUpdatePaste( wxUpdateUIEvent& event );
|
||||
void OnUpdateSchematicUndo( wxUpdateUIEvent& event );
|
||||
void OnUpdateSchematicRedo( wxUpdateUIEvent& event );
|
||||
void OnUpdateGrid( wxUpdateUIEvent& event );
|
||||
void OnUpdateUnits( wxUpdateUIEvent& event );
|
||||
void OnUpdateSelectCursor( wxUpdateUIEvent& event );
|
||||
void OnUpdateHiddenPins( wxUpdateUIEvent& event );
|
||||
void OnUpdateBusOrientation( wxUpdateUIEvent& event );
|
||||
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
|
|
|
@ -53,6 +53,10 @@ class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
|
|||
{
|
||||
friend class PCB_LAYER_WIDGET;
|
||||
|
||||
void updateTraceWidthSelectBox();
|
||||
void updateViaSizeSelectBox();
|
||||
void updateDesignRulesSelectBoxes();
|
||||
|
||||
protected:
|
||||
|
||||
PCB_LAYER_WIDGET* m_Layers;
|
||||
|
@ -103,6 +107,7 @@ protected:
|
|||
* <p>
|
||||
* This function cannot be inline without including layer_widget.h in
|
||||
* here and we do not want to do that.
|
||||
* </p>
|
||||
*/
|
||||
void syncLayerWidget( );
|
||||
|
||||
|
@ -157,6 +162,20 @@ public:
|
|||
|
||||
void SVG_Print( wxCommandEvent& event );
|
||||
|
||||
// User interface update command event handlers.
|
||||
void OnUpdateSave( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateAuxilaryToolbar( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function PrintPage , virtual
|
||||
* used to print a page
|
||||
|
@ -310,6 +329,7 @@ public:
|
|||
void OnCloseWindow( wxCloseEvent& Event );
|
||||
void Process_Special_Functions( wxCommandEvent& event );
|
||||
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
|
||||
void OnSelectTool( wxCommandEvent& aEvent );
|
||||
|
||||
void ProcessMuWaveFunctions( wxCommandEvent& event );
|
||||
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
|
||||
|
@ -379,28 +399,13 @@ public:
|
|||
|
||||
void PrepareLayerIndicator();
|
||||
|
||||
/**
|
||||
* Function AuxiliaryToolBar_Update_UI
|
||||
* update the displayed values on auxiliary horizontal toolbar
|
||||
* (track width, via sizes, clearance ...
|
||||
*/
|
||||
void AuxiliaryToolBar_Update_UI();
|
||||
|
||||
/**
|
||||
* Function AuxiliaryToolBar_DesignRules_Update_UI
|
||||
* update the displayed values: track width, via sizes, clearance
|
||||
* used when a new netclass is selected
|
||||
*/
|
||||
void AuxiliaryToolBar_DesignRules_Update_UI();
|
||||
|
||||
/* mouse functions events: */
|
||||
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
||||
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
||||
|
||||
/**
|
||||
* Function OnRightClick
|
||||
* populates a popup menu with the choices appropriate for the current
|
||||
*context.
|
||||
* populates a popup menu with the choices appropriate for the current context.
|
||||
* The caller will add the ZOOM menu choices afterward.
|
||||
* @param aMousePos The current mouse position
|
||||
* @param aPopMenu The menu to add to.
|
||||
|
@ -439,13 +444,10 @@ public:
|
|||
/**
|
||||
* Function PutDataInPreviousState
|
||||
* Used in undo or redo command.
|
||||
* Put data pointed by List in the previous state, i.e. the state memorized
|
||||
* by List
|
||||
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to
|
||||
* undo/redo
|
||||
* Put data pointed by List in the previous state, i.e. the state memorized by List
|
||||
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
|
||||
* @param aRedoCommand = a bool: true for redo, false for undo
|
||||
* @param aRebuildRatsnet = a bool: true to rebuild ratsnet (normal use),
|
||||
* false
|
||||
* @param aRebuildRatsnet = a bool: true to rebuild ratsnet (normal use), false
|
||||
* to just retrieve last state (used in abort commands that do not need to
|
||||
* rebuild ratsnest)
|
||||
*/
|
||||
|
@ -554,8 +556,6 @@ public:
|
|||
*/
|
||||
void Block_Duplicate();
|
||||
|
||||
|
||||
void SetToolbars();
|
||||
void Process_Settings( wxCommandEvent& event );
|
||||
void OnConfigurePcbOptions( wxCommandEvent& aEvent );
|
||||
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
|
||||
|
@ -582,7 +582,7 @@ public:
|
|||
* @param aForceFileDialog - Display the file open dialog even if aFullFileName is
|
||||
* valid if true; Default = false.
|
||||
*
|
||||
* @return False if file load fails or is cancelled by the user, otherwise true.
|
||||
* @return False if file load fails or is canceled by the user, otherwise true.
|
||||
*/
|
||||
bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
|
||||
bool aForceFileDialog = false );
|
||||
|
@ -606,8 +606,7 @@ public:
|
|||
/**
|
||||
* Function Clear_Pcb
|
||||
* delete all and reinitialize the current board
|
||||
* @param aQuery = true to prompt user for confirmation, false to
|
||||
* initialize silently
|
||||
* @param aQuery = true to prompt user for confirmation, false to initialize silently
|
||||
*/
|
||||
bool Clear_Pcb( bool aQuery );
|
||||
|
||||
|
@ -1045,13 +1044,14 @@ public:
|
|||
* @param aNetlistFullFilename = netlist file name (*.net)
|
||||
* @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found,
|
||||
* only the netlist will be used
|
||||
* @param aMessageWindow = a reference to a wxTextCtrl where to dislay messages.
|
||||
* @param aMessageWindow = a reference to a wxTextCtrl where to display messages.
|
||||
* can be NULL
|
||||
* @param aChangeFootprint if true, footprints that have changed in netlist will be changed
|
||||
* @param aDeleteBadTracks if true, erroneous tracks will be deleted
|
||||
* @param aDeleteExtraFootprints if true, remove unlocked footprints that are not in netlist
|
||||
* @param aSelect_By_Timestamp if true, use timestamp instead of reference to identify footprints
|
||||
* from components (use after reannotation of the chematic)
|
||||
* @param aSelect_By_Timestamp if true, use timestamp instead of reference to identify
|
||||
* footprints from components (use after reannotation of the
|
||||
* schematic)
|
||||
* @return true if Ok
|
||||
*
|
||||
* the format of the netlist is something like:
|
||||
|
|
|
@ -283,7 +283,6 @@ public:
|
|||
|
||||
void EraseMsgBox();
|
||||
void Process_PageSettings( wxCommandEvent& event );
|
||||
virtual void SetToolbars();
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
|
@ -377,6 +376,19 @@ public:
|
|||
virtual void OnSelectGrid( wxCommandEvent& event );
|
||||
virtual void OnSelectZoom( wxCommandEvent& event );
|
||||
|
||||
// Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
|
||||
void OnToggleGridState( wxCommandEvent& aEvent );
|
||||
void OnSelectUnits( wxCommandEvent& aEvent );
|
||||
void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
|
||||
|
||||
// Update user interface event handlers shared by all applications derived from
|
||||
// EDA_DRAW_FRAME.
|
||||
void OnUpdateUndo( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateRedo( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateGrid( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateUnits( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function GeneralControle
|
||||
* performs application specific control using \a aDC at \a aPosition in logical units.
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "common.h"
|
||||
#include "confirm.h"
|
||||
#include "appl_wxstruct.h"
|
||||
#include "dialog_helpers.h"
|
||||
#include "kicad_device_context.h"
|
||||
|
||||
#include "pcbnew.h"
|
||||
#include "bitmaps.h"
|
||||
|
@ -32,14 +34,25 @@ static const wxString DisplayModuleEdgeEntry( wxT( "DiModEd" ) );
|
|||
static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) );
|
||||
|
||||
|
||||
/*******************************/
|
||||
/*****************************/
|
||||
/* class WinEDA_BasePcbFrame */
|
||||
/*******************************/
|
||||
/*****************************/
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, EDA_DRAW_FRAME )
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||
ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||
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()
|
||||
|
||||
|
||||
|
@ -101,16 +114,18 @@ int WinEDA_BasePcbFrame::BestZoom( void )
|
|||
|
||||
dx = m_Pcb->m_BoundaryBox.GetWidth();
|
||||
dy = m_Pcb->m_BoundaryBox.GetHeight();
|
||||
|
||||
size = DrawPanel->GetClientSize();
|
||||
|
||||
if( size.x )
|
||||
ii = ( dx + (size.x / 2) ) / size.x;
|
||||
else
|
||||
ii = 31;
|
||||
|
||||
if ( size.y )
|
||||
jj = ( dy + (size.y / 2) ) / size.y;
|
||||
else
|
||||
jj = 31;
|
||||
|
||||
bestzoom = MAX( ii, jj ) + 1;
|
||||
GetScreen()->SetScrollCenterPosition( m_Pcb->m_BoundaryBox.Centre() );
|
||||
|
||||
|
@ -155,7 +170,6 @@ void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
|
||||
// Note: virtual, overridden in WinEDA_PcbFrame;
|
||||
void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
|
||||
{
|
||||
|
@ -206,17 +220,99 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event )
|
||||
/**********************************************************************/
|
||||
void WinEDA_BasePcbFrame::OnTogglePolarCoords( wxCommandEvent& aEvent )
|
||||
{
|
||||
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:
|
||||
int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START;
|
||||
|
||||
if( id >= ID_POPUP_PCB_ITEM_SELECTION_START
|
||||
&& id <= ID_POPUP_PCB_ITEM_SELECTION_END )
|
||||
if( id >= ID_POPUP_PCB_ITEM_SELECTION_START && id <= ID_POPUP_PCB_ITEM_SELECTION_END )
|
||||
{
|
||||
BOARD_ITEM* item = (*m_Collector)[itemNdx];
|
||||
DrawPanel->m_AbortRequest = false;
|
||||
|
@ -350,19 +446,11 @@ void WinEDA_BasePcbFrame::UpdateStatusBar()
|
|||
break;
|
||||
}
|
||||
|
||||
Line.Printf( formatter, To_User_Unit( g_UserUnit, ro, m_InternalUnits ),
|
||||
theta );
|
||||
Line.Printf( formatter, To_User_Unit( g_UserUnit, ro, m_InternalUnits ), theta );
|
||||
|
||||
// overwrite the absolute cartesian coordinates
|
||||
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;
|
||||
|
||||
EDA_DRAW_FRAME::LoadSettings();
|
||||
|
||||
// Ensure grid id is an existent grid id:
|
||||
if( (m_LastGridSizeId <= 0) ||
|
||||
(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 + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
|
||||
cfg->Read( m_FrameName + UserGridUnitsEntry, (long*)&m_UserGridUnit,
|
||||
( long )INCHES );
|
||||
cfg->Read( m_FrameName + UserGridUnitsEntry, (long*)&m_UserGridUnit, ( long )INCHES );
|
||||
cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
|
||||
cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true );
|
||||
cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );
|
||||
cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge,
|
||||
( long )FILLED );
|
||||
cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, ( long )FILLED );
|
||||
|
||||
if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH )
|
||||
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 )
|
||||
m_DisplayModText = FILLED;
|
||||
}
|
||||
|
@ -426,7 +515,6 @@ void WinEDA_BasePcbFrame::SaveSettings()
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function OnModify
|
||||
* Must be called after a schematic change
|
||||
|
@ -442,3 +530,95 @@ void WinEDA_BasePcbFrame::OnModify( )
|
|||
wxString date = GenDate();
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -598,9 +598,6 @@ void WinEDA_PcbFrame::GetBoardFromUndoList( wxCommandEvent& event )
|
|||
GetScreen()->PushCommandToRedoList( List );
|
||||
|
||||
OnModify();
|
||||
ReCreateHToolbar();
|
||||
SetToolbars();
|
||||
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
@ -629,9 +626,6 @@ void WinEDA_PcbFrame::GetBoardFromRedoList( wxCommandEvent& event )
|
|||
GetScreen()->PushCommandToUndoList( List );
|
||||
|
||||
OnModify();
|
||||
ReCreateHToolbar();
|
||||
SetToolbars();
|
||||
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
|||
scanList = GENERAL_COLLECTOR::Tracks;
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
case ID_PCB_MODULE_BUTT:
|
||||
scanList = GENERAL_COLLECTOR::ModuleItems;
|
||||
break;
|
||||
|
||||
|
@ -376,6 +376,5 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
|
|||
wxSafeYield();
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
UpdateStatusBar(); /* Display new cursor coordinates */
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
|
|||
if( aTrack == NULL )
|
||||
return NULL;
|
||||
|
||||
if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last segment
|
||||
if( aTrack->IsNew() ) // Trace in progress, erase the last segment
|
||||
{
|
||||
if( g_CurrentTrackList.GetCount() > 0 )
|
||||
{
|
||||
|
|
|
@ -710,7 +710,6 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
|
|||
|
||||
m_Pcb->SetCurrentNetClass( NETCLASS::Default );
|
||||
m_Parent->m_TrackAndViasSizesList_Changed = true;
|
||||
m_Parent->AuxiliaryToolBar_Update_UI();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
|
|||
UserUnitType ii;
|
||||
|
||||
DisplayOpt.DisplayPolarCood =
|
||||
( m_PolarDisplay->GetSelection() == 0 ) ? FALSE : true;
|
||||
( m_PolarDisplay->GetSelection() == 0 ) ? false : true;
|
||||
ii = g_UserUnit;
|
||||
g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
|
||||
if( ii != g_UserUnit )
|
||||
|
@ -114,12 +114,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
switch( id )
|
||||
{
|
||||
case ID_TB_OPTIONS_DRC_OFF:
|
||||
Drc_On = state ? FALSE : true;
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_GRID:
|
||||
SetElementVisibility(GRID_VISIBLE, state);
|
||||
DrawPanel->Refresh();
|
||||
Drc_On = !state;
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
||||
|
@ -131,28 +126,6 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
g_Show_Module_Ratsnest = state; // TODO: use the visibility list
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
||||
g_UserUnit = MILLIMETRES;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
||||
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
|
||||
g_UserUnit = INCHES;
|
||||
m_TrackAndViasSizesList_Changed = true;
|
||||
UpdateStatusBar();
|
||||
ReCreateAuxiliaryToolbar();
|
||||
DisplayUnitsMsg();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
|
||||
SetStatusText( wxEmptyString );
|
||||
DisplayOpt.DisplayPolarCood = state;
|
||||
UpdateStatusBar();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_CURSOR:
|
||||
m_CursorShape = state;
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_AUTO_DEL_TRACK:
|
||||
g_AutoDeleteOldTrack = state;
|
||||
break;
|
||||
|
@ -172,27 +145,8 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
||||
if( state )
|
||||
{
|
||||
m_DisplayPadFill = DisplayOpt.DisplayPadFill = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DisplayPadFill = DisplayOpt.DisplayPadFill = true;
|
||||
}
|
||||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
||||
if( state )
|
||||
{
|
||||
m_DisplayViaFill = DisplayOpt.DisplayViaFill = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DisplayViaFill = DisplayOpt.DisplayViaFill = true;
|
||||
}
|
||||
m_DisplayViaFill = DisplayOpt.DisplayViaFill = !state;
|
||||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
|
@ -217,6 +171,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
m_show_layer_manager_tools = state;
|
||||
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
|
||||
m_auimgr.Update();
|
||||
|
||||
if( m_show_layer_manager_tools )
|
||||
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
||||
_("Hide &Layers Manager" ) );
|
||||
|
@ -230,6 +185,4 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
|
||||
if( Dimension )
|
||||
{
|
||||
if( Dimension->m_Flags & IS_NEW )
|
||||
if( Dimension->IsNew() )
|
||||
{
|
||||
Dimension->Draw( Panel, DC, GR_XOR );
|
||||
Dimension->DeleteStructure();
|
||||
|
|
|
@ -280,7 +280,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
|
||||
if( Edge && ( Edge->Type() == TYPE_EDGE_MODULE ) )
|
||||
{
|
||||
if( Edge->m_Flags & IS_NEW ) // On aborting, delete new outline.
|
||||
if( Edge->IsNew() ) // On aborting, delete new outline.
|
||||
{
|
||||
MODULE* Module = (MODULE*) Edge->GetParent();
|
||||
Edge->Draw( Panel, DC, GR_XOR, MoveVector );
|
||||
|
|
176
pcbnew/edit.cpp
176
pcbnew/edit.cpp
|
@ -49,8 +49,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
{
|
||||
case wxID_CUT:
|
||||
case wxID_COPY:
|
||||
case ID_ON_GRID_SELECT:
|
||||
case ID_ON_ZOOM_SELECT:
|
||||
case ID_PCB_USER_GRID_SETUP:
|
||||
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
||||
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
|
||||
|
@ -231,66 +229,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
InstallFindFrame( pos, &dc );
|
||||
break;
|
||||
|
||||
case ID_TRACK_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Tracks" ) );
|
||||
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||
{
|
||||
Compile_Ratsnest( &dc, true );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_PCB_ZONES_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Zones" ) );
|
||||
if( DisplayOpt.DisplayZonesMode != 0 )
|
||||
DisplayInfoMessage( this, _( "Warning: Display Zone is OFF!!!" ) );
|
||||
if( !g_HighLight_Status && (g_HighLight_NetCode > 0 ) )
|
||||
High_Light( &dc );
|
||||
break;
|
||||
|
||||
case ID_PCB_MIRE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Layer Alignment Target" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Zero" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_PLACE_GRID_COORD_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Grid Origin" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_ADD_LINE_BUTT:
|
||||
case ID_PCB_ARC_BUTT:
|
||||
case ID_PCB_CIRCLE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Graphic" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_ADD_TEXT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Add Modules" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_DIMENSION_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Dimension" ) );
|
||||
break;
|
||||
|
||||
case ID_NO_SELECT_BUTT:
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_PCB_HIGHLIGHT_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Net Highlight" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Local Ratsnest" ) );
|
||||
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||
Compile_Ratsnest( &dc, true );
|
||||
break;
|
||||
|
||||
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
@ -593,10 +531,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
case ID_PCB_DELETE_ITEM_BUTT:
|
||||
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
|
||||
Process_Move_Item( this, GetCurItem(), &dc );
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
|
@ -952,7 +886,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
|
||||
if( GetCurItem() && (GetCurItem()->IsNew()) )
|
||||
{
|
||||
End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
|
||||
SetCurItem( NULL );
|
||||
|
@ -961,7 +895,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
|
||||
if( GetCurItem() && (GetCurItem()->IsNew()) )
|
||||
{
|
||||
if( End_Zone( &dc ) )
|
||||
SetCurItem( NULL );
|
||||
|
@ -971,7 +905,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
|
||||
if( GetCurItem() && (GetCurItem()->IsNew()) )
|
||||
{
|
||||
if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
|
||||
SetCurItem( NULL );
|
||||
|
@ -1060,7 +994,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
DrawPanel->CrossHairOn( &dc );
|
||||
DrawPanel->m_IgnoreMouseEvents = false;
|
||||
}
|
||||
|
@ -1222,7 +1155,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
|
|||
// See if we are drawing a segment; if so, add a via?
|
||||
if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
|
||||
{
|
||||
if( current->Type() == TYPE_TRACK && ( current->m_Flags & IS_NEW ) )
|
||||
if( current->Type() == TYPE_TRACK && ( current->IsNew() ) )
|
||||
{
|
||||
// Want to set the routing layers so that it switches properly -
|
||||
// see the implementation of Other_Layer_Route - the working
|
||||
|
@ -1255,3 +1188,104 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
|
|||
if( DisplayOpt.ContrastModeDisplay )
|
||||
GetScreen()->SetRefreshReq();
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_PcbFrame::OnSelectTool( wxCommandEvent& aEvent )
|
||||
{
|
||||
int id = aEvent.GetId();
|
||||
|
||||
if( m_ID_current_state == id )
|
||||
return;
|
||||
|
||||
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||
|
||||
// Stop the current command and deselect the current tool.
|
||||
DrawPanel->EndMouseCapture( ID_PCB_NO_TOOL, DrawPanel->GetDefaultCursor() );
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_PCB_NO_TOOL:
|
||||
SetToolID( id, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_TRACK_BUTT:
|
||||
if( Drc_On )
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
|
||||
else
|
||||
SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
|
||||
|
||||
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||
{
|
||||
Compile_Ratsnest( &dc, true );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ID_PCB_MODULE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add module" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_ZONES_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add zones" ) );
|
||||
|
||||
if( DisplayOpt.DisplayZonesMode != 0 )
|
||||
DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
|
||||
|
||||
if( !g_HighLight_Status && (g_HighLight_NetCode > 0 ) )
|
||||
High_Light( &dc );
|
||||
|
||||
break;
|
||||
|
||||
case ID_PCB_MIRE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust zero" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_PLACE_GRID_COORD_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_ADD_LINE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic line" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_ARC_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_CIRCLE_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_ADD_TEXT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Add module" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_DIMENSION_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add dimension" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_DELETE_ITEM_BUTT:
|
||||
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_HIGHLIGHT_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Highlight net" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
||||
SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
|
||||
|
||||
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
||||
Compile_Ratsnest( &dc, true );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
|
||||
TextePcb->Draw( Panel, DC, GR_XOR );
|
||||
|
||||
if( (TextePcb->m_Flags & IS_NEW) ) // If new: remove it
|
||||
if( TextePcb->IsNew() ) // If new: remove it
|
||||
{
|
||||
TextePcb->DeleteStructure();
|
||||
return;
|
||||
|
@ -69,7 +69,7 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
|
|||
TextePcb->Draw( DrawPanel, DC, GR_OR );
|
||||
OnModify();
|
||||
|
||||
if( (TextePcb->m_Flags & IS_NEW) ) // If new: prepare undo command
|
||||
if( TextePcb->IsNew() ) // If new: prepare undo command
|
||||
{
|
||||
SaveCopyInUndoList( TextePcb, UR_NEW );
|
||||
TextePcb->m_Flags = 0;
|
||||
|
@ -100,7 +100,7 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
|
|||
return;
|
||||
|
||||
// if it is an existing item: prepare a copy to undo/abort command
|
||||
if( (TextePcb->m_Flags & IS_NEW) == 0 )
|
||||
if( !TextePcb->IsNew() )
|
||||
s_TextCopy.Copy( TextePcb );
|
||||
|
||||
TextePcb->Draw( DrawPanel, DC, GR_XOR );
|
||||
|
|
|
@ -88,7 +88,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
|
|||
if( Segment == NULL )
|
||||
return;
|
||||
|
||||
if( Segment->m_Flags & IS_NEW ) // Trace in progress.
|
||||
if( Segment->IsNew() ) // Trace in progress.
|
||||
{
|
||||
/* Delete current segment. */
|
||||
DisplayOpt.DisplayDrawItems = SKETCH;
|
||||
|
@ -175,7 +175,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
return;
|
||||
}
|
||||
|
||||
if( Segment->m_Flags & IS_NEW )
|
||||
if( Segment->IsNew() )
|
||||
{
|
||||
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
|
||||
Segment ->DeleteStructure();
|
||||
|
|
|
@ -104,7 +104,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
|||
setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM );
|
||||
|
||||
UpdateStatusBar();
|
||||
SetToolbars();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -257,7 +256,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
|||
via->DisplayInfo( this );
|
||||
|
||||
UpdateStatusBar();
|
||||
SetToolbars();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -152,7 +152,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
|
|||
g_CurrentTrackSegment->SetNet( g_HighLight_NetCode );
|
||||
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
|
||||
m_TrackAndViasSizesList_Changed = true;
|
||||
AuxiliaryToolBar_Update_UI();
|
||||
|
||||
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
|
||||
g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth();
|
||||
|
|
|
@ -37,20 +37,17 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
|
|||
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
|
||||
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth =
|
||||
not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth;
|
||||
AuxiliaryToolBar_Update_UI( );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
|
||||
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
|
||||
GetBoard()->m_TrackWidthSelector = 0;
|
||||
GetBoard()->m_ViaSizeSelector = 0;
|
||||
AuxiliaryToolBar_Update_UI( );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true;
|
||||
AuxiliaryToolBar_Update_UI( );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection
|
||||
|
@ -65,7 +62,6 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
|
|||
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
|
||||
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
|
||||
GetBoard()->m_TrackWidthSelector = ii;
|
||||
AuxiliaryToolBar_Update_UI( );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection
|
||||
|
@ -79,7 +75,6 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
|
|||
DrawPanel->MoveCursorToCrossHair();
|
||||
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
|
||||
GetBoard()->m_ViaSizeSelector = ii;
|
||||
AuxiliaryToolBar_Update_UI( );
|
||||
break;
|
||||
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
|
|||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
||||
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
|
||||
LoadOnePcbFile( fn );
|
||||
ReCreateAuxiliaryToolbar();
|
||||
SetToolbars();
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +53,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
|
|||
{
|
||||
case ID_LOAD_FILE:
|
||||
LoadOnePcbFile( GetScreen()->GetFileName(), false, true );
|
||||
ReCreateAuxiliaryToolbar();
|
||||
SetToolbars();
|
||||
break;
|
||||
|
||||
case ID_MENU_READ_LAST_SAVED_VERSION_BOARD:
|
||||
|
@ -91,8 +87,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
|
|||
fn.SetExt( PcbFileExtension );
|
||||
GetScreen()->SetFileName( fn.GetFullPath() );
|
||||
SetTitle( GetScreen()->GetFileName() );
|
||||
ReCreateAuxiliaryToolbar();
|
||||
SetToolbars();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -107,7 +101,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
|
|||
GetChars( PcbFileExtension ) );
|
||||
SetTitle( GetScreen()->GetFileName() );
|
||||
ReCreateLayerBox( NULL );
|
||||
SetToolbars();
|
||||
break;
|
||||
|
||||
case ID_SAVE_BOARD:
|
||||
|
@ -286,7 +279,6 @@ this file again." ) );
|
|||
ReFillLayerWidget();
|
||||
|
||||
ReCreateLayerBox( NULL );
|
||||
AuxiliaryToolBar_Update_UI();
|
||||
syncLayerWidget();
|
||||
|
||||
// Display the loaded board:
|
||||
|
|
|
@ -152,7 +152,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
|
|||
break;
|
||||
|
||||
case HK_ADD_MODULE:
|
||||
evt_type = ID_COMPONENT_BUTT;
|
||||
evt_type = ID_PCB_MODULE_BUTT;
|
||||
break;
|
||||
|
||||
case HK_UNDO:
|
||||
|
@ -214,8 +214,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
|
|||
break;
|
||||
|
||||
case HK_END_TRACK:
|
||||
if( itemCurrentlyEdited && (GetCurItem()->IsTrack() )
|
||||
&& ( (GetCurItem()->m_Flags & IS_NEW) != 0 ) )
|
||||
if( itemCurrentlyEdited && GetCurItem()->IsTrack() && GetCurItem()->IsNew() )
|
||||
{
|
||||
// A new track is in progress: call to End_Route()
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
|
@ -250,7 +249,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
|
|||
break;
|
||||
if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur
|
||||
return;
|
||||
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
|
||||
if( !GetCurItem()->IsNew() )
|
||||
return;
|
||||
|
||||
// place micro via and switch layer
|
||||
|
@ -268,7 +267,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
|
|||
return;
|
||||
if( GetCurItem()->Type() != TYPE_TRACK )
|
||||
return;
|
||||
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
|
||||
if( !GetCurItem()->IsNew() )
|
||||
return;
|
||||
evt_type = ID_POPUP_PCB_PLACE_VIA;
|
||||
break;
|
||||
|
@ -300,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
|
|||
if( track )
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
else if( GetCurItem()->m_Flags & IS_NEW )
|
||||
else if( GetCurItem()->IsNew() )
|
||||
{
|
||||
TRACK* track = Begin_Route( (TRACK*) GetCurItem(), aDC );
|
||||
|
||||
|
@ -404,7 +403,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC )
|
|||
}
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
case ID_PCB_MODULE_BUTT:
|
||||
if( ItemFree )
|
||||
{
|
||||
wxPoint pos = GetScreen()->RefPos( false );
|
||||
|
|
|
@ -66,7 +66,6 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery )
|
|||
|
||||
ReFillLayerWidget();
|
||||
|
||||
SetToolbars();
|
||||
Zoom_Automatique( true );
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1121,7 +1121,6 @@ int WinEDA_PcbFrame::ReadPcbFile( LINE_READER* aReader, bool Append )
|
|||
m_TrackAndViasSizesList_Changed = true;
|
||||
SetStatusText( wxEmptyString );
|
||||
BestZoom();
|
||||
SetToolbars();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1156,10 +1155,8 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
|
|||
|
||||
// Select default Netclass before writing file.
|
||||
// Useful to save default values in headers
|
||||
GetBoard()->SetCurrentNetClass(
|
||||
GetBoard()->m_NetClasses.GetDefault()->GetName() );
|
||||
GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
|
||||
m_TrackAndViasSizesList_Changed = true;
|
||||
AuxiliaryToolBar_Update_UI();
|
||||
|
||||
WriteGeneralDescrPcb( aFile );
|
||||
WriteSheetDescr( GetScreen(), aFile );
|
||||
|
|
|
@ -132,7 +132,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
|
|||
|
||||
/* Delete items */
|
||||
item = new wxMenuItem( editMenu,
|
||||
ID_MODEDIT_DELETE_ITEM_BUTT,
|
||||
ID_MODEDIT_DELETE_TOOL,
|
||||
_( "Delete" ),
|
||||
_( "Delete objects with the eraser" ) );
|
||||
item->SetBitmap( delete_body_xpm );
|
||||
|
@ -236,9 +236,9 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
|
|||
|
||||
/* Pad */
|
||||
item = new wxMenuItem( placeMenu,
|
||||
ID_MODEDIT_ADD_PAD,
|
||||
ID_MODEDIT_PAD_TOOL,
|
||||
_( "Pad" ),
|
||||
_( "Add Pads" ) );
|
||||
_( "Add pad" ) );
|
||||
item->SetBitmap( pad_xpm );
|
||||
placeMenu->Append( item );
|
||||
|
||||
|
@ -247,7 +247,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
|
|||
|
||||
/* Circle */
|
||||
item = new wxMenuItem( placeMenu,
|
||||
ID_PCB_CIRCLE_BUTT,
|
||||
ID_MODEDIT_CIRCLE_TOOL,
|
||||
_( "Circle" ),
|
||||
_( "Add graphic circle" ) );
|
||||
item->SetBitmap( add_circle_xpm );
|
||||
|
@ -255,7 +255,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
|
|||
|
||||
/* Line or Polygon */
|
||||
item = new wxMenuItem( placeMenu,
|
||||
ID_PCB_ADD_LINE_BUTT,
|
||||
ID_MODEDIT_LINE_TOOL,
|
||||
_( "Line or Polygon" ),
|
||||
_( "Add graphic line or polygon" ) );
|
||||
item->SetBitmap( add_polygon_xpm );
|
||||
|
@ -263,7 +263,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
|
|||
|
||||
/* Arc */
|
||||
item = new wxMenuItem( placeMenu,
|
||||
ID_PCB_ARC_BUTT,
|
||||
ID_MODEDIT_ARC_TOOL,
|
||||
_( "Arc" ),
|
||||
_( "Add graphic arc" ) );
|
||||
item->SetBitmap( add_arc_xpm );
|
||||
|
@ -271,7 +271,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
|
|||
|
||||
/* Text */
|
||||
item = new wxMenuItem( placeMenu,
|
||||
ID_PCB_ADD_TEXT_BUTT,
|
||||
ID_MODEDIT_TEXT_TOOL,
|
||||
_( "Text" ),
|
||||
_( "Add graphic text" ) );
|
||||
item->SetBitmap( add_text_xpm );
|
||||
|
@ -280,7 +280,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
|
|||
/* Anchor */
|
||||
placeMenu->AppendSeparator();
|
||||
item = new wxMenuItem( placeMenu,
|
||||
ID_MODEDIT_PLACE_ANCHOR,
|
||||
ID_MODEDIT_ANCHOR_TOOL,
|
||||
_( "Anchor" ),
|
||||
_( "Place the footprint module reference anchor" ) );
|
||||
item->SetBitmap( anchor_xpm );
|
||||
|
|
|
@ -381,9 +381,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
wxMenu* placeMenu = new wxMenu;
|
||||
|
||||
// Module
|
||||
text = AddHotkeyName( _( "Module" ), g_Pcbnew_Editor_Hokeys_Descr,
|
||||
HK_ADD_MODULE, false );
|
||||
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text,
|
||||
text = AddHotkeyName( _( "Module" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ADD_MODULE, false );
|
||||
item = new wxMenuItem( placeMenu, ID_PCB_MODULE_BUTT, text,
|
||||
_( "Add modules" ), wxITEM_NORMAL );
|
||||
|
||||
item->SetBitmap( module_xpm );
|
||||
|
|
|
@ -184,7 +184,7 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
|
||||
MirePcb->Draw( Panel, DC, GR_XOR );
|
||||
|
||||
if( MirePcb->m_Flags & IS_NEW ) // If it is new, delete it
|
||||
if( MirePcb->IsNew() ) // If it is new, delete it
|
||||
{
|
||||
MirePcb->Draw( Panel, DC, GR_XOR );
|
||||
MirePcb->DeleteStructure();
|
||||
|
@ -250,7 +250,7 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
|
|||
SetCurItem( NULL );
|
||||
OnModify();
|
||||
|
||||
if( (MirePcb->m_Flags & IS_NEW) )
|
||||
if( MirePcb->IsNew() )
|
||||
{
|
||||
SaveCopyInUndoList( MirePcb, UR_NEW );
|
||||
MirePcb->m_Flags = 0;
|
||||
|
|
|
@ -443,46 +443,12 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
}
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_ADD_PAD:
|
||||
if( GetBoard()->m_Modules )
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Pad" ) );
|
||||
else
|
||||
{
|
||||
SetToolID( id, wxCURSOR_ARROW, _( "Pad Settings" ) );
|
||||
InstallPadOptionsFrame( NULL );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_PCB_ADD_LINE_BUTT:
|
||||
case ID_PCB_ARC_BUTT:
|
||||
case ID_PCB_CIRCLE_BUTT:
|
||||
case ID_PCB_ADD_TEXT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Drawing" ) );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_PLACE_ANCHOR:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_PLACE_GRID_COORD_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Grid Origin" ) );
|
||||
break;
|
||||
|
||||
case ID_NO_SELECT_BUTT:
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
||||
break;
|
||||
|
||||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_DELETE_ITEM_BUTT:
|
||||
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
|
||||
|
@ -708,8 +674,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
|
||||
if( redraw )
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
@ -836,3 +800,57 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
|
|||
module->Set_Rectangle_Encadrement();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_ModuleEditFrame::OnVerticalToolbar( wxCommandEvent& aEvent )
|
||||
{
|
||||
int id = aEvent.GetId();
|
||||
|
||||
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_MODEDIT_LINE_TOOL:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_ARC_TOOL:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_CIRCLE_TOOL:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_TEXT_TOOL:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_ANCHOR_TOOL:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_PLACE_GRID_COORD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Set grid origin" ) );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_PAD_TOOL:
|
||||
if( GetBoard()->m_Modules )
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add pad" ) );
|
||||
else
|
||||
{
|
||||
SetToolID( id, wxCURSOR_ARROW, _( "Pad settings" ) );
|
||||
InstallPadOptionsFrame( NULL );
|
||||
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_DELETE_TOOL:
|
||||
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxT( "Unknown command id." ) );
|
||||
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
|||
}
|
||||
|
||||
item = GetCurItem();
|
||||
|
||||
if( !item || (item->m_Flags == 0) )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
case 0:
|
||||
case ID_MODEDIT_NO_TOOL:
|
||||
break;
|
||||
|
||||
case ID_NO_SELECT_BUTT:
|
||||
break;
|
||||
|
||||
case ID_PCB_CIRCLE_BUTT:
|
||||
case ID_PCB_ARC_BUTT:
|
||||
case ID_PCB_ADD_LINE_BUTT:
|
||||
case ID_MODEDIT_CIRCLE_TOOL:
|
||||
case ID_MODEDIT_ARC_TOOL:
|
||||
case ID_MODEDIT_LINE_TOOL:
|
||||
if( !item || item->m_Flags == 0 )
|
||||
{
|
||||
int shape = S_SEGMENT;
|
||||
|
||||
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
||||
shape = S_CIRCLE;
|
||||
if( m_ID_current_state == ID_PCB_ARC_BUTT )
|
||||
shape = S_ARC;
|
||||
|
||||
SetCurItem(
|
||||
Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
|
||||
SetCurItem( 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 )
|
||||
{
|
||||
|
@ -106,33 +105,35 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
|||
}
|
||||
else if( ( (EDGE_MODULE*) item )->m_Shape == S_SEGMENT )
|
||||
{
|
||||
SetCurItem(
|
||||
Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) );
|
||||
SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) );
|
||||
}
|
||||
else
|
||||
DisplayError( this,
|
||||
wxT( "ProcessCommand error: item flags error" ) );
|
||||
DisplayError( this, wxT( "ProcessCommand error: item flags error" ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_DELETE_ITEM_BUTT:
|
||||
case ID_MODEDIT_DELETE_TOOL:
|
||||
if( item == NULL || // No item to delete
|
||||
(item->m_Flags != 0) ) // Item in edit, cannot delete it
|
||||
break;
|
||||
|
||||
if( item->Type() != TYPE_MODULE ) // Cannot delete the module itself
|
||||
{
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
RemoveStruct( item );
|
||||
SetCurItem( NULL );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_PLACE_ANCHOR:
|
||||
case ID_MODEDIT_ANCHOR_TOOL:
|
||||
{
|
||||
MODULE* module = GetBoard()->m_Modules;
|
||||
|
||||
if( module == NULL // No module loaded
|
||||
|| (module->m_Flags != 0) )
|
||||
break;
|
||||
|
||||
module->m_Flags = 0;
|
||||
SaveCopyInUndoList( module, UR_MODEDIT );
|
||||
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;
|
||||
|
||||
case ID_PCB_PLACE_GRID_COORD_BUTT:
|
||||
case ID_MODEDIT_PLACE_GRID_COORD:
|
||||
DrawPanel->DrawGridAxis( DC, GR_XOR );
|
||||
GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition();
|
||||
DrawPanel->DrawGridAxis( DC, GR_COPY );
|
||||
GetScreen()->SetModify();
|
||||
break;
|
||||
|
||||
case ID_PCB_ADD_TEXT_BUTT:
|
||||
case ID_MODEDIT_TEXT_TOOL:
|
||||
if( GetBoard()->m_Modules == NULL )
|
||||
break;
|
||||
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
CreateTextModule( GetBoard()->m_Modules, DC );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_ADD_PAD:
|
||||
case ID_MODEDIT_PAD_TOOL:
|
||||
if( GetBoard()->m_Modules )
|
||||
{
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
AddPad( GetBoard()->m_Modules, true );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -199,13 +202,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
|
|||
if( m_ID_current_state )
|
||||
{
|
||||
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
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL,
|
||||
_( "End Tool" ), cancel_tool_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ), cancel_tool_xpm );
|
||||
|
||||
PopMenu->AppendSeparator();
|
||||
}
|
||||
else
|
||||
|
@ -240,6 +240,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
|
|||
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||
_( "Cancel" ), cancel_xpm );
|
||||
}
|
||||
|
||||
PopMenu->AppendSeparator();
|
||||
}
|
||||
}
|
||||
|
@ -254,16 +255,12 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
|
|||
case TYPE_MODULE:
|
||||
{
|
||||
wxMenu* transform_choice = new wxMenu;
|
||||
ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_ROTATE,
|
||||
_( "Rotate" ), rotate_module_pos_xpm );
|
||||
ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_MIRROR,
|
||||
_( "Mirror" ), mirror_H_xpm );
|
||||
msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_EDIT_ITEM );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_MODULE,
|
||||
msg, edit_module_xpm );
|
||||
ADD_MENUITEM_WITH_SUBMENU( PopMenu, transform_choice,
|
||||
ID_MODEDIT_TRANSFORM_MODULE,
|
||||
ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_ROTATE, _( "Rotate" ),
|
||||
rotate_module_pos_xpm );
|
||||
ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ), mirror_H_xpm );
|
||||
msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
|
||||
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 );
|
||||
break;
|
||||
}
|
||||
|
@ -271,29 +268,26 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
|
|||
case TYPE_PAD:
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_MOVE_ITEM );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST,
|
||||
msg, move_pad_xpm );
|
||||
msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
|
||||
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 );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD,
|
||||
msg, options_pad_xpm );
|
||||
|
||||
msg = AddHotkeyName( _("Edit Pad" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD, msg, options_pad_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
|
||||
_( "New Pad Settings" ), options_new_pad_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
|
||||
_( "Export Pad Settings" ), export_options_pad_xpm );
|
||||
msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_DELETE );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_PAD,
|
||||
msg, delete_pad_xpm );
|
||||
msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_PAD, msg, delete_pad_xpm );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
PopMenu->AppendSeparator();
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
|
||||
_( "Global Pad Settings" ), global_options_pad_xpm );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
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,
|
||||
HK_MOVE_ITEM );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST,
|
||||
msg, move_field_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, msg, move_field_xpm );
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _("Rotate Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_ROTATE_ITEM );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE,
|
||||
msg, rotate_field_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, msg, rotate_field_xpm );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _("Edit Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_EDIT_ITEM );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE,
|
||||
msg, edit_text_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, edit_text_xpm );
|
||||
|
||||
if( ( (TEXTE_MODULE*) item )->m_Type == TEXT_is_DIVERS )
|
||||
{
|
||||
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_DELETE );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE,
|
||||
msg, delete_text_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, msg, delete_text_xpm );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -327,22 +320,19 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
|
|||
case TYPE_EDGE_MODULE:
|
||||
{
|
||||
if( (flags & IS_NEW) )
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING,
|
||||
_( "End edge" ), apply_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End edge" ), apply_xpm );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_MOVE_ITEM );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_EDGE,
|
||||
msg, move_line_xpm );
|
||||
msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, move_line_xpm );
|
||||
}
|
||||
if( ( flags & (IS_NEW | IS_MOVED) ) == IS_MOVED )
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_PLACE_EDGE,
|
||||
_( "Place edge" ), apply_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place edge" ), apply_xpm );
|
||||
|
||||
wxMenu* edit_mnu = new wxMenu;
|
||||
ADD_MENUITEM_WITH_SUBMENU( PopMenu, edit_mnu,
|
||||
ID_POPUP_PCB_EDIT_EDGE, _(
|
||||
"Edit" ), edit_xpm );
|
||||
ADD_MENUITEM_WITH_SUBMENU( PopMenu, edit_mnu, ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ),
|
||||
edit_xpm );
|
||||
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
|
||||
_( "Edit Width (Current)" ), width_segment_xpm );
|
||||
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 );
|
||||
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE,
|
||||
_( "Edit Layer (All)" ), select_layer_pair_xpm );
|
||||
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_DELETE );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_EDGE,
|
||||
msg, delete_xpm );
|
||||
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, delete_xpm );
|
||||
append_set_width = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -412,6 +400,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
switch( m_ID_current_state )
|
||||
{
|
||||
case 0:
|
||||
case ID_MODEDIT_NO_TOOL:
|
||||
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
||||
{
|
||||
item = ModeditLocateAndDisplay();
|
||||
|
@ -454,7 +443,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
|
||||
case ID_PCB_ADD_LINE_BUTT:
|
||||
{
|
||||
if( item && ( item->m_Flags & IS_NEW ) )
|
||||
if( item && item->IsNew() )
|
||||
{
|
||||
End_Edge_Module( (EDGE_MODULE*) item );
|
||||
SetCurItem( NULL );
|
||||
|
|
|
@ -95,8 +95,6 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList( wxCommandEvent& event )
|
|||
SetCurItem( NULL );
|
||||
|
||||
OnModify();
|
||||
ReCreateHToolbar();
|
||||
SetToolbars();
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
@ -133,7 +131,5 @@ void WinEDA_ModuleEditFrame::GetComponentFromUndoList( wxCommandEvent& event )
|
|||
SetCurItem( NULL );;
|
||||
|
||||
OnModify();
|
||||
ReCreateHToolbar();
|
||||
SetToolbars();
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
|
|
@ -22,31 +22,6 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
|
||||
switch( id )
|
||||
{
|
||||
case ID_TB_OPTIONS_SHOW_GRID:
|
||||
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
|
||||
DrawPanel->Refresh( );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
||||
g_UserUnit = MILLIMETRES;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
||||
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
|
||||
g_UserUnit = INCHES;
|
||||
UpdateStatusBar();
|
||||
ReCreateAuxiliaryToolbar();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
|
||||
SetStatusText( wxEmptyString );
|
||||
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
|
||||
UpdateStatusBar();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_CURSOR:
|
||||
m_CursorShape = m_OptionsToolBar->GetToolState( id );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
||||
m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
|
||||
DrawPanel->Refresh( );
|
||||
|
@ -74,6 +49,4 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
wxT( "WinEDA_ModuleEditFrame::OnSelectOptionToolbar error" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ public:
|
|||
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
||||
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
||||
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
||||
void SetToolbars();
|
||||
void ReCreateMenuBar();
|
||||
void ToolOnRightClick( wxCommandEvent& event );
|
||||
void OnSelectOptionToolbar( wxCommandEvent& event );
|
||||
|
@ -48,6 +47,15 @@ public:
|
|||
bool OnHotkeyRotateItem( int aIdCommand );
|
||||
void Show3D_Frame( wxCommandEvent& event );
|
||||
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
|
||||
void OnVerticalToolbar( wxCommandEvent& aEvent );
|
||||
|
||||
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLibSelected( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLibAndModuleSelected( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function LoadModuleFromBoard
|
||||
|
@ -78,8 +86,7 @@ public:
|
|||
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
||||
* @param aData = a pointer on an auxiliary data (NULL if not used)
|
||||
*/
|
||||
virtual void PrintPage( wxDC* aDC,
|
||||
int aPrintMaskLayer, bool aPrintMirrorMode,
|
||||
virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode,
|
||||
void * aData = NULL);
|
||||
|
||||
// BOARD handling
|
||||
|
|
|
@ -29,94 +29,42 @@ static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting;
|
|||
/* class WinEDA_ModuleEditFrame */
|
||||
/********************************/
|
||||
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||
ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||
WinEDA_BasePcbFrame::ProcessItemSelection )
|
||||
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
|
||||
EVT_MENU( wxID_EXIT, WinEDA_ModuleEditFrame::CloseModuleEditor )
|
||||
|
||||
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
|
||||
|
||||
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT,
|
||||
WinEDA_ModuleEditFrame::OnSelectZoom )
|
||||
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT,
|
||||
WinEDA_ModuleEditFrame::OnSelectGrid )
|
||||
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_ModuleEditFrame::OnSelectZoom )
|
||||
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,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_DELETE_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_NEW_MODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_IMPORT_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_EXPORT_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_DELETE_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_NEW_MODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_IMPORT_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_EXPORT_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SHEET_SET,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SHEET_SET, WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( wxID_PRINT, WinEDA_ModuleEditFrame::ToPrinter )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
|
||||
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 )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, 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):
|
||||
EVT_TOOL( ID_NO_SELECT_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
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):
|
||||
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
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 )
|
||||
// Vertical tool bar button click event handler.
|
||||
EVT_TOOL_RANGE( ID_MODEDIT_NO_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
|
||||
WinEDA_ModuleEditFrame::OnVerticalToolbar )
|
||||
|
||||
// Options Toolbar
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
||||
|
@ -130,21 +78,32 @@ EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
|||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
|
||||
// Module transformations
|
||||
EVT_MENU( ID_MODEDIT_MODULE_ROTATE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
|
||||
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 )
|
||||
|
||||
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_PCB_PAD_SETUP,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_PCB_USER_GRID_SETUP,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
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_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
|
||||
|
||||
EVT_UPDATE_UI( ID_MODEDIT_SAVE_LIBMODULE, WinEDA_ModuleEditFrame::OnUpdateLibSelected )
|
||||
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()
|
||||
|
||||
|
||||
|
@ -153,8 +112,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
|
|||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style ) :
|
||||
WinEDA_BasePcbFrame( father, MODULE_EDITOR_FRAME,
|
||||
wxEmptyString, pos, size, style )
|
||||
WinEDA_BasePcbFrame( father, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style )
|
||||
{
|
||||
m_FrameName = wxT( "ModEditFrame" );
|
||||
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 )
|
||||
s_screenModule = new PCB_SCREEN();
|
||||
|
||||
SetScreen( s_screenModule );
|
||||
GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
|
@ -209,19 +168,16 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
|
|||
horiz.LeftDockable( false ).RightDockable( false );
|
||||
|
||||
m_auimgr.AddPane( m_HToolBar,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
|
||||
Row( 0 ) );
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) );
|
||||
|
||||
m_auimgr.AddPane( m_AuxiliaryToolBar,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).
|
||||
Top().Row( 1 ) );
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
|
||||
|
||||
m_auimgr.AddPane( m_VToolBar,
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
|
||||
|
||||
m_auimgr.AddPane( m_OptionsToolBar,
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).
|
||||
Left() );
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ). Left() );
|
||||
|
||||
m_auimgr.AddPane( DrawPanel,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||
|
@ -230,8 +186,6 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
|
|||
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
||||
|
||||
m_auimgr.Update();
|
||||
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,49 +224,53 @@ void WinEDA_ModuleEditFrame::CloseModuleEditor( wxCommandEvent& Event )
|
|||
Close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetToolbars
|
||||
* 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()
|
||||
|
||||
void WinEDA_ModuleEditFrame::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
bool active, islib = true;
|
||||
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) wxGetApp().GetTopWindow();
|
||||
if( m_ID_current_state == 0 )
|
||||
m_ID_current_state = ID_MODEDIT_NO_TOOL;
|
||||
|
||||
if( m_HToolBar == NULL )
|
||||
return;
|
||||
wxMenuBar* menuBar = GetMenuBar();
|
||||
if( menuBar == NULL )
|
||||
return;
|
||||
if( m_VToolBar == NULL )
|
||||
return;
|
||||
if( m_OptionsToolBar == NULL )
|
||||
return;
|
||||
aEvent.Enable( GetBoard()->m_Modules != NULL );
|
||||
|
||||
if( m_CurrentLib == wxEmptyString )
|
||||
islib = false;
|
||||
if( aEvent.GetEventObject() == m_VToolBar )
|
||||
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 )
|
||||
active = false;
|
||||
else
|
||||
active = true;
|
||||
void WinEDA_ModuleEditFrame::OnUpdateLibSelected( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Enable( m_CurrentLib != wxEmptyString );
|
||||
}
|
||||
|
||||
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 );
|
||||
menuBar->Enable( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, active );
|
||||
void WinEDA_ModuleEditFrame::OnUpdateModuleSelected( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
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;
|
||||
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
|
||||
{
|
||||
BOARD* mainpcb = frame->GetBoard();
|
||||
|
@ -325,116 +283,36 @@ void WinEDA_ModuleEditFrame::SetToolbars()
|
|||
break;
|
||||
}
|
||||
|
||||
if( source_module )
|
||||
{
|
||||
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 );
|
||||
canInsert = ( source_module == NULL );
|
||||
}
|
||||
|
||||
m_HToolBar->EnableTool( wxID_UNDO, GetScreen()->GetUndoCommandCount()>0 && active );
|
||||
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:
|
||||
int idtools[] =
|
||||
{
|
||||
ID_MODEDIT_ADD_PAD, ID_MODEDIT_ADD_PAD,
|
||||
ID_PCB_ADD_LINE_BUTT, ID_PCB_CIRCLE_BUTT,
|
||||
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 );
|
||||
aEvent.Enable( canInsert );
|
||||
}
|
||||
|
||||
m_VToolBar->Refresh();
|
||||
|
||||
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 )
|
||||
void WinEDA_ModuleEditFrame::OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
unsigned jj;
|
||||
if( m_SelZoomBox )
|
||||
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
|
||||
{
|
||||
bool not_found = true;
|
||||
for( jj = 0; jj < GetScreen()->m_ZoomList.GetCount(); jj++ )
|
||||
BOARD* mainpcb = frame->GetBoard();
|
||||
MODULE* source_module = mainpcb->m_Modules;
|
||||
|
||||
// search if the source module was not deleted:
|
||||
for( ; source_module != NULL; source_module = source_module->Next() )
|
||||
{
|
||||
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[jj] )
|
||||
{
|
||||
m_SelZoomBox->SetSelection( jj + 1 );
|
||||
not_found = false;
|
||||
if( module_in_edit->m_Link == source_module->m_TimeStamp )
|
||||
break;
|
||||
}
|
||||
|
||||
canReplace = ( source_module != NULL );
|
||||
}
|
||||
|
||||
if( not_found )
|
||||
m_SelZoomBox->SetSelection( -1 );
|
||||
}
|
||||
|
||||
if( m_SelGridBox )
|
||||
m_SelGridBox->SetSelection( m_LastGridSizeId );
|
||||
|
||||
m_AuxiliaryToolBar->Refresh();
|
||||
}
|
||||
|
||||
DisplayUnitsMsg();
|
||||
|
||||
if( m_auimgr.GetManagedWindow() )
|
||||
m_auimgr.Update();
|
||||
aEvent.Enable( canReplace );
|
||||
}
|
||||
|
||||
|
||||
|
@ -537,7 +415,6 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
|
|||
wxSafeYield();
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
||||
|
@ -552,6 +429,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
|
|||
void WinEDA_ModuleEditFrame::OnModify()
|
||||
{
|
||||
WinEDA_BasePcbFrame::OnModify();
|
||||
|
||||
if( m_Draw3DFrame )
|
||||
m_Draw3DFrame->ReloadRequest();
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
module->m_Flags = 0;
|
||||
}
|
||||
|
||||
if( (module->m_Flags & IS_NEW) ) // Copy command: delete new footprint
|
||||
if( (module->IsNew()) ) // Copy command: delete new footprint
|
||||
{
|
||||
module->DeleteStructure();
|
||||
module = NULL;
|
||||
|
@ -396,7 +396,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
|
|||
OnModify();
|
||||
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
|
||||
|
||||
if( module->m_Flags & IS_NEW )
|
||||
if( module->IsNew() )
|
||||
{
|
||||
SaveCopyInUndoList( module, UR_NEW );
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
|
||||
if( NewTrack )
|
||||
{
|
||||
if( NewTrack->m_Flags & IS_NEW )
|
||||
if( NewTrack->IsNew() )
|
||||
{
|
||||
for( ii = 0; ii < NbPtNewTrack; ii++, NewTrack = NextS )
|
||||
{
|
||||
|
|
|
@ -64,8 +64,6 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
|
|||
wxT( "WinEDA_PcbFrame::ProcessMuWaveFunctions() id error" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
switch( DrawStruct->Type() )
|
||||
{
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
if( (DrawStruct->m_Flags & IS_NEW) )
|
||||
if( DrawStruct->IsNew() )
|
||||
{
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
Begin_Zone( aDC );
|
||||
|
@ -127,7 +127,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
GetBoard()->SetCurrentNetClass(
|
||||
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
|
||||
m_TrackAndViasSizesList_Changed = true;
|
||||
AuxiliaryToolBar_Update_UI();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -138,12 +137,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
switch( m_ID_current_state )
|
||||
{
|
||||
case ID_MAIN_MENUBAR:
|
||||
case ID_PCB_NO_TOOL:
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case ID_NO_SELECT_BUTT:
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
|
||||
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
|
||||
|
@ -211,7 +208,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
}
|
||||
else if( DrawStruct
|
||||
&& (DrawStruct->Type() == TYPE_DRAWSEGMENT)
|
||||
&& (DrawStruct->m_Flags & IS_NEW) )
|
||||
&& DrawStruct->IsNew() )
|
||||
{
|
||||
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC );
|
||||
SetCurItem( DrawStruct );
|
||||
|
@ -234,7 +231,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
if( DrawStruct )
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
else if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
||||
else if( DrawStruct && DrawStruct->IsNew() )
|
||||
{
|
||||
TRACK* track = Begin_Route( (TRACK*) DrawStruct, aDC );
|
||||
// SetCurItem() must not write to the msg panel
|
||||
|
@ -284,7 +281,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
}
|
||||
else if( DrawStruct
|
||||
&& (DrawStruct->Type() == TYPE_ZONE_CONTAINER)
|
||||
&& (DrawStruct->m_Flags & IS_NEW) )
|
||||
&& DrawStruct->IsNew() )
|
||||
{ // Add a new corner to the current outline beeing created:
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
Begin_Zone( aDC );
|
||||
|
@ -311,7 +308,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) );
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
case ID_PCB_MODULE_BUTT:
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
|
@ -343,7 +340,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
}
|
||||
else if( DrawStruct
|
||||
&& (DrawStruct->Type() == TYPE_DIMENSION)
|
||||
&& (DrawStruct->m_Flags & IS_NEW) )
|
||||
&& DrawStruct->IsNew() )
|
||||
{
|
||||
DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, aDC );
|
||||
SetCurItem( DrawStruct );
|
||||
|
@ -395,6 +392,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
|
||||
switch( m_ID_current_state )
|
||||
{
|
||||
case ID_PCB_NO_TOOL:
|
||||
case 0:
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
|
@ -413,7 +411,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
{
|
||||
case TYPE_TRACK:
|
||||
case TYPE_VIA:
|
||||
if( DrawStruct->m_Flags & IS_NEW )
|
||||
if( DrawStruct->IsNew() )
|
||||
{
|
||||
End_Route( (TRACK*) DrawStruct, aDC );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
|
@ -451,7 +449,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
break; // end case 0
|
||||
|
||||
case ID_TRACK_BUTT:
|
||||
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
||||
if( DrawStruct && DrawStruct->IsNew() )
|
||||
{
|
||||
End_Route( (TRACK*) DrawStruct, aDC );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
|
@ -471,18 +469,21 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
case ID_PCB_CIRCLE_BUTT:
|
||||
if( DrawStruct == NULL )
|
||||
break;
|
||||
|
||||
if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
|
||||
{
|
||||
DisplayError( this, wxT( "DrawStruct Type error" ) );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
break;
|
||||
}
|
||||
if( (DrawStruct->m_Flags & IS_NEW) )
|
||||
|
||||
if( DrawStruct->IsNew() )
|
||||
{
|
||||
End_Edge( (DRAWSEGMENT*) DrawStruct, aDC );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
SetCurItem( NULL );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,8 +134,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
}
|
||||
else
|
||||
{
|
||||
msg = AddHotkeyName( _(
|
||||
"Unlock Module" ), g_Board_Editor_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Unlock Module" ), g_Board_Editor_Hokeys_Descr,
|
||||
HK_LOCK_UNLOCK_FOOTPRINT );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg,
|
||||
unlocked_xpm );
|
||||
|
@ -311,7 +310,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
aPopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
case ID_PCB_MODULE_BUTT:
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC,
|
||||
_( "Footprint Documentation" ), book_xpm );
|
||||
aPopMenu->AppendSeparator();
|
||||
|
@ -408,9 +407,9 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
|
|||
|
||||
GetBoard()->SetCurrentNetClass( Track->GetNetClassName() );
|
||||
m_TrackAndViasSizesList_Changed = true;
|
||||
AuxiliaryToolBar_Update_UI();
|
||||
|
||||
int flags = Track->m_Flags;
|
||||
|
||||
if( flags == 0 )
|
||||
{
|
||||
if( Track->Type() == TYPE_VIA )
|
||||
|
@ -737,7 +736,6 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
|
|||
|
||||
GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() );
|
||||
m_TrackAndViasSizesList_Changed = true;
|
||||
AuxiliaryToolBar_Update_UI();
|
||||
|
||||
wxString msg = Pad->MenuText( GetBoard() );
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
|
|||
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
|
||||
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_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io )
|
||||
|
@ -86,9 +86,6 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
|
|||
// Menu Files:
|
||||
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_SAVE_BOARD_AS, WinEDA_PcbFrame::Files_io )
|
||||
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_PcbFrame::OnFileHistory )
|
||||
|
@ -181,39 +178,19 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
|
|||
// Option toolbar
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
||||
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,
|
||||
WinEDA_PcbFrame::OnSelectOptionToolbar )
|
||||
|
||||
// Vertical toolbar:
|
||||
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
||||
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_NO_TOOL, ID_PCB_PLACE_GRID_COORD_BUTT, WinEDA_PcbFrame::OnSelectTool )
|
||||
|
||||
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
|
||||
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_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,
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE, ID_POPUP_PCB_AUTOPLACE_END_RANGE,
|
||||
WinEDA_PcbFrame::AutoPlace )
|
||||
|
||||
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,
|
||||
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()
|
||||
|
||||
|
||||
///////****************************///////////:
|
||||
|
||||
|
||||
WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* parent,
|
||||
const wxString& title,
|
||||
WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style ) :
|
||||
WinEDA_BasePcbFrame( parent, PCB_FRAME, title, pos, size, style )
|
||||
|
@ -386,7 +379,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* parent,
|
|||
m_auimgr.AddPane( MsgPanel,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
||||
|
||||
SetToolbars();
|
||||
ReFillLayerWidget(); // this is near end because contents establish size
|
||||
syncLayerWidget();
|
||||
m_auimgr.Update();
|
||||
|
@ -399,6 +391,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
|
|||
delete m_drc;
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_PcbFrame::ReFillLayerWidget()
|
||||
{
|
||||
m_Layers->ReFill();
|
||||
|
@ -423,6 +416,7 @@ void WinEDA_PcbFrame::OnQuit( wxCommandEvent& event )
|
|||
Close( true );
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||
{
|
||||
DrawPanel->m_AbortRequest = true;
|
||||
|
@ -432,8 +426,7 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
|||
unsigned ii;
|
||||
wxMessageDialog dialog( this, _( "Board modified, Save before exit ?" ),
|
||||
_( "Confirmation" ),
|
||||
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION |
|
||||
wxYES_DEFAULT );
|
||||
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
|
||||
|
||||
ii = dialog.ShowModal();
|
||||
|
||||
|
@ -549,9 +542,9 @@ void WinEDA_PcbFrame::SaveSettings()
|
|||
config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption );
|
||||
config->Write( SHOW_MICROWAVE_TOOLS, (long) m_show_microwave_tools );
|
||||
config->Write( SHOW_LAYER_MANAGER_TOOLS, (long)m_show_layer_manager_tools );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function IsGridVisible() , virtual
|
||||
* @return true if the grid must be shown
|
||||
|
@ -561,10 +554,11 @@ bool WinEDA_PcbFrame::IsGridVisible()
|
|||
return IsElementVisible( GRID_VISIBLE );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetGridVisibility() , virtual
|
||||
* It may be overloaded by derived classes
|
||||
* if you want to store/retrieve the grid visiblity in configuration.
|
||||
* if you want to store/retrieve the grid visibility in configuration.
|
||||
* @param aVisible = true if the grid must be shown
|
||||
*/
|
||||
void WinEDA_PcbFrame::SetGridVisibility(bool aVisible)
|
||||
|
@ -572,6 +566,7 @@ void WinEDA_PcbFrame::SetGridVisibility(bool aVisible)
|
|||
SetElementVisibility( GRID_VISIBLE, aVisible );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function GetGridColor() , virtual
|
||||
* @return the color of the grid
|
||||
|
@ -581,6 +576,7 @@ int WinEDA_PcbFrame::GetGridColor()
|
|||
return GetBoard()->GetVisibleElementColor( GRID_VISIBLE );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetGridColor() , virtual
|
||||
* @param aColor = the new color of the grid
|
||||
|
@ -590,8 +586,9 @@ void WinEDA_PcbFrame::SetGridColor(int aColor)
|
|||
GetBoard()->SetVisibleElementColor( GRID_VISIBLE, aColor );
|
||||
}
|
||||
|
||||
|
||||
/* 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
|
||||
* 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
|
||||
|
@ -622,6 +619,7 @@ void WinEDA_PcbFrame::syncLayerWidget( )
|
|||
m_Layers->SelectLayer( getActiveLayer() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetElementVisibility
|
||||
* 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 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetVisibleAlls
|
||||
* 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( )
|
||||
{
|
||||
GetBoard()->SetVisibleAlls( );
|
||||
|
||||
for( int ii = 0; ii < PCB_VISIBLE( END_PCB_VISIBLE_LIST ); ii++ )
|
||||
m_Layers->SetRenderState( ii, true );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
|
@ -669,8 +670,7 @@ wxString WinEDA_PcbFrame::GetLastNetListRead()
|
|||
wxFileName absoluteFileName = m_lastNetListRead;
|
||||
wxFileName pcbFileName = GetScreen()->GetFileName();
|
||||
|
||||
if( !absoluteFileName.MakeAbsolute( pcbFileName.GetPath() )
|
||||
|| !absoluteFileName.FileExists() )
|
||||
if( !absoluteFileName.MakeAbsolute( pcbFileName.GetPath() ) || !absoluteFileName.FileExists() )
|
||||
{
|
||||
absoluteFileName.Clear();
|
||||
m_lastNetListRead = wxEmptyString;
|
||||
|
@ -692,6 +692,7 @@ void WinEDA_PcbFrame::SetLastNetListRead( const wxString& aLastNetListRead )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function OnModify() (virtual)
|
||||
* Must be called after a change
|
||||
|
@ -702,6 +703,7 @@ void WinEDA_PcbFrame::SetLastNetListRead( const wxString& aLastNetListRead )
|
|||
void WinEDA_PcbFrame::OnModify( )
|
||||
{
|
||||
WinEDA_BasePcbFrame::OnModify();
|
||||
|
||||
if( m_Draw3DFrame )
|
||||
m_Draw3DFrame->ReloadRequest();
|
||||
}
|
||||
|
|
|
@ -17,17 +17,26 @@ enum pcbnew_ids
|
|||
ID_MICROWAVE_V_TOOLBAR,
|
||||
ID_OPEN_MODULE_EDITOR,
|
||||
ID_READ_NETLIST,
|
||||
|
||||
// Right vertical tool bar command IDs.
|
||||
ID_PCB_NO_TOOL,
|
||||
ID_PCB_HIGHLIGHT_BUTT,
|
||||
ID_PCB_SHOW_1_RATSNEST_BUTT,
|
||||
ID_PCB_MODULE_BUTT,
|
||||
ID_TRACK_BUTT,
|
||||
ID_PCB_ZONES_BUTT,
|
||||
ID_PCB_ADD_LINE_BUTT,
|
||||
ID_PCB_CIRCLE_BUTT,
|
||||
ID_PCB_ARC_BUTT,
|
||||
ID_PCB_HIGHLIGHT_BUTT,
|
||||
ID_PCB_ADD_TEXT_BUTT,
|
||||
ID_PCB_DIMENSION_BUTT,
|
||||
ID_PCB_MIRE_BUTT,
|
||||
ID_PCB_SHOW_1_RATSNEST_BUTT,
|
||||
ID_PCB_DELETE_ITEM_BUTT,
|
||||
ID_PCB_PLACE_OFFSET_COORD_BUTT,
|
||||
ID_PCB_PLACE_GRID_COORD_BUTT,
|
||||
|
||||
ID_PCB_MASK_CLEARANCE,
|
||||
ID_PCB_LAYERS_SETUP,
|
||||
ID_PCB_ADD_LINE_BUTT,
|
||||
ID_PCB_ADD_TEXT_BUTT,
|
||||
|
||||
ID_POPUP_PCB_START_RANGE,
|
||||
ID_POPUP_PCB_MOVE_MODULE_REQUEST,
|
||||
|
@ -228,7 +237,6 @@ enum pcbnew_ids
|
|||
|
||||
ID_PCB_PAD_SETUP,
|
||||
|
||||
ID_PCB_DIMENSION_BUTT,
|
||||
ID_PCB_DRAWINGS_WIDTHS_SETUP,
|
||||
|
||||
ID_PCB_GEN_CMP_FILE,
|
||||
|
@ -251,13 +259,21 @@ enum pcbnew_ids
|
|||
|
||||
ID_DRC_CONTROL,
|
||||
ID_PCB_GLOBAL_DELETE,
|
||||
ID_TRACK_BUTT,
|
||||
ID_PCB_ZONES_BUTT,
|
||||
ID_PCB_DELETE_ITEM_BUTT,
|
||||
ID_POPUP_PCB_DELETE_TRACKSEG,
|
||||
ID_TOOLBARH_PCB_SELECT_LAYER,
|
||||
ID_PCB_DISPLAY_OPTIONS_SETUP,
|
||||
|
||||
// Module editor right vertical tool bar commands.
|
||||
ID_MODEDIT_NO_TOOL,
|
||||
ID_MODEDIT_PAD_TOOL,
|
||||
ID_MODEDIT_LINE_TOOL,
|
||||
ID_MODEDIT_CIRCLE_TOOL,
|
||||
ID_MODEDIT_ARC_TOOL,
|
||||
ID_MODEDIT_TEXT_TOOL,
|
||||
ID_MODEDIT_ANCHOR_TOOL,
|
||||
ID_MODEDIT_DELETE_TOOL,
|
||||
ID_MODEDIT_PLACE_GRID_COORD,
|
||||
|
||||
// ID used in module editor:
|
||||
ID_MODEDIT_CHECK,
|
||||
ID_MODEDIT_SELECT_CURRENT_LIB,
|
||||
|
@ -266,9 +282,6 @@ enum pcbnew_ids
|
|||
ID_MODEDIT_NEW_MODULE,
|
||||
ID_MODEDIT_SHEET_SET,
|
||||
ID_MODEDIT_LOAD_MODULE,
|
||||
ID_MODEDIT_ADD_PAD,
|
||||
ID_MODEDIT_PLACE_ANCHOR,
|
||||
ID_MODEDIT_DELETE_ITEM_BUTT,
|
||||
ID_MODEDIT_PAD_SETTINGS,
|
||||
ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
||||
ID_MODEDIT_INSERT_MODULE_IN_BOARD,
|
||||
|
|
|
@ -235,7 +235,6 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
|
|||
int result = frame->ShowModal();
|
||||
frame->Destroy();
|
||||
DrawPanel->MoveCursorToCrossHair();
|
||||
SetToolbars();
|
||||
|
||||
// if user changed colors and we are in high contrast mode, then redraw
|
||||
// because the PAD_SMD pads may change color.
|
||||
|
|
|
@ -30,34 +30,29 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
|
|||
|
||||
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
|
||||
m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString,
|
||||
wxBitmap( open_library_xpm ),
|
||||
_( "Select working library" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString,
|
||||
wxBitmap( save_library_xpm ),
|
||||
m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, wxBitmap( save_library_xpm ),
|
||||
_( "Save Module in working library" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
|
||||
wxEmptyString,
|
||||
m_HToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString,
|
||||
wxBitmap( new_library_xpm ),
|
||||
_( "Create new library and save current module" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString,
|
||||
wxBitmap( delete_xpm ),
|
||||
m_HToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, wxBitmap( delete_xpm ),
|
||||
_( "Delete part in current library" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString,
|
||||
wxBitmap( new_footprint_xpm ),
|
||||
m_HToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, wxBitmap( new_footprint_xpm ),
|
||||
_( "New Module" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString,
|
||||
wxBitmap( module_xpm ),
|
||||
m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString, wxBitmap( module_xpm ),
|
||||
_( "Load module from lib" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
|
@ -74,12 +69,10 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
|
|||
_( "Insert module into current board" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString,
|
||||
wxBitmap( import_module_xpm ),
|
||||
m_HToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, wxBitmap( import_module_xpm ),
|
||||
_( "import module" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString,
|
||||
wxBitmap( export_module_xpm ),
|
||||
m_HToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, wxBitmap( export_module_xpm ),
|
||||
_( "export module" ) );
|
||||
|
||||
|
||||
|
@ -99,29 +92,20 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
|
|||
_( "Print Module" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_ZOOM_IN, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
|
||||
wxBitmap( zoom_in_xpm ), msg );
|
||||
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_IN, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_ZOOM_OUT, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
|
||||
wxBitmap( zoom_out_xpm ), msg );
|
||||
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_OUT, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_ZOOM_REDRAW, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||
wxBitmap( zoom_redraw_xpm ), msg );
|
||||
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_ZOOM_AUTO, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
||||
wxBitmap( zoom_auto_xpm ), msg );
|
||||
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_AUTO, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ), msg );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString,
|
||||
wxBitmap( options_pad_xpm ),
|
||||
m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, wxBitmap( options_pad_xpm ),
|
||||
_( "Pad Settings" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
|
@ -140,47 +124,39 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar()
|
|||
if( m_VToolBar )
|
||||
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
|
||||
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
|
||||
wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK );
|
||||
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
|
||||
m_VToolBar->AddTool( ID_MODEDIT_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
|
||||
wxEmptyString, wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_MODEDIT_ADD_PAD, wxEmptyString,
|
||||
wxBitmap( pad_xpm ),
|
||||
_( "Add Pads" ), wxITEM_CHECK );
|
||||
m_VToolBar->AddTool( ID_MODEDIT_PAD_TOOL, wxEmptyString, wxBitmap( pad_xpm ),
|
||||
_( "Add pads" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString,
|
||||
wxBitmap( add_polygon_xpm ),
|
||||
m_VToolBar->AddTool( ID_MODEDIT_LINE_TOOL, wxEmptyString, wxBitmap( add_polygon_xpm ),
|
||||
_( "Add graphic line or polygon" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString,
|
||||
wxBitmap( add_circle_xpm ),
|
||||
m_VToolBar->AddTool( ID_MODEDIT_CIRCLE_TOOL, wxEmptyString, wxBitmap( add_circle_xpm ),
|
||||
_( "Add graphic circle" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString,
|
||||
wxBitmap( add_arc_xpm ),
|
||||
m_VToolBar->AddTool( ID_MODEDIT_ARC_TOOL, wxEmptyString, wxBitmap( add_arc_xpm ),
|
||||
_( "Add graphic arc" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString,
|
||||
wxBitmap( add_text_xpm ),
|
||||
m_VToolBar->AddTool( ID_MODEDIT_TEXT_TOOL, wxEmptyString, wxBitmap( add_text_xpm ),
|
||||
_( "Add Text" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_MODEDIT_PLACE_ANCHOR, wxEmptyString,
|
||||
wxBitmap( anchor_xpm ),
|
||||
m_VToolBar->AddTool( ID_MODEDIT_ANCHOR_TOOL, wxEmptyString, wxBitmap( anchor_xpm ),
|
||||
_( "Place the footprint module reference anchor" ),
|
||||
wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_MODEDIT_DELETE_ITEM_BUTT, wxEmptyString,
|
||||
wxBitmap( delete_body_xpm ),
|
||||
m_VToolBar->AddTool( ID_MODEDIT_DELETE_TOOL, wxEmptyString, wxBitmap( delete_body_xpm ),
|
||||
_( "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 ),
|
||||
_( "Set the origin point for the grid" ),
|
||||
wxITEM_CHECK );
|
||||
|
@ -195,13 +171,9 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
|
|||
return;
|
||||
|
||||
// Create options tool bar.
|
||||
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
|
||||
ID_OPT_TOOLBAR, FALSE );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
|
||||
wxBitmap( grid_xpm ),
|
||||
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, wxBitmap( grid_xpm ),
|
||||
_( "Hide grid" ), wxITEM_CHECK );
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,IsGridVisible() );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
|
||||
wxBitmap( polar_coord_xpm ),
|
||||
|
@ -224,13 +196,11 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
|
|||
wxBitmap( pad_sketch_xpm ),
|
||||
_( "Show Pads Sketch" ), wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
|
||||
wxEmptyString,
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString,
|
||||
wxBitmap( text_sketch_xpm ),
|
||||
_( "Show Texts Sketch" ), wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
|
||||
wxEmptyString,
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString,
|
||||
wxBitmap( show_mod_edge_xpm ),
|
||||
_( "Show Edges Sketch" ), wxITEM_CHECK );
|
||||
|
||||
|
@ -240,13 +210,12 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
|
|||
|
||||
void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
|
||||
{
|
||||
size_t i;
|
||||
wxString msg;
|
||||
|
||||
if( m_AuxiliaryToolBar == NULL )
|
||||
{
|
||||
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this,
|
||||
ID_AUX_TOOLBAR, TRUE );
|
||||
if( m_AuxiliaryToolBar )
|
||||
return;
|
||||
|
||||
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this, ID_AUX_TOOLBAR, true );
|
||||
|
||||
// Set up toolbar
|
||||
m_AuxiliaryToolBar->AddSeparator();
|
||||
|
@ -264,67 +233,12 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
|
|||
ID_ON_ZOOM_SELECT,
|
||||
wxPoint( -1, -1 ),
|
||||
wxSize( LISTBOX_WIDTH, -1 ) );
|
||||
msg = _( "Auto" );
|
||||
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 );
|
||||
|
||||
// Update tool bar to reflect setting.
|
||||
updateGridSelectBox();
|
||||
updateZoomSelectBox();
|
||||
|
||||
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
||||
m_AuxiliaryToolBar->Realize();
|
||||
}
|
||||
|
||||
// Update tool bar to reflect setting.
|
||||
m_SelGridBox->Clear();
|
||||
|
||||
for( i = 0; i < GetScreen()->GetGridCount(); i++ )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
|
|||
break;
|
||||
}
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
case ID_PCB_MODULE_BUTT:
|
||||
break;
|
||||
|
||||
case ID_PCB_CIRCLE_BUTT:
|
||||
|
@ -61,15 +61,14 @@ void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event )
|
|||
|
||||
switch( id )
|
||||
{
|
||||
case ID_MODEDIT_ADD_PAD:
|
||||
case ID_MODEDIT_PAD_TOOL:
|
||||
InstallPadOptionsFrame( NULL );
|
||||
break;
|
||||
|
||||
case ID_PCB_CIRCLE_BUTT:
|
||||
case ID_PCB_ARC_BUTT:
|
||||
case ID_PCB_ADD_LINE_BUTT:
|
||||
case ID_PCB_DIMENSION_BUTT:
|
||||
case ID_PCB_ADD_TEXT_BUTT:
|
||||
case ID_MODEDIT_CIRCLE_TOOL:
|
||||
case ID_MODEDIT_ARC_TOOL:
|
||||
case ID_MODEDIT_LINE_TOOL:
|
||||
case ID_MODEDIT_TEXT_TOOL:
|
||||
InstallOptionsFrame( pos );
|
||||
break;
|
||||
|
||||
|
|
|
@ -73,18 +73,23 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
|
|||
|
||||
/* get colors, and redraw bitmap button only on changes */
|
||||
active_layer_color = GetBoard()->GetLayerColor(getActiveLayer());
|
||||
|
||||
if( previous_active_layer_color != active_layer_color )
|
||||
{
|
||||
previous_active_layer_color = active_layer_color;
|
||||
change = true;
|
||||
}
|
||||
|
||||
Route_Layer_TOP_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP);
|
||||
|
||||
if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color )
|
||||
{
|
||||
previous_Route_Layer_TOP_color = Route_Layer_TOP_color;
|
||||
change = true;
|
||||
}
|
||||
|
||||
Route_Layer_BOTTOM_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM);
|
||||
|
||||
if( 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;
|
||||
via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type);
|
||||
|
||||
if( previous_via_color != via_color )
|
||||
{
|
||||
previous_via_color = via_color;
|
||||
|
@ -145,11 +151,9 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
|
|||
}
|
||||
|
||||
color &= MASKCOLOR;
|
||||
pen.SetColour(
|
||||
ColorRefs[color].m_Red,
|
||||
pen.SetColour( ColorRefs[color].m_Red,
|
||||
ColorRefs[color].m_Green,
|
||||
ColorRefs[color].m_Blue
|
||||
);
|
||||
ColorRefs[color].m_Blue );
|
||||
iconDC.SetPen( pen );
|
||||
}
|
||||
iconDC.DrawPoint( jj, ii );
|
||||
|
@ -162,8 +166,7 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
|
|||
|
||||
if( m_HToolBar )
|
||||
{
|
||||
m_HToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
|
||||
*LayerPairBitmap );
|
||||
m_HToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap );
|
||||
m_HToolBar->Realize();
|
||||
}
|
||||
}
|
||||
|
@ -175,11 +178,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
|
|||
{
|
||||
wxString msg;
|
||||
|
||||
if( m_HToolBar != NULL )
|
||||
{
|
||||
SetToolbars();
|
||||
if( m_HToolBar )
|
||||
return;
|
||||
}
|
||||
|
||||
wxWindowUpdateLocker dummy( this );
|
||||
|
||||
|
@ -199,8 +199,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
|
|||
_( "Page settings (size, texts)" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString,
|
||||
wxBitmap( modedit_xpm ),
|
||||
m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, wxBitmap( modedit_xpm ),
|
||||
_( "Open module editor" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
|
@ -216,14 +215,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
|
|||
#endif
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr,
|
||||
HK_UNDO, false );
|
||||
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ),
|
||||
HELP_UNDO );
|
||||
msg = AddHotkeyName( HELP_REDO, g_Board_Editor_Hokeys_Descr,
|
||||
HK_REDO, false );
|
||||
m_HToolBar->AddTool( wxID_REDO, wxEmptyString, wxBitmap( redo_xpm ),
|
||||
HELP_REDO );
|
||||
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, false );
|
||||
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ), HELP_UNDO );
|
||||
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->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
|
||||
|
@ -232,32 +227,21 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
|
|||
_( "Plot (HPGL, PostScript, or GERBER format)" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
msg = AddHotkeyName( HELP_ZOOM_IN, g_Board_Editor_Hokeys_Descr,
|
||||
HK_ZOOM_IN, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
|
||||
msg );
|
||||
msg = AddHotkeyName( HELP_ZOOM_IN, g_Board_Editor_Hokeys_Descr, HK_ZOOM_IN, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Board_Editor_Hokeys_Descr,
|
||||
HK_ZOOM_OUT, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
|
||||
wxBitmap( zoom_out_xpm ), msg );
|
||||
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_OUT, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hokeys_Descr,
|
||||
HK_ZOOM_REDRAW, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||
wxBitmap( zoom_redraw_xpm ), msg );
|
||||
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ), msg );
|
||||
|
||||
msg = AddHotkeyName( HELP_ZOOM_FIT, g_Board_Editor_Hokeys_Descr,
|
||||
HK_ZOOM_AUTO, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
||||
wxBitmap( zoom_auto_xpm ), msg );
|
||||
msg = AddHotkeyName( HELP_ZOOM_FIT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_AUTO, false );
|
||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ), msg );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
msg = AddHotkeyName( HELP_FIND, // Find components and texts
|
||||
g_Board_Editor_Hokeys_Descr,
|
||||
HK_FIND_ITEM, false );
|
||||
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ),
|
||||
msg );
|
||||
msg = AddHotkeyName( HELP_FIND, g_Board_Editor_Hokeys_Descr, HK_FIND_ITEM, false );
|
||||
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ), msg );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
|
||||
|
@ -279,12 +263,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
|
|||
*LayerPairBitmap, SEL_LAYER_HELP );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString,
|
||||
wxBitmap( mode_module_xpm ),
|
||||
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString, wxBitmap( mode_module_xpm ),
|
||||
_( "Mode footprint: manual and automatic move and place modules" ),
|
||||
wxITEM_CHECK );
|
||||
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString,
|
||||
wxBitmap( mode_track_xpm ),
|
||||
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString, wxBitmap( mode_track_xpm ),
|
||||
_( "Mode track: autorouting" ), wxITEM_CHECK );
|
||||
|
||||
// Fast call to FreeROUTE Web Bases router
|
||||
|
@ -294,9 +276,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
|
|||
_( "Fast access to the Web Based FreeROUTE advanced router" ) );
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -308,15 +289,11 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
|
|||
|
||||
wxWindowUpdateLocker dummy( this );
|
||||
|
||||
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_DRC_OFF, wxEmptyString,
|
||||
wxBitmap( drc_off_xpm ),
|
||||
_( "Enable design rule checking" ),
|
||||
wxITEM_CHECK );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
|
||||
wxBitmap( grid_xpm ),
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, wxBitmap( drc_off_xpm ),
|
||||
_( "Enable design rule checking" ), wxITEM_CHECK );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, wxBitmap( grid_xpm ),
|
||||
_( "Hide grid" ), wxITEM_CHECK );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
|
||||
wxBitmap( polar_coord_xpm ),
|
||||
|
@ -350,15 +327,11 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
|
|||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString,
|
||||
wxBitmap( show_zone_xpm ), wxNullBitmap,
|
||||
_( "Show filled areas in zones" ) );
|
||||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
|
||||
wxEmptyString,
|
||||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString,
|
||||
wxBitmap( show_zone_disable_xpm ),
|
||||
wxNullBitmap,
|
||||
_( "Do not show filled areas in zones" ));
|
||||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
|
||||
wxEmptyString,
|
||||
wxBitmap( show_zone_outline_only_xpm ),
|
||||
wxNullBitmap,
|
||||
wxNullBitmap, _( "Do not show filled areas in zones" ));
|
||||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString,
|
||||
wxBitmap( show_zone_outline_only_xpm ), wxNullBitmap,
|
||||
_( "Show outlines of filled areas only in zones" ) );
|
||||
|
||||
m_OptionsToolBar->AddSeparator();
|
||||
|
@ -375,13 +348,10 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
|
|||
_( "Show tracks in outline mode" ),
|
||||
wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
||||
wxEmptyString,
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString,
|
||||
wxBitmap( palette_xpm ),
|
||||
_( "Enable high contrast display mode" ),
|
||||
wxITEM_CHECK );
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
||||
DisplayOpt.ContrastModeDisplay );
|
||||
|
||||
// Tools to show/hide toolbars:
|
||||
m_OptionsToolBar->AddSeparator();
|
||||
|
@ -411,70 +381,55 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
|
|||
|
||||
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
|
||||
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
|
||||
wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK );
|
||||
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, true );
|
||||
m_VToolBar->AddTool( ID_PCB_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
|
||||
wxEmptyString, wxITEM_CHECK );
|
||||
m_VToolBar->AddSeparator();
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString,
|
||||
wxBitmap( net_highlight_xpm ), _( "Highlight net" ),
|
||||
wxITEM_CHECK );
|
||||
m_VToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString, wxBitmap( net_highlight_xpm ),
|
||||
_( "Highlight net" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString,
|
||||
wxBitmap( tool_ratsnet_xpm ),
|
||||
_( "Display local ratsnest" ),
|
||||
wxITEM_CHECK );
|
||||
m_VToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString, wxBitmap( tool_ratsnet_xpm ),
|
||||
_( "Display local ratsnest" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_COMPONENT_BUTT, wxEmptyString,
|
||||
wxBitmap( module_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_MODULE_BUTT, wxEmptyString, wxBitmap( module_xpm ),
|
||||
_( "Add modules" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString,
|
||||
wxBitmap( add_tracks_xpm ),
|
||||
m_VToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, wxBitmap( add_tracks_xpm ),
|
||||
_( "Add tracks and vias" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString,
|
||||
wxBitmap( add_zone_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, wxBitmap( add_zone_xpm ),
|
||||
_( "Add filled zones" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString,
|
||||
wxBitmap( add_dashed_line_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, wxBitmap( add_dashed_line_xpm ),
|
||||
_( "Add graphic line or polygon" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString,
|
||||
wxBitmap( add_circle_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString, wxBitmap( add_circle_xpm ),
|
||||
_( "Add graphic circle" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString,
|
||||
wxBitmap( add_arc_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString, wxBitmap( add_arc_xpm ),
|
||||
_( "Add graphic arc" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString,
|
||||
wxBitmap( add_text_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString, wxBitmap( add_text_xpm ),
|
||||
_( "Add text on copper layers or graphic text" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString,
|
||||
wxBitmap( add_dimension_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString, wxBitmap( add_dimension_xpm ),
|
||||
_( "Add dimension" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddTool( ID_PCB_MIRE_BUTT, wxEmptyString,
|
||||
wxBitmap( add_mires_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_MIRE_BUTT, wxEmptyString, wxBitmap( add_mires_xpm ),
|
||||
_( "Add layer alignment target" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString,
|
||||
wxBitmap( delete_body_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
|
||||
_( "Delete items" ), wxITEM_CHECK );
|
||||
|
||||
m_VToolBar->AddSeparator();
|
||||
m_VToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString,
|
||||
wxBitmap( pcb_offset_xpm ),
|
||||
m_VToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString, wxBitmap( pcb_offset_xpm ),
|
||||
_( "Place the origin point for drill and place files" ),
|
||||
wxITEM_CHECK );
|
||||
|
||||
|
@ -497,8 +452,7 @@ void WinEDA_PcbFrame::ReCreateMicrowaveVToolbar()
|
|||
|
||||
wxWindowUpdateLocker dummy(this);
|
||||
|
||||
m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this,
|
||||
ID_MICROWAVE_V_TOOLBAR, FALSE );
|
||||
m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_MICROWAVE_V_TOOLBAR, false );
|
||||
|
||||
// Set up toolbar
|
||||
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString,
|
||||
|
@ -539,15 +493,14 @@ void WinEDA_PcbFrame::ReCreateMicrowaveVToolbar()
|
|||
*/
|
||||
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
|
||||
{
|
||||
size_t i;
|
||||
wxString msg;
|
||||
|
||||
wxWindowUpdateLocker dummy( this );
|
||||
|
||||
if( m_AuxiliaryToolBar == NULL )
|
||||
{
|
||||
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this,
|
||||
ID_AUX_TOOLBAR, true );
|
||||
if( m_AuxiliaryToolBar )
|
||||
return;
|
||||
|
||||
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this, ID_AUX_TOOLBAR, true );
|
||||
|
||||
m_TrackAndViasSizesList_Changed = true;
|
||||
|
||||
|
@ -587,8 +540,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
|
|||
m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox );
|
||||
m_AuxiliaryToolBar->AddSeparator();
|
||||
|
||||
// Creates box to display and choose strategy to handle tracks an
|
||||
// vias sizes:
|
||||
// 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 ),
|
||||
|
@ -610,81 +562,123 @@ an existing track use its width\notherwise, use current width setting" ),
|
|||
ID_ON_ZOOM_SELECT,
|
||||
wxPoint( -1, -1 ),
|
||||
wxSize( LISTBOX_WIDTH, -1 ) );
|
||||
msg = _( "Auto" );
|
||||
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()
|
||||
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_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()
|
||||
{
|
||||
wxASSERT( m_SelLayerBox );
|
||||
|
|
|
@ -19,57 +19,9 @@
|
|||
#include "class_board_design_settings.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
|
||||
* 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
|
||||
* Function OnUpdateAuxilaryToolbar
|
||||
* update the displayed values on auxiliary horizontal toolbar
|
||||
* (track width, via sizes, clearance ...
|
||||
* 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).
|
||||
* 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;
|
||||
|
||||
AuxiliaryToolBar_DesignRules_Update_UI();
|
||||
|
||||
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 )
|
||||
if( m_AuxiliaryToolBar == NULL )
|
||||
return;
|
||||
|
||||
m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() );
|
||||
aEvent.Check( GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth );
|
||||
|
||||
state = GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE;
|
||||
m_HToolBar->EnableTool( wxID_CUT, state );
|
||||
m_HToolBar->EnableTool( wxID_COPY, state );
|
||||
if( GetBoard()->m_TrackWidthSelector >= GetBoard()->m_TrackWidthList.size() )
|
||||
GetBoard()->m_TrackWidthSelector = 0;
|
||||
|
||||
m_HToolBar->EnableTool( wxID_PASTE, false );
|
||||
if( m_SelTrackWidthBox->GetSelection() != (int) GetBoard()->m_TrackWidthSelector )
|
||||
m_SelTrackWidthBox->SetSelection( GetBoard()->m_TrackWidthSelector );
|
||||
|
||||
state = GetScreen()->GetUndoCommandCount() > 0;
|
||||
m_HToolBar->EnableTool( wxID_UNDO, state );
|
||||
if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViasDimensionsList.size() )
|
||||
GetBoard()->m_ViaSizeSelector = 0;
|
||||
|
||||
state = GetScreen()->GetRedoCommandCount() > 0;
|
||||
m_HToolBar->EnableTool( wxID_REDO, state );
|
||||
syncLayerBox();
|
||||
PrepareLayerIndicator();
|
||||
m_HToolBar->Refresh(true);
|
||||
if( m_SelViaSizeBox->GetSelection() != (int) GetBoard()->m_ViaSizeSelector )
|
||||
m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector );
|
||||
}
|
||||
|
||||
if( m_OptionsToolBar )
|
||||
|
||||
void WinEDA_PcbFrame::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_DRC_OFF,
|
||||
!Drc_On );
|
||||
int selected = aEvent.GetId() - ID_TB_OPTIONS_SHOW_ZONES;
|
||||
|
||||
if( aEvent.IsChecked() && ( DisplayOpt.DisplayZonesMode == selected ) )
|
||||
return;
|
||||
|
||||
aEvent.Check( DisplayOpt.DisplayZonesMode == selected );
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_PcbFrame::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( !Drc_On );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
|
||||
Drc_On ?
|
||||
_( "Disable design rule checking" ) :
|
||||
_( "Enable design rule checking" ) );
|
||||
}
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
|
||||
g_UserUnit == MILLIMETRES );
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
||||
g_UserUnit == INCHES );
|
||||
|
||||
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_RATSNEST,
|
||||
GetBoard()->IsElementVisible(RATSNEST_VISIBLE) );
|
||||
void WinEDA_PcbFrame::OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
|
||||
GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ?
|
||||
_( "Hide board ratsnest" ) :
|
||||
_( "Show board ratsnest" ) );
|
||||
}
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
|
||||
g_Show_Module_Ratsnest );
|
||||
|
||||
void WinEDA_PcbFrame::OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( g_Show_Module_Ratsnest );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
|
||||
g_Show_Module_Ratsnest ?
|
||||
_( "Hide module ratsnest" ) :
|
||||
_( "Show module ratsnest" ) );
|
||||
}
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_AUTO_DEL_TRACK,
|
||||
g_AutoDeleteOldTrack );
|
||||
|
||||
void WinEDA_PcbFrame::OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( g_AutoDeleteOldTrack );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK,
|
||||
g_AutoDeleteOldTrack ?
|
||||
_( "Disable auto delete old track" ) :
|
||||
_( "Enable auto delete old track" ) );
|
||||
}
|
||||
|
||||
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 outline mode" ) :
|
||||
_( "Show pads in fill mode" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
|
||||
!m_DisplayViaFill );
|
||||
|
||||
void WinEDA_PcbFrame::OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( !m_DisplayViaFill );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
|
||||
m_DisplayViaFill ?
|
||||
_( "Show vias in outline mode" ) :
|
||||
_( "Show vias in fill mode" ) );
|
||||
}
|
||||
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
|
||||
!m_DisplayPcbTrackFill );
|
||||
void WinEDA_PcbFrame::OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( !m_DisplayPcbTrackFill );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
|
||||
m_DisplayPcbTrackFill ?
|
||||
_( "Show tracks in outline mode" ) :
|
||||
_( "Show tracks in fill mode" ) );
|
||||
}
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
||||
DisplayOpt.ContrastModeDisplay );
|
||||
|
||||
void WinEDA_PcbFrame::OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( DisplayOpt.ContrastModeDisplay );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
||||
DisplayOpt.ContrastModeDisplay ?
|
||||
_( "Normal contrast display mode" ) :
|
||||
_( "High contrast display mode" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
|
||||
m_auimgr.GetPane(wxT("m_AuxVToolBar")).IsShown() );
|
||||
m_OptionsToolBar->Refresh();
|
||||
}
|
||||
|
||||
if( m_AuxiliaryToolBar )
|
||||
AuxiliaryToolBar_Update_UI();
|
||||
DisplayUnitsMsg();
|
||||
|
||||
void WinEDA_PcbFrame::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( m_auimgr.GetPane( wxT( "m_AuxVToolBar" ) ).IsShown() );
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_PcbFrame::OnUpdateSave( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Enable( GetScreen()->IsModify() );
|
||||
}
|
||||
|
||||
|
||||
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() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue