Use logical cursor position and other minor changes.

* Remove unused member variable m_SizeVisu from base screen object.
* Move nearest grid position code into base screen object.
* Add get cursor position method to base screen object.
* Add position parameter to OnHotKey method in base draw frame and all
  derived objects.
* Pass logical position on left mouse button click and double click
  events instead of device position.
* Pass logical position to on right mouse button click instead of device
  position.
* Use logical event position parameter for locating items in EESchema
  instead of the stored position.
* Remove unused position parameter when displaying component edit dialog
  in EESchema.
* Comment out debugging macro in eeschema/template_field_names.cpp that was
  preventing debug builds using wxWidgets 2.8.x.
This commit is contained in:
Wayne Stambaugh 2011-02-02 14:01:21 -05:00
parent 0093f4f612
commit 6a26a7f9bf
27 changed files with 556 additions and 499 deletions

View File

@ -390,6 +390,39 @@ int BASE_SCREEN::GetGridId()
}
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize )
{
wxPoint pt;
wxRealPoint gridSize;
if( aGridSize )
gridSize = *aGridSize;
else
gridSize = GetGridSize();
wxPoint gridOrigin = m_GridOrigin;
double offset = fmod( gridOrigin.x, gridSize.x );
int x = wxRound( (aPosition.x - offset) / gridSize.x );
pt.x = wxRound( x * gridSize.x + offset );
offset = fmod( gridOrigin.y, gridSize.y );
int y = wxRound( (aPosition.y - offset) / gridSize.y );
pt.y = wxRound ( y * gridSize.y + offset );
return pt;
}
wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize )
{
if( aOnGrid )
return GetNearestGridPosition( m_Curseur, aGridSize );
return m_Curseur;
}
/* free the undo and the redo lists
*/
void BASE_SCREEN::ClearUndoRedoList()

View File

@ -176,7 +176,7 @@ void EDA_DRAW_FRAME::ReCreateMenuBar()
// Virtual function
void EDA_DRAW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
void EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
{
}

View File

@ -778,14 +778,17 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
wxPoint pos;
wxMenu MasterMenu;
pos = event.GetPosition();
INSTALL_UNBUFFERED_DC( dc, this );
pos = event.GetLogicalPosition( dc );
if( !m_Parent->OnRightClick( pos, &MasterMenu ) )
return false;
m_Parent->AddMenuZoomAndGrid( &MasterMenu );
m_IgnoreMouseEvents = TRUE;
pos = event.GetPosition();
m_IgnoreMouseEvents = true;
PopupMenu( &MasterMenu, pos );
MouseToCursorSchema();
m_IgnoreMouseEvents = false;
@ -940,14 +943,14 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
localrealbutt |= localbutt; /* compensation default wxGTK */
INSTALL_UNBUFFERED_DC( DC, this );
DC.SetBackground( *wxBLACK_BRUSH );
/* Compute the cursor position in screen (device) units. */
wxPoint pos = CalcUnscrolledPosition( event.GetPosition() );
/* Compute the cursor position in drawing (logical) units. */
screen->m_MousePosition = CursorRealPosition( pos );
INSTALL_UNBUFFERED_DC( DC, this );
DC.SetBackground( *wxBLACK_BRUSH );
screen->m_MousePosition = event.GetLogicalPosition( DC );
int kbstat = 0;
@ -967,7 +970,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// Calling Double Click and Click functions :
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{
m_Parent->OnLeftDClick( &DC, pos );
m_Parent->OnLeftDClick( &DC, screen->m_MousePosition );
// inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new
@ -979,7 +982,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 && !s_IgnoreNextLeftButtonRelease )
m_Parent->OnLeftClick( &DC, pos );
m_Parent->OnLeftClick( &DC, screen->m_MousePosition );
s_IgnoreNextLeftButtonRelease = false;
}
@ -1217,7 +1220,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
}
}
/* Some key commands use the current mouse position: refresh it */
// Some key commands use the current mouse position: refresh it.
pos = wxGetMousePosition() - GetScreenPosition();
// Compute the cursor position in drawing units. Also known as logical units to wxDC.

View File

@ -51,21 +51,9 @@ void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
*/
void EDA_DRAW_FRAME::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize )
{
wxRealPoint grid_size;
wxCHECK_RET( aCoord != NULL, wxT( "Cannot pull NULL coordinate pointer on grid." ) );
if( aGridSize )
grid_size = *aGridSize;
else
grid_size = GetBaseScreen()->GetGridSize();
const wxPoint& grid_origin = GetBaseScreen()->GetGridOrigin();
double offset = fmod( grid_origin.x, grid_size.x );
int tmp = wxRound( (aCoord->x - offset) / grid_size.x );
aCoord->x = wxRound( tmp * grid_size.x + offset );
offset = fmod( grid_origin.y, grid_size.y );
tmp = wxRound( (aCoord->y - offset) / grid_size.y );
aCoord->y = wxRound ( tmp * grid_size.y + offset );
*aCoord = GetBaseScreen()->GetNearestGridPosition( *aCoord, aGridSize );
}

View File

@ -23,55 +23,60 @@
/**
* Function SchematicGeneralLocateAndDisplay
* Overlaid function
* Find the schematic item at cursor position
* the priority order is:
* - marker
* - noconnect
* - junction
* - wire/bus/entry
* - label
* - pin
* - component
* @return an EDA_ITEM pointer on the item or NULL if no item found
* @param IncludePin = true to search for pins, false to ignore them
* Function LocateAndShowItem
* search the schematic at \a aPosition in logical (drawing) units for any item.
* <p>
* The search is first performed at \a aPosition which may be off grid. If no item is
* found at \a aPosition, the search is repeated for the nearest grid position to \a
* aPosition.
*
* For some items, characteristics are displayed on the screen.
* The search order is as follows:
* <ul>
* <li>Marker</li>
* <li>No Connect</li>
* <li>Junction</li>
* <li>Wire, bus, or entry</li>
* <li>Label</li>
* <li>Pin</li>
* <li>Component</li>
* </ul></p>
* @param aPosition The wxPoint on the schematic to search.
* @param aIncludePin = true to search for pins, false to ignore them
* @return A SCH_ITEM pointer on the item or NULL if no item found
*/
SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin )
SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, bool aIncludePin )
{
SCH_ITEM* DrawStruct;
SCH_ITEM* item;
wxString msg;
wxPoint mouse_position = GetScreen()->m_MousePosition;
LIB_PIN* Pin = NULL;
SCH_COMPONENT* LibItem = NULL;
wxPoint gridPosition = GetScreen()->GetNearestGridPosition( aPosition );
DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin );
item = LocateItem( aPosition, aIncludePin );
if( !DrawStruct && ( mouse_position != GetScreen()->m_Curseur) )
{
DrawStruct = SchematicGeneralLocateAndDisplay( GetScreen()->m_Curseur, IncludePin );
}
if( !item && aPosition != gridPosition )
item = LocateItem( gridPosition, aIncludePin );
if( !DrawStruct )
if( !item )
return NULL;
/* Cross probing to pcbnew if a pin or a component is found */
switch( DrawStruct->Type() )
switch( item->Type() )
{
case SCH_FIELD_T:
case LIB_FIELD_T:
LibItem = (SCH_COMPONENT*) DrawStruct->GetParent();
SendMessageToPCBNEW( DrawStruct, LibItem );
LibItem = (SCH_COMPONENT*) item->GetParent();
SendMessageToPCBNEW( item, LibItem );
break;
case SCH_COMPONENT_T:
Pin = GetScreen()->GetPin( GetScreen()->m_Curseur, &LibItem );
if( Pin )
break; // Priority is probing a pin first
LibItem = (SCH_COMPONENT*) DrawStruct;
SendMessageToPCBNEW( DrawStruct, LibItem );
LibItem = (SCH_COMPONENT*) item;
SendMessageToPCBNEW( item, LibItem );
break;
default:
@ -79,85 +84,71 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin )
break;
case LIB_PIN_T:
Pin = (LIB_PIN*) DrawStruct;
Pin = (LIB_PIN*) item;
break;
}
if( Pin )
{
/* Force display pin information (the previous display could be a
* component info) */
// Force display pin information (the previous display could be a component info)
Pin->DisplayInfo( this );
if( LibItem )
AppendMsgPanel( LibItem->GetRef( GetSheet() ),
LibItem->GetField( VALUE )->m_Text, DARKCYAN );
// Cross probing:2 - pin found, and send a locate pin command to
// pcbnew (highlight net)
// Cross probing:2 - pin found, and send a locate pin command to pcbnew (highlight net)
SendMessageToPCBNEW( Pin, LibItem );
}
return DrawStruct;
return item;
}
/**
* Function SchematicGeneralLocateAndDisplay
* Overlaid function
* Find the schematic item at a given position
* the priority order is:
* - marker
* - noconnect
* - junction
* - wire/bus/entry
* - label
* - pin
* - component
* @return an EDA_ITEM pointer on the item or NULL if no item found
* @param refpoint = the wxPoint location where to search
* @param IncludePin = true to search for pins, false to ignore them
*
* For some items, characteristics are displayed on the screen.
* Function LocateItem
* searches for an item at \a aPosition.
* @param aPosition The wxPoint location where to search.
* @param aIncludePin True to search for pins, false to ignore them.
* @return The SCH_ITEM pointer of the item or NULL if no item found.
*/
SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
bool IncludePin )
SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin )
{
SCH_ITEM* DrawStruct;
SCH_ITEM* item;
LIB_PIN* Pin;
SCH_COMPONENT* LibItem;
wxString Text;
wxString msg;
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), MARKER_T );
item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), MARKER_T );
if( DrawStruct )
if( item )
{
DrawStruct->DisplayInfo( this );
return DrawStruct;
item->DisplayInfo( this );
return item;
}
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), NO_CONNECT_T );
item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), NO_CONNECT_T );
if( DrawStruct )
if( item )
{
ClearMsgPanel();
return DrawStruct;
return item;
}
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), JUNCTION_T );
item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), JUNCTION_T );
if( DrawStruct )
if( item )
{
ClearMsgPanel();
return DrawStruct;
return item;
}
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(),
WIRE_T | BUS_T | BUS_ENTRY_T );
item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), WIRE_T | BUS_T | BUS_ENTRY_T );
if( DrawStruct ) // We have found a wire: Search for a connected pin at the same location
if( item ) // We have found a wire: Search for a connected pin at the same location
{
Pin = GetScreen()->GetPin( refpoint, &LibItem );
Pin = GetScreen()->GetPin( aPosition, &LibItem );
if( Pin )
{
@ -170,30 +161,30 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
else
ClearMsgPanel();
return DrawStruct;
return item;
}
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), FIELD_T );
item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), FIELD_T );
if( DrawStruct )
if( item )
{
SCH_FIELD* Field = (SCH_FIELD*) DrawStruct;
SCH_FIELD* Field = (SCH_FIELD*) item;
LibItem = (SCH_COMPONENT*) Field->GetParent();
LibItem->DisplayInfo( this );
return DrawStruct;
return item;
}
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), LABEL_T | TEXT_T );
item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), LABEL_T | TEXT_T );
if( DrawStruct )
if( item )
{
ClearMsgPanel();
return DrawStruct;
return item;
}
/* search for a pin */
Pin = GetScreen()->GetPin( refpoint, &LibItem );
Pin = GetScreen()->GetPin( aPosition, &LibItem );
if( Pin )
{
@ -202,41 +193,39 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
if( LibItem )
AppendMsgPanel( LibItem->GetRef( GetSheet() ),
LibItem->GetField( VALUE )->m_Text, DARKCYAN );
if( IncludePin )
if( aIncludePin )
return LibItem;
}
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), COMPONENT_T );
item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), COMPONENT_T );
if( DrawStruct )
if( item )
{
DrawStruct = LocateSmallestComponent( GetScreen() );
LibItem = (SCH_COMPONENT*) DrawStruct;
item = LocateSmallestComponent( GetScreen() );
LibItem = (SCH_COMPONENT*) item;
LibItem->DisplayInfo( this );
return DrawStruct;
return item;
}
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEET_T );
item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), SHEET_T );
if( DrawStruct )
if( item )
{
( (SCH_SHEET*) DrawStruct )->DisplayInfo( this );
return DrawStruct;
( (SCH_SHEET*) item )->DisplayInfo( this );
return item;
}
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), NO_FILTER_T );
item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), NO_FILTER_T );
if( DrawStruct )
{
return DrawStruct;
}
if( item )
return item;
ClearMsgPanel();
return NULL;
}
void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
SCH_SCREEN* screen = GetScreen();
@ -308,9 +297,9 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
if( hotkey )
{
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
OnHotKey( aDC, hotkey, screen->GetCurItem() );
OnHotKey( aDC, hotkey, aPosition, screen->GetCurItem() );
else
OnHotKey( aDC, hotkey, NULL );
OnHotKey( aDC, hotkey, aPosition, NULL );
}
UpdateStatusBar(); /* Display cursor coordinates info */
@ -318,7 +307,7 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
}
void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
SCH_SCREEN* screen = GetScreen();
@ -390,16 +379,16 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
if( hotkey )
{
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
OnHotKey( aDC, hotkey, screen->GetCurItem() );
OnHotKey( aDC, hotkey, aPosition, screen->GetCurItem() );
else
OnHotKey( aDC, hotkey, NULL );
OnHotKey( aDC, hotkey, aPosition, NULL );
}
UpdateStatusBar();
}
void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
SCH_SCREEN* screen = GetScreen();
@ -471,9 +460,9 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
if( hotkey )
{
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
OnHotKey( aDC, hotkey, screen->GetCurItem() );
OnHotKey( aDC, hotkey, aPosition, screen->GetCurItem() );
else
OnHotKey( aDC, hotkey, NULL );
OnHotKey( aDC, hotkey, aPosition, NULL );
}
UpdateStatusBar();

View File

@ -27,51 +27,46 @@ int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow;
wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize;
void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, wxPoint& pos, SCH_COMPONENT* aComponent )
void InstallCmpeditFrame( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aComponent )
{
if( aComponent == NULL ) // Null component not accepted
return;
parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
aParent->DrawPanel->m_IgnoreMouseEvents = TRUE;
if( aComponent->Type() != SCH_COMPONENT_T )
{
DisplayError( parent,
DisplayError( aParent,
wxT( "InstallCmpeditFrame() error: This item is not a component" ) );
return;
}
else
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC dialog( aParent );
dialog.InitBuffers( aComponent );
wxSize sizeNow = dialog.GetSize();
// this relies on wxDefaultSize being -1,-1, be careful here.
if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|| sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
{
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC* dialog =
new DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( parent );
dialog->InitBuffers( aComponent );
wxSize sizeNow = dialog->GetSize();
// this relies on wxDefaultSize being -1,-1, be careful here.
if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|| sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
{
dialog->SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize );
}
// make sure the chipnameTextCtrl is wide enough to hold any
// unusually long chip names:
EnsureTextCtrlWidth( dialog->chipnameTextCtrl );
dialog->ShowModal();
// Some of the field values are long and are not always fully visible
// because the window comes up too narrow.
// Remember user's manual window resizing efforts here so it comes up
// wide enough next time.
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog->GetSize();
dialog->Destroy();
dialog.SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize );
}
parent->DrawPanel->MouseToCursorSchema();
parent->DrawPanel->m_IgnoreMouseEvents = false;
// make sure the chipnameTextCtrl is wide enough to hold any
// unusually long chip names:
EnsureTextCtrlWidth( dialog.chipnameTextCtrl );
dialog.ShowModal();
// Some of the field values are long and are not always fully visible because the
// window comes up too narrow. Remember user's manual window resizing efforts here
// so it comes up wide enough next time.
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog.GetSize();
aParent->DrawPanel->MouseToCursorSchema();
aParent->DrawPanel->m_IgnoreMouseEvents = false;
}

View File

@ -16,9 +16,7 @@
*/
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
{
friend void InstallCmpeditFrame( SCH_EDIT_FRAME* parent,
wxPoint& pos,
SCH_COMPONENT* aComponent );
friend void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, SCH_COMPONENT* aComponent );
SCH_EDIT_FRAME* m_Parent;
SCH_COMPONENT* m_Cmp;

View File

@ -257,7 +257,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[] =
* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive
*/
void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
@ -271,20 +271,20 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK);
bool RefreshToolBar = FALSE;
if( hotkey == 0 )
if( aHotKey == 0 )
return;
wxPoint MousePos = GetScreen()->m_MousePosition;
/* Convert lower to upper case (the usual toupper function has problem
* with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a';
// Search command from key :
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, s_Schematic_Hotkey_List );
HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Schematic_Hotkey_List );
if( HK_Descr == NULL )
return;
@ -337,22 +337,22 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
break;
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
HandleBlockEndByPopUp( BLOCK_DRAG, DC );
HandleBlockEndByPopUp( BLOCK_DRAG, aDC );
break;
case HK_DELETE:
if( notBusy)
{
RefreshToolBar = LocateAndDeleteItem( this, DC );
RefreshToolBar = LocateAndDeleteItem( this, aDC );
OnModify();
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds( DrawPanel, DC );
GetScreen()->TestDanglingEnds( DrawPanel, aDC );
}
break;
case HK_REPEAT_LAST:
if( notBusy && m_itemToRepeat && ( m_itemToRepeat->m_Flags == 0 ) )
RepeatDrawItem( DC );
RepeatDrawItem( aDC );
break;
case HK_FIND_ITEM:
@ -392,7 +392,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// 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" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -402,7 +403,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_PLACE_POWER_BUTT;
if( m_ID_current_state != ID_PLACE_POWER_BUTT )
SetToolID( ID_PLACE_POWER_BUTT, wxCURSOR_PENCIL, _( "Add Power" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -412,7 +414,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_LABEL_BUTT;
if( m_ID_current_state != ID_LABEL_BUTT )
SetToolID( ID_LABEL_BUTT, wxCURSOR_PENCIL, _( "Add Label" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -422,7 +425,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_HIERLABEL_BUTT;
if( m_ID_current_state != ID_HIERLABEL_BUTT )
SetToolID( ID_HIERLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Hierarchical Label" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -432,7 +436,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_GLABEL_BUTT;
if( m_ID_current_state != ID_GLABEL_BUTT )
SetToolID( ID_GLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Global Label" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -442,7 +447,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_JUNCTION_BUTT;
if( m_ID_current_state != ID_JUNCTION_BUTT )
SetToolID( ID_JUNCTION_BUTT, wxCURSOR_PENCIL, _( "Add Junction" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -452,7 +458,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_WIRETOBUS_ENTRY_BUTT;
if( m_ID_current_state != ID_WIRETOBUS_ENTRY_BUTT )
SetToolID( ID_WIRETOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Wire to Bus entry" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -462,7 +469,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_BUSTOBUS_ENTRY_BUTT;
if( m_ID_current_state != ID_BUSTOBUS_ENTRY_BUTT )
SetToolID( ID_BUSTOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Bus to Bus entry" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -472,7 +480,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_SHEET_SYMBOL_BUTT;
if( m_ID_current_state != ID_SHEET_SYMBOL_BUTT )
SetToolID( ID_SHEET_SYMBOL_BUTT, wxCURSOR_PENCIL, _( "Add Sheet" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -482,7 +491,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_TEXT_COMMENT_BUTT;
if( m_ID_current_state != ID_TEXT_COMMENT_BUTT )
SetToolID( ID_TEXT_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Text" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -492,7 +502,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_LINE_COMMENT_BUTT;
if( m_ID_current_state != ID_LINE_COMMENT_BUTT )
SetToolID( ID_LINE_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Lines" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
@ -503,22 +514,25 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_WIRE_BUTT;
if( m_ID_current_state != ID_BUS_BUTT )
SetToolID( ID_BUS_BUTT, wxCURSOR_PENCIL, _( "Add Bus" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
break;
}
if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_BUS_BUTT ) )
if( aItem && aItem->IsNew() && ( m_ID_current_state == ID_BUS_BUTT ) )
{
if( DrawStruct->Type() == SCH_LINE_T )
if( aItem->Type() == SCH_LINE_T )
{
SCH_LINE* segment = (SCH_LINE*) DrawStruct;
SCH_LINE* segment = (SCH_LINE*) aItem;
if( segment->GetLayer() != LAYER_BUS )
break;
// Bus in progress:
OnLeftClick( DC, MousePos );
// Bus in progress:
OnLeftClick( aDC, aPosition );
}
}
break;
case HK_BEGIN_WIRE:
@ -528,18 +542,22 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
// switch to m_ID_current_state = ID_WIRE_BUTT;
if( m_ID_current_state != ID_WIRE_BUTT )
SetToolID( ID_WIRE_BUTT, wxCURSOR_PENCIL, _( "Add Wire" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
break;
}
if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_WIRE_BUTT ) )
if( aItem && aItem->IsNew() && ( m_ID_current_state == ID_WIRE_BUTT ) )
{
if( DrawStruct->Type() == SCH_LINE_T )
if( aItem->Type() == SCH_LINE_T )
{
SCH_LINE* segment = (SCH_LINE*) DrawStruct;
SCH_LINE* segment = (SCH_LINE*) aItem;
if( segment->GetLayer() != LAYER_WIRE )
break;
// Wire in progress:
OnLeftClick( DC, MousePos );
// Wire in progress:
OnLeftClick( aDC, aPosition );
}
}
break;
@ -549,34 +567,36 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
{
if( m_ID_current_state != ID_NOCONN_BUTT )
SetToolID( ID_NOCONN_BUTT, wxCURSOR_PENCIL, _( "Add \"NoNonnect\" Flags" ) );
OnLeftClick( DC, MousePos );
OnLeftClick( aDC, aPosition );
}
break;
case HK_ROTATE: // Component or other schematic item rotation
if ( screen->m_BlockLocate.m_State != STATE_NO_BLOCK)//allows bloc operation on hotkey
{
HandleBlockEndByPopUp(BLOCK_ROTATE, DC );
HandleBlockEndByPopUp(BLOCK_ROTATE, aDC );
break;
}
if( DrawStruct == NULL )
if( aItem == NULL )
{
// Find the schematic object to rotate under the cursor
DrawStruct = SchematicGeneralLocateAndDisplay( false );
aItem = LocateAndShowItem( aPosition, false );
if( DrawStruct == NULL )
if( aItem == NULL )
break;
if( DrawStruct->Type() == SCH_COMPONENT_T )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( aItem->Type() == SCH_COMPONENT_T )
aItem = LocateSmallestComponent( GetScreen() );
if( DrawStruct == NULL )
if( aItem == NULL )
break;
}
if( DrawStruct )
if( aItem )
{
GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
GetScreen()->SetCurItem( (SCH_ITEM*) aItem );
// Create the events for rotating a component or other schematic item
wxCommandEvent eventRotateComponent( wxEVT_COMMAND_TOOL_CLICKED,
@ -586,11 +606,12 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
wxCommandEvent eventRotateField( wxEVT_COMMAND_TOOL_CLICKED,
ID_POPUP_SCH_ROTATE_FIELD );
switch( DrawStruct->Type() )
switch( aItem->Type() )
{
case SCH_SHEET_T: //TODO allow sheet rotate on hotkey
//wxPostEvent( this, eventRotateSheet );
break;
case SCH_COMPONENT_T:
wxPostEvent( this, eventRotateComponent );
break;
@ -615,54 +636,63 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component)
if ( screen->m_BlockLocate.m_State != STATE_NO_BLOCK )
{
HandleBlockEndByPopUp(BLOCK_MIRROR_Y, DC );
HandleBlockEndByPopUp(BLOCK_MIRROR_Y, aDC );
break;
}
if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct )
if( aItem == NULL )
aItem = LocateSmallestComponent( GetScreen() );
if( aItem )
{
if( DrawStruct->m_Flags == 0 )
if( aItem->m_Flags == 0 )
{
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIRROR_Y );
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_Y );
}
break;
case HK_MIRROR_X_COMPONENT: // Mirror X (Component)
if ( screen->m_BlockLocate.m_State != STATE_NO_BLOCK ) //allows bloc operation on hotkey
{
HandleBlockEndByPopUp(BLOCK_MIRROR_X, DC );
HandleBlockEndByPopUp(BLOCK_MIRROR_X, aDC );
break;
}
if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct )
if( aItem == NULL )
aItem = LocateSmallestComponent( GetScreen() );
if( aItem )
{
if( DrawStruct->m_Flags == 0 )
if( aItem->m_Flags == 0 )
{
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIRROR_X );
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_MIRROR_X );
}
break;
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct )
if( aItem == NULL )
aItem = LocateSmallestComponent( GetScreen() );
if( aItem )
{
if( DrawStruct->m_Flags == 0 )
if( aItem->m_Flags == 0 )
{
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) aItem, UR_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL );
GetScreen()->TestDanglingEnds( DrawPanel, DC );
CmpRotationMiroir( (SCH_COMPONENT*) aItem, aDC, CMP_NORMAL );
GetScreen()->TestDanglingEnds( DrawPanel, aDC );
}
break;
case HK_DRAG: // Start drag
@ -671,51 +701,56 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( itemInEdit )
break;
if( DrawStruct == NULL )
if( aItem == NULL )
{
// For a drag or copy command, try to find first a component:
if( DrawStruct == NULL && HK_Descr->m_Idcommand != HK_MOVE_COMPONENT_OR_ITEM )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( aItem == NULL && HK_Descr->m_Idcommand != HK_MOVE_COMPONENT_OR_ITEM )
aItem = LocateSmallestComponent( GetScreen() );
// If no component, find the schematic object to move/drag or copy under the cursor
if( DrawStruct == NULL )
DrawStruct = SchematicGeneralLocateAndDisplay( false );
if( aItem == NULL )
aItem = LocateAndShowItem( aPosition, false );
if( DrawStruct == NULL )
if( aItem == NULL )
break;
if( DrawStruct->Type() == SCH_COMPONENT_T )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct == NULL )
if( aItem->Type() == SCH_COMPONENT_T )
aItem = LocateSmallestComponent( GetScreen() );
if( aItem == NULL )
break;
if( DrawStruct->Type() == SCH_SHEET_T )
if( aItem->Type() == SCH_SHEET_T )
{
SCH_SHEET* sheet = (SCH_SHEET*) DrawStruct;
SCH_SHEET* sheet = (SCH_SHEET*) aItem;
// If it's a sheet, then check if a pinsheet is under the cursor
SCH_SHEET_PIN* slabel = sheet->GetLabel( GetScreen()->m_Curseur );
if( slabel )
DrawStruct = slabel;
aItem = slabel;
}
if( DrawStruct->Type() == SCH_JUNCTION_T )
if( aItem->Type() == SCH_JUNCTION_T )
{
// If it's a junction, pick the underlying wire instead
DrawStruct = PickStruct( GetScreen()->m_Curseur, GetScreen(), WIRE_T );
aItem = PickStruct( GetScreen()->m_Curseur, GetScreen(), WIRE_T );
}
if( DrawStruct == NULL )
if( aItem == NULL )
break;
}
if( HK_Descr->m_Idcommand == HK_COPY_COMPONENT_OR_LABEL )
{
GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
GetScreen()->SetCurItem( (SCH_ITEM*) aItem );
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event );
break;
}
if( DrawStruct && (DrawStruct->m_Flags == 0) )
if( aItem && (aItem->m_Flags == 0) )
{
GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
GetScreen()->SetCurItem( (SCH_ITEM*) aItem );
// Create the events for moving a component or other schematic item
wxCommandEvent eventMoveOrDragComponent( wxEVT_COMMAND_TOOL_CLICKED,
@ -727,7 +762,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
wxCommandEvent eventDragWire( wxEVT_COMMAND_TOOL_CLICKED,
ID_POPUP_SCH_DRAG_WIRE_REQUEST );
switch( DrawStruct->Type() )
switch( aItem->Type() )
{
// select the correct event for moving an schematic object
// and add it to the event queue
@ -755,7 +790,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
break;
case SCH_LINE_T:
if( ( (SCH_ITEM*) DrawStruct )->GetLayer() == LAYER_WIRE )
if( ( (SCH_ITEM*) aItem )->GetLayer() == LAYER_WIRE )
{
if( HK_Descr->m_Idcommand == HK_DRAG )
wxPostEvent( this, eventDragWire );
@ -775,31 +810,34 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( itemInEdit )
break;
if( DrawStruct == NULL )
if( aItem == NULL )
{
DrawStruct = PickStruct( GetScreen()->m_Curseur, GetScreen(),
COMPONENT_T | TEXT_T | LABEL_T | SHEET_T );
if( DrawStruct == NULL )
aItem = PickStruct( GetScreen()->m_Curseur, GetScreen(),
COMPONENT_T | TEXT_T | LABEL_T | SHEET_T );
if( aItem == NULL )
break;
if( DrawStruct->Type() == SCH_COMPONENT_T )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct == NULL )
if( aItem->Type() == SCH_COMPONENT_T )
aItem = LocateSmallestComponent( GetScreen() );
if( aItem == NULL )
break;
}
if( DrawStruct )
if( aItem )
{
wxCommandEvent eventEditPinsheet( wxEVT_COMMAND_TOOL_CLICKED,
ID_POPUP_SCH_EDIT_SHEET );
switch( DrawStruct->Type() )
switch( aItem->Type() )
{
case SCH_COMPONENT_T:
InstallCmpeditFrame( this, MousePos, (SCH_COMPONENT*) DrawStruct );
InstallCmpeditFrame( this, (SCH_COMPONENT*) aItem );
break;
case SCH_SHEET_T:
GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
GetScreen()->SetCurItem( (SCH_ITEM*) aItem );
wxPostEvent( this, eventEditPinsheet );
break;
@ -807,7 +845,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
EditSchematicText( (SCH_TEXT*) DrawStruct );
EditSchematicText( (SCH_TEXT*) aItem );
break;
default:
@ -819,22 +857,26 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
case HK_EDIT_COMPONENT_VALUE:
if( itemInEdit )
break;
if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct )
if( aItem == NULL )
aItem = LocateSmallestComponent( GetScreen() );
if( aItem )
{
EditComponentValue( (SCH_COMPONENT*) DrawStruct, DC );
EditComponentValue( (SCH_COMPONENT*) aItem, aDC );
}
break;
case HK_EDIT_COMPONENT_FOOTPRINT:
if( itemInEdit )
break;
if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct )
if( aItem == NULL )
aItem = LocateSmallestComponent( GetScreen() );
if( aItem )
{
EditComponentFootprint( (SCH_COMPONENT*) DrawStruct, DC );
EditComponentFootprint( (SCH_COMPONENT*) aItem, aDC );
}
break;
}
@ -849,26 +891,28 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
* under the mouse cursor
* Commands are case insensitive
*/
void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
wxCommandEvent toolCmd( wxEVT_COMMAND_TOOL_CLICKED );
cmd.SetEventObject( this );
wxPoint MousePos = GetScreen()->m_MousePosition;
bool itemInEdit = GetScreen()->GetCurItem()&& GetScreen()->GetCurItem()->m_Flags;
bool itemInEdit = GetScreen()->GetCurItem() && GetScreen()->GetCurItem()->m_Flags;
if( hotkey == 0 )
if( aHotKey == 0 )
return;
/* Convert lower to upper case (the usual toupper function has problem
* with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, s_LibEdit_Hotkey_List );
HK_Descr = GetDescriptorFromHotkey( aHotKey, s_LibEdit_Hotkey_List );
if( HK_Descr == NULL )
return;
@ -931,7 +975,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
case HK_REPEAT_LAST:
if( m_lastDrawItem && (m_lastDrawItem->m_Flags == 0)
&& ( m_lastDrawItem->Type() == LIB_PIN_T ) )
RepeatPinItem( DC, (LIB_PIN*) m_lastDrawItem );
RepeatPinItem( aDC, (LIB_PIN*) m_lastDrawItem );
break;
case HK_EDIT:
@ -1002,7 +1046,6 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
break;
}
case HK_DELETE:
m_drawItem = LocateItemUsingCursor();

View File

@ -100,9 +100,10 @@ public:
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void LoadSettings();
void SaveSettings();

View File

@ -26,21 +26,18 @@ static wxArrayString s_CmpNameList;
static wxArrayString s_PowerNameList;
/* Process the command triggers by the left button of the mouse when a tool
* is already selected.
*/
void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{
SCH_ITEM* DrawStruct = GetScreen()->GetCurItem();
SCH_ITEM* item = GetScreen()->GetCurItem();
if( ( m_ID_current_state == 0 ) || ( DrawStruct && DrawStruct->m_Flags ) )
if( ( m_ID_current_state == 0 ) || ( item && item->m_Flags ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
m_itemToRepeat = NULL;
if( DrawStruct && DrawStruct->m_Flags )
if( item && item->m_Flags )
{
switch( DrawStruct->Type() )
switch( item->Type() )
{
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
@ -52,7 +49,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case SCH_JUNCTION_T:
case SCH_COMPONENT_T:
case SCH_FIELD_T:
DrawStruct->Place( this, DC );
item->Place( this, aDC );
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
@ -60,7 +57,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case SCH_SCREEN_T:
DisplayError( this, wxT( "OnLeftClick err: unexpected type for Place" ) );
DrawStruct->m_Flags = 0;
item->m_Flags = 0;
break;
case SCH_LINE_T: // May already be drawing segment.
@ -70,16 +67,16 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
wxString msg;
msg.Printf( wxT( "SCH_EDIT_FRAME::OnLeftClick err: m_Flags != 0, itmetype %d" ),
DrawStruct->Type());
item->Type());
DisplayError( this, msg );
DrawStruct->m_Flags = 0;
item->m_Flags = 0;
break;
}
}
}
else
{
DrawStruct = SchematicGeneralLocateAndDisplay( true );
item = LocateAndShowItem( aPosition );
}
}
@ -92,114 +89,115 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_HIERARCHY_PUSH_POP_BUTT:
if( DrawStruct && DrawStruct->m_Flags )
if( item && item->m_Flags )
break;
DrawStruct = SchematicGeneralLocateAndDisplay();
if( DrawStruct && ( DrawStruct->Type() == SCH_SHEET_T ) )
{
InstallNextScreen( (SCH_SHEET*) DrawStruct );
}
item = LocateAndShowItem( aPosition );
if( item && ( item->Type() == SCH_SHEET_T ) )
InstallNextScreen( (SCH_SHEET*) item );
else
InstallPreviousSheet();
break;
case ID_NOCONN_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
m_itemToRepeat = CreateNewNoConnectStruct( DC );
m_itemToRepeat = CreateNewNoConnectStruct( aDC );
GetScreen()->SetCurItem( m_itemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
}
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
break;
case ID_JUNCTION_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
m_itemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE );
m_itemToRepeat = CreateNewJunctionStruct( aDC, GetScreen()->m_Curseur, TRUE );
GetScreen()->SetCurItem( m_itemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
}
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
break;
case ID_WIRETOBUS_ENTRY_BUTT:
case ID_BUSTOBUS_ENTRY_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
DrawStruct = CreateBusEntry( DC,
(m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT) ?
WIRE_TO_BUS : BUS_TO_BUS );
GetScreen()->SetCurItem( DrawStruct );
item = CreateBusEntry( aDC, ( m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT ) ?
WIRE_TO_BUS : BUS_TO_BUS );
GetScreen()->SetCurItem( item );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
DrawPanel->m_AutoPAN_Request = FALSE;
}
break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
LocateAndDeleteItem( this, DC );
OnModify( );
LocateAndDeleteItem( this, aDC );
OnModify();
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
break;
case ID_WIRE_BUTT:
BeginSegment( DC, LAYER_WIRE );
BeginSegment( aDC, LAYER_WIRE );
DrawPanel->m_AutoPAN_Request = TRUE;
break;
case ID_BUS_BUTT:
BeginSegment( DC, LAYER_BUS );
BeginSegment( aDC, LAYER_BUS );
DrawPanel->m_AutoPAN_Request = TRUE;
break;
case ID_LINE_COMMENT_BUTT:
BeginSegment( DC, LAYER_NOTES );
BeginSegment( aDC, LAYER_NOTES );
DrawPanel->m_AutoPAN_Request = TRUE;
break;
case ID_TEXT_COMMENT_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_NOTES ) );
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
}
break;
case ID_LABEL_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_LOCLABEL ) );
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
@ -208,17 +206,19 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_GLABEL_BUTT:
case ID_HIERLABEL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (item == NULL) || (item->m_Flags == 0) )
{
if(m_ID_current_state == ID_GLABEL_BUTT)
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_GLOBLABEL ) );
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_GLOBLABEL ) );
if(m_ID_current_state == ID_HIERLABEL_BUTT)
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_HIERLABEL ) );
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
@ -226,14 +226,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_SHEET_SYMBOL_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( CreateSheet( DC ) );
GetScreen()->SetCurItem( CreateSheet( aDC ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
@ -242,37 +242,36 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_IMPORT_HLABEL_BUTT:
case ID_SHEET_LABEL_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
DrawStruct = SchematicGeneralLocateAndDisplay();
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
item = LocateAndShowItem( aPosition );
if( DrawStruct == NULL )
if( item == NULL )
break;
if( (DrawStruct->Type() == SCH_SHEET_T)
&& (DrawStruct->m_Flags == 0) )
if( (item->Type() == SCH_SHEET_T) && (item->m_Flags == 0) )
{
if( m_ID_current_state == ID_IMPORT_HLABEL_BUTT )
GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) item, aDC ) );
else
GetScreen()->SetCurItem( Create_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
GetScreen()->SetCurItem( Create_PinSheet( (SCH_SHEET*) item, aDC ) );
}
else if( (DrawStruct->Type() == SCH_SHEET_LABEL_T) && (DrawStruct->m_Flags != 0) )
else if( (item->Type() == SCH_SHEET_LABEL_T) && (item->m_Flags != 0) )
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
}
break;
case ID_COMPONENT_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (item == NULL) || (item->m_Flags == 0) )
{
GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString, s_CmpNameList, TRUE ) );
GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, TRUE ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
@ -280,14 +279,15 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_PLACE_POWER_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) );
GetScreen()->SetCurItem( Load_Component( aDC, wxT( "power" ),
s_PowerNameList, FALSE ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
@ -315,31 +315,31 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* Id a create command is in progress:
* validate and finish the command
*/
void SCH_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
{
EDA_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxPoint pos = GetPosition();
EDA_ITEM* item = GetScreen()->GetCurItem();
wxPoint pos = aPosition;
switch( m_ID_current_state )
{
case 0:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
DrawStruct = SchematicGeneralLocateAndDisplay();
item = LocateAndShowItem( aPosition );
}
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags != 0 ) )
if( ( item == NULL ) || ( item->m_Flags != 0 ) )
break;
switch( DrawStruct->Type() )
switch( item->Type() )
{
case SCH_SHEET_T:
InstallNextScreen( (SCH_SHEET*) DrawStruct );
InstallNextScreen( (SCH_SHEET*) item );
break;
case SCH_COMPONENT_T:
InstallCmpeditFrame( this, pos, (SCH_COMPONENT*) DrawStruct );
InstallCmpeditFrame( this, (SCH_COMPONENT*) item );
DrawPanel->MouseToCursorSchema();
break;
@ -347,16 +347,16 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
EditSchematicText( (SCH_TEXT*) DrawStruct );
EditSchematicText( (SCH_TEXT*) item );
break;
case SCH_FIELD_T:
EditCmpFieldText( (SCH_FIELD*) DrawStruct, DC );
EditCmpFieldText( (SCH_FIELD*) item, aDC );
DrawPanel->MouseToCursorSchema();
break;
case SCH_MARKER_T:
( (SCH_MARKER*) DrawStruct )->DisplayMarkerInfo( this );
( (SCH_MARKER*) item )->DisplayMarkerInfo( this );
break;
default:
@ -368,8 +368,9 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case ID_BUS_BUTT:
case ID_WIRE_BUTT:
case ID_LINE_COMMENT_BUTT:
if( DrawStruct && ( DrawStruct->m_Flags & IS_NEW ) )
EndSegment( DC );
if( item && ( item->m_Flags & IS_NEW ) )
EndSegment( aDC );
break;
}
}

View File

@ -48,7 +48,7 @@ static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_
*
* This menu is then added to the list of zoom commands.
*/
bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
@ -66,7 +66,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
// Try to locate items at cursor position.
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = SchematicGeneralLocateAndDisplay( false );
DrawStruct = LocateAndShowItem( aPosition, false );
if( DrawStruct && (DrawStruct->Type() == SCH_SHEET_T) )
{

View File

@ -40,7 +40,7 @@ void IncrementLabelMember( wxString& name );
/****************/
/* EDITPART.CPP */
/****************/
void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, wxPoint& pos, SCH_COMPONENT* m_Cmp );
void InstallCmpeditFrame( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aComponent );
void SnapLibItemPoint( int OrigX,
int OrigY,

View File

@ -484,7 +484,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( screen->GetCurItem() == NULL )
break;
InstallCmpeditFrame( this, pos, (SCH_COMPONENT*) screen->GetCurItem() );
InstallCmpeditFrame( this, (SCH_COMPONENT*) screen->GetCurItem() );
break;
case ID_POPUP_SCH_MIROR_X_CMP:

View File

@ -153,8 +153,8 @@ int TEMPLATES::AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
{
if( m_Fields[i].m_Name == aFieldName.m_Name )
{
D(printf("inserting template fieldname:'%s' at %d\n",
aFieldName.m_Name.utf8_str(), i );)
// D(printf("inserting template fieldname:'%s' at %d\n",
// aFieldName.m_Name.utf8_str(), i );)
m_Fields[i] = aFieldName;
return i; // return the container index

View File

@ -69,7 +69,7 @@ public:
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void LoadSettings();
void SaveSettings();

View File

@ -13,7 +13,7 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
}
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
wxPoint oldpos;

View File

@ -370,7 +370,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
bool Read_GERBER_File( const wxString& GERBER_FullFileName,
const wxString& D_Code_FullFileName );
void GeneralControle( wxDC* DC, wxPoint Mouse );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
/**

View File

@ -57,48 +57,45 @@ class BASE_SCREEN : public EDA_ITEM
GRIDS m_grids; ///< List of valid grid sizes.
EDA_ITEM* m_drawList; ///< Object list for the screen.
wxString m_fileName; ///< File used to load the screen.
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
char m_FlagModified; ///< Indicates current drawing has been modified.
char m_FlagSave; ///< Indicates automatic file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
public:
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */
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)*/
* in user units. (coordinates from last reset position)*/
// Scrollbars management:
int m_ScrollPixelsPerUnitX; /* Pixels per scroll unit in the horizontal direction. */
int m_ScrollPixelsPerUnitY; /* Pixels per scroll unit in the vertical direction. */
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll
* units.
* m_ScrollbarNumber * m_ScrollPixelsPerUnit = virtual draw area size in pixels
*/
wxPoint m_ScrollbarPos; /* Current scroll bar position in scroll
* units. */
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll units.
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
* virtual draw area size in pixels */
wxPoint m_ScrollbarPos; /* Current scroll bar position in scroll units. */
wxPoint m_StartVisu; /* Coordinates in drawing units of the current
* view position (upper left corner of device)
*/
wxPoint m_StartVisu; /* Coordinates in drawing units of the current
* view position (upper left corner of device)
*/
wxSize m_SizeVisu; /* taille en pixels de l'ecran (fenetre de visu
* Utile pour recadrer les affichages lors de la
* navigation dans la hierarchie */
bool m_Center; /* Center on screen. If TRUE (0.0) is centered
* on screen coordinates can be < 0 and
* > 0 except for schematics.
* FALSE: when coordinates can only be >= 0
* Schematic */
bool m_Center; /* Center on screen. If TRUE (0.0) is centered
* on screen coordinates can be < 0 and
* > 0 except for schematics.
* FALSE: when coordinates can only be >= 0
* Schematic */
bool m_FirstRedraw;
// Undo/redo list of commands
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo
* command (old data) */
UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo
* command (old data) */
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */
UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo command (old data) */
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
/* block control */
BLOCK_SELECTOR m_BlockLocate; /* Block description for block
* commands */
BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */
/* Page description */
Ki_PageDescr* m_CurrentSheetDesc;
@ -114,23 +111,12 @@ public:
wxString m_Commentaire3;
wxString m_Commentaire4;
private:
char m_FlagRefreshReq; /* indicates that the screen should
* be redrawn */
char m_FlagModified; // indicates current drawing has
// been modified
char m_FlagSave; // Perform automatica file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
/* Grid and zoom values. */
public:
wxPoint m_GridOrigin;
wxArrayInt m_ZoomList; /* Array of standard zoom coefficients. */
int m_Zoom; /* Current zoom coefficient. */
int m_ZoomScalar; /* Allow zooming to non-integer increments.
*/
int m_ZoomScalar; /* Allow zooming to non-integer increments. */
bool m_IsPrinting;
public:
@ -369,6 +355,25 @@ public:
return useMouse ? m_MousePosition : m_Curseur;
}
/**
* Function GetCursorPosition
* returns the current cursor position in logical (drawing) units.
* @param aOnGrid Returns the nearest grid position at the current cursor position.
* @param aGridSize Custom grid size instead of the current grid size. Only valid
* if \a aOnGrid is true.
* @return The current cursor position.
*/
wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL );
/**
* Function GetNearestGridPosition
* returns the nearest \a aGridSize location to \a aPosition.
* @param aPosition The position to check.
* @param aGridSize The grid size to locate to if provided. If NULL then the current
* grid size is used.
* @return The nearst grid position.
*/
wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL );
/**
* Function GetClass

View File

@ -109,7 +109,7 @@ public:
void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
PARAM_CFG_ARRAY& GetProjectFileParameters( void );
void SaveProjectFile( wxWindow* displayframe, bool askoverwrite = true );
@ -172,7 +172,8 @@ public:
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem = NULL );
SCH_FIELD* GetCurrentField() { return m_CurrentField; }
@ -200,15 +201,14 @@ public:
void InstallConfigFrame( wxCommandEvent& event );
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnLeftClick( wxDC* aDC, const wxPoint& aPosition );
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition );
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
int BestZoom();
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
SCH_ITEM* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
bool IncludePin );
SCH_ITEM* LocateAndShowItem( const wxPoint& aPosition, bool aIncludePin = true );
SCH_ITEM* LocateItem( const wxPoint& aPosition, bool aIncludePin );
/**
* Function FillFootprintFieldForAllInstancesofComponent

View File

@ -267,11 +267,12 @@ public:
* Function OnHotKey.
* ** Commands are case insensitive **
* Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aPosition The cursor position in logical (drawing) units.
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/
void OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_ITEM* aItem );
void OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
/**
* Function OnHotkeyDeleteItem
@ -366,7 +367,7 @@ public:
void ReFillLayerWidget();
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
/**
* Function ShowDesignRulesEditor

View File

@ -269,7 +269,8 @@ public:
void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event );
virtual void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
virtual void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem = NULL );
/**
* Function AddMenuZoomAndGrid (virtual)
@ -373,9 +374,9 @@ public:
* called on every mouse and key event.
*</p>
* @param aDC A device context.
* @param aPosition The cursor position in logical (drawing) units.
* @param aPosition The current cursor position in logical (drawing) units.
*/
virtual void GeneralControle( wxDC* aDC, wxPoint aPosition ) { /* dummy */ }
virtual void GeneralControle( wxDC* aDC, const wxPoint& aPosition ) { /* dummy */ }
virtual void OnSize( wxSizeEvent& event );
void OnEraseBackground( wxEraseEvent& SizeEvent );

View File

@ -226,7 +226,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
}
void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
wxPoint oldpos;
@ -370,7 +370,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
if( hotkey )
{
OnHotKey( aDC, hotkey, NULL );
OnHotKey( aDC, hotkey, aPosition );
}
if( GetScreen()->IsRefreshReq() )

View File

@ -22,12 +22,14 @@
/**
* Function OnHotKey.
* ** Commands are case insensitive **
* Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
* Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aPosition The current cursor position in logical (drawing) units.
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/
void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_ITEM* aItem )
void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
EDA_ITEM* aItem )
{
if( aHotkeyCode == 0 )
return;

View File

@ -20,14 +20,13 @@
*/
/*****************************************************************************************/
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStruct )
{
/*****************************************************************************************/
/* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive
*/
if( hotkey == 0 )
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem )
{
if( aHotKey == 0 )
return;
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
@ -37,13 +36,13 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStru
cmd.SetEventObject( this );
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( hotkey, common_Hotkey_List );
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, module_edit_Hotkey_List );
HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List );
if( HK_Descr == NULL )
return;

View File

@ -40,13 +40,14 @@ public:
void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem = NULL );
bool OnHotkeyEditItem( int aIdCommand );
bool OnHotkeyDeleteItem( int aIdCommand );
bool OnHotkeyMoveItem( int aIdCommand );
bool OnHotkeyRotateItem( int aIdCommand );
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
/**
* Function LoadModuleFromBoard

View File

@ -455,7 +455,7 @@ void WinEDA_ModuleEditFrame::Show3D_Frame( wxCommandEvent& event )
}
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
wxPoint oldpos;
@ -529,7 +529,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
if( hotkey )
{
OnHotKey( aDC, hotkey, NULL );
OnHotKey( aDC, hotkey, aPosition );
}
if( GetScreen()->IsRefreshReq() )

View File

@ -14,12 +14,9 @@
#include "pcbnew_id.h"
/********************************************************************/
void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/********************************************************************/
/* Handle the left buttom mouse click, when a tool is active
*/
void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{
BOARD_ITEM* DrawStruct = GetCurItem();
bool exit = false;
@ -31,7 +28,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
{
DrawPanel->m_IgnoreMouseEvents = true;
DrawPanel->CursorOff( DC );
DrawPanel->CursorOff( aDC );
switch( DrawStruct->Type() )
{
@ -39,10 +36,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( (DrawStruct->m_Flags & IS_NEW) )
{
DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( DC );
Begin_Zone( aDC );
}
else
End_Move_Zone_Corner_Or_Outlines( DC, (ZONE_CONTAINER*) DrawStruct );
End_Move_Zone_Corner_Or_Outlines( aDC, (ZONE_CONTAINER*) DrawStruct );
exit = true;
break;
@ -50,40 +47,40 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case TYPE_VIA:
if( DrawStruct->m_Flags & IS_DRAGGED )
{
PlaceDraggedOrMovedTrackSegment( (TRACK*) DrawStruct, DC );
PlaceDraggedOrMovedTrackSegment( (TRACK*) DrawStruct, aDC );
exit = true;
}
break;
case TYPE_TEXTE:
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, aDC );
exit = true;
break;
case TYPE_TEXTE_MODULE:
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, aDC );
exit = true;
break;
case TYPE_PAD:
PlacePad( (D_PAD*) DrawStruct, DC );
PlacePad( (D_PAD*) DrawStruct, aDC );
exit = true;
break;
case TYPE_MODULE:
Place_Module( (MODULE*) DrawStruct, DC );
Place_Module( (MODULE*) DrawStruct, aDC );
exit = true;
break;
case TYPE_MIRE:
Place_Mire( (MIREPCB*) DrawStruct, DC );
Place_Mire( (MIREPCB*) DrawStruct, aDC );
exit = true;
break;
case TYPE_DRAWSEGMENT:
if( m_ID_current_state == 0 )
{
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, DC );
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC );
exit = true;
}
break;
@ -105,7 +102,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
DrawPanel->m_IgnoreMouseEvents = false;
DrawPanel->CursorOn( DC );
DrawPanel->CursorOn( aDC );
if( exit )
return;
}
@ -151,12 +148,12 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
MuWaveCommand( DC, MousePos );
MuWaveCommand( aDC, aPosition );
break;
case ID_PCB_HIGHLIGHT_BUTT:
{
int netcode = Select_High_Light( DC );
int netcode = Select_High_Light( aDC );
if( netcode < 0 )
GetBoard()->DisplayInfo( this );
else
@ -170,7 +167,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_SHOW_1_RATSNEST_BUTT:
DrawStruct = PcbGeneralLocateAndDisplay();
Show_1_Ratsnest( DrawStruct, DC );
Show_1_Ratsnest( DrawStruct, aDC );
if( DrawStruct )
SendMessageToEESCHEMA( DrawStruct );
@ -179,12 +176,12 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_MIRE_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
SetCurItem( Create_Mire( DC ) );
SetCurItem( Create_Mire( aDC ) );
DrawPanel->MouseToCursorSchema();
}
else if( DrawStruct->Type() == TYPE_MIRE )
{
Place_Mire( (MIREPCB*) DrawStruct, DC );
Place_Mire( (MIREPCB*) DrawStruct, aDC );
}
else
DisplayError( this, wxT( "Internal err: Struct not TYPE_MIRE" ) );
@ -207,7 +204,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = Begin_DrawSegment( NULL, shape, DC );
DrawStruct = Begin_DrawSegment( NULL, shape, aDC );
SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = true;
}
@ -215,7 +212,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
&& (DrawStruct->Type() == TYPE_DRAWSEGMENT)
&& (DrawStruct->m_Flags & IS_NEW) )
{
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, DC );
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC );
SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = true;
}
@ -231,14 +228,14 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = Begin_Route( NULL, DC );
DrawStruct = Begin_Route( NULL, aDC );
SetCurItem( DrawStruct );
if( DrawStruct )
DrawPanel->m_AutoPAN_Request = true;
}
else if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
{
TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC );
TRACK* track = Begin_Route( (TRACK*) DrawStruct, aDC );
// SetCurItem() must not write to the msg panel
// because a track info is displayed while moving the mouse cursor
if( track ) // A new segment was created
@ -272,12 +269,12 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Corner( DC,
Start_Move_Zone_Corner( aDC,
zone_cont,
zone_cont->m_CornerSelection,
false );
}
else if( Begin_Zone( DC ) )
else if( Begin_Zone( aDC ) )
{
DrawPanel->m_AutoPAN_Request = true;
DrawStruct = GetBoard()->m_CurrentZoneContour;
@ -289,7 +286,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
&& (DrawStruct->m_Flags & IS_NEW) )
{ // Add a new corner to the current outline beeing created:
DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( DC );
Begin_Zone( aDC );
DrawStruct = GetBoard()->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
}
@ -300,13 +297,13 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_ADD_TEXT_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
SetCurItem( Create_Texte_Pcb( DC ) );
SetCurItem( Create_Texte_Pcb( aDC ) );
DrawPanel->MouseToCursorSchema();
DrawPanel->m_AutoPAN_Request = true;
}
else if( DrawStruct->Type() == TYPE_TEXTE )
{
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false;
}
else
@ -317,14 +314,14 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawPanel->MouseToCursorSchema();
DrawStruct = Load_Module_From_Library( wxEmptyString, DC );
DrawStruct = Load_Module_From_Library( wxEmptyString, aDC );
SetCurItem( DrawStruct );
if( DrawStruct )
StartMove_Module( (MODULE*) DrawStruct, DC );
StartMove_Module( (MODULE*) DrawStruct, aDC );
}
else if( DrawStruct->Type() == TYPE_MODULE )
{
Place_Module( (MODULE*) DrawStruct, DC );
Place_Module( (MODULE*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false;
}
else
@ -339,7 +336,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = Begin_Dimension( NULL, DC );
DrawStruct = Begin_Dimension( NULL, aDC );
SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = true;
}
@ -347,7 +344,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
&& (DrawStruct->Type() == TYPE_DIMENSION)
&& (DrawStruct->m_Flags & IS_NEW) )
{
DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, DC );
DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, aDC );
SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = true;
}
@ -361,23 +358,23 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct = PcbGeneralLocateAndDisplay();
if( DrawStruct && (DrawStruct->m_Flags == 0) )
{
RemoveStruct( DrawStruct, DC );
RemoveStruct( DrawStruct, aDC );
SetCurItem( DrawStruct = NULL );
}
}
break;
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
DrawPanel->DrawAuxiliaryAxis( DC, GR_XOR );
DrawPanel->DrawAuxiliaryAxis( aDC, GR_XOR );
m_Auxiliary_Axis_Position = GetScreen()->m_Curseur;
DrawPanel->DrawAuxiliaryAxis( DC, GR_COPY );
DrawPanel->DrawAuxiliaryAxis( aDC, GR_COPY );
OnModify();
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
DrawPanel->DrawGridAxis( DC, GR_XOR );
DrawPanel->DrawGridAxis( aDC, GR_XOR );
GetScreen()->m_GridOrigin = GetScreen()->m_Curseur;
DrawPanel->DrawGridAxis( DC, GR_COPY );
DrawPanel->DrawGridAxis( aDC, GR_COPY );
break;
default:
@ -391,7 +388,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/* handle the double click on the mouse left button
*/
void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
{
BOARD_ITEM* DrawStruct = GetCurItem();
@ -417,12 +414,12 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case TYPE_VIA:
if( DrawStruct->m_Flags & IS_NEW )
{
End_Route( (TRACK*) DrawStruct, DC );
End_Route( (TRACK*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false;
}
else if( DrawStruct->m_Flags == 0 )
{
Edit_TrackSegm_Width( DC, (TRACK*) DrawStruct );
Edit_TrackSegm_Width( aDC, (TRACK*) DrawStruct );
}
break;
@ -432,18 +429,18 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case TYPE_MIRE:
case TYPE_DIMENSION:
case TYPE_TEXTE_MODULE:
OnEditItemRequest( DC, DrawStruct );
OnEditItemRequest( aDC, DrawStruct );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_DRAWSEGMENT:
OnEditItemRequest( DC, DrawStruct );
OnEditItemRequest( aDC, DrawStruct );
break;
case TYPE_ZONE_CONTAINER:
if( DrawStruct->m_Flags )
break;
OnEditItemRequest( DC, DrawStruct );
OnEditItemRequest( aDC, DrawStruct );
break;
default:
@ -455,13 +452,13 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case ID_TRACK_BUTT:
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
{
End_Route( (TRACK*) DrawStruct, DC );
End_Route( (TRACK*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false;
}
break;
case ID_PCB_ZONES_BUTT:
if( End_Zone( DC ) )
if( End_Zone( aDC ) )
{
DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL );
@ -481,7 +478,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
}
if( (DrawStruct->m_Flags & IS_NEW) )
{
End_Edge( (DRAWSEGMENT*) DrawStruct, DC );
End_Edge( (DRAWSEGMENT*) DrawStruct, aDC );
DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL );
}
@ -494,20 +491,20 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/**
* Function OnEditItemRequest
* Install the corresponding dialog editor for the given item
* @param DC = the current device context
* @param aDC = the current device context
* @param aItem = a pointer to the BOARD_ITEM to edit
*/
void WinEDA_PcbFrame::OnEditItemRequest( wxDC* DC, BOARD_ITEM* aItem )
void WinEDA_PcbFrame::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
{
switch( aItem->Type() )
{
case TYPE_TRACK:
case TYPE_VIA:
Edit_TrackSegm_Width( DC, (TRACK*) aItem );
Edit_TrackSegm_Width( aDC, (TRACK*) aItem );
break;
case TYPE_TEXTE:
InstallTextPCBOptionsFrame( (TEXTE_PCB*) aItem, DC );
InstallTextPCBOptionsFrame( (TEXTE_PCB*) aItem, aDC );
break;
case TYPE_PAD:
@ -515,27 +512,27 @@ void WinEDA_PcbFrame::OnEditItemRequest( wxDC* DC, BOARD_ITEM* aItem )
break;
case TYPE_MODULE:
InstallModuleOptionsFrame( (MODULE*) aItem, DC );
InstallModuleOptionsFrame( (MODULE*) aItem, aDC );
break;
case TYPE_MIRE:
InstallMireOptionsFrame( (MIREPCB*) aItem, DC );
InstallMireOptionsFrame( (MIREPCB*) aItem, aDC );
break;
case TYPE_DIMENSION:
Install_Edit_Dimension( (DIMENSION*) aItem, DC );
Install_Edit_Dimension( (DIMENSION*) aItem, aDC );
break;
case TYPE_TEXTE_MODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) aItem, DC );
InstallTextModOptionsFrame( (TEXTE_MODULE*) aItem, aDC );
break;
case TYPE_DRAWSEGMENT:
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) aItem, DC );
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) aItem, aDC );
break;
case TYPE_ZONE_CONTAINER:
Edit_Zone_Params( DC, (ZONE_CONTAINER*) aItem );
Edit_Zone_Params( aDC, (ZONE_CONTAINER*) aItem );
break;
default: