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
This commit is contained in:
parent
9b7d499c51
commit
2201482e47
|
@ -308,6 +308,9 @@ bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KE
|
||||||
keyHandled = true;
|
keyHandled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure current-part highlighting doesn't get lost in seleciton highlighting
|
||||||
|
ClearSearchTreeSelection();
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
|
|
||||||
return keyHandled;
|
return keyHandled;
|
||||||
|
|
|
@ -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,
|
bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCol,
|
||||||
wxDataViewItemAttr& aAttr ) const
|
wxDataViewItemAttr& aAttr ) const
|
||||||
{
|
{
|
||||||
|
@ -197,10 +230,16 @@ bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCo
|
||||||
// mark modified libs with bold font
|
// mark modified libs with bold font
|
||||||
aAttr.SetBold( m_libMgr->IsLibraryModified( node->Name ) );
|
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() )
|
if( node->Name == m_libMgr->GetCurrentLib() )
|
||||||
aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
|
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;
|
break;
|
||||||
|
|
||||||
case CMP_TREE_NODE::LIBID:
|
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
|
// mark aliases with italic font
|
||||||
aAttr.SetItalic( !node->IsRoot );
|
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() )
|
if( node->LibId == m_libMgr->GetCurrentLibId() )
|
||||||
aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -54,6 +54,8 @@ protected:
|
||||||
|
|
||||||
CMP_TREE_NODE* findLibrary( const wxString& aLibNickName );
|
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,
|
bool GetAttr( wxDataViewItem const& aItem, unsigned int aCol,
|
||||||
wxDataViewItemAttr& aAttr ) const override;
|
wxDataViewItemAttr& aAttr ) const override;
|
||||||
|
|
||||||
|
|
|
@ -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 )
|
void LIB_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
aEvent.Check( GetToolId() == aEvent.GetId() );
|
aEvent.Check( GetToolId() == aEvent.GetId() );
|
||||||
|
|
|
@ -316,6 +316,7 @@ public:
|
||||||
void OnEditSymbolLibTable( wxCommandEvent& aEvent ) override;
|
void OnEditSymbolLibTable( wxCommandEvent& aEvent ) override;
|
||||||
|
|
||||||
bool IsSearchTreeShown();
|
bool IsSearchTreeShown();
|
||||||
|
void ClearSearchTreeSelection();
|
||||||
|
|
||||||
void OnEditComponentProperties( wxCommandEvent& event );
|
void OnEditComponentProperties( wxCommandEvent& event );
|
||||||
void InstallFieldsEditorDialog( wxCommandEvent& event );
|
void InstallFieldsEditorDialog( wxCommandEvent& event );
|
||||||
|
|
|
@ -126,4 +126,7 @@ void CMP_TREE_PANE::onComponentSelected( wxCommandEvent& aEvent )
|
||||||
//wxPostEvent( libEditFrame, evt );
|
//wxPostEvent( libEditFrame, evt );
|
||||||
//wxQueueEvent( m_libEditFrame, new wxCommandEvent( ID_LIBEDIT_EDIT_PART ) );
|
//wxQueueEvent( m_libEditFrame, new wxCommandEvent( ID_LIBEDIT_EDIT_PART ) );
|
||||||
m_libEditFrame->OnEditPart( evt );
|
m_libEditFrame->OnEditPart( evt );
|
||||||
|
|
||||||
|
// Make sure current-part highlighting doesn't get lost in seleciton highlighting
|
||||||
|
m_tree->Unselect();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue