Commit f743b988 authored by jean-pierre charras's avatar jean-pierre charras

Try to fix Bug #1431391 (Unable to edit pins in Schematic library editor). It...

Try to fix Bug #1431391 (Unable to edit pins in Schematic library editor). It happens on XFCE, but also on Unity. This fix works on Unity. (it is due to the fact the dialog is not raised, for an unknown reason, and this bug depend on the way Eeschema and Libedit are run).
Add Ctrl+E hotkey in eeschema to edit a component with Libedit (similar to pcbnew Ctrl+E hotkey)
As usual, fix a few minor coverity warnings
parent adf2fc83
......@@ -35,10 +35,10 @@
#include <class_layer_box_selector.h>
LAYER_SELECTOR::LAYER_SELECTOR() :
m_layerhotkeys( true ),
m_hotkeys( NULL )
LAYER_SELECTOR::LAYER_SELECTOR()
{
m_layerhotkeys = true;
m_hotkeys = NULL;
}
......@@ -79,6 +79,8 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
LAYER_SELECTOR()
{
m_hotkeys = NULL;
if( choices != NULL )
ResyncBitmapOnly();
}
......@@ -90,6 +92,8 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ),
LAYER_SELECTOR()
{
m_hotkeys = NULL;
if( !choices.IsEmpty() )
ResyncBitmapOnly();
}
......
......@@ -276,7 +276,15 @@ public:
* @param aIsOwner true if the instance is the owner of item list
* (default = false)
*/
NETLIST_OBJECT_LIST( bool aIsOwner = false ) { m_isOwner = aIsOwner; }
NETLIST_OBJECT_LIST( bool aIsOwner = false )
{
m_isOwner = aIsOwner;
// Do not leave some members uninitialized:
m_lastNetCode = 0;
m_lastBusNetCode = 0;
}
~NETLIST_OBJECT_LIST();
void SetOwner( bool aIsOwner ) { m_isOwner = aIsOwner; }
......
......@@ -49,6 +49,11 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( EDA_DRAW_FRAME* parent, LIB_PIN* aPin
// Set tab order
m_textPadName->MoveAfterInTabOrder(m_textPinName);
m_sdbSizerButtonsOK->SetDefault();
GetSizer()->SetSizeHints( this );
Raise(); // On Unity, ans some other windows manager,
// this dialog is not always shown,
// depending on this dialog is run. Force it to be shown
}
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -103,7 +103,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
bLeftSizer->Add( boarderSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 12 );
bUpperSizer->Add( bLeftSizer, 2, wxEXPAND, 5 );
bUpperSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
......@@ -179,7 +179,6 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
......@@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
......@@ -42,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_LIB_EDIT_PIN_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">515,370</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Pin Properties</property>
......@@ -103,7 +105,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">2</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bLeftSizer</property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -95,7 +95,7 @@ class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
public:
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 515,370 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_EDIT_PIN_BASE();
};
......
......@@ -179,6 +179,10 @@ static EDA_HOTKEY HkEditComponentReference( wxT( "Edit Component Reference" ),
static EDA_HOTKEY HkEditComponentFootprint( wxT( "Edit Component Footprint" ),
HK_EDIT_COMPONENT_FOOTPRINT, 'F',
ID_SCH_EDIT_COMPONENT_FOOTPRINT );
static EDA_HOTKEY HkEditComponentWithLibedit( wxT( "Edit with Component Editor" ),
HK_EDIT_COMPONENT_WITH_LIBEDIT,
'E' + GR_KB_CTRL,
ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP );
static EDA_HOTKEY HkMove( wxT( "Move Schematic Item" ),
HK_MOVE_COMPONENT_OR_ITEM, 'M',
ID_SCH_MOVE_ITEM );
......@@ -270,6 +274,7 @@ static EDA_HOTKEY* schematic_Hotkey_List[] =
&HkEditComponentValue,
&HkEditComponentReference,
&HkEditComponentFootprint,
&HkEditComponentWithLibedit,
&HkBeginWire,
&HkBeginBus,
&HkEndLineWireBus,
......@@ -545,6 +550,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_MIRROR_X_COMPONENT: // Mirror X
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
case HK_ROTATE: // Rotate schematic item.
case HK_EDIT_COMPONENT_WITH_LIBEDIT: // Call Libedit and load the current component
{
// force a new item search on hot keys at current position,
// if there is no currently edited item,
......
......@@ -50,6 +50,7 @@ enum hotkey_id_commnand {
HK_EDIT_COMPONENT_VALUE,
HK_EDIT_COMPONENT_REFERENCE,
HK_EDIT_COMPONENT_FOOTPRINT,
HK_EDIT_COMPONENT_WITH_LIBEDIT,
HK_MIRROR_X_COMPONENT,
HK_MIRROR_Y_COMPONENT,
HK_ORIENT_NORMAL_COMPONENT,
......
......@@ -441,7 +441,6 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet()
candidate = NULL;
for( unsigned ii = 0; ii <= size(); ii++ )
{
if( ii == size() ) // last item already found
netcode = -2;
else
......
......@@ -461,9 +461,10 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_L
if( !Component->GetFlags() )
{
msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_WITH_LIBEDIT );
AddMenuItem( editmenu, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
_( "Edit with Library Editor" ),
KiBitmap( libedit_xpm ) );
msg, KiBitmap( libedit_xpm ) );
}
AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
......
......@@ -999,8 +999,30 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
if( event.GetId() == ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP )
{
// We want to edit a component with Libedit.
// we are here by a hot key, or by a popup menu
SCH_ITEM* item = GetScreen()->GetCurItem();
if( !item )
{
// If we didn't get here by a hot key, then something has gone wrong.
if( event.GetInt() == 0 )
return;
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) event.GetClientObject();
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
// Set the locat filter, according to the edit command
const KICAD_T* filterList = SCH_COLLECTOR::ComponentsOnly;
item = LocateAndShowItem( data->GetPosition(), filterList, event.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
return;
}
if( !item || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
{
wxMessageBox( _( "Error: not a component or no component" ) );
......
......@@ -74,6 +74,7 @@ public:
COLLECTOR()
{
m_ScanTypes = 0;
m_TimeAtCollection = 0;
}
virtual ~COLLECTOR() {}
......
......@@ -80,7 +80,8 @@ void PCB_ARC::Parse( XNODE* aNode,
&m_positionX, &m_positionY, aActualConversion );
// start point
lNode = lNode->GetNext();
if( lNode )
lNode = lNode->GetNext();
if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
......
......@@ -72,7 +72,8 @@ void PCB_LINE::Parse( XNODE* aNode,
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
&m_positionX, &m_positionY, aActualConversion );
lNode = lNode->GetNext();
if( lNode )
lNode = lNode->GetNext();
if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
......
......@@ -1345,6 +1345,8 @@ public:
TOKPROP( ELEM* aParent, DSN_T aType ) :
ELEM( aType, aParent )
{
// Do not leave uninitialized members
value = T_NONE;
}
void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR )
......
......@@ -43,6 +43,7 @@
GRID_HELPER::GRID_HELPER( PCB_BASE_FRAME* aFrame ) :
m_frame( aFrame )
{
m_diagonalAuxAxesEnable = true;
}
......
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