Commit 0e7fa222 authored by jean-pierre charras's avatar jean-pierre charras

merge trunk. Prepare hotkeys move and rotate items in board editor

parents 2a14f2d5 f839ba95
...@@ -204,6 +204,46 @@ int OUTPUTFORMATTER::Print( int nestLevel, const char* fmt, ... ) throw( IOError ...@@ -204,6 +204,46 @@ int OUTPUTFORMATTER::Print( int nestLevel, const char* fmt, ... ) throw( IOError
} }
const char* OUTPUTFORMATTER::Quoted( std::string* aWrapee ) throw( IOError )
{
// derived class's notion of what a quote character is
char quote = *GetQuoteChar( "(" );
// Will the string be wrapped based on its interior content?
const char* squote = GetQuoteChar( aWrapee->c_str() );
// Search the interior of the string for 'quote' chars
// and replace them as found with duplicated quotes.
// Note that necessarily any string which has internal quotes will
// also be wrapped in quotes later in this function.
for( unsigned i=0; i<aWrapee->size(); ++i )
{
if( (*aWrapee)[i] == quote )
{
aWrapee->insert( aWrapee->begin()+i, quote );
++i;
}
else if( (*aWrapee)[0]=='\r' || (*aWrapee)[0]=='\n' )
{
// In a desire to maintain accurate line number reporting within DSNLEXER
// a decision was made to make all S-expression strings be on a single
// line. You can embedd \n (human readable) in the text but not
// '\n' which is 0x0a.
throw IOError( _( "S-expression string has newline" ) );
}
}
if( *squote )
{
// wrap the beginning and end of the string in a quote.
aWrapee->insert( aWrapee->begin(), quote );
aWrapee->insert( aWrapee->end(), quote );
}
return aWrapee->c_str();
}
//-----<STRING_FORMATTER>---------------------------------------------------- //-----<STRING_FORMATTER>----------------------------------------------------
void STRING_FORMATTER::write( const char* aOutBuf, int aCount ) throw( IOError ) void STRING_FORMATTER::write( const char* aOutBuf, int aCount ) throw( IOError )
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include "xnode.h" #include "xnode.h"
#include "macros.h" #include "macros.h"
typedef wxXmlProperty XATTR; typedef wxXmlProperty XATTR;
#define GetAttribs GetProperties
void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{ {
...@@ -51,18 +51,16 @@ void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) ...@@ -51,18 +51,16 @@ void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{ {
std::string utf8; std::string utf8;
const char* quote;
// output attributes first if they exist // output attributes first if they exist
for( XATTR* attr = (XATTR*) GetAttributes(); attr; attr = (XATTR*) attr->GetNext() ) for( XATTR* attr = (XATTR*) GetAttribs(); attr; attr = (XATTR*) attr->GetNext() )
{ {
utf8 = CONV_TO_UTF8( attr->GetValue() ); // capture the content utf8 = CONV_TO_UTF8( attr->GetValue() ); // capture the content
quote = out->GetQuoteChar( utf8.c_str() );
out->Print( 0, " (%s %s%s%s)", out->Print( 0, " (%s %s)",
// attr names should never need quoting, no spaces, we designed the file. // attr names should never need quoting, no spaces, we designed the file.
CONV_TO_UTF8( attr->GetName() ), CONV_TO_UTF8( attr->GetName() ),
quote, utf8.c_str(), quote ); out->Quoted( &utf8 ) );
} }
// we only expect to have used one of two types here: // we only expect to have used one of two types here:
...@@ -88,8 +86,7 @@ void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ...@@ -88,8 +86,7 @@ void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError
case wxXML_TEXT_NODE: case wxXML_TEXT_NODE:
utf8 = CONV_TO_UTF8( GetContent() ); utf8 = CONV_TO_UTF8( GetContent() );
quote = out->GetQuoteChar( utf8.c_str() ); out->Print( 0, " %s", out->Quoted( &utf8 ) );
out->Print( 0, " %s%s%s", quote, utf8.c_str(), quote );
break; break;
default: default:
...@@ -97,5 +94,4 @@ void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ...@@ -97,5 +94,4 @@ void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError
} }
} }
// EOF // EOF
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/> <xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="export"> <xsl:template match="/export">
<xsl:text>*PADS-PCB*&nl;*PART*&nl;</xsl:text> <xsl:text>*PADS-PCB*&nl;*PART*&nl;</xsl:text>
<xsl:apply-templates select="components/comp"/> <xsl:apply-templates select="components/comp"/>
<xsl:text>&nl;*NET*&nl;</xsl:text> <xsl:text>&nl;*NET*&nl;</xsl:text>
......
...@@ -301,7 +301,7 @@ public: ...@@ -301,7 +301,7 @@ public:
/** /**
* Function Quoted * Function Quoted
* checks \a aWrappee input string for a need to be quoted * checks \a aWrapee input string for a need to be quoted
* (e.g. contains a ')' character or a space), and for \" double quotes * (e.g. contains a ')' character or a space), and for \" double quotes
* within the string that need to be doubled up such that the DSNLEXER * within the string that need to be doubled up such that the DSNLEXER
* will correctly parse the string from a file later. * will correctly parse the string from a file later.
...@@ -312,9 +312,11 @@ public: ...@@ -312,9 +312,11 @@ public:
* *
* @return const char* - useful for passing to printf() style functions that * @return const char* - useful for passing to printf() style functions that
* must output utf8 streams. * must output utf8 streams.
virtual const char* Quoted( std::string* aWrapee ); * @throw IOError, if aWrapee has any \r or \n bytes in it which is
thinking about using wxCharBuffer* instead. * illegal according to the DSNLEXER who does not ever want them
* within a string.
*/ */
virtual const char* Quoted( std::string* aWrapee ) throw( IOError );
//-----</interface functions>----------------------------------------- //-----</interface functions>-----------------------------------------
}; };
......
...@@ -253,10 +253,46 @@ public: ...@@ -253,10 +253,46 @@ public:
*/ */
void SetLastNetListRead( const wxString& aNetListFile ); void SetLastNetListRead( const wxString& aNetListFile );
void OnHotKey( wxDC* DC, /** Function OnHotKey.
int hotkey, * ** Commands are case insensitive **
EDA_BaseStruct* DrawStruct ); * Some commands are relatives to the item under the mouse cursor
bool OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ); * @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aItem = NULL or pointer on a EDA_BaseStruct under the mouse cursor
*/
void OnHotKey( wxDC* aDC,
int aHotkeyCode,
EDA_BaseStruct* aItem );
/** Function OnHotkeyDeleteItem
* Delete the item found under the mouse cursor
* Depending on the current active tool::
* Tool track
* if a track is in progress: Delete the last segment
* else delete the entire track
* Tool module (footprint):
* Delete the module.
* @param aDC = current device context
* @return true if an item was deleted
*/
bool OnHotkeyDeleteItem( wxDC* aDC );
/** Function OnHotkeyMoveItem
* Moves or drag the item (footprint, track, text .. ) found under the mouse cursor
* Only a footprint or a track can be dragged
* @param aIdCommand = the hotkey command id
* @param aDC = current device context
* @return true if an item was moved
*/
bool OnHotkeyMoveItem( int aIdCommand, wxDC* aDC );
/** Function OnHotkeyRotateItem
* Rotate the item (text or footprint) found under the mouse cursor
* @param aIdCommand = the hotkey command id
* @param aDC = current device context
* @return true if an item was moved
*/
bool OnHotkeyRotateItem( int aIdCommand, wxDC* aDC );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* default key value is the default hotkey for this command. Can be overrided by the user hotkey list file * default key value is the default hotkey for this command. Can be overrided by the user hotkey list file
* add the HkMyNewEntry pointer in the s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list) * add the HkMyNewEntry pointer in the s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list)
* Add the new code in the switch in OnHotKey() function. * Add the new code in the switch in OnHotKey() function.
* when the variable PopupOn is true, an item is currently edited. * Note: when the variable itemCurrentlyEdited is true, an item is currently edited.
* This can be useful if the new function cannot be executed while an item is currently being edited * This can be useful if the new function cannot be executed while an item is currently being edited
* ( For example, one cannot start a new wire when a component is moving.) * ( For example, one cannot start a new wire when a component is moving.)
* *
...@@ -76,18 +76,15 @@ static Ki_HotkeyInfo HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END ); ...@@ -76,18 +76,15 @@ static Ki_HotkeyInfo HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
static Ki_HotkeyInfo HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' ); static Ki_HotkeyInfo HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' );
static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT,
'F' ); 'F' );
static Ki_HotkeyInfo HkRotateFootprint( wxT( "Rotate Footprint" ), static Ki_HotkeyInfo HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' );
HK_ROTATE_FOOTPRINT, 'R' ); static Ki_HotkeyInfo HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' );
static Ki_HotkeyInfo HkMoveFootprint( wxT( "Move Footprint" ), HK_MOVE_FOOTPRINT_OR_TRACK,
'M' );
static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT_OR_TRACK, static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT_OR_TRACK,
'G' ); 'G' );
static Ki_HotkeyInfo HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ), static Ki_HotkeyInfo HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ),
HK_GET_AND_MOVE_FOOTPRINT, 'T' ); HK_GET_AND_MOVE_FOOTPRINT, 'T' );
static Ki_HotkeyInfo HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ), static Ki_HotkeyInfo HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ),
HK_LOCK_UNLOCK_FOOTPRINT, 'L' ); HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
static Ki_HotkeyInfo HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, static Ki_HotkeyInfo HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE );
WXK_DELETE );
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ),
HK_RESET_LOCAL_COORD, ' ' ); HK_RESET_LOCAL_COORD, ' ' );
...@@ -162,8 +159,8 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = ...@@ -162,8 +159,8 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] =
&HkBackspace, &HkBackspace,
&HkAddNewTrack, &HkAddVia, &HkAddMicroVia, &HkAddNewTrack, &HkAddVia, &HkAddMicroVia,
&HkSwitchTrackPosture, &HkSwitchTrackPosture,
&HkEndTrack, &HkMoveFootprint, &HkEndTrack, &HkMoveItem,
&HkFlipFootprint, &HkRotateFootprint, &HkDragFootprint, &HkFlipFootprint, &HkRotateItem, &HkDragFootprint,
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile, &HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile,
&HkLoadfile, &HkFindItem, &HkEditBoardItem, &HkLoadfile, &HkFindItem, &HkEditBoardItem,
&HkSwitch2CopperLayer, &HkSwitch2InnerLayer1, &HkSwitch2CopperLayer, &HkSwitch2InnerLayer1,
...@@ -210,45 +207,40 @@ struct Ki_HotkeyInfoSectionDescriptor s_Module_Editor_Hokeys_Descr[] = ...@@ -210,45 +207,40 @@ struct Ki_HotkeyInfoSectionDescriptor s_Module_Editor_Hokeys_Descr[] =
NULL, NULL, NULL NULL, NULL, NULL
} }; } };
/***********************************************************/ /** Function OnHotKey.
void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ) * ** Commands are case insensitive **
/***********************************************************/ * Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
/* Hot keys. Some commands are relatives to the item under the mouse cursor
* Commands are case insensitive
* @param DC = current device context
* @param hotkey = hotkey code (ascii or wxWidget code for special keys) * @param hotkey = hotkey code (ascii or wxWidget code for special keys)
* @param DrawStruct = NULL or pointer on a EDA_BaseStruct under the mouse cursor * @param aItem = NULL or pointer on a EDA_BaseStruct under the mouse cursor
*/ */
void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_BaseStruct* aItem )
{ {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); if( aHotkeyCode == 0 )
cmd.SetEventObject( this );
bool PopupOn = (GetCurItem() && GetCurItem()->m_Flags);
bool ItemFree = (GetCurItem() == 0 || GetCurItem()->m_Flags == 0);
if( hotkey == 0 )
return; return;
bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->m_Flags);
MODULE* module = NULL; MODULE* module = NULL;
/* Convert lower to upper case /* Convert lower to upper case
* (the usual toupper function has problem with non ascii codes like function keys * (the usual toupper function has problem with non ascii codes like function keys
*/ */
if( (hotkey >= 'a') && (hotkey <= 'z') ) if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
hotkey += 'A' - 'a'; aHotkeyCode += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List ); Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_Common_Hotkey_List );
if( HK_Descr == NULL ) if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, s_board_edit_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_board_edit_Hotkey_List );
if( HK_Descr == NULL ) if( HK_Descr == NULL )
return; return;
// Create a wxCommandEvent that will be posted in some hot keys functions
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
int ll; int ll;
switch( HK_Descr->m_Idcommand ) switch( HK_Descr->m_Idcommand )
...@@ -270,7 +262,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -270,7 +262,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
GetBoard()->GetCopperLayerCount() - 2 ); GetBoard()->GetCopperLayerCount() - 2 );
else else
ll--; ll--;
SwitchLayer( DC, ll ); SwitchLayer( aDC, ll );
break; break;
case HK_SWITCH_LAYER_TO_NEXT: case HK_SWITCH_LAYER_TO_NEXT:
...@@ -283,39 +275,39 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -283,39 +275,39 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
ll = LAYER_N_FRONT; ll = LAYER_N_FRONT;
else else
ll++; ll++;
SwitchLayer( DC, ll ); SwitchLayer( aDC, ll );
break; break;
case HK_SWITCH_LAYER_TO_COMPONENT: case HK_SWITCH_LAYER_TO_COMPONENT:
SwitchLayer( DC, LAYER_N_FRONT ); SwitchLayer( aDC, LAYER_N_FRONT );
break; break;
case HK_SWITCH_LAYER_TO_COPPER: case HK_SWITCH_LAYER_TO_COPPER:
SwitchLayer( DC, LAYER_N_BACK ); SwitchLayer( aDC, LAYER_N_BACK );
break; break;
case HK_SWITCH_LAYER_TO_INNER1: case HK_SWITCH_LAYER_TO_INNER1:
SwitchLayer( DC, LAYER_N_2 ); SwitchLayer( aDC, LAYER_N_2 );
break; break;
case HK_SWITCH_LAYER_TO_INNER2: case HK_SWITCH_LAYER_TO_INNER2:
SwitchLayer( DC, LAYER_N_3 ); SwitchLayer( aDC, LAYER_N_3 );
break; break;
case HK_SWITCH_LAYER_TO_INNER3: case HK_SWITCH_LAYER_TO_INNER3:
SwitchLayer( DC, LAYER_N_4 ); SwitchLayer( aDC, LAYER_N_4 );
break; break;
case HK_SWITCH_LAYER_TO_INNER4: case HK_SWITCH_LAYER_TO_INNER4:
SwitchLayer( DC, LAYER_N_5 ); SwitchLayer( aDC, LAYER_N_5 );
break; break;
case HK_SWITCH_LAYER_TO_INNER5: case HK_SWITCH_LAYER_TO_INNER5:
SwitchLayer( DC, LAYER_N_6 ); SwitchLayer( aDC, LAYER_N_6 );
break; break;
case HK_SWITCH_LAYER_TO_INNER6: case HK_SWITCH_LAYER_TO_INNER6:
SwitchLayer( DC, LAYER_N_7 ); SwitchLayer( aDC, LAYER_N_7 );
break; break;
case HK_HELP: // Display Current hotkey list case HK_HELP: // Display Current hotkey list
...@@ -354,7 +346,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -354,7 +346,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
case HK_UNDO: case HK_UNDO:
case HK_REDO: case HK_REDO:
if( ItemFree ) if( !itemCurrentlyEdited )
{ {
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED,
HK_Descr->m_IdMenuEvent ); HK_Descr->m_IdMenuEvent );
...@@ -378,26 +370,24 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -378,26 +370,24 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
break; break;
case HK_DELETE: case HK_DELETE:
OnHotkeyDeleteItem( DC, DrawStruct ); OnHotkeyDeleteItem( aDC );
break; break;
case HK_BACK_SPACE: case HK_BACK_SPACE:
if( m_ID_current_state == ID_TRACK_BUTT && getActiveLayer() if( m_ID_current_state == ID_TRACK_BUTT && getActiveLayer()
<= LAYER_N_FRONT ) <= LAYER_N_FRONT )
{ {
if( ItemFree ) if( !itemCurrentlyEdited )
{ {
// no track is currently being edited - select a segment and remove it. // no track is currently being edited - select a segment and remove it.
// @todo: possibly? pass the HK command code to PcbGeneralLocateAndDisplay() so it can restrict its search to specific item types. // @todo: possibly? pass the HK command code to PcbGeneralLocateAndDisplay() so it can restrict its search to specific item types.
// @todo: use PcbGeneralLocateAndDisplay() everywhere in this source file. aItem = PcbGeneralLocateAndDisplay();
DrawStruct = PcbGeneralLocateAndDisplay();
// don't let backspace delete modules!! // don't let backspace delete modules!!
if( DrawStruct && (DrawStruct->Type() == TYPE_TRACK if( aItem && (aItem->Type() == TYPE_TRACK
|| DrawStruct->Type() == TYPE_VIA) ) || aItem->Type() == TYPE_VIA) )
{ {
Delete_Segment( DC, (TRACK*) DrawStruct ); Delete_Segment( aDC, (TRACK*) aItem );
SetCurItem( NULL ); SetCurItem( NULL );
} }
OnModify(); OnModify();
...@@ -407,7 +397,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -407,7 +397,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
// then an element is being edited - remove the last segment. // then an element is being edited - remove the last segment.
// simple lines for debugger: // simple lines for debugger:
TRACK* track = (TRACK*) GetCurItem(); TRACK* track = (TRACK*) GetCurItem();
track = Delete_Segment( DC, track ); track = Delete_Segment( aDC, track );
SetCurItem( track ); SetCurItem( track );
OnModify(); OnModify();
} }
...@@ -415,17 +405,17 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -415,17 +405,17 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
break; break;
case HK_END_TRACK: case HK_END_TRACK:
if( !ItemFree && (GetCurItem()->Type() == TYPE_TRACK) if( itemCurrentlyEdited && (GetCurItem()->Type() == TYPE_TRACK)
&& ( (GetCurItem()->m_Flags & IS_NEW) != 0 ) ) && ( (GetCurItem()->m_Flags & IS_NEW) != 0 ) )
{ {
// A new track is in progress: call to End_Route() // A new track is in progress: call to End_Route()
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
End_Route( (TRACK*) GetCurItem(), DC ); End_Route( (TRACK*) GetCurItem(), aDC );
} }
break; break;
case HK_GET_AND_MOVE_FOOTPRINT: case HK_GET_AND_MOVE_FOOTPRINT:
if( ItemFree ) if( !itemCurrentlyEdited )
{ {
wxCommandEvent evt; wxCommandEvent evt;
evt.SetId( ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST ); evt.SetId( ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST );
...@@ -434,7 +424,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -434,7 +424,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
break; break;
case HK_FIND_ITEM: case HK_FIND_ITEM:
if( ItemFree ) if( !itemCurrentlyEdited )
{ {
wxCommandEvent evt; wxCommandEvent evt;
evt.SetId( ID_FIND_ITEMS ); evt.SetId( ID_FIND_ITEMS );
...@@ -443,7 +433,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -443,7 +433,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
break; break;
case HK_LOAD_BOARD: case HK_LOAD_BOARD:
if( ItemFree ) if( !itemCurrentlyEdited )
{ {
// try not to duplicate save, load code etc. // try not to duplicate save, load code etc.
wxCommandEvent evt; wxCommandEvent evt;
...@@ -453,7 +443,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -453,7 +443,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
break; break;
case HK_SAVE_BOARD: case HK_SAVE_BOARD:
if( ItemFree ) if( !itemCurrentlyEdited )
{ {
// try not to duplicate save, load code etc. // try not to duplicate save, load code etc.
wxCommandEvent evt; wxCommandEvent evt;
...@@ -465,7 +455,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -465,7 +455,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
case HK_ADD_MICROVIA: // Place a micro via if a track is in progress case HK_ADD_MICROVIA: // Place a micro via if a track is in progress
if( m_ID_current_state != ID_TRACK_BUTT ) if( m_ID_current_state != ID_TRACK_BUTT )
return; return;
if( ItemFree ) // no track in progress: nothing to do if( !itemCurrentlyEdited ) // no track in progress: nothing to do
break; break;
if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur
return; return;
...@@ -477,7 +467,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -477,7 +467,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
{ {
int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType; int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = VIA_MICROVIA; GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = VIA_MICROVIA;
Other_Layer_Route( (TRACK*) GetCurItem(), DC ); Other_Layer_Route( (TRACK*) GetCurItem(), aDC );
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type; GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh(); DrawPanel->Refresh();
...@@ -487,34 +477,35 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -487,34 +477,35 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
case HK_ADD_VIA: // Switch to alternate layer and Place a via if a track is in progress case HK_ADD_VIA: // Switch to alternate layer and Place a via if a track is in progress
if( m_ID_current_state != ID_TRACK_BUTT ) if( m_ID_current_state != ID_TRACK_BUTT )
return; return;
if( ItemFree ) // no track in progress: switch layer only if( !itemCurrentlyEdited ) // no track in progress: switch layer only
{ {
Other_Layer_Route( NULL, DC ); Other_Layer_Route( NULL, aDC );
break; break;
} }
if( GetCurItem()->Type() != TYPE_TRACK ) if( GetCurItem()->Type() != TYPE_TRACK )
return; return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 ) if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
return; return;
Other_Layer_Route( (TRACK*) GetCurItem(), DC ); // place via and switch layer Other_Layer_Route( (TRACK*) GetCurItem(), aDC ); // place via and switch layer
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case HK_SWITCH_TRACK_POSTURE: case HK_SWITCH_TRACK_POSTURE:
/* change the position of initial segment when creating new tracks /* change the position of initial segment when creating new tracks
* switch from _/ to -\ . * switch from _/ to -\ .
*/ */
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false ); ShowNewTrackWhenMovingCursor( DrawPanel, aDC, false );
g_Alternate_Track_Posture = !g_Alternate_Track_Posture; g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false ); ShowNewTrackWhenMovingCursor( DrawPanel, aDC, false );
break; break;
case HK_ADD_NEW_TRACK: // Start new track case HK_ADD_NEW_TRACK: // Start new track
if( getActiveLayer() > LAYER_N_FRONT ) if( getActiveLayer() > LAYER_N_FRONT )
break; break;
if( m_ID_current_state != ID_TRACK_BUTT && ItemFree ) if( m_ID_current_state != ID_TRACK_BUTT && !itemCurrentlyEdited )
{ {
cmd.SetId( ID_TRACK_BUTT ); cmd.SetId( ID_TRACK_BUTT );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
...@@ -523,16 +514,16 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -523,16 +514,16 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
if( m_ID_current_state != ID_TRACK_BUTT ) if( m_ID_current_state != ID_TRACK_BUTT )
break; break;
if( ItemFree ) // no track in progress: if( !itemCurrentlyEdited ) // no track in progress:
{ {
TRACK* track = Begin_Route( NULL, DC ); TRACK* track = Begin_Route( NULL, aDC );
SetCurItem( track ); SetCurItem( track );
if( track ) if( track )
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
} }
else if( GetCurItem()->m_Flags & IS_NEW ) else if( GetCurItem()->m_Flags & IS_NEW )
{ {
TRACK* track = Begin_Route( (TRACK*) GetCurItem(), DC ); TRACK* track = Begin_Route( (TRACK*) GetCurItem(), aDC );
// SetCurItem() must not write to the msg panel // SetCurItem() must not write to the msg panel
// because a track info is displayed while moving the mouse cursor // because a track info is displayed while moving the mouse cursor
...@@ -543,20 +534,21 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -543,20 +534,21 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
break; break;
case HK_EDIT_ITEM: // Edit board item case HK_EDIT_ITEM: // Edit board item
if( ItemFree ) if( !itemCurrentlyEdited )
{ {
BOARD_ITEM * item = PcbGeneralLocateAndDisplay(); BOARD_ITEM* item = PcbGeneralLocateAndDisplay();
if ( item == NULL ) if( item == NULL )
break; break;
//An item is found, and some can be edited: //An item is found, and some can be edited:
OnEditItemRequest( DC, item ); OnEditItemRequest( aDC, item );
} }
break; break;
// Footprint edition: // Footprint edition:
case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status: case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
// get any module, locked or not locked and toggle its locked status // get any module, locked or not locked and toggle its locked status
if( ItemFree ) if( !itemCurrentlyEdited )
module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE
| VISIBLE_ONLY ); | VISIBLE_ONLY );
else if( GetCurItem()->Type() == TYPE_MODULE ) else if( GetCurItem()->Type() == TYPE_MODULE )
...@@ -569,133 +561,27 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -569,133 +561,27 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
} }
break; break;
case HK_DRAG_FOOTPRINT_OR_TRACK: // Start move (and drag) module or track segment case HK_DRAG_FOOTPRINT_OR_TRACK: // Start drag module or track segment
case HK_MOVE_FOOTPRINT_OR_TRACK: // Start move module or track segment OnHotkeyMoveItem( HK_DRAG_FOOTPRINT_OR_TRACK, aDC );
if( PopupOn )
break;
// Fall through on hot key
case HK_ROTATE_FOOTPRINT: // Rotation
case HK_FLIP_FOOTPRINT: // move to other side
int exit = 0;
if( m_ID_current_state == ID_TRACK_BUTT )
{
if( ItemFree )
DrawStruct = PcbGeneralLocateAndDisplay();
else
DrawStruct = GetCurItem();
if( DrawStruct && (DrawStruct->Type() == TYPE_TRACK
|| DrawStruct->Type() == TYPE_VIA) )
switch( HK_Descr->m_Idcommand )
{
case HK_DRAG_FOOTPRINT_OR_TRACK: // Start drag track segment
DrawPanel->MouseToCursorSchema();
//Start_DragTrackSegmentAndKeepSlope( (TRACK*) DrawStruct,DC );
Start_MoveOneNodeOrSegment( (TRACK*) DrawStruct, DC,
ID_POPUP_PCB_DRAG_TRACK_SEGMENT );
break;
// fall through
case HK_MOVE_FOOTPRINT_OR_TRACK: // Start move track segment
DrawPanel->MouseToCursorSchema();
Start_MoveOneNodeOrSegment( (TRACK*) DrawStruct, DC,
ID_POPUP_PCB_MOVE_TRACK_NODE );
break; break;
}
else
exit = 1;
}
else if( !exit )
{
if( ItemFree )
{
module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE
| IGNORE_LOCKED | VISIBLE_ONLY
#if defined(USE_MATCH_LAYER)
| MATCH_LAYER
#endif
);
if( module == NULL ) // no footprint found
{
module = Locate_Prefered_Module( GetBoard(),
CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
if( module )
{
// a footprint is found, but locked or on an other layer
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
}
module = NULL;
}
}
}
else if( GetCurItem()->Type() == TYPE_MODULE )
{
module = (MODULE*) GetCurItem();
// @todo: might need to add a layer check in if() below case HK_MOVE_ITEM: // Start move item
if( (GetCurItem()->m_Flags == 0) && module->IsLocked() ) OnHotkeyMoveItem( HK_MOVE_ITEM, aDC );
module = NULL; // do not move, rotate ... it.
}
if( module == NULL )
break; break;
/* I'd like to make sending to EESCHEMA edge triggered, but the case HK_ROTATE_ITEM: // Rotation
* simple mouse click on a module when the arrow icon is in play OnHotkeyRotateItem( HK_ROTATE_ITEM, aDC );
* does not set GetCurItem() at this time, nor does a mouse click
* when the local ratsnest icon is in play set GetCurItem(), and these
* actions also call SendMessageToEESCHEMA().
* if( GetCurItem() != module )
*/
{
// Send the module via socket to EESCHEMA's search facility.
SendMessageToEESCHEMA( module );
SetCurItem( module );
}
switch( HK_Descr->m_Idcommand )
{
case HK_ROTATE_FOOTPRINT: // Rotation
if( module->m_Flags == 0 ) // not currently in edit, prepare undo command
SaveCopyInUndoList( module, UR_ROTATED, module->m_Pos );
Rotate_Module( DC, module, 900, TRUE );
break; break;
case HK_FLIP_FOOTPRINT: // move to other side case HK_FLIP_FOOTPRINT: // move to other side
if( module->m_Flags == 0 ) // not currently in edit, prepare undo command OnHotkeyRotateItem( HK_FLIP_FOOTPRINT, aDC );
SaveCopyInUndoList( module, UR_FLIPPED, module->m_Pos );
Change_Side_Module( module, DC );
break;
case HK_DRAG_FOOTPRINT_OR_TRACK: // Start move (and drag) module
g_Drag_Pistes_On = TRUE;
// fall through
case HK_MOVE_FOOTPRINT_OR_TRACK: // Start move module
GetScreen()->m_Curseur = module->m_Pos;
DrawPanel->MouseToCursorSchema();
StartMove_Module( module, DC );
break; break;
} }
module->DisplayInfo( this );
break;
}
}
} }
/***********************************************************/ /***********************************************************/
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey, void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey,
EDA_BaseStruct* DrawStruct ) EDA_BaseStruct* DrawStruct )
/***********************************************************/ /***********************************************************/
...@@ -779,18 +665,18 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -779,18 +665,18 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
} }
/******************************************************************************/ /** Function OnHotkeyDeleteItem
bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) * Delete the item found under the mouse cursor
/******************************************************************************/
/* Delete the item foun under the mouse cursor
* Depending on the current active tool:: * Depending on the current active tool::
* Tool track * Tool track
* if a track is in progress: Delete the last segment * if a track is in progress: Delete the last segment
* else delete the entire track * else delete the entire track
* Tool module (footprint): * Tool module (footprint):
* Delete the module. * Delete the module.
* @param aDC = current device context
* @return true if an item was deleted
*/ */
bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC )
{ {
bool ItemFree = (GetCurItem() == NULL) || (GetCurItem()->m_Flags == 0); bool ItemFree = (GetCurItem() == NULL) || (GetCurItem()->m_Flags == 0);
...@@ -798,22 +684,22 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) ...@@ -798,22 +684,22 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
{ {
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
if( getActiveLayer() > LAYER_N_FRONT ) if( getActiveLayer() > LAYER_N_FRONT )
return FALSE; return false;
if( ItemFree ) if( ItemFree )
{ {
DrawStruct = PcbGeneralLocateAndDisplay(); BOARD_ITEM* DrawStruct = PcbGeneralLocateAndDisplay();
if( DrawStruct && DrawStruct->Type() != TYPE_TRACK ) if( DrawStruct && DrawStruct->Type() != TYPE_TRACK )
return FALSE; return false;
Delete_Track( DC, (TRACK*) DrawStruct ); Delete_Track( aDC, (TRACK*) DrawStruct );
} }
else if( GetCurItem()->Type() == TYPE_TRACK ) else if( GetCurItem()->Type() == TYPE_TRACK )
{ {
// simple lines for debugger: // simple lines for debugger:
TRACK* track = (TRACK*) GetCurItem(); TRACK* track = (TRACK*) GetCurItem();
track = Delete_Segment( DC, track ); track = Delete_Segment( aDC, track );
SetCurItem( track ); SetCurItem( track );
OnModify(); OnModify();
return TRUE; return true;
} }
break; break;
...@@ -823,20 +709,195 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) ...@@ -823,20 +709,195 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
MODULE* module = Locate_Prefered_Module( GetBoard(), MODULE* module = Locate_Prefered_Module( GetBoard(),
CURSEUR_ON_GRILLE ); CURSEUR_ON_GRILLE );
if( module == NULL ) if( module == NULL )
return FALSE; return false;
if( !IsOK( this, _( "Delete module?" ) ) ) if( !IsOK( this, _( "Delete module?" ) ) )
return FALSE; return false;
RemoveStruct( module, DC ); RemoveStruct( module, aDC );
} }
else else
return FALSE; return false;
break; break;
default: default:
return FALSE; return false;
} }
OnModify(); OnModify();
SetCurItem( NULL ); SetCurItem( NULL );
return TRUE; return true;
}
/** Function OnHotkeyMoveItem
* Moves or drag the item (footprint, track, text .. ) found under the mouse cursor
* Only a footprint or a track can be dragged
* @param aIdCommand = the hotkey command id
* @param aDC = current device context
* @return true if an item was moved
*/
bool WinEDA_PcbFrame::OnHotkeyMoveItem( int aIdCommand, wxDC* aDC )
{
bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->m_Flags);
if( itemCurrentlyEdited )
return false;
BOARD_ITEM* item = NULL;
if( m_ID_current_state == ID_COMPONENT_BUTT )
{
item = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE
| IGNORE_LOCKED | VISIBLE_ONLY
#if defined(USE_MATCH_LAYER)
| MATCH_LAYER
#endif
);
if( item == NULL ) // no footprint found
item = Locate_Prefered_Module( GetBoard(),
CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
}
if( item == NULL )
item = PcbGeneralLocateAndDisplay();
if( item == NULL )
return false;
SetCurItem( item );
switch( item->Type() )
{
case TYPE_TRACK:
case TYPE_VIA:
if( aIdCommand == HK_MOVE_ITEM )
{
Start_MoveOneNodeOrSegment( (TRACK*) item, aDC,
ID_POPUP_PCB_MOVE_TRACK_NODE );
return true;
}
if( aIdCommand == HK_DRAG_FOOTPRINT_OR_TRACK )
{
//Start_DragTrackSegmentAndKeepSlope( (TRACK*) DrawStruct, aDC );
Start_MoveOneNodeOrSegment( (TRACK*) item, aDC,
ID_POPUP_PCB_DRAG_TRACK_SEGMENT );
return true;
}
break;
case TYPE_MODULE:
{
MODULE* module = (MODULE*) item;
// a footprint is found, but locked or on an other layer
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
// Send the module via socket to EESCHEMA's search facility.
SendMessageToEESCHEMA( module );
// Start move module
GetScreen()->m_Curseur = module->m_Pos;
DrawPanel->MouseToCursorSchema();
if( aIdCommand == HK_DRAG_FOOTPRINT_OR_TRACK )
g_Drag_Pistes_On = true;
StartMove_Module( module, aDC );
}
return true;
default:
break;
}
return false;
}
/** Function OnHotkeyRotateItem
* Rotate the item (text or footprint) found under the mouse cursor
* @param aIdCommand = the hotkey command id
* @param aDC = current device context
* @return true if an item was moved
*/
bool WinEDA_PcbFrame::OnHotkeyRotateItem( int aIdCommand, wxDC* aDC )
{
bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->m_Flags);
MODULE* module = NULL;
if( !itemCurrentlyEdited )
{
module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE
| IGNORE_LOCKED | VISIBLE_ONLY
#if defined(USE_MATCH_LAYER)
| MATCH_LAYER
#endif
);
if( module == NULL ) // no footprint found
{
module = Locate_Prefered_Module( GetBoard(),
CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
if( module )
{
// a footprint is found, but locked or on an other layer
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
}
module = NULL;
}
}
}
else if( GetCurItem()->Type() == TYPE_MODULE )
{
module = (MODULE*) GetCurItem();
// @todo: might need to add a layer check in if() below
if( (GetCurItem()->m_Flags == 0) && module->IsLocked() )
module = NULL; // do not move, rotate ... it.
}
if( module == NULL )
return false;
/* I'd like to make sending to EESCHEMA edge triggered, but the
* simple mouse click on a module when the arrow icon is in play
* does not set GetCurItem() at this time, nor does a mouse click
* when the local ratsnest icon is in play set GetCurItem(), and these
* actions also call SendMessageToEESCHEMA().
* if( GetCurItem() != module )
*/
{
// Send the module via socket to EESCHEMA's search facility.
SendMessageToEESCHEMA( module );
SetCurItem( module );
}
switch( aIdCommand )
{
case HK_ROTATE_ITEM: // Rotation
if( module->m_Flags == 0 ) // not currently in edit, prepare undo command
SaveCopyInUndoList( module, UR_ROTATED, module->m_Pos );
Rotate_Module( aDC, module, 900, true );
break;
case HK_FLIP_FOOTPRINT: // move to other side
if( module->m_Flags == 0 ) // not currently in edit, prepare undo command
SaveCopyInUndoList( module, UR_FLIPPED, module->m_Pos );
Change_Side_Module( module, aDC );
break;
}
module->DisplayInfo( this );
return true;
} }
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
enum hotkey_id_commnand { enum hotkey_id_commnand {
HK_DELETE = HK_COMMON_END, HK_DELETE = HK_COMMON_END,
HK_BACK_SPACE, HK_BACK_SPACE,
HK_ROTATE_FOOTPRINT, HK_ROTATE_ITEM,
HK_MOVE_FOOTPRINT_OR_TRACK, HK_MOVE_ITEM,
HK_DRAG_FOOTPRINT_OR_TRACK, HK_DRAG_FOOTPRINT_OR_TRACK,
HK_FLIP_FOOTPRINT, HK_FLIP_FOOTPRINT,
HK_GET_AND_MOVE_FOOTPRINT, HK_GET_AND_MOVE_FOOTPRINT,
...@@ -48,7 +48,6 @@ enum hotkey_id_commnand { ...@@ -48,7 +48,6 @@ enum hotkey_id_commnand {
HK_SWITCH_LAYER_TO_INNER13, HK_SWITCH_LAYER_TO_INNER13,
HK_SWITCH_LAYER_TO_INNER14, HK_SWITCH_LAYER_TO_INNER14,
HK_ADD_MODULE, HK_ADD_MODULE,
HK_MOVE_TRACK,
HK_SLIDE_TRACK HK_SLIDE_TRACK
}; };
......
...@@ -169,8 +169,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -169,8 +169,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
} }
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _( "Move Drawing" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST,
_( "Move Drawing" ), move_xpm ); msg, move_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING, _( "Edit Drawing" ), edit_xpm ); ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING, _( "Edit Drawing" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING, _( ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING, _(
"Delete Drawing" ), delete_xpm ); "Delete Drawing" ), delete_xpm );
...@@ -225,8 +226,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -225,8 +226,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case TYPE_MIRE: case TYPE_MIRE:
if( !flags ) if( !flags )
{ {
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST, msg = AddHotkeyName( _( "Move Target" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
_( "Move Target" ), move_xpm ); ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST, msg, move_xpm );
msg = AddHotkeyName( _( "Edit Target" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); msg = AddHotkeyName( _( "Edit Target" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_MIRE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_MIRE,
msg, edit_xpm ); msg, edit_xpm );
...@@ -601,8 +602,9 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu ...@@ -601,8 +602,9 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
_( "Remove Filled Areas in Zone" ), fill_zone_xpm ); _( "Remove Filled Areas in Zone" ), fill_zone_xpm );
} }
msg = AddHotkeyName( _( "Move Zone" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_OUTLINES, ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_OUTLINES,
_( "Move Zone" ), move_xpm ); msg, move_xpm );
msg = AddHotkeyName( _( "Edit Zone Params" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); msg = AddHotkeyName( _( "Edit Zone Params" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_EDIT_ZONE_PARAMS, ADD_MENUITEM( zones_menu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
...@@ -636,14 +638,14 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men ...@@ -636,14 +638,14 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm );
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_FOOTPRINT_OR_TRACK ); msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
msg, move_module_xpm ); msg, move_module_xpm );
msg = AddHotkeyName( _( "Drag" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_FOOTPRINT_OR_TRACK ); msg = AddHotkeyName( _( "Drag" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_FOOTPRINT_OR_TRACK );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST,
msg, drag_module_xpm ); msg, drag_module_xpm );
} }
msg = AddHotkeyName( _( "Rotate +" ), s_Board_Editor_Hokeys_Descr, HK_ROTATE_FOOTPRINT ); msg = AddHotkeyName( _( "Rotate +" ), s_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE,
msg, rotate_module_pos_xpm ); msg, rotate_module_pos_xpm );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE,
...@@ -681,8 +683,11 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m ...@@ -681,8 +683,11 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Fp_text, -1, msg, footprint_text_xpm ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Fp_text, -1, msg, footprint_text_xpm );
if( !flags ) if( !flags )
{
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST,
_( "Move" ), move_field_xpm ); msg, move_field_xpm );
}
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE, ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE,
_( "Rotate" ), rotate_field_xpm ); _( "Rotate" ), rotate_field_xpm );
...@@ -734,8 +739,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) ...@@ -734,8 +739,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
sub_menu_Pad = new wxMenu; sub_menu_Pad = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm );
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST,
_( "Move" ), move_pad_xpm ); msg, move_pad_xpm );
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST,
_( "Drag" ), drag_pad_xpm ); _( "Drag" ), drag_pad_xpm );
...@@ -791,8 +797,9 @@ void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) ...@@ -791,8 +797,9 @@ void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM );
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST, ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST,
_( "Move" ), move_text_xpm ); msg, move_text_xpm );
} }
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB,
_( "Rotate" ), rotate_pos_xpm ); _( "Rotate" ), rotate_pos_xpm );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment