62 m_titleBlock( nullptr ),
63 m_drawingSheet( nullptr ),
74 if( current->GetFilename() != app_settings->
m_ColorTheme )
143 wxString msg =
_(
"Some items have the same color as the background\n"
144 "and they will not be seen on the screen. Are you\n"
145 "sure you want to use these colors?" );
147 if( wxMessageBox( msg,
_(
"Warning" ), wxYES_NO | wxICON_QUESTION,
this ) == wxNO )
169 color.Darken( 0.01 );
181 std::vector<SCH_LAYER_ID> layers;
188 layers.push_back( i );
191 std::sort( layers.begin(), layers.end(),
194 return LayerName( a ) < LayerName( b );
197 for(
int layer : layers )
202 name += wxS(
" " ) +
_(
"(symbol editor only)" );
210 const int margin = 20;
216 m_preview->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
243 std::vector<DANGLING_END_ITEM> endPoints;
262 auto addItem = [&](
EDA_ITEM* aItem )
268 std::vector<std::pair<SCH_LAYER_ID, std::pair<VECTOR2I, VECTOR2I>>> lines = {
269 {
LAYER_WIRE, { { 1950, 1500 }, { 2325, 1500 } } },
270 {
LAYER_WIRE, { { 1950, 2600 }, { 2350, 2600 } } },
271 {
LAYER_WIRE, { { 2150, 1700 }, { 2325, 1700 } } },
272 {
LAYER_WIRE, { { 2150, 2000 }, { 2150, 1700 } } },
273 {
LAYER_WIRE, { { 2925, 1600 }, { 3075, 1600 } } },
274 {
LAYER_WIRE, { { 3075, 1600 }, { 3075, 2000 } } },
275 {
LAYER_WIRE, { { 3075, 1600 }, { 3250, 1600 } } },
276 {
LAYER_WIRE, { { 3075, 2000 }, { 2150, 2000 } } },
277 {
LAYER_BUS, { { 1750, 1400 }, { 1850, 1400 } } },
278 {
LAYER_BUS, { { 1850, 2500 }, { 1850, 1400 } } },
279 {
LAYER_NOTES, { { 2350, 2125 }, { 2350, 2300 } } },
280 {
LAYER_NOTES, { { 2350, 2125 }, { 2950, 2125 } } },
281 {
LAYER_NOTES, { { 2950, 2125 }, { 2950, 2300 } } },
282 {
LAYER_NOTES, { { 2950, 2300 }, { 2350, 2300 } } }
285 for(
const std::pair<
SCH_LAYER_ID, std::pair<VECTOR2I, VECTOR2I>>& line : lines )
310#define MILS_POINT( x, y ) VECTOR2I( schIUScale.MilsToIU( x ), schIUScale.MilsToIU( y ) )
354 auto mapLibItemPosition =
357 return VECTOR2I( aLibPosition.x, -aLibPosition.y );
371 value.
SetText( wxT(
"OPA604" ) );
384 comp_body->
SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
390 addItem( comp_body );
397 pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );
398 pin->SetNumber( wxT(
"1" ) );
399 pin->SetName( wxT(
"-" ) );
401 endPoints.emplace_back(
PIN_END,
pin, mapLibItemPosition(
pin->GetPosition() ) );
409 pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );
410 pin->SetNumber( wxT(
"2" ) );
411 pin->SetName( wxT(
"+" ) );
413 endPoints.emplace_back(
PIN_END,
pin, mapLibItemPosition(
pin->GetPosition() ) );
421 pin->SetType( ELECTRICAL_PINTYPE::PT_OUTPUT );
422 pin->SetNumber( wxT(
"3" ) );
423 pin->SetName( wxT(
"OUT" ) );
425 endPoints.emplace_back(
PIN_END,
pin, mapLibItemPosition(
pin->GetPosition() ) );
506 double scale = view->
GetScale() / std::max( fabs( psize.
x / screenSize.
x ),
507 fabs( psize.
y / screenSize.
y ) );
constexpr EDA_IU_SCALE schIUScale
wxString m_ColorTheme
Active color theme name.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetColor(int aLayer, const COLOR4D &aColor)
bool GetOverrideSchItemColors() const
COLOR4D GetColor(int aLayer) const
void SetOverrideSchItemColors(bool aFlag)
const BOX2I ViewBBox() const override
void SetPageBorderColorLayer(int aLayerId)
Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
void SetColorLayer(int aLayerId)
Can be used to override which layer ID is used for drawing sheet item colors.
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
void ForceRefresh()
Force a redraw.
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
A base class for most all the KiCad significant classes used in schematics and boards.
void SetFillMode(FILL_T aFill)
virtual void SetText(const wxString &aText)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
wxString GetFilename() const
A color representation with 4 components: red, green, blue, alpha.
void ReadConfig(COMMON_SETTINGS &aCommonConfig, WINDOW_SETTINGS &aWindowConfig, wxWindow *aWindow)
Read application and common configs.
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
void SetClearColor(const COLOR4D &aColor)
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Store schematic specific render settings.
void LoadColors(const COLOR_SETTINGS *aSettings) override
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Field object used in symbol libraries.
void SetPosition(const VECTOR2I &aPosition) override
void SetConvert(int aConvert)
void SetStroke(const STROKE_PARAMS &aStroke)
void AddPoint(const VECTOR2I &aPosition)
Define a library symbol object.
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
LIB_FIELD & GetValueField()
Return reference to the value field.
Describe the page size and margins of a paper page on which to eventually print or plot.
void SetWidthMils(int aWidthInMils)
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
static const wxChar Custom[]
"User" defined page type
void SetHeightMils(int aHeightInMils)
int GetWidthIU(double aIUScale) const
Gets the page width in IU.
wxCheckBox * m_optOverrideColors
wxBoxSizer * m_colorsMainSizer
wxFlexGridSizer * m_colorsGridSizer
wxScrolledWindow * m_colorsListWindow
void createThemeList(const wxString &aCurrent)
Builds the theme listbox and sets the selection to the current theme.
void createSwatch(int aLayer, const wxString &aName)
std::vector< int > m_validLayers
A list of layer IDs that are valid for the current color settings dialog.
virtual bool saveCurrentTheme(bool aValidate)
std::string m_colorNamespace
A namespace that will be passed to SETTINGS_MANAGER::SaveColorSettings.
virtual void ResetPanel() override
Reset the contents of this panel.
std::map< int, wxStaticText * > m_labels
COLOR_SETTINGS * m_currentSettings
std::map< int, COLOR_SWATCH * > m_swatches
TITLE_BLOCK * m_titleBlock
bool saveCurrentTheme(bool aValidate) override
PANEL_EESCHEMA_COLOR_SETTINGS(wxWindow *aParent)
void onNewThemeSelected() override
Event fired when a new theme is selected that can be overridden in children.
void OnOverrideItemColorsClicked(wxCommandEvent &aEvent) override
bool validateSave(bool aQuiet=false) override
Performs a pre-save validation of the current color theme.
void ResetPanel() override
Reset the contents of this panel.
void OnSize(wxSizeEvent &aEvent) override
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
DS_PROXY_VIEW_ITEM * m_drawingSheet
void createPreviewItems()
~PANEL_EESCHEMA_COLOR_SETTINGS() override
void updateAllowedSwatches()
EDA_DRAW_PANEL_GAL::GAL_TYPE m_galType
void onColorChanged() override
Event fired when the user changes any color.
SCH_PREVIEW_PANEL * m_preview
void createSwatches() override
bool TransferDataToWindow() override
bool TransferDataFromWindow() override
std::vector< EDA_ITEM * > m_previewItems
void SetPosition(const VECTOR2I &aPosition) override
Class for a wire to bus entry.
void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual bool IsConnectable() const
virtual void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList)
Add the schematic item end points to aItemList if the item has end points.
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
virtual bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr)
Test the schematic item to aItemList to check if it's dangling state has changed.
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
void SetIsDangling(bool aIsDangling)
Segment description base class to describe items which have 2 end points (track, wire,...
void SetStartPoint(const VECTOR2I &aPosition)
virtual STROKE_PARAMS GetStroke() const override
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
void SetEndPoint(const VECTOR2I &aPosition)
void SetPosition(const VECTOR2I &aPosition) override
void Refresh(bool aEraseBackground, const wxRect *aRect) override
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings() const
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
std::vector< SCH_FIELD > & GetFields()
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
virtual void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
Simple container to manage line stroke parameters.
void SetWidth(int aWidth)
void SetPlotStyle(PLOT_DASH_TYPE aPlotStyle)
Hold the information shown in the lower right corner of a plot, printout, or editing view.
void SetTitle(const wxString &aTitle)
void SetDate(const wxString &aDate)
Set the date field, and defaults to the current time and date.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_SCHEMATIC_DRAWINGSHEET
@ LAYER_SCHEMATIC_GRID_AXES
@ LAYER_SCHEMATIC_PAGE_LIMITS
@ LAYER_SCHEMATIC_BACKGROUND
@ COLOR
Color has changed.
std::set< int > g_excludedLayers
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
constexpr int MilsToIU(int mils) const
VECTOR2D ToVECTOR2D(const wxPoint &aPoint)