Eeschema: Add hotkeys. Minor code cleaning

This commit is contained in:
jean-pierre charras 2010-11-11 18:54:24 +01:00
commit 32394e056a
9 changed files with 206 additions and 84 deletions

View File

@ -124,7 +124,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
} }
newsegment->m_Flags = IS_NEW; newsegment->m_Flags = IS_NEW;
if( g_HVLines ) // We need 2 segments to go from a given start pint to if( g_HVLines ) // We need 2 segments to go from a given start pin to
// an end point // an end point
{ {
nextsegment = newsegment->GenCopy(); nextsegment = newsegment->GenCopy();

View File

@ -49,7 +49,7 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC )
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
/* Drawing of the bus entry segment" while moving the cursor. */ // Draws the bus entry while moving the cursor
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) screen->GetCurItem(); SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) screen->GetCurItem();
@ -69,21 +69,12 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
SCH_BUS_ENTRY* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC, SCH_BUS_ENTRY* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC,
int entry_type ) int entry_type )
{ {
/* Create a new bus entry, and prepare moving function (for later place it) // Create and place a new bus entry at cursor position
*/
SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur, SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur,
s_LastShape, s_LastShape, entry_type );
entry_type );
BusEntry->m_Flags = IS_NEW; BusEntry->m_Flags = IS_NEW;
BusEntry->Place( this, DC );;
DrawPanel->CursorOff( DC ); // Erase schematic cursor
RedrawOneStruct( DrawPanel, DC, BusEntry, g_XorMode );
DrawPanel->CursorOn( DC ); // Display schematic cursor
OnModify( ); OnModify( );
StartMoveBusEntry( BusEntry, DC );
return BusEntry; return BusEntry;
} }

View File

@ -443,13 +443,8 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
// Enable these line to draw the bounding box (debug tests purposes only) // Enable these line to draw the bounding box (debug tests purposes only)
#if 0 #if 0
{ {
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox = GetBoundingBox();
BoundaryBox = GetBoundingBox(); GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN );
int x1 = BoundaryBox.GetX();
int y1 = BoundaryBox.GetY();
int x2 = BoundaryBox.GetRight();
int y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
} }
#endif #endif
} }
@ -1028,7 +1023,7 @@ void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position )
{ {
/* The global label is NOT really mirrored. /* The global label is NOT really mirrored.
* for an horizontal label, the schematic orientation is changed. * for an horizontal label, the schematic orientation is changed.
* for a vericalal label, the schematic orientation is not changed. * for a vertical label, the schematic orientation is not changed.
* and the label is moved to a suitable position * and the label is moved to a suitable position
*/ */
switch( GetSchematicTextOrientation() ) switch( GetSchematicTextOrientation() )
@ -1210,13 +1205,8 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel,
// Enable these line to draw the bounding box (debug tests purposes only) // Enable these line to draw the bounding box (debug tests purposes only)
#if 0 #if 0
{ {
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox = GetBoundingBox();
BoundaryBox = GetBoundingBox(); GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN );
int x1 = BoundaryBox.GetX();
int y1 = BoundaryBox.GetY();
int x2 = BoundaryBox.GetRight();
int y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
} }
#endif #endif
} }
@ -1555,13 +1545,8 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel,
// Enable these line to draw the bounding box (debug tests purposes only) // Enable these line to draw the bounding box (debug tests purposes only)
#if 0 #if 0
{ {
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox = GetBoundingBox();
BoundaryBox = GetBoundingBox(); GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN );
int x1 = BoundaryBox.GetX();
int y1 = BoundaryBox.GetY();
int x2 = BoundaryBox.GetRight();
int y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
} }
#endif #endif
} }

View File

@ -103,16 +103,21 @@ static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL +
// Schematic editor // Schematic editor
static Ki_HotkeyInfo HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' ); static Ki_HotkeyInfo HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' );
static Ki_HotkeyInfo HkAddHierarchicalLabel( wxT( "add Hierarchical Label" ), HK_ADD_HLABEL, 'H' );
static Ki_HotkeyInfo HkAddGlobalLabel( wxT( "add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'L' );
static Ki_HotkeyInfo HkAddJunction( wxT( "add Junction" ), HK_ADD_JUNCTION, 'J' ); static Ki_HotkeyInfo HkAddJunction( wxT( "add Junction" ), HK_ADD_JUNCTION, 'J' );
static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' ); static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), static Ki_HotkeyInfo HkBeginBus( wxT( "begin Bus" ), HK_BEGIN_BUS, 'B' );
HK_ADD_NEW_COMPONENT, 'A' ); static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' );
static Ki_HotkeyInfo HkAddNoConn( wxT( "Add NoConnected Flag" ), static Ki_HotkeyInfo HkAddPower( wxT( "Add Power" ), HK_ADD_NEW_POWER, 'P' );
HK_ADD_NOCONN_FLAG, 'Q' ); static Ki_HotkeyInfo HkAddNoConn( wxT( "Add NoConnected Flag" ), HK_ADD_NOCONN_FLAG, 'Q' );
static Ki_HotkeyInfo HkMirrorYComponent( wxT( "Mirror Y Component" ), static Ki_HotkeyInfo HkAddHierSheet( wxT( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S' );
HK_MIRROR_Y_COMPONENT, 'Y' ); static Ki_HotkeyInfo HkAddBusEntry( wxT( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/' );
static Ki_HotkeyInfo HkMirrorXComponent( wxT( "Mirror X Component" ), static Ki_HotkeyInfo HkAddWireEntry( wxT( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z' );
HK_MIRROR_X_COMPONENT, 'X' ); static Ki_HotkeyInfo HkAddGraphicPolyLine( wxT( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I' );
static Ki_HotkeyInfo HkAddGraphicText( wxT( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T' );
static Ki_HotkeyInfo HkMirrorYComponent( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y' );
static Ki_HotkeyInfo HkMirrorXComponent( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X' );
static Ki_HotkeyInfo HkOrientNormalComponent( wxT( "Orient Normal Component" ), static Ki_HotkeyInfo HkOrientNormalComponent( wxT( "Orient Normal Component" ),
HK_ORIENT_NORMAL_COMPONENT, 'N' ); HK_ORIENT_NORMAL_COMPONENT, 'N' );
static Ki_HotkeyInfo HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R' ); static Ki_HotkeyInfo HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R' );
@ -175,6 +180,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] =
&HkCopyComponentOrText, &HkCopyComponentOrText,
&HkDrag, &HkDrag,
&HkAddComponent, &HkAddComponent,
&HkAddPower,
&HkRotate, &HkRotate,
&HkMirrorXComponent, &HkMirrorXComponent,
&HkMirrorYComponent, &HkMirrorYComponent,
@ -183,9 +189,17 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] =
&HkEditComponentValue, &HkEditComponentValue,
&HkEditComponentFootprint, &HkEditComponentFootprint,
&HkBeginWire, &HkBeginWire,
&HkBeginBus,
&HkAddLabel, &HkAddLabel,
&HkAddHierarchicalLabel,
&HkAddGlobalLabel,
&HkAddJunction, &HkAddJunction,
&HkAddNoConn, &HkAddNoConn,
&HkAddHierSheet,
&HkAddWireEntry,
&HkAddBusEntry,
&HkAddGraphicPolyLine,
&HkAddGraphicText,
NULL NULL
}; };
@ -382,6 +396,16 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
} }
break; break;
case HK_ADD_NEW_POWER: // Add power component
if( !itemInEdit )
{
// 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 );
}
break;
case HK_ADD_LABEL: case HK_ADD_LABEL:
if( notBusy ) if( notBusy )
{ {
@ -392,6 +416,26 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
} }
break; break;
case HK_ADD_HLABEL:
if( notBusy )
{
// 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 );
}
break;
case HK_ADD_GLABEL:
if( notBusy )
{
// 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 );
}
break;
case HK_ADD_JUNCTION: case HK_ADD_JUNCTION:
if( notBusy ) if( notBusy )
{ {
@ -402,27 +446,100 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
} }
break; break;
case HK_BEGIN_WIRE: case HK_ADD_WIRE_ENTRY:
// An item is selected. If not a wire, a new command is not possible
if( notBusy ) if( notBusy )
{ {
if( DrawStruct && DrawStruct->m_Flags ) // 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 );
}
break;
case HK_ADD_BUS_ENTRY:
if( notBusy )
{
// 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 );
}
break;
case HK_ADD_HIER_SHEET:
if( notBusy )
{
// 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 );
}
break;
case HK_ADD_GRAPHIC_TEXT:
if( notBusy )
{
// 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 );
}
break;
case HK_ADD_GRAPHIC_POLYLINE:
if( notBusy )
{
// 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 );
}
break;
case HK_BEGIN_BUS:
// An item can be selected. If not a Bus, a begin command is not possible
if( notBusy )
{
// 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 );
break;
}
if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_BUS_BUTT ) )
{
if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{
SCH_LINE* segment = (SCH_LINE*) DrawStruct;
if( segment->GetLayer() != LAYER_BUS )
break;
// Bus in progress:
OnLeftClick( DC, MousePos );
}
}
break;
case HK_BEGIN_WIRE:
// An item can be selected. If not a wire, a begin command is not possible
if( notBusy )
{
// 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 );
break;
}
if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_WIRE_BUTT ) )
{ {
if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
SCH_LINE* segment = (SCH_LINE*) DrawStruct; SCH_LINE* segment = (SCH_LINE*) DrawStruct;
if( segment->GetLayer() != LAYER_WIRE ) if( segment->GetLayer() != LAYER_WIRE )
break; break;
} // Wire in progress:
else
break;
}
// 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( DC, MousePos );
} }
}
break; break;
case HK_ADD_NOCONN_FLAG: // Add a no connected flag case HK_ADD_NOCONN_FLAG: // Add a no connected flag

View File

@ -30,9 +30,18 @@ enum hotkey_id_commnand {
HK_COPY_COMPONENT_OR_LABEL, HK_COPY_COMPONENT_OR_LABEL,
HK_DRAG, HK_DRAG,
HK_ADD_NEW_COMPONENT, HK_ADD_NEW_COMPONENT,
HK_ADD_NEW_POWER,
HK_BEGIN_WIRE, HK_BEGIN_WIRE,
HK_BEGIN_BUS,
HK_ADD_WIRE_ENTRY,
HK_ADD_BUS_ENTRY,
HK_ADD_LABEL, HK_ADD_LABEL,
HK_ADD_HLABEL,
HK_ADD_GLABEL,
HK_ADD_JUNCTION, HK_ADD_JUNCTION,
HK_ADD_HIER_SHEET,
HK_ADD_GRAPHIC_TEXT,
HK_ADD_GRAPHIC_POLYLINE,
HK_ADD_NOCONN_FLAG HK_ADD_NOCONN_FLAG
}; };

View File

@ -249,7 +249,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
/* Component */ /* Component */
text = AddHotkeyName( _( "&Component" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text, item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text,
HELP_PLACE_COMPONENTS, wxITEM_NORMAL ); HELP_PLACE_COMPONENTS, wxITEM_NORMAL );
@ -257,13 +257,15 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
placeMenu->Append( item ); placeMenu->Append( item );
/* Power port */ /* Power port */
item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, _( "&Power port" ), text = AddHotkeyName( _( "Power port" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_POWER, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text,
HELP_PLACE_POWERPORT, wxITEM_NORMAL ); HELP_PLACE_POWERPORT, wxITEM_NORMAL );
item->SetBitmap( add_power_xpm ); item->SetBitmap( add_power_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Wire */ /* Wire */
text = AddHotkeyName( _( "&Wire" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Wire" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_WIRE, false ); // add comment, not a shortcut HK_BEGIN_WIRE, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, text, item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, text,
HELP_PLACE_WIRE, wxITEM_NORMAL ); HELP_PLACE_WIRE, wxITEM_NORMAL );
@ -271,19 +273,25 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
placeMenu->Append( item ); placeMenu->Append( item );
/* Bus */ /* Bus */
item = new wxMenuItem( placeMenu, ID_BUS_BUTT, _( "&Bus" ), text = AddHotkeyName( _( "Bus" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_BUS, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_BUS_BUTT, text,
HELP_PLACE_BUS, wxITEM_NORMAL ); HELP_PLACE_BUS, wxITEM_NORMAL );
item->SetBitmap( add_bus_xpm ); item->SetBitmap( add_bus_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Wire to Bus */ /* Wire to Bus entry */
item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, _( "W&ire to bus entry" ), text = AddHotkeyName( _( "Wire to bus entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_WIRE_ENTRY, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_NORMAL ); HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_NORMAL );
item->SetBitmap( add_line2bus_xpm ); item->SetBitmap( add_line2bus_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Bus to Bus */ /* Bus to Bus entry */
item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, _( "B&us to bus entry" ), text = AddHotkeyName( _( "Bus to bus entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_BUS_ENTRY, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
HELP_PLACE_BUS2BUS_ENTRY, wxITEM_NORMAL ); HELP_PLACE_BUS2BUS_ENTRY, wxITEM_NORMAL );
item->SetBitmap( add_bus2bus_xpm ); item->SetBitmap( add_bus2bus_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
@ -304,7 +312,9 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
placeMenu->Append( item ); placeMenu->Append( item );
/* Global label */ /* Global label */
item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, _( "Global label" ), text = AddHotkeyName( _( "Global label" ), s_Schematic_Hokeys_Descr,
HK_ADD_GLABEL, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, text,
HELP_PLACE_GLOBALLABEL, wxITEM_NORMAL ); HELP_PLACE_GLOBALLABEL, wxITEM_NORMAL );
item->SetBitmap( add_glabel_xpm ); item->SetBitmap( add_glabel_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
@ -321,13 +331,17 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
/* Hierarchical label */ /* Hierarchical label */
item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT, _( "Hierarchical label" ), text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr,
HK_ADD_HLABEL, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT, text,
HELP_PLACE_HIER_LABEL, wxITEM_NORMAL ); HELP_PLACE_HIER_LABEL, wxITEM_NORMAL );
item->SetBitmap( add_hierarchical_label_xpm ); item->SetBitmap( add_hierarchical_label_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Hierarchical sheet */ /* Hierarchical sheet */
item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, _( "Hierarchical sheet" ), text = AddHotkeyName( _( "Hierarchical sheet" ), s_Schematic_Hokeys_Descr,
HK_ADD_HIER_SHEET, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text,
HELP_PLACE_SHEET, wxITEM_NORMAL ); HELP_PLACE_SHEET, wxITEM_NORMAL );
item->SetBitmap( add_hierarchical_subsheet_xpm ); item->SetBitmap( add_hierarchical_subsheet_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
@ -348,13 +362,17 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
/* Graphic line or polygon */ /* Graphic line or polygon */
item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, _( "Graphic line or polygon" ), text = AddHotkeyName( _( "Graphic polyline" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_POLYLINE, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICLINES, wxITEM_NORMAL ); HELP_PLACE_GRAPHICLINES, wxITEM_NORMAL );
item->SetBitmap( add_dashed_line_xpm ); item->SetBitmap( add_dashed_line_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Graphic text */ /* Graphic text */
item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, _( "Graphic text" ), text = AddHotkeyName( _( "Graphic text" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_TEXT, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICTEXTS, wxITEM_NORMAL ); HELP_PLACE_GRAPHICTEXTS, wxITEM_NORMAL );
item->SetBitmap( add_text_xpm ); item->SetBitmap( add_text_xpm );
placeMenu->Append( item ); placeMenu->Append( item );

View File

@ -533,13 +533,13 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, WinEDA_SchematicFrame* fr
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm ); msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm );
msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL ); msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm );
// Add global label command only if the cursor is over one end of the wire. // Add global label command only if the cursor is over one end of the wire.
if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y) if( ( pos == Wire->m_Start ) || ( pos == Wire->m_End ) )
|| ( pos.x == Wire->m_End.x && pos.y == Wire->m_End.y ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm );
} }
@ -548,24 +548,26 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, WinEDA_SchematicFrame* fram
{ {
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
wxPoint pos = frame->GetScreen()->m_Curseur; wxPoint pos = frame->GetScreen()->m_Curseur;
wxString msg;
if( is_new ) if( is_new )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm );
return; return;
} }
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Bus" ), delete_bus_xpm ); msg = AddHotkeyName( _( "Delete Bus" ), s_Schematic_Hokeys_Descr, HK_DELETE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_bus_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), break_bus_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), break_bus_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm ); msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ), add_line_label_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm );
msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm );
// Add global label command only if the cursor is over one end of the bus. // Add global label command only if the cursor is over one end of the bus.
if( ( pos.x == Bus->m_Start.x && pos.y == Bus->m_Start.y) if( ( pos == Bus->m_Start ) || ( pos == Bus->m_End ) )
|| ( pos.x == Bus->m_End.x && pos.y == Bus->m_End.y ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm );
} }
@ -593,7 +595,6 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
else else
{ {
msg = AddHotkeyName( _( "Edit Sheet" ), s_Schematic_Hokeys_Descr, HK_EDIT ); msg = AddHotkeyName( _( "Edit Sheet" ), s_Schematic_Hokeys_Descr, HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg, edit_sheet_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg, edit_sheet_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ), ADD_MENUITEM( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ),
@ -606,7 +607,8 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup PinSheets" ), ADD_MENUITEM( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup PinSheets" ),
options_pinsheet_xpm ); options_pinsheet_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet" ), delete_sheet_xpm ); msg = AddHotkeyName( _( "Delete Sheet" ), s_Schematic_Hokeys_Descr, HK_DELETE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_sheet_xpm );
} }
} }

View File

@ -192,7 +192,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_LINE_COMMENT_BUTT: case ID_LINE_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Drawing" ) ); SetToolID( id, wxCURSOR_PENCIL, _( "Add Lines" ) );
break; break;
case ID_JUNCTION_BUTT: case ID_JUNCTION_BUTT:
@ -208,7 +208,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_HIERLABEL_BUTT: case ID_HIERLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchal label" ) ); SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchical label" ) );
break; break;
case ID_TEXT_COMMENT_BUTT: case ID_TEXT_COMMENT_BUTT:

View File

@ -193,7 +193,7 @@ void GRFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1,
void GRFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, void GRFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1,
int x2, int y2, int width, int Color, int BgColor ); int x2, int y2, int width, int Color, int BgColor );
void GRRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int Color ); void GRRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int Color );
void GRRect( EDA_Rect* ClipBox, wxDC* DC,const EDA_Rect& aRect, int Color ); void GRRect( EDA_Rect* ClipBox, wxDC* DC,const EDA_Rect& aRect, int aWidth, int Color );
void GRRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, void GRRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1,
int x2, int y2, int width, int Color ); int x2, int y2, int width, int Color );
void GRRectPs( EDA_Rect* aClipBox, wxDC* aDC,const EDA_Rect& aRect, void GRRectPs( EDA_Rect* aClipBox, wxDC* aDC,const EDA_Rect& aRect,