Browse Source

Add '*' to modified files in libedit cmptree, and change highlighting.

The highlight colour on some platforms (OSX, for instance)
renders nearly invisible against a white background.  However,
wxWidgets doesn't handle background colours on OSX and GTK+.
A separate commit to the new kicad/wxWidgets fork fixes OSX,
and we continue to use the old highlighting on GTK+

Fixes: lp:1741719
* https://bugs.launchpad.net/kicad/+bug/1741719
pull/5/merge
Jeff Young 8 years ago
committed by Maciej Suminski
parent
commit
2201482e47
  1. 3
      eeschema/controle.cpp
  2. 53
      eeschema/lib_manager_adapter.cpp
  3. 2
      eeschema/lib_manager_adapter.h
  4. 6
      eeschema/libeditframe.cpp
  5. 1
      eeschema/libeditframe.h
  6. 3
      eeschema/widgets/cmp_tree_pane.cpp

3
eeschema/controle.cpp

@ -308,6 +308,9 @@ bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KE
keyHandled = true;
}
// Make sure current-part highlighting doesn't get lost in seleciton highlighting
ClearSearchTreeSelection();
UpdateStatusBar();
return keyHandled;

53
eeschema/lib_manager_adapter.cpp

@ -181,6 +181,39 @@ CMP_TREE_NODE* LIB_MANAGER_ADAPTER::findLibrary( const wxString& aLibNickName )
}
void LIB_MANAGER_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
unsigned int aCol ) const
{
auto node = ToNode( aItem );
wxASSERT( node );
switch( aCol )
{
case 0:
aVariant = node->Name;
// mark modified libs with an asterix
if( node->Type == CMP_TREE_NODE::LIB && m_libMgr->IsLibraryModified( node->Name ) )
aVariant = node->Name + " *";
// mark modified parts with an asterix
if( node->Type == CMP_TREE_NODE::LIBID
&& m_libMgr->IsPartModified( node->Name, node->Parent->Name ) )
aVariant = node->Name + " *";
break;
case 1:
aVariant = node->Desc;
break;
default: // column == -1 is used for default Compare function
aVariant = node->Name;
break;
}
}
bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCol,
wxDataViewItemAttr& aAttr ) const
{
@ -197,10 +230,16 @@ bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCo
// mark modified libs with bold font
aAttr.SetBold( m_libMgr->IsLibraryModified( node->Name ) );
// mark the current library with inverted colors
#ifdef __WXGTK__
// The native wxGTK+ impl ignores background colour, so set the text colour instead.
// This works reasonably well in dark themes, and quite poorly in light ones....
if( node->Name == m_libMgr->GetCurrentLib() )
aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#else
// mark the current library with background color
if( node->Name == m_libMgr->GetCurrentLib() )
aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#endif
break;
case CMP_TREE_NODE::LIBID:
@ -210,10 +249,16 @@ bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCo
// mark aliases with italic font
aAttr.SetItalic( !node->IsRoot );
// mark the current part with inverted colors
#ifdef __WXGTK__
// The native wxGTK+ impl ignores background colour, so set the text colour instead.
// This works reasonably well in dark themes, and quite poorly in light ones....
if( node->LibId == m_libMgr->GetCurrentLibId() )
aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#else
// mark the current part with background color
if( node->LibId == m_libMgr->GetCurrentLibId() )
aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#endif
break;
default:

2
eeschema/lib_manager_adapter.h

@ -54,6 +54,8 @@ protected:
CMP_TREE_NODE* findLibrary( const wxString& aLibNickName );
void GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
unsigned int aCol ) const override;
bool GetAttr( wxDataViewItem const& aItem, unsigned int aCol,
wxDataViewItemAttr& aAttr ) const override;

6
eeschema/libeditframe.cpp

@ -492,6 +492,12 @@ bool LIB_EDIT_FRAME::IsSearchTreeShown()
}
void LIB_EDIT_FRAME::ClearSearchTreeSelection()
{
m_treePane->GetCmpTree()->Unselect();
}
void LIB_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
{
aEvent.Check( GetToolId() == aEvent.GetId() );

1
eeschema/libeditframe.h

@ -316,6 +316,7 @@ public:
void OnEditSymbolLibTable( wxCommandEvent& aEvent ) override;
bool IsSearchTreeShown();
void ClearSearchTreeSelection();
void OnEditComponentProperties( wxCommandEvent& event );
void InstallFieldsEditorDialog( wxCommandEvent& event );

3
eeschema/widgets/cmp_tree_pane.cpp

@ -126,4 +126,7 @@ void CMP_TREE_PANE::onComponentSelected( wxCommandEvent& aEvent )
//wxPostEvent( libEditFrame, evt );
//wxQueueEvent( m_libEditFrame, new wxCommandEvent( ID_LIBEDIT_EDIT_PART ) );
m_libEditFrame->OnEditPart( evt );
// Make sure current-part highlighting doesn't get lost in seleciton highlighting
m_tree->Unselect();
}
Loading…
Cancel
Save