43#include <wx/checkbox.h>
55static void shrinkFont( wxWindow* aControl,
int aPointSize )
57 wxFont font = aControl->GetFont();
58 font.SetPointSize( aPointSize );
59 aControl->SetFont( font );
82 wxWindow* eventSource = (wxWindow*) event.GetEventObject();
96 for( row = 0; row<rowCount; ++row )
98 if( y < height + heights[row] )
101 height += heights[row];
104 if( row >= rowCount )
113 int id = eventSource->GetId();
126 const wxString& aLayerName )
131 _(
"Change Layer Color for" ) + wxS(
" " ) + aLayerName,
132 KiBitmap( BITMAPS::color_materials ) );
133 menu.AppendSeparator();
137 menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event )
141 aColorSwatch->GetNewSwatchColor();
165 wxPostEvent(
this, event );
173 wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
182 const wxString& aRenderName )
187 _(
"Change Render Color for" ) + wxS(
" " )+ aRenderName,
188 KiBitmap( BITMAPS::color_materials ) );
190 menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
191 [aColorSwatch]( wxCommandEvent& event )
243 wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
265 if( ndx < m_LayersFlexGridSizer->GetChildren().GetCount() )
276 for(
int row = 0; row < count; ++row )
294 if( (
unsigned) ndx < m_RenderFlexGridSizer->GetChildren().GetCount() )
305 for(
int row = 0; row < count; ++row )
321 wxASSERT( aRow >= 0 );
325 const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
341 bmb->SetToolTip(
_(
"Left double click or middle click for color change, right click for "
349 cb->SetValue( aSpec.
state );
351 cb->SetToolTip(
_(
"Enable this for visibility" ) );
358 aSpec.
rowName, wxDefaultPosition,
360 wxST_ELLIPSIZE_MIDDLE );
363 st->SetToolTip( aSpec.
tooltip );
374 wxString layerName( aSpec.
rowName );
376 sbm->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
380 bmb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
384 cb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
388 st->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
400 label->SetLabel( aName );
416 wxASSERT( aRow >= 0 );
420 const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
422 wxString renderName( aSpec.
rowName );
423 wxCheckBox* cb =
nullptr;
430 aSpec.
rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
432 cb->SetValue( aSpec.
state );
435 cb->SetToolTip( aSpec.
tooltip );
441 if( aSpec.
color != COLOR4D::UNSPECIFIED )
446 bmb->SetToolTip(
_(
"Left double click or middle click for color change" ) );
449 bmb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, renderName] ( wxMouseEvent& aEvt ) {
452 cb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, renderName] ( wxMouseEvent& aEvt ) {
487 const wxPoint& pos,
const wxSize& size,
long style ) :
488 wxPanel( aParent, id, pos, size, style ),
489 m_smallestLayerString( wxT(
"M...M" ) )
491 int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x;
494 int pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
495 int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
497 if( screenHeight <= 900 && pointSize >= indicatorSize )
498 pointSize = pointSize * 8 / 10;
502 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
504 m_notebook =
new wxNotebook(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
509 font.SetPointSize( pointSize );
515 wxBoxSizer* layerPanelSizer;
516 layerPanelSizer =
new wxBoxSizer( wxVERTICAL );
519 wxDefaultSize, wxNO_BORDER );
540 wxBoxSizer* renderPanelSizer;
541 renderPanelSizer =
new wxBoxSizer( wxVERTICAL );
544 wxDefaultSize, wxNO_BORDER );
562 SetSizer( mainSizer );
588 totWidth += widths[i];
596 unsigned totHeight = 32;
598 wxSize layerz( totWidth, totHeight );
607 totWidth += widths[i];
613 wxSize renderz( totWidth, totHeight );
617 wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) );
717 cb->SetValue( isVisible );
730 return cb->GetValue();
747 swatch->SetSwatchColor( aColor,
false );
762 return swatch->GetSwatchColor();
765 return COLOR4D::UNSPECIFIED;
779 return swatch->GetSwatchColor();
782 return COLOR4D::UNSPECIFIED;
795 cb->SetValue( isSet );
809 return cb->GetValue();
830 for(
int row = 0; row < rowCount ; row++ )
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
A simple color swatch of the kind used to set layer colors.
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.
KIGFX::COLOR4D GetSwatchColor() const
void SetSwatchBackground(const KIGFX::COLOR4D &aBackground)
Set the swatch background color.
representing a row indicator icon for use in places like the layer widget
void SetIndicatorState(ICON_ID aIconId)
Set the row indicator to the given state.
A color representation with 4 components: red, green, blue, alpha.
Icon provider for the "standard" row indicators, for example in layer selection lists.
STATE
< State constants to select the right icons
@ OFF
Row "off" or "deselected".
@ ON
Row "on" or "selected".
A version of a wxStaticText control that will request a smaller size than the full string.
void SetMinimumStringLength(const wxString &aString)
Set the string that is used for determining the requested size of the control.
@ LAYER_PCB_BACKGROUND
PCB background color.
This file contains miscellaneous commonly used macros and functions.
KICOMMON_API wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
Functions to provide common constants and other functions to assist in making a consistent UI.