39#include <wx/checkbox.h>
51static void shrinkFont( wxWindow* aControl,
int aPointSize )
53 wxFont font = aControl->GetFont();
54 font.SetPointSize( aPointSize );
55 aControl->SetFont( font );
78 wxWindow* eventSource = (wxWindow*) event.GetEventObject();
92 for( row = 0; row<rowCount; ++row )
94 if( y < height + heights[row] )
97 height += heights[row];
100 if( row >= rowCount )
109 int id = eventSource->GetId();
122 const wxString& aLayerName )
127 _(
"Change Layer Color for" ) + wxS(
" " ) + aLayerName,
129 menu.AppendSeparator();
133 menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event )
161 wxPostEvent(
this, event );
169 wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
178 const wxString& aRenderName )
183 _(
"Change Render Color for" ) + wxS(
" " )+ aRenderName,
186 menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
187 [aColorSwatch]( wxCommandEvent& event )
239 wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
261 if( ndx < m_LayersFlexGridSizer->GetChildren().GetCount() )
272 for(
int row = 0; row < count; ++row )
290 if( (
unsigned) ndx < m_RenderFlexGridSizer->GetChildren().GetCount() )
301 for(
int row = 0; row < count; ++row )
317 wxASSERT( aRow >= 0 );
321 const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
337 bmb->SetToolTip(
_(
"Left double click or middle click for color change, right click for "
345 cb->SetValue( aSpec.
state );
347 cb->SetToolTip(
_(
"Enable this for visibility" ) );
354 aSpec.
rowName, wxDefaultPosition,
356 wxST_ELLIPSIZE_MIDDLE );
359 st->SetToolTip( aSpec.
tooltip );
370 wxString layerName( aSpec.
rowName );
372 sbm->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
376 bmb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
380 cb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
384 st->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
396 label->SetLabel( aName );
412 wxASSERT( aRow >= 0 );
416 const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
418 wxString renderName( aSpec.
rowName );
419 wxCheckBox* cb =
nullptr;
426 aSpec.
rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
428 cb->SetValue( aSpec.
state );
431 cb->SetToolTip( aSpec.
tooltip );
442 bmb->SetToolTip(
_(
"Left double click or middle click for color change" ) );
445 bmb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, renderName] ( wxMouseEvent& aEvt )
449 cb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, renderName] ( wxMouseEvent& aEvt )
485 const wxPoint& pos,
const wxSize& size,
long style ) :
486 wxPanel( aParent, id, pos, size, style ),
491 int pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
492 int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
495 pointSize = pointSize * 8 / 10;
499 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
501 m_notebook =
new wxNotebook(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
506 font.SetPointSize( pointSize );
512 wxBoxSizer* layerPanelSizer;
513 layerPanelSizer =
new wxBoxSizer( wxVERTICAL );
516 wxDefaultSize, wxNO_BORDER );
537 wxBoxSizer* renderPanelSizer;
538 renderPanelSizer =
new wxBoxSizer( wxVERTICAL );
541 wxDefaultSize, wxNO_BORDER );
559 SetSizer( mainSizer );
585 totWidth += widths[i];
593 unsigned totHeight = 32;
595 wxSize layerz( totWidth, totHeight );
604 totWidth += widths[i];
610 wxSize renderz( totWidth, totHeight );
614 wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) );
714 cb->SetValue( isVisible );
727 return cb->GetValue();
744 swatch->SetSwatchColor( aColor,
false );
759 return swatch->GetSwatchColor();
776 return swatch->GetSwatchColor();
792 cb->SetValue( isSet );
806 return cb->GetValue();
827 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...
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
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.
Represent 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.