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 )
453 cb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, renderName] ( wxMouseEvent& aEvt )
489 const wxPoint& pos,
const wxSize& size,
long style ) :
490 wxPanel( aParent, id, pos, size, style ),
491 m_smallestLayerString( wxT(
"M...M" ) )
495 int pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
496 int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
499 pointSize = pointSize * 8 / 10;
503 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
505 m_notebook =
new wxNotebook(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
510 font.SetPointSize( pointSize );
516 wxBoxSizer* layerPanelSizer;
517 layerPanelSizer =
new wxBoxSizer( wxVERTICAL );
520 wxDefaultSize, wxNO_BORDER );
541 wxBoxSizer* renderPanelSizer;
542 renderPanelSizer =
new wxBoxSizer( wxVERTICAL );
545 wxDefaultSize, wxNO_BORDER );
563 SetSizer( mainSizer );
589 totWidth += widths[i];
597 unsigned totHeight = 32;
599 wxSize layerz( totWidth, totHeight );
608 totWidth += widths[i];
614 wxSize renderz( totWidth, totHeight );
618 wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) );
718 cb->SetValue( isVisible );
731 return cb->GetValue();
748 swatch->SetSwatchColor( aColor,
false );
763 return swatch->GetSwatchColor();
766 return COLOR4D::UNSPECIFIED;
780 return swatch->GetSwatchColor();
783 return COLOR4D::UNSPECIFIED;
796 cb->SetValue( isSet );
810 return cb->GetValue();
831 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 wxBitmapBundle &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
const int c_IndicatorSizeDIP
Functions to provide common constants and other functions to assist in making a consistent UI.