Dark theme support for SPICE model editor

This commit is contained in:
Mikolaj Wielgus 2021-12-03 03:41:02 +01:00
parent cec258f7dd
commit 9efbeaa064
4 changed files with 13 additions and 7 deletions

View File

@ -81,7 +81,7 @@ void SCINTILLA_TRICKS::setupStyles()
wxColour foreground = dummy.GetForegroundColour(); wxColour foreground = dummy.GetForegroundColour();
wxColour background = dummy.GetBackgroundColour(); wxColour background = dummy.GetBackgroundColour();
wxColour highlight = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ); wxColour highlight = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT );
wxColour highlightText = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ); wxColour highlightText = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT );
m_te->StyleSetForeground( wxSTC_STYLE_DEFAULT, foreground ); m_te->StyleSetForeground( wxSTC_STYLE_DEFAULT, foreground );
m_te->StyleSetBackground( wxSTC_STYLE_DEFAULT, background ); m_te->StyleSetBackground( wxSTC_STYLE_DEFAULT, background );
@ -104,11 +104,11 @@ void SCINTILLA_TRICKS::setupStyles()
} }
// Set up the brace highlighting // Set up the brace highlighting
unsigned char r = highlight.Red(); unsigned char r = highlight.Red();
unsigned char g = highlight.Green(); unsigned char g = highlight.Green();
unsigned char b = highlight.Blue(); unsigned char b = highlight.Blue();
wxColour::MakeGrey( &r, &g, &b ); wxColour::MakeGrey( &r, &g, &b );
highlight.Set( r, g, b ); highlight.Set( r, g, b );
m_te->StyleSetForeground( wxSTC_STYLE_BRACELIGHT, highlightText ); m_te->StyleSetForeground( wxSTC_STYLE_BRACELIGHT, highlightText );
m_te->StyleSetBackground( wxSTC_STYLE_BRACELIGHT, highlight ); m_te->StyleSetBackground( wxSTC_STYLE_BRACELIGHT, highlight );
m_te->StyleSetForeground( wxSTC_STYLE_BRACEBAD, *wxRED ); m_te->StyleSetForeground( wxSTC_STYLE_BRACEBAD, *wxRED );

View File

@ -230,6 +230,8 @@ void DIALOG_SPICE_MODEL::Init()
// wxPanel::Hide() isn't enough on some platforms // wxPanel::Hide() isn't enough on some platforms
m_powerNotebook->RemovePage( m_powerNotebook->FindPage( m_pwrTransNoise ) ); m_powerNotebook->RemovePage( m_powerNotebook->FindPage( m_pwrTransNoise ) );
m_powerNotebook->RemovePage( m_powerNotebook->FindPage( m_pwrExtData ) ); m_powerNotebook->RemovePage( m_powerNotebook->FindPage( m_pwrExtData ) );
m_scintillaTricks = std::make_unique<SCINTILLA_TRICKS>( m_libraryContents, wxT( "{}" ), false );
} }

View File

@ -27,8 +27,9 @@
#ifndef DIALOG_SPICE_MODEL_H #ifndef DIALOG_SPICE_MODEL_H
#define DIALOG_SPICE_MODEL_H #define DIALOG_SPICE_MODEL_H
#include "dialog_spice_model_base.h" #include <dialog_spice_model_base.h>
#include "netlist_exporter_pspice.h" #include <netlist_exporter_pspice.h>
#include <scintilla_tricks.h>
#include <sim/spice_value.h> #include <sim/spice_value.h>
#include <sch_symbol.h> #include <sch_symbol.h>
@ -167,6 +168,8 @@ private:
SPICE_VALIDATOR m_spiceValidator; SPICE_VALIDATOR m_spiceValidator;
SPICE_VALIDATOR m_spiceEmptyValidator; SPICE_VALIDATOR m_spiceEmptyValidator;
wxTextValidator m_notEmptyValidator; wxTextValidator m_notEmptyValidator;
std::unique_ptr<SCINTILLA_TRICKS> m_scintillaTricks;
}; };
#endif /* DIALOG_SPICE_MODEL_H */ #endif /* DIALOG_SPICE_MODEL_H */

View File

@ -29,7 +29,8 @@
#include <functional> #include <functional>
/** /**
* Add cut/copy/paste, autocomplete and brace highlighting to a wxStyleTextCtrl instance. * Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl
* instance.
*/ */
class SCINTILLA_TRICKS : public wxEvtHandler class SCINTILLA_TRICKS : public wxEvtHandler
{ {