KiCad PCB EDA Suite
DIALOG_COLOR_PICKER Class Reference

#include <dialog_color_picker.h>

Inheritance diagram for DIALOG_COLOR_PICKER:
DIALOG_COLOR_PICKER_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

 DIALOG_COLOR_PICKER (wxWindow *aParent, KIGFX::COLOR4D &aCurrentColor, bool aAllowOpacityControl, CUSTOM_COLORS_LIST *aUserColors=nullptr)
 Dialog constructor. More...
 
 ~DIALOG_COLOR_PICKER ()
 
KIGFX::COLOR4D GetColor ()
 
void SetInitialFocus (wxWindow *aWindow)
 Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown. More...
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
EDA_UNITS_T GetUserUnits () const override
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Static Public Attributes

static int m_ActivePage = 0
 the active notebook page, stored during a session More...
 

Protected Member Functions

void FinishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void SetSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int HorizPixelsFromDU (int x)
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int VertPixelsFromDU (int y)
 Convert an integer number of dialog units to pixels, vertically. More...
 

Protected Attributes

wxNotebook * m_notebook
 
wxPanel * m_panelFreeColors
 
wxStaticBitmap * m_RgbBitmap
 
wxStaticText * m_staticTextR
 
wxStaticText * m_staticTextG
 
wxStaticText * m_staticTextB
 
wxSpinCtrl * m_spinCtrlRed
 
wxSpinCtrl * m_spinCtrlGreen
 
wxSpinCtrl * m_spinCtrlBlue
 
wxStaticBitmap * m_HsvBitmap
 
wxStaticText * m_staticTextHue
 
wxStaticText * m_staticTextSat
 
wxSpinCtrl * m_spinCtrlHue
 
wxSpinCtrl * m_spinCtrlSaturation
 
wxStaticText * m_staticTextBright
 
wxSlider * m_sliderBrightness
 
wxPanel * m_panelDefinedColors
 
wxBoxSizer * m_SizerDefinedColors
 
wxFlexGridSizer * m_fgridColor
 
wxBoxSizer * m_SizerTransparency
 
wxStaticText * m_opacityLabel
 
wxSlider * m_sliderTransparency
 
wxStaticLine * m_staticline
 
wxStaticText * m_staticTextOldColor
 
wxStaticBitmap * m_OldColorRect
 
wxStaticBitmap * m_NewColorRect
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 
EDA_UNITS_T m_units
 
std::string m_hash_key
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Member Functions

void SetEditVals (CHANGED_COLOR aChanged)
 
void drawAll ()
 
void createHSVBitmap ()
 generate the bitmap that shows the HSV color circle More...
 
void drawHSVPalette ()
 draws the HSV color circle More...
 
void createRGBBitmap ()
 generate the bitmap that shows the RVB color space More...
 
void drawRGBPalette ()
 draws the RVB color space More...
 
void drawRGBCursors ()
 
void setIconColor (wxStaticBitmap *aStaticBitmap, KIGFX::COLOR4D &aColor4D)
 

repaint a static bitmap with the aColor4D color

More...
 
void OnChangeBrightness (wxScrollEvent &event) override
 Event handler from wxSlider: alpha (transparency) control. More...
 
void OnChangeAlpha (wxScrollEvent &event) override
 Event handlers from wxSpinControl. More...
 
void OnChangeEditRed (wxSpinEvent &event) override
 
void OnChangeEditGreen (wxSpinEvent &event) override
 
void OnChangeEditBlue (wxSpinEvent &event) override
 
void OnChangeEditHue (wxSpinEvent &event) override
 
void OnChangeEditSat (wxSpinEvent &event) override
 
void onRGBMouseClick (wxMouseEvent &event) override
 

mouse handlers, when clicking on a palette bitmap

More...
 
void onRGBMouseDrag (wxMouseEvent &event) override
 
void onHSVMouseClick (wxMouseEvent &event) override
 
void onHSVMouseDrag (wxMouseEvent &event) override
 
bool setHSvaluesFromCursor (wxPoint aMouseCursor)
 manage the Hue and Saturation settings when the mouse cursor is at aMouseCursor. More...
 
void buttColorClick (wxCommandEvent &event)
 

Event handler for defined color buttons

More...
 
bool TransferDataToWindow () override
 

called when creating the dialog

More...
 
void initDefinedColors (CUSTOM_COLORS_LIST *aPredefinedColors)
 creates the bitmap buttons for each defined colors if aPredefinedColors is nullptr, a internal predefined list will be used More...
 
int normalizeToInt (double aValue, int aValMax=255)
 

Private Attributes

bool m_allowMouseEvents
 
bool m_allowOpacityCtrl
 true to show the widget, false to keep alpha channel = 1.0 More...
 
KIGFX::COLOR4D m_previousColor4D
 the inital color4d More...
 
KIGFX::COLOR4D m_newColor4D
 the current color4d More...
 
std::vector< KIGFX::COLOR4Dm_Color4DList
 the list of color4d ordered by button ID, for predefined colors More...
 
int m_cursorsSize
 
wxPoint m_cursorBitmapRed
 the red cursor on the RGB bitmap palette. More...
 
wxPoint m_cursorBitmapGreen
 the green cursor on the RGB bitmap palette. More...
 
wxPoint m_cursorBitmapBlue
 the blue cursor on the RGB bitmap palette. More...
 
wxPoint m_cursorBitmapHSV
 the cursor on the HSV bitmap palette. More...
 
wxPointm_selectedCursor
 the ref cursor to the selected curor, if any, or null. More...
 
double m_hue
 the current hue, in degrees (0 ... 360) More...
 
double m_sat
 the current saturation (0 ... 1.0) More...
 
double m_val
 the current value (0 ... 1.0) More...
 
wxBitmap * m_bitmapRGB
 the basic RGB palette More...
 
wxBitmap * m_bitmapHSV
 the basic HUV palette More...
 
std::vector< wxBitmapButton * > m_buttonsColor
 list of defined colors buttons More...
 

Detailed Description

Definition at line 67 of file dialog_color_picker.h.

Constructor & Destructor Documentation

DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER ( wxWindow *  aParent,
KIGFX::COLOR4D aCurrentColor,
bool  aAllowOpacityControl,
CUSTOM_COLORS_LIST aUserColors = nullptr 
)

Dialog constructor.

Parameters
aParentis the caller
aCurrentColoris the current color, used to show it in dialog
aAllowOpacityControl= true to allow opacity (alpha channel) setting false to not show this setting (opacity = 1.0 always)
aUserColorsif not null is a list of defined colors replacing the dialog predefined colors

Definition at line 26 of file dialog_color_picker.cpp.

References KIGFX::COLOR4D::a, initDefinedColors(), m_ActivePage, m_allowMouseEvents, m_allowOpacityCtrl, m_bitmapHSV, m_bitmapRGB, m_cursorsSize, m_hue, m_newColor4D, DIALOG_COLOR_PICKER_BASE::m_notebook, m_previousColor4D, m_sat, DIALOG_COLOR_PICKER_BASE::m_sdbSizerOK, m_selectedCursor, DIALOG_COLOR_PICKER_BASE::m_SizerTransparency, m_val, and KIGFX::COLOR4D::ToHSV().

28  : DIALOG_COLOR_PICKER_BASE( aParent )
29 {
30  m_allowMouseEvents = false;
31  m_allowOpacityCtrl = aAllowOpacityControl;
32  m_previousColor4D = aCurrentColor;
33  m_newColor4D = aCurrentColor;
34  m_cursorsSize = 8; // Size of square cursors drawn on color bitmaps
35  m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
36  m_bitmapRGB = nullptr;
37  m_bitmapHSV = nullptr;
38  m_selectedCursor = nullptr;
39 
40  if( !m_allowOpacityCtrl )
41  {
42  m_SizerTransparency->Show( false );
43  m_previousColor4D.a = 1.0;
44  m_newColor4D.a = 1.0;
45  }
46 
47  if( m_ActivePage >= 0 )
48  m_notebook->SetSelection( (unsigned) m_ActivePage );
49 
50  // Build the defined colors panel:
51  initDefinedColors( aUserColors );
52 
53  m_sdbSizerOK->SetDefault();
54 }
double m_hue
the current hue, in degrees (0 ... 360)
bool m_allowOpacityCtrl
true to show the widget, false to keep alpha channel = 1.0
double m_sat
the current saturation (0 ... 1.0)
DIALOG_COLOR_PICKER_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Color Picker"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
KIGFX::COLOR4D m_newColor4D
the current color4d
void ToHSV(double &aOutHue, double &aOutSaturation, double &aOutValue, bool aAlwaysDefineHue=false) const
Function ToHSV() Converts current color (stored in RGB) to HSV format.
Definition: color4d.cpp:286
double a
Alpha component.
Definition: color4d.h:290
KIGFX::COLOR4D m_previousColor4D
the inital color4d
static int m_ActivePage
the active notebook page, stored during a session
wxBitmap * m_bitmapHSV
the basic HUV palette
double m_val
the current value (0 ... 1.0)
void initDefinedColors(CUSTOM_COLORS_LIST *aPredefinedColors)
creates the bitmap buttons for each defined colors if aPredefinedColors is nullptr, a internal predefined list will be used
wxBitmap * m_bitmapRGB
the basic RGB palette
wxPoint * m_selectedCursor
the ref cursor to the selected curor, if any, or null.
DIALOG_COLOR_PICKER::~DIALOG_COLOR_PICKER ( )

Definition at line 59 of file dialog_color_picker.cpp.

References buttColorClick(), m_ActivePage, m_bitmapHSV, m_bitmapRGB, m_buttonsColor, and DIALOG_COLOR_PICKER_BASE::m_notebook.

60 {
61  delete m_bitmapRGB;
62  delete m_bitmapHSV;
63 
64  m_ActivePage = m_notebook->GetSelection();
65 
66  for( auto button : m_buttonsColor )
67  button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
68  wxCommandEventHandler( DIALOG_COLOR_PICKER::buttColorClick ), NULL, this );
69 }
static int m_ActivePage
the active notebook page, stored during a session
wxBitmap * m_bitmapHSV
the basic HUV palette
void buttColorClick(wxCommandEvent &event)
Event handler for defined color buttons
std::vector< wxBitmapButton * > m_buttonsColor
list of defined colors buttons
wxBitmap * m_bitmapRGB
the basic RGB palette

Member Function Documentation

void DIALOG_COLOR_PICKER::buttColorClick ( wxCommandEvent &  event)
private

Event handler for defined color buttons

Definition at line 550 of file dialog_color_picker.cpp.

References ALL_CHANGED, KIGFX::COLOR4D::b, color, drawAll(), KIGFX::COLOR4D::g, ID_COLOR_BLACK, m_Color4DList, m_hue, m_newColor4D, m_sat, m_val, KIGFX::COLOR4D::r, SetEditVals(), and KIGFX::COLOR4D::ToHSV().

Referenced by initDefinedColors(), and ~DIALOG_COLOR_PICKER().

551 {
552  int id = event.GetId();
553  KIGFX::COLOR4D color( m_Color4DList[id - ID_COLOR_BLACK] );//EDA_COLOR_T( id - ID_COLOR_BLACK ) );
554  m_newColor4D.r = color.r;
555  m_newColor4D.g = color.g;
556  m_newColor4D.b = color.b;
557 
558  m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
560 
561  drawAll();
562 
563  event.Skip();
564 }
double m_hue
the current hue, in degrees (0 ... 360)
double m_sat
the current saturation (0 ... 1.0)
void SetEditVals(CHANGED_COLOR aChanged)
std::vector< KIGFX::COLOR4D > m_Color4DList
the list of color4d ordered by button ID, for predefined colors
int color
Definition: DXF_plotter.cpp:62
double g
Green component.
Definition: color4d.h:288
KIGFX::COLOR4D m_newColor4D
the current color4d
void ToHSV(double &aOutHue, double &aOutSaturation, double &aOutValue, bool aAlwaysDefineHue=false) const
Function ToHSV() Converts current color (stored in RGB) to HSV format.
Definition: color4d.cpp:286
double b
Blue component.
Definition: color4d.h:289
double m_val
the current value (0 ... 1.0)
double r
Red component.
Definition: color4d.h:287
#define ID_COLOR_BLACK
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void DIALOG_COLOR_PICKER::createHSVBitmap ( )
private

generate the bitmap that shows the HSV color circle

Definition at line 341 of file dialog_color_picker.cpp.

References color, KIGFX::COLOR4D::FromHSV(), m_bitmapHSV, m_cursorsSize, DIALOG_COLOR_PICKER_BASE::m_HsvBitmap, and min.

Referenced by drawHSVPalette().

342 {
343  wxMemoryDC bitmapDC;
344  wxSize bmsize = m_HsvBitmap->GetSize();
345  int half_size = std::min( bmsize.x, bmsize.y )/2;
346  delete m_bitmapHSV;
347  m_bitmapHSV = new wxBitmap( bmsize );
348  bitmapDC.SelectObject( *m_bitmapHSV );
349  wxPen pen;
350 
351  // clear background (set the window bd color)
352  wxBrush bgbrush( GetBackgroundColour() );
353  bitmapDC.SetBackground( bgbrush );
354  bitmapDC.Clear();
355 
356  // Use Y axis from bottom to top and origin to center
357  bitmapDC.SetAxisOrientation( true, true );
358  bitmapDC.SetDeviceOrigin( half_size, half_size );
359 
360  // Reserve room to draw cursors inside the bitmap
361  half_size -= m_cursorsSize/2;
362 
363  double hue, sat;
365  int sq_radius = half_size*half_size;
366 
367  for( int xx = -half_size; xx < half_size; xx++ )
368  {
369  for( int yy = -half_size; yy < half_size; yy++ )
370  {
371  sat = double(xx*xx + yy*yy) / sq_radius;
372 
373  // sat is <= 1.0
374  // any value > 1.0 is not a valid HSB color:
375  if( sat > 1.0 )
376  continue;
377 
378  // sat is the distance from center
379  sat = sqrt( sat );
380  hue = atan2( (double)yy, (double)xx ) * 180 / M_PI;
381 
382  if( hue < 0.0 )
383  hue += 360.0;
384 
385  color.FromHSV( hue, sat, 1.0 );
386 
387  pen.SetColour( color.ToColour() );
388  bitmapDC.SetPen( pen );
389  bitmapDC.DrawPoint( xx, yy );
390  }
391  }
392 
393  /* Deselect the Tool Bitmap from DC,
394  * in order to delete the MemoryDC safely without deleting the bitmap
395  */
396  bitmapDC.SelectObject( wxNullBitmap );
397 }
int color
Definition: DXF_plotter.cpp:62
wxBitmap * m_bitmapHSV
the basic HUV palette
void FromHSV(double aInH, double aInS, double aInV)
Function FromHSV() Changes currently used color to the one given by hue, saturation and value paramet...
Definition: color4d.cpp:339
#define min(a, b)
Definition: auxiliary.h:85
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void DIALOG_COLOR_PICKER::createRGBBitmap ( )
private

generate the bitmap that shows the RVB color space

Definition at line 257 of file dialog_color_picker.cpp.

References abs, KIGFX::COLOR4D::b, color, KIGFX::COLOR4D::g, m_bitmapRGB, m_cursorsSize, DIALOG_COLOR_PICKER_BASE::m_RgbBitmap, min, KIGFX::COLOR4D::r, and SLOPE_AXIS.

Referenced by drawRGBPalette().

258 {
259  wxMemoryDC bitmapDC;
260  wxSize bmsize = m_RgbBitmap->GetSize();
261  int half_size = std::min( bmsize.x, bmsize.y )/2;
262  m_bitmapRGB = new wxBitmap( bmsize );
263  bitmapDC.SelectObject( *m_bitmapRGB );
264  wxPen pen;
265 
266  // clear background (set the window bg color)
267  wxBrush bgbrush( GetBackgroundColour() );
268  bitmapDC.SetBackground( bgbrush );
269  bitmapDC.Clear();
270 
271  // Use Y axis from bottom to top and origin to center
272  bitmapDC.SetAxisOrientation( true, true );
273  bitmapDC.SetDeviceOrigin( half_size, half_size );
274 
275  // Reserve room to draw cursors inside the bitmap
276  half_size -= m_cursorsSize/2;
277 
279 
280  // Red blue area in X Z 3d axis
281  double inc = 1.0 / half_size;
282  #define SLOPE_AXIS 50.0
283  double slope = SLOPE_AXIS/half_size;
284  color.g = 0.0;
285 
286  for( int xx = 0; xx < half_size; xx++ ) // blue axis
287  {
288  color.b = inc * xx;
289 
290  for( int yy = 0; yy < half_size; yy++ ) // Red axis
291  {
292  color.r = inc * yy;
293 
294  pen.SetColour( color.ToColour() );
295  bitmapDC.SetPen( pen );
296  bitmapDC.DrawPoint( xx, yy - (slope*xx) );
297  }
298  }
299 
300  // Red green area in y Z 3d axis
301  color.b = 0.0;
302  for( int xx = 0; xx < half_size; xx++ ) // green axis
303  {
304  color.g = inc * xx;
305 
306  for( int yy = 0; yy < half_size; yy++ ) // Red axis
307  {
308  color.r = inc * yy;
309 
310  pen.SetColour( color.ToColour() );
311  bitmapDC.SetPen( pen );
312  bitmapDC.DrawPoint( -xx, yy - (slope*xx) );
313  }
314  }
315 
316  // Blue green area in x y 3d axis
317  color.r = 0.0;
318  for( int xx = 0; xx < half_size; xx++ ) // green axis
319  {
320  color.g = inc * xx;
321 
322  for( int yy = 0; yy < half_size; yy++ ) // blue axis
323  {
324  color.b = inc * yy;
325 
326  pen.SetColour( color.ToColour() );
327  bitmapDC.SetPen( pen );
328 
329  // Mapping the xx, yy color axis to draw coordinates is more tricky than previously
330  // in DC coordinates:
331  // the blue axis is the (0, 0) to half_size, (-yy - SLOPE_AXIS)
332  // the green axis is the (0, 0) to - half_size, (-yy - SLOPE_AXIS)
333  int drawX = -xx + yy;
334  int drawY = - std::min( xx,yy ) * 0.9;
335  bitmapDC.DrawPoint( drawX, drawY - std::abs( slope*drawX ) );
336  }
337  }
338 }
int color
Definition: DXF_plotter.cpp:62
double g
Green component.
Definition: color4d.h:288
#define abs(a)
Definition: auxiliary.h:84
double b
Blue component.
Definition: color4d.h:289
wxBitmap * m_bitmapRGB
the basic RGB palette
double r
Red component.
Definition: color4d.h:287
#define SLOPE_AXIS
#define min(a, b)
Definition: auxiliary.h:85
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void DIALOG_COLOR_PICKER::drawAll ( )
private

Definition at line 533 of file dialog_color_picker.cpp.

References drawHSVPalette(), drawRGBPalette(), DIALOG_COLOR_PICKER_BASE::m_HsvBitmap, m_newColor4D, DIALOG_COLOR_PICKER_BASE::m_NewColorRect, DIALOG_COLOR_PICKER_BASE::m_RgbBitmap, and setIconColor().

Referenced by buttColorClick(), OnChangeBrightness(), OnChangeEditBlue(), OnChangeEditGreen(), OnChangeEditHue(), OnChangeEditRed(), OnChangeEditSat(), onHSVMouseClick(), onHSVMouseDrag(), onRGBMouseDrag(), and TransferDataToWindow().

534 {
535  m_NewColorRect->Freeze(); // Avoid flicker
536  m_HsvBitmap->Freeze();
537  m_RgbBitmap->Freeze();
539  drawHSVPalette();
540  drawRGBPalette();
541  m_NewColorRect->Thaw();
542  m_HsvBitmap->Thaw();
543  m_RgbBitmap->Thaw();
544  m_NewColorRect->Refresh();
545  m_HsvBitmap->Refresh();
546  m_RgbBitmap->Refresh();
547 }
void drawRGBPalette()
draws the RVB color space
void drawHSVPalette()
draws the HSV color circle
void setIconColor(wxStaticBitmap *aStaticBitmap, KIGFX::COLOR4D &aColor4D)
repaint a static bitmap with the aColor4D color
KIGFX::COLOR4D m_newColor4D
the current color4d
void DIALOG_COLOR_PICKER::drawHSVPalette ( )
private

draws the HSV color circle

Definition at line 464 of file dialog_color_picker.cpp.

References createHSVBitmap(), m_bitmapHSV, m_cursorBitmapHSV, m_cursorsSize, DIALOG_COLOR_PICKER_BASE::m_HsvBitmap, m_hue, m_sat, min, wxPoint::x, and wxPoint::y.

Referenced by drawAll().

465 {
466  if( !m_bitmapHSV || m_bitmapHSV->GetSize() != m_HsvBitmap->GetSize() )
467  createHSVBitmap();
468 
469  wxMemoryDC bitmapDC;
470  wxSize bmsize = m_bitmapHSV->GetSize();
471  int half_size = std::min( bmsize.x, bmsize.y )/2;
472  wxBitmap newBm( *m_bitmapHSV );
473  bitmapDC.SelectObject( newBm );
474 
475  // Use Y axis from bottom to top and origin to center
476  bitmapDC.SetAxisOrientation( true, true );
477  bitmapDC.SetDeviceOrigin( half_size, half_size );
478 
479  // Reserve room to draw cursors inside the bitmap
480  half_size -= m_cursorsSize/2;
481 
482  // Draw the HSB cursor:
483  m_cursorBitmapHSV.x = cos( m_hue * M_PI / 180.0 ) * half_size * m_sat;
484  m_cursorBitmapHSV.y = sin( m_hue * M_PI / 180.0 ) * half_size * m_sat;
485 
486  wxPen pen( wxColor( 0, 0, 0 ) );
487  wxBrush brush( wxColor( 0, 0, 0 ), wxBRUSHSTYLE_TRANSPARENT );
488  bitmapDC.SetPen( pen );
489  bitmapDC.SetBrush( brush );
490 
491  int half_csize = m_cursorsSize/2;
492  bitmapDC.DrawRectangle( m_cursorBitmapHSV.x- half_csize,
493  m_cursorBitmapHSV.y-half_csize,
495 
496  m_HsvBitmap->SetBitmap( newBm );
497  /* Deselect the Tool Bitmap from DC,
498  * in order to delete the MemoryDC safely without deleting the bitmap
499  */
500  bitmapDC.SelectObject( wxNullBitmap );
501 }
double m_hue
the current hue, in degrees (0 ... 360)
double m_sat
the current saturation (0 ... 1.0)
void createHSVBitmap()
generate the bitmap that shows the HSV color circle
wxPoint m_cursorBitmapHSV
the cursor on the HSV bitmap palette.
wxBitmap * m_bitmapHSV
the basic HUV palette
#define min(a, b)
Definition: auxiliary.h:85
void DIALOG_COLOR_PICKER::drawRGBCursors ( )
private
void DIALOG_COLOR_PICKER::drawRGBPalette ( )
private

draws the RVB color space

Definition at line 400 of file dialog_color_picker.cpp.

References KIGFX::COLOR4D::b, createRGBBitmap(), KIGFX::COLOR4D::g, m_bitmapRGB, m_cursorBitmapBlue, m_cursorBitmapGreen, m_cursorBitmapRed, m_cursorsSize, m_newColor4D, DIALOG_COLOR_PICKER_BASE::m_RgbBitmap, min, KIGFX::COLOR4D::r, SLOPE_AXIS, wxPoint::x, and wxPoint::y.

Referenced by drawAll().

401 {
402  if( !m_bitmapRGB || m_bitmapRGB->GetSize() != m_RgbBitmap->GetSize() )
403  createRGBBitmap();
404 
405  wxMemoryDC bitmapDC;
406  wxSize bmsize = m_bitmapRGB->GetSize();
407  int half_size = std::min( bmsize.x, bmsize.y )/2;
408  wxBitmap newBm( *m_bitmapRGB );
409  bitmapDC.SelectObject( newBm );
410 
411  // Use Y axis from bottom to top and origin to center
412  bitmapDC.SetAxisOrientation( true, true );
413  bitmapDC.SetDeviceOrigin( half_size, half_size );
414 
415  // Reserve room to draw cursors inside the bitmap
416  half_size -= m_cursorsSize/2;
417 
418  // Draw the 3 RGB cursors, usiing white color to make them always visible:
419  wxPen pen( wxColor( 255, 255, 255 ) );
420  wxBrush brush( wxColor( 0, 0, 0 ), wxBRUSHSTYLE_TRANSPARENT );
421  bitmapDC.SetPen( pen );
422  bitmapDC.SetBrush( brush );
423  int half_csize = m_cursorsSize/2;
424 
425  #define SLOPE_AXIS 50.0
426  double slope = SLOPE_AXIS/half_size;
427 
428  // Red axis cursor (Z 3Daxis):
429  m_cursorBitmapRed.x = 0;
430  m_cursorBitmapRed.y = m_newColor4D.r * half_size;
431  bitmapDC.DrawRectangle( m_cursorBitmapRed.x - half_csize,
432  m_cursorBitmapRed.y - half_csize,
434 
435  // Blue axis cursor (X 3Daxis):
436  m_cursorBitmapBlue.x = m_newColor4D.b * half_size;
438  bitmapDC.DrawRectangle( m_cursorBitmapBlue.x - half_csize,
439  m_cursorBitmapBlue.y - half_csize,
441 
442  // Green axis cursor (Y 3Daxis):
443  m_cursorBitmapGreen.x = m_newColor4D.g * half_size;
446 
447  bitmapDC.DrawRectangle( m_cursorBitmapGreen.x - half_csize,
448  m_cursorBitmapGreen.y - half_csize,
450 
451  // Draw the 3 RGB axis:
452  half_size += half_size/5;
453  bitmapDC.DrawLine( 0, 0, 0, half_size ); // Red axis (Z 3D axis)
454  bitmapDC.DrawLine( 0, 0, half_size, - half_size*slope ); // Blue axis (X 3D axis)
455  bitmapDC.DrawLine( 0, 0, -half_size, - half_size*slope ); // green axis (Y 3D axis)
456 
457  m_RgbBitmap->SetBitmap( newBm );
458  /* Deselect the Tool Bitmap from DC,
459  * in order to delete the MemoryDC safely without deleting the bitmap */
460  bitmapDC.SelectObject( wxNullBitmap );
461 }
double g
Green component.
Definition: color4d.h:288
KIGFX::COLOR4D m_newColor4D
the current color4d
double b
Blue component.
Definition: color4d.h:289
void createRGBBitmap()
generate the bitmap that shows the RVB color space
wxPoint m_cursorBitmapRed
the red cursor on the RGB bitmap palette.
wxPoint m_cursorBitmapBlue
the blue cursor on the RGB bitmap palette.
wxBitmap * m_bitmapRGB
the basic RGB palette
double r
Red component.
Definition: color4d.h:287
#define SLOPE_AXIS
wxPoint m_cursorBitmapGreen
the green cursor on the RGB bitmap palette.
#define min(a, b)
Definition: auxiliary.h:85
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 221 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::IsQuasiModal().

222 {
223  // so we can do logging of this state change:
224 
225 #if defined(DEBUG)
226  const char* type_id = typeid( *this ).name();
227  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
228 #endif
229 
230  return wxDialog::Enable( enable );
231 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 381 of file dialog_shim.cpp.

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, and DIALOG_SHIM::Show().

Referenced by DIALOG_SHIM::OnButton(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), DIALOG_SHIM::SetInitialFocus(), and DIALOG_SHIM::~DIALOG_SHIM().

382 {
383  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
384  // handle validation in the same way as other dialogs.
385  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
386  return;
387 
388  SetReturnCode( retCode );
389 
390  if( !IsQuasiModal() )
391  {
392  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
393  return;
394  }
395 
396  if( m_qmodal_loop )
397  {
398  if( m_qmodal_loop->IsRunning() )
399  m_qmodal_loop->Exit( 0 );
400  else
401  m_qmodal_loop->ScheduleExit( 0 );
402 
403  m_qmodal_loop = NULL;
404  }
405 
408 
409  Show( false );
410 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:153
bool IsQuasiModal()
Definition: dialog_shim.h:95
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:155
void DIALOG_SHIM::FinishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

FinishDialogSettings must be called from derived classes, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 120 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(), DIALOG_FP_BROWSER_DISPLAY_OPTIONS::DIALOG_FP_BROWSER_DISPLAY_OPTIONS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PAGED_DIALOG::finishInitialization(), DIALOG_SHIM::GetUserUnits(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), and TransferDataToWindow().

121 {
122  // must be called from the constructor of derived classes,
123  // when all widgets are initialized, and therefore their size fixed
124 
125  // SetSizeHints fixes the minimal size of sizers in the dialog
126  // (SetSizeHints calls Fit(), so no need to call it)
127  GetSizer()->SetSizeHints( this );
128 
129  // the default position, when calling the first time the dlg
130  Center();
131 }
KIGFX::COLOR4D DIALOG_COLOR_PICKER::GetColor ( )
inline
int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

Convert an integer number of dialog units to pixels, horizontally.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 141 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), and DIALOG_SHIM::GetUserUnits().

142 {
143  wxSize sz( x, 0 );
144  return ConvertDialogToPixels( sz ).x;
145 }
void DIALOG_COLOR_PICKER::initDefinedColors ( CUSTOM_COLORS_LIST aPredefinedColors)
private

creates the bitmap buttons for each defined colors if aPredefinedColors is nullptr, a internal predefined list will be used

Definition at line 143 of file dialog_color_picker.cpp.

References buttColorClick(), g_ColorRefs, ID_COLOR_BLACK, m_buttonsColor, CUSTOM_COLOR_ITEM::m_Color, m_Color4DList, CUSTOM_COLOR_ITEM::m_ColorName, DIALOG_COLOR_PICKER_BASE::m_fgridColor, DIALOG_COLOR_PICKER_BASE::m_panelDefinedColors, and NBCOLORS.

Referenced by DIALOG_COLOR_PICKER().

144 {
145  #define ID_COLOR_BLACK 2000 // colors_id = ID_COLOR_BLACK a ID_COLOR_BLACK + NBCOLORS-1
146 
147  // Size of color swatches
148  const int w = 32, h = 32;
149 
150  // Colors are built from the g_ColorRefs table (size NBCOLORS).
151  // The look is better when g_ColorRefs order is displayed in a grid matrix
152  // of 6 row and 5 columns, first filling a row, and after the next column.
153  // But the wxFlexGrid used here must be filled by columns, then next row
154  // the best interval g_ColorRefs from a matrix row to the next row is 6
155  // So when have to reorder the index used to explore g_ColorRefs
156  int grid_col = 0;
157  int grid_row = 0;
158  int table_row_count = 6;
159 
160  // If no predefined list is given, build the default predefined colors:
161  if( aPredefinedColors )
162  {
163  for( unsigned jj = 0; jj < aPredefinedColors->size() && jj < NBCOLORS; ++jj )
164  {
165  CUSTOM_COLOR_ITEM* item = & *aPredefinedColors->begin() + jj;
166  int butt_ID = ID_COLOR_BLACK + jj;
167  wxMemoryDC iconDC;
168  wxBitmap ButtBitmap( w, h );
169  wxBrush brush;
170 
171  iconDC.SelectObject( ButtBitmap );
172 
173  KIGFX::COLOR4D buttcolor = item->m_Color;
174 
175  iconDC.SetPen( *wxBLACK_PEN );
176  brush.SetColour( buttcolor.ToColour() );
177  brush.SetStyle( wxBRUSHSTYLE_SOLID );
178 
179  iconDC.SetBrush( brush );
180  iconDC.SetBackground( *wxGREY_BRUSH );
181  iconDC.Clear();
182  iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 );
183 
184  wxBitmapButton* bitmapButton = new wxBitmapButton( m_panelDefinedColors, butt_ID, ButtBitmap,
185  wxDefaultPosition, wxSize( w+8, h+6 ) );
186  m_fgridColor->Add( bitmapButton, 0,
187  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
188  wxLEFT | wxBOTTOM, 5 );
189 
190  wxStaticText* label = new wxStaticText( m_panelDefinedColors, -1,
191  item->m_ColorName,
192  wxDefaultPosition, wxDefaultSize, 0 );
193  m_fgridColor->Add( label, 1,
194  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
195  wxLEFT | wxRIGHT | wxBOTTOM, 5 );
196  m_buttonsColor.push_back( bitmapButton );
197 
198  m_Color4DList.push_back( buttcolor );
199 
200  bitmapButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
201  wxCommandEventHandler( DIALOG_COLOR_PICKER::buttColorClick ), NULL, this );
202  }
203  }
204  else
205  {
206  m_Color4DList.assign( NBCOLORS, KIGFX::COLOR4D( 0.0, 0.0, 0.0, 1.0 ) );
207 
208  for( int jj = 0; jj < NBCOLORS; ++jj, grid_col++ )
209  {
210  if( grid_col*table_row_count >= NBCOLORS )
211  { // the current grid row is filled, and we must fill the next grid row
212  grid_col = 0;
213  grid_row++;
214  }
215 
216  int ii = grid_row + (grid_col*table_row_count); // The index in g_ColorRefs
217 
218  int butt_ID = ID_COLOR_BLACK + ii;
219  wxMemoryDC iconDC;
220  wxBitmap ButtBitmap( w, h );
221  wxBrush brush;
222 
223  iconDC.SelectObject( ButtBitmap );
224 
225  KIGFX::COLOR4D buttcolor = KIGFX::COLOR4D( g_ColorRefs[ii].m_Numcolor );
226  m_Color4DList[ butt_ID - ID_COLOR_BLACK ] = buttcolor;
227 
228  iconDC.SetPen( *wxBLACK_PEN );
229  brush.SetColour( buttcolor.ToColour() );
230  brush.SetStyle( wxBRUSHSTYLE_SOLID );
231 
232  iconDC.SetBrush( brush );
233  iconDC.SetBackground( *wxGREY_BRUSH );
234  iconDC.Clear();
235  iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 );
236 
237  wxBitmapButton* bitmapButton = new wxBitmapButton( m_panelDefinedColors, butt_ID, ButtBitmap,
238  wxDefaultPosition, wxSize( w+8, h+6 ) );
239  m_fgridColor->Add( bitmapButton, 0,
240  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
241  wxLEFT | wxBOTTOM, 5 );
242 
243  wxStaticText* label = new wxStaticText( m_panelDefinedColors, -1,
244  wxGetTranslation( g_ColorRefs[ii].m_ColorName ),
245  wxDefaultPosition, wxDefaultSize, 0 );
246  m_fgridColor->Add( label, 1,
247  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
248  wxLEFT | wxRIGHT | wxBOTTOM, 5 );
249  m_buttonsColor.push_back( bitmapButton );
250  bitmapButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
251  wxCommandEventHandler( DIALOG_COLOR_PICKER::buttColorClick ), NULL, this );
252  }
253  }
254 }
std::vector< KIGFX::COLOR4D > m_Color4DList
the list of color4d ordered by button ID, for predefined colors
a class to handle a custom color (predefined color) for the color picker dialog
void buttColorClick(wxCommandEvent &event)
Event handler for defined color buttons
const StructColors g_ColorRefs[NBCOLORS]
The predefined colors used in KiCad.
Definition: colors.cpp:37
std::vector< wxBitmapButton * > m_buttonsColor
list of defined colors buttons
KIGFX::COLOR4D m_Color
Number of colors.
Definition: colors.h:75
#define ID_COLOR_BLACK
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::GetUserUnits(), KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), KIWAY_HOLDER::SetKiway(), and VTBL_ENTRY.

Referenced by TREEPROJECT_ITEM::Activate(), PCB_BASE_EDIT_FRAME::AddLibrary(), SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), KICAD_MANAGER_FRAME::OnEditFpLibTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnEditSymLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), EDA_BASE_FRAME::ShowPreferences(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:94
int DIALOG_COLOR_PICKER::normalizeToInt ( double  aValue,
int  aValMax = 255 
)
inlineprivate

Definition at line 169 of file dialog_color_picker.h.

Referenced by SetEditVals().

170  {
171  return ( aValue * aValMax ) + 0.5;
172  }
void DIALOG_COLOR_PICKER::OnChangeAlpha ( wxScrollEvent &  event)
overrideprivatevirtual

Event handlers from wxSpinControl.

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 722 of file dialog_color_picker.cpp.

References KIGFX::COLOR4D::a, ALPHA_MAX, m_newColor4D, DIALOG_COLOR_PICKER_BASE::m_NewColorRect, and setIconColor().

723 {
724  double alpha = (double)event.GetPosition() / ALPHA_MAX;
725  m_newColor4D.a = alpha;
726  m_NewColorRect->Freeze(); // Avoid flicker
728  m_NewColorRect->Thaw();
729  m_NewColorRect->Refresh();
730 }
void setIconColor(wxStaticBitmap *aStaticBitmap, KIGFX::COLOR4D &aColor4D)
repaint a static bitmap with the aColor4D color
KIGFX::COLOR4D m_newColor4D
the current color4d
double a
Alpha component.
Definition: color4d.h:290
#define ALPHA_MAX
void DIALOG_COLOR_PICKER::OnChangeBrightness ( wxScrollEvent &  event)
overrideprivatevirtual

Event handler from wxSlider: alpha (transparency) control.

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 787 of file dialog_color_picker.cpp.

References drawAll(), KIGFX::COLOR4D::FromHSV(), m_hue, m_newColor4D, m_sat, m_val, SetEditVals(), and VAL_CHANGED.

788 {
789  m_val = (double)event.GetPosition() / 255.0;
790 
792 
794 
795  drawAll();
796 }
double m_hue
the current hue, in degrees (0 ... 360)
double m_sat
the current saturation (0 ... 1.0)
void SetEditVals(CHANGED_COLOR aChanged)
KIGFX::COLOR4D m_newColor4D
the current color4d
void FromHSV(double aInH, double aInS, double aInV)
Function FromHSV() Changes currently used color to the one given by hue, saturation and value paramet...
Definition: color4d.cpp:339
double m_val
the current value (0 ... 1.0)
void DIALOG_COLOR_PICKER::OnChangeEditBlue ( wxSpinEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 753 of file dialog_color_picker.cpp.

References KIGFX::COLOR4D::b, BLUE_CHANGED, drawAll(), m_newColor4D, and SetEditVals().

754 {
755  double val = (double)event.GetPosition() / 255.0;
756  m_newColor4D.b = val;
758 
759  drawAll();
760 }
void SetEditVals(CHANGED_COLOR aChanged)
KIGFX::COLOR4D m_newColor4D
the current color4d
double b
Blue component.
Definition: color4d.h:289
void DIALOG_COLOR_PICKER::OnChangeEditGreen ( wxSpinEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 743 of file dialog_color_picker.cpp.

References drawAll(), KIGFX::COLOR4D::g, GREEN_CHANGED, m_newColor4D, and SetEditVals().

744 {
745  double val = (double)event.GetPosition() / 255.0;
746  m_newColor4D.g = val;
748 
749  drawAll();
750 }
void SetEditVals(CHANGED_COLOR aChanged)
double g
Green component.
Definition: color4d.h:288
KIGFX::COLOR4D m_newColor4D
the current color4d
void DIALOG_COLOR_PICKER::OnChangeEditHue ( wxSpinEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 763 of file dialog_color_picker.cpp.

References drawAll(), KIGFX::COLOR4D::FromHSV(), HUE_CHANGED, m_hue, m_newColor4D, m_sat, m_val, and SetEditVals().

764 {
765  m_hue = (double)event.GetPosition();
766 
768 
770 
771  drawAll();
772 }
double m_hue
the current hue, in degrees (0 ... 360)
double m_sat
the current saturation (0 ... 1.0)
void SetEditVals(CHANGED_COLOR aChanged)
KIGFX::COLOR4D m_newColor4D
the current color4d
void FromHSV(double aInH, double aInS, double aInV)
Function FromHSV() Changes currently used color to the one given by hue, saturation and value paramet...
Definition: color4d.cpp:339
double m_val
the current value (0 ... 1.0)
void DIALOG_COLOR_PICKER::OnChangeEditRed ( wxSpinEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 733 of file dialog_color_picker.cpp.

References drawAll(), m_newColor4D, KIGFX::COLOR4D::r, RED_CHANGED, and SetEditVals().

734 {
735  double val = (double)event.GetPosition() / 255.0;
736  m_newColor4D.r = val;
738 
739  drawAll();
740 }
void SetEditVals(CHANGED_COLOR aChanged)
KIGFX::COLOR4D m_newColor4D
the current color4d
double r
Red component.
Definition: color4d.h:287
void DIALOG_COLOR_PICKER::OnChangeEditSat ( wxSpinEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 775 of file dialog_color_picker.cpp.

References drawAll(), KIGFX::COLOR4D::FromHSV(), m_hue, m_newColor4D, m_sat, m_val, SAT_CHANGED, and SetEditVals().

776 {
777  m_sat = (double)event.GetPosition() / 255.0;
778 
780 
782 
783  drawAll();
784 }
double m_hue
the current hue, in degrees (0 ... 360)
double m_sat
the current saturation (0 ... 1.0)
void SetEditVals(CHANGED_COLOR aChanged)
KIGFX::COLOR4D m_newColor4D
the current color4d
void FromHSV(double aInH, double aInS, double aInV)
Function FromHSV() Changes currently used color to the one given by hue, saturation and value paramet...
Definition: color4d.cpp:339
double m_val
the current value (0 ... 1.0)
void DIALOG_COLOR_PICKER::onHSVMouseClick ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 665 of file dialog_color_picker.cpp.

References drawAll(), m_allowMouseEvents, and setHSvaluesFromCursor().

666 {
667  m_allowMouseEvents = true;
668 
669  if( setHSvaluesFromCursor( event.GetPosition() ) )
670  drawAll();
671 }
bool setHSvaluesFromCursor(wxPoint aMouseCursor)
manage the Hue and Saturation settings when the mouse cursor is at aMouseCursor.
void DIALOG_COLOR_PICKER::onHSVMouseDrag ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 674 of file dialog_color_picker.cpp.

References drawAll(), m_allowMouseEvents, and setHSvaluesFromCursor().

675 {
676  if( !event.Dragging() || !m_allowMouseEvents )
677  return;
678 
679  if( setHSvaluesFromCursor( event.GetPosition() ) )
680  drawAll();
681 }
bool setHSvaluesFromCursor(wxPoint aMouseCursor)
manage the Hue and Saturation settings when the mouse cursor is at aMouseCursor.
void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 283 of file dialog_shim.cpp.

References DIALOG_SHIM::m_firstPaintEvent, and DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and DIALOG_SHIM::IsQuasiModal().

284 {
285  if( m_firstPaintEvent )
286  {
287 #ifdef __WXMAC__
288  fixOSXCancelButtonIssue( this );
289  selectAllInTextCtrls( GetChildren() );
290 #endif
291 
293  m_initialFocusTarget->SetFocus();
294  else
295  SetFocus(); // Focus the dialog itself
296 
297  m_firstPaintEvent = false;
298  }
299 
300  event.Skip();
301 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:150
bool m_firstPaintEvent
Definition: dialog_shim.h:149
void DIALOG_COLOR_PICKER::onRGBMouseClick ( wxMouseEvent &  event)
overrideprivatevirtual

mouse handlers, when clicking on a palette bitmap

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 567 of file dialog_color_picker.cpp.

References abs, dist, m_allowMouseEvents, m_bitmapRGB, m_cursorBitmapBlue, m_cursorBitmapGreen, m_cursorBitmapRed, m_cursorsSize, m_selectedCursor, min, wxPoint::x, and wxPoint::y.

568 {
569  m_allowMouseEvents = true;
570  wxPoint mousePos = event.GetPosition();
571 
572  // The cursor position is relative to the m_bitmapHSV wxBitmap center
573  wxSize bmsize = m_bitmapRGB->GetSize();
574  int half_size = std::min( bmsize.x, bmsize.y )/2;
575  mousePos.x -= half_size;
576  mousePos.y -= half_size;
577  mousePos.y = -mousePos.y; // Use the bottom to top vertical axis
578 
579  wxPoint dist = m_cursorBitmapRed - mousePos;
580 
581  if( std::abs( dist.x ) <= m_cursorsSize/2 && std::abs( dist.y ) <= m_cursorsSize/2 )
582  {
584  return;
585  }
586 
587  dist = m_cursorBitmapGreen - mousePos;
588 
589  if( std::abs( dist.x ) <= m_cursorsSize/2 && std::abs( dist.y ) <= m_cursorsSize/2 )
590  {
592  return;
593  }
594 
595  dist = m_cursorBitmapBlue - mousePos;
596 
597  if( std::abs( dist.x ) <= m_cursorsSize/2 && std::abs( dist.y ) <= m_cursorsSize/2 )
598  {
600  return;
601  }
602 
603  m_selectedCursor = nullptr;
604 }
static const int dist[10][10]
Definition: ar_matrix.cpp:320
#define abs(a)
Definition: auxiliary.h:84
wxPoint m_cursorBitmapRed
the red cursor on the RGB bitmap palette.
wxPoint m_cursorBitmapBlue
the blue cursor on the RGB bitmap palette.
wxBitmap * m_bitmapRGB
the basic RGB palette
wxPoint m_cursorBitmapGreen
the green cursor on the RGB bitmap palette.
#define min(a, b)
Definition: auxiliary.h:85
wxPoint * m_selectedCursor
the ref cursor to the selected curor, if any, or null.
void DIALOG_COLOR_PICKER::onRGBMouseDrag ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_COLOR_PICKER_BASE.

Definition at line 607 of file dialog_color_picker.cpp.

References ALL_CHANGED, KIGFX::COLOR4D::b, drawAll(), KIGFX::COLOR4D::g, m_allowMouseEvents, m_bitmapRGB, m_cursorBitmapBlue, m_cursorBitmapGreen, m_cursorBitmapRed, m_cursorsSize, m_hue, m_newColor4D, m_sat, m_selectedCursor, m_val, min, KIGFX::COLOR4D::r, SetEditVals(), KIGFX::COLOR4D::ToHSV(), wxPoint::x, and wxPoint::y.

608 {
609  if( !event.Dragging() || !m_allowMouseEvents )
610  {
611  m_selectedCursor = nullptr;
612  return;
613  }
614 
618  return;
619 
620  // Adjust the HSV cursor position to follow the mouse cursor
621  // The cursor position is relative to the m_bitmapHSV wxBitmap center
622  wxPoint mousePos = event.GetPosition();
623  wxSize bmsize = m_bitmapRGB->GetSize();
624  int half_size = std::min( bmsize.x, bmsize.y )/2;
625  mousePos.x -= half_size;
626  mousePos.y -= half_size;
627  mousePos.y = -mousePos.y; // Use the bottom to top vertical axis
628 
629  half_size -= m_cursorsSize/2; // the actual half_size of the palette area
630 
631  // Change colors according to the selected cursor:
633  {
634  if( mousePos.y >= 0 && mousePos.y <= half_size )
635  m_newColor4D.r = (double)mousePos.y / half_size;
636  else
637  return;
638  }
639 
641  {
642  mousePos.x = -mousePos.x;
643 
644  if( mousePos.x >= 0 && mousePos.x <= half_size )
645  m_newColor4D.g = (double)mousePos.x / half_size;
646  else
647  return;
648  }
649 
651  {
652  if( mousePos.x >= 0 && mousePos.x <= half_size )
653  m_newColor4D.b = (double)mousePos.x / half_size;
654  else
655  return;
656  }
657 
658  m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
660 
661  drawAll();
662 }
double m_hue
the current hue, in degrees (0 ... 360)
double m_sat
the current saturation (0 ... 1.0)
void SetEditVals(CHANGED_COLOR aChanged)
double g
Green component.
Definition: color4d.h:288
KIGFX::COLOR4D m_newColor4D
the current color4d
void ToHSV(double &aOutHue, double &aOutSaturation, double &aOutValue, bool aAlwaysDefineHue=false) const
Function ToHSV() Converts current color (stored in RGB) to HSV format.
Definition: color4d.cpp:286
double b
Blue component.
Definition: color4d.h:289
double m_val
the current value (0 ... 1.0)
wxPoint m_cursorBitmapRed
the red cursor on the RGB bitmap palette.
wxPoint m_cursorBitmapBlue
the blue cursor on the RGB bitmap palette.
wxBitmap * m_bitmapRGB
the basic RGB palette
double r
Red component.
Definition: color4d.h:287
wxPoint m_cursorBitmapGreen
the green cursor on the RGB bitmap palette.
#define min(a, b)
Definition: auxiliary.h:85
wxPoint * m_selectedCursor
the ref cursor to the selected curor, if any, or null.
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnConfigurePaths(), FOOTPRINT_EDIT_FRAME::OnConfigurePaths(), KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), KICAD_MANAGER_FRAME::OnRunGerbview(), DIALOG_BOM::OnRunPlugin(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), KICAD_MANAGER_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::saveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), KICAD_MANAGER_FRAME::SetProjectFileName(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), LAUNCHER_PANEL::~LAUNCHER_PANEL(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
void DIALOG_COLOR_PICKER::SetEditVals ( CHANGED_COLOR  aChanged)
private

Definition at line 504 of file dialog_color_picker.cpp.

References KIGFX::COLOR4D::a, ALPHA_MAX, KIGFX::COLOR4D::b, BLUE_CHANGED, KIGFX::COLOR4D::g, GREEN_CHANGED, HUE_CHANGED, m_hue, m_newColor4D, m_sat, DIALOG_COLOR_PICKER_BASE::m_sliderBrightness, DIALOG_COLOR_PICKER_BASE::m_sliderTransparency, DIALOG_COLOR_PICKER_BASE::m_spinCtrlBlue, DIALOG_COLOR_PICKER_BASE::m_spinCtrlGreen, DIALOG_COLOR_PICKER_BASE::m_spinCtrlHue, DIALOG_COLOR_PICKER_BASE::m_spinCtrlRed, DIALOG_COLOR_PICKER_BASE::m_spinCtrlSaturation, m_val, normalizeToInt(), KIGFX::COLOR4D::r, RED_CHANGED, SAT_CHANGED, KIGFX::COLOR4D::ToHSV(), and VAL_CHANGED.

Referenced by buttColorClick(), OnChangeBrightness(), OnChangeEditBlue(), OnChangeEditGreen(), OnChangeEditHue(), OnChangeEditRed(), OnChangeEditSat(), onRGBMouseDrag(), setHSvaluesFromCursor(), and TransferDataToWindow().

505 {
507 
508  if( aChanged == RED_CHANGED || aChanged == GREEN_CHANGED || aChanged == BLUE_CHANGED )
509  m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
510 
511  if( aChanged != RED_CHANGED )
512  m_spinCtrlRed->SetValue( normalizeToInt( m_newColor4D.r ) );
513 
514  if( aChanged != GREEN_CHANGED )
516 
517  if( aChanged != BLUE_CHANGED )
519 
520  if( aChanged != HUE_CHANGED )
521  m_spinCtrlHue->SetValue( (int)m_hue );
522 
523  if( aChanged != SAT_CHANGED )
524  m_spinCtrlSaturation->SetValue( m_sat * 255 );
525 
526  if( aChanged != VAL_CHANGED )
527  {
528  m_sliderBrightness->SetValue(normalizeToInt( m_val ) );
529  }
530 }
double m_hue
the current hue, in degrees (0 ... 360)
double m_sat
the current saturation (0 ... 1.0)
int normalizeToInt(double aValue, int aValMax=255)
double g
Green component.
Definition: color4d.h:288
KIGFX::COLOR4D m_newColor4D
the current color4d
void ToHSV(double &aOutHue, double &aOutSaturation, double &aOutValue, bool aAlwaysDefineHue=false) const
Function ToHSV() Converts current color (stored in RGB) to HSV format.
Definition: color4d.cpp:286
double b
Blue component.
Definition: color4d.h:289
double a
Alpha component.
Definition: color4d.h:290
#define ALPHA_MAX
double m_val
the current value (0 ... 1.0)
double r
Red component.
Definition: color4d.h:287
bool DIALOG_COLOR_PICKER::setHSvaluesFromCursor ( wxPoint  aMouseCursor)
private

manage the Hue and Saturation settings when the mouse cursor is at aMouseCursor.

Parameters
aMouseCursoris the mouse cursor position on the HSV bitmap
Returns
true if the Hue and Saturation can be set from aMouseCursor, if Saturation value computed from aMouseCursor is <= 1.0, and false if aMouseCursor is outside this area.

Definition at line 684 of file dialog_color_picker.cpp.

References ALL_CHANGED, KIGFX::COLOR4D::FromHSV(), m_bitmapHSV, m_cursorBitmapHSV, m_cursorsSize, m_hue, m_newColor4D, m_sat, m_val, min, SetEditVals(), wxPoint::x, and wxPoint::y.

Referenced by onHSVMouseClick(), and onHSVMouseDrag().

685 {
686  wxPoint mousePos = aMouseCursor;
687  wxSize bmsize = m_bitmapHSV->GetSize();
688  int half_size = std::min( bmsize.x, bmsize.y )/2;
689  // Make the cursor position relative to the m_bitmapHSV wxBitmap center
690  mousePos.x -= half_size;
691  mousePos.y -= half_size;
692  mousePos.y = -mousePos.y; // Use the bottom to top vertical axis
693 
694  // The HS cursor position is restricted to a circle of radius half_size
695  double dist_from_centre = hypot( (double)mousePos.x, (double)mousePos.y );
696 
697  if( dist_from_centre > half_size )
698  // Saturation cannot be calculated:
699  return false;
700 
701  m_cursorBitmapHSV = mousePos;
702 
703  // Set saturation and hue from new cursor position:
704  half_size -= m_cursorsSize/2; // the actual half_size of the palette area
705  m_sat = dist_from_centre / half_size;
706 
707  if( m_sat > 1.0 )
708  m_sat = 1.0;
709 
710  m_hue = atan2( mousePos.y, mousePos.x ) / M_PI * 180.0;
711 
712  if( m_hue < 0 )
713  m_hue += 360.0;
714 
717 
718  return true;
719 }
double m_hue
the current hue, in degrees (0 ... 360)
double m_sat
the current saturation (0 ... 1.0)
void SetEditVals(CHANGED_COLOR aChanged)
KIGFX::COLOR4D m_newColor4D
the current color4d
wxPoint m_cursorBitmapHSV
the cursor on the HSV bitmap palette.
wxBitmap * m_bitmapHSV
the basic HUV palette
void FromHSV(double aInH, double aInS, double aInV)
Function FromHSV() Changes currently used color to the one given by hue, saturation and value paramet...
Definition: color4d.cpp:339
double m_val
the current value (0 ... 1.0)
#define min(a, b)
Definition: auxiliary.h:85
void DIALOG_COLOR_PICKER::setIconColor ( wxStaticBitmap *  aStaticBitmap,
KIGFX::COLOR4D aColor4D 
)
private

repaint a static bitmap with the aColor4D color

Event handler from wxSlider: brightness (value) control

Definition at line 72 of file dialog_color_picker.cpp.

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, and KIGFX::COLOR4D::r.

Referenced by drawAll(), OnChangeAlpha(), and TransferDataToWindow().

73 {
74  // Draw the icon that shows the aColor4D,
75  // with colors according to the color 4D rgb and alpha
76  // for alpha = 1 (no tranparency, the icon is a full rgb color rect
77  // for alpha = 0 (100% tranparency, the icon is a grid of rgb color
78  // and background color small sub rect
79  wxMemoryDC bitmapDC;
80  wxSize size = aStaticBitmap->GetSize();
81  wxBitmap newBm( size );
82  bitmapDC.SelectObject( newBm );
83  wxPen pen( aColor4D.ToColour() );
84  wxBrush brush( aColor4D.ToColour() );
85 
86  // clear background (set bg color to aColor4D )
87  bitmapDC.SetBackground( brush );
88  bitmapDC.Clear();
89 
90 
91  // Draw the alpha subrect
92  int stepx = size.x/8;
93  int stepy = size.y/8;
94 
95  // build the alpha color for icon:
96  // the alpha color is the initial color modified to be
97  // the initial color for transparency = 0 ( alpha = 1 )
98  // and white color for transparency = 1( alpha = 0 )
99  KIGFX::COLOR4D bgcolor( GetBackgroundColour() );
100  KIGFX::COLOR4D alphacolor = aColor4D;
101  alphacolor.r = ( alphacolor.r * aColor4D.a ) + ( bgcolor.r * (1-aColor4D.a) );
102  alphacolor.g = ( alphacolor.g * aColor4D.a ) + ( bgcolor.g * (1-aColor4D.a) );
103  alphacolor.b = ( alphacolor.b * aColor4D.a ) + ( bgcolor.b * (1-aColor4D.a) );
104 
105  pen.SetColour( alphacolor.ToColour() );
106  brush.SetColour( alphacolor.ToColour() );
107  bitmapDC.SetPen( pen );
108  bitmapDC.SetBrush( brush );
109 
110  for( int ii = 0; ii < size.x/stepx; ii+=2 )
111  {
112  for( int jj = 0; jj < size.y/stepy; jj+= 2 )
113  {
114  wxPoint pos( stepx*ii + stepx/2, stepy*jj + stepy/2 );
115  bitmapDC.DrawRectangle( pos, wxSize( stepx, stepy ) );
116  }
117  }
118 
119  aStaticBitmap->SetBitmap( newBm );
120 
121  // Deselect the Tool Bitmap from DC, in order to delete the MemoryDC
122  // safely without deleting the bitmap
123  bitmapDC.SelectObject( wxNullBitmap );
124 }
double g
Green component.
Definition: color4d.h:288
double b
Blue component.
Definition: color4d.h:289
double a
Alpha component.
Definition: color4d.h:290
double r
Red component.
Definition: color4d.h:287
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.

Definition at line 86 of file dialog_shim.h.

References DIALOG_SHIM::EndQuasiModal(), DIALOG_SHIM::m_initialFocusTarget, and DIALOG_SHIM::ShowQuasiModal().

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchAllClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchRefClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchSelectedClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchValueClicked(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), and LIB_EDIT_FRAME::savePartAs().

87  {
88  m_initialFocusTarget = aWindow;
89  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:150
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 47 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), InvokePcbLibTableEditor(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

48 {
49 #if defined(DEBUG)
50  // offer a trap point for debugging most any window
51  wxASSERT( aDest );
52  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
53  {
54  int breakhere=1;
55  (void) breakhere;
56  }
57 #endif
58 
59  (void) aDest;
60 
61  m_kiway = aKiway;
62 }
KIWAY * m_kiway
Definition: kiway_player.h:94
const char * name
Definition: DXF_plotter.cpp:61
void DIALOG_SHIM::SetSizeInDU ( int  x,
int  y 
)
protectedinherited

Set the dialog to the given dimensions in "dialog units".

These are units equivalent to 4* the average character width and 8* the average character height, allowing a dialog to be sized in a way that scales it with the system font.

Definition at line 134 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::GetUserUnits(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

135 {
136  wxSize sz( x, y );
137  SetSize( ConvertDialogToPixels( sz ) );
138 }
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 162 of file dialog_shim.cpp.

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, max, wxPoint::x, and wxPoint::y.

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_SHIM::IsQuasiModal(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

163 {
164  bool ret;
165  const char* hash_key;
166 
167  if( m_hash_key.size() )
168  {
169  // a special case like EDA_LIST_DIALOG, which has multiple uses.
170  hash_key = m_hash_key.c_str();
171  }
172  else
173  {
174  hash_key = typeid(*this).name();
175  }
176 
177  // Show or hide the window. If hiding, save current position and size.
178  // If showing, use previous position and size.
179  if( show )
180  {
181 #ifndef __WINDOWS__
182  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
183 #endif
184  ret = wxDialog::Show( show );
185 
186  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
187  EDA_RECT savedDialogRect = class_map[ hash_key ];
188 
189  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
190  {
191  SetSize( savedDialogRect.GetPosition().x,
192  savedDialogRect.GetPosition().y,
193  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
194  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
195  0 );
196  }
197 
198  // Be sure that the dialog appears in a visible area
199  // (the dialog position might have been stored at the time when it was
200  // shown on another display)
201  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
202  Centre();
203  }
204  else
205  {
206  // Save the dialog's position & size before hiding, using classname as key
207  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
208 
209 #ifdef __WXMAC__
210  if ( m_eventLoop )
211  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
212 #endif
213 
214  ret = wxDialog::Show( show );
215  }
216 
217  return ret;
218 }
const wxSize GetSize() const
Definition: eda_rect.h:101
std::string m_hash_key
Definition: dialog_shim.h:144
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:113
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 327 of file dialog_shim.cpp.

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, DIALOG_SHIM::Show(), and WX_EVENT_LOOP.

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), SCH_EDIT_FRAME::InstallHierarchyFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogUpdateFields(), LIB_EDIT_FRAME::OnEditComponentProperties(), PCB_EDIT_FRAME::OnEditTracksAndVias(), SCH_EDIT_FRAME::OnLaunchBomManager(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), and DIALOG_SHIM::SetInitialFocus().

328 {
329  // This is an exception safe way to zero a pointer before returning.
330  // Yes, even though DismissModal() clears this first normally, this is
331  // here in case there's an exception before the dialog is dismissed.
332  struct NULLER
333  {
334  void*& m_what;
335  NULLER( void*& aPtr ) : m_what( aPtr ) {}
336  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
337  } clear_this( (void*&) m_qmodal_loop );
338 
339  // release the mouse if it's currently captured as the window having it
340  // will be disabled when this dialog is shown -- but will still keep the
341  // capture making it impossible to do anything in the modal dialog itself
342  wxWindow* win = wxWindow::GetCapture();
343  if( win )
344  win->ReleaseMouse();
345 
346  // Get the optimal parent
347  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
348 
349  // Show the optimal parent
350  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
351 
352  wxASSERT_MSG( !m_qmodal_parent_disabler,
353  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
354 
355  // quasi-modal: disable only my "optimal" parent
357 
358 #ifdef __WXMAC__
359  // Apple in its infinite wisdom will raise a disabled window before even passing
360  // us the event, so we have no way to stop it. Instead, we must set an order on
361  // the windows so that the quasi-modal will be pushed in front of the disabled
362  // window when it is raised.
363  ReparentQuasiModal();
364 #endif
365  Show( true );
366 
367  m_qmodal_showing = true;
368 
369  WX_EVENT_LOOP event_loop;
370 
371  m_qmodal_loop = &event_loop;
372 
373  event_loop.Run();
374 
375  m_qmodal_showing = false;
376 
377  return GetReturnCode();
378 }
bool m_qmodal_showing
Definition: dialog_shim.h:154
#define WX_EVENT_LOOP
Definition: kiway_player.h:100
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:153
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:155
Toggle a window&#39;s "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33
bool DIALOG_COLOR_PICKER::TransferDataToWindow ( )
overrideprivate

called when creating the dialog

Definition at line 127 of file dialog_color_picker.cpp.

References ALL_CHANGED, drawAll(), DIALOG_SHIM::FinishDialogSettings(), DIALOG_COLOR_PICKER_BASE::m_notebook, DIALOG_COLOR_PICKER_BASE::m_OldColorRect, m_previousColor4D, SetEditVals(), and setIconColor().

128 {
129  // Draw all bitmaps, with colors according to the color 4D
132  drawAll();
133 
134  m_notebook->GetPage( 0 )->Layout();
135  m_notebook->GetPage( 1 )->Layout();
136 
138 
139  return true;
140 }
void SetEditVals(CHANGED_COLOR aChanged)
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void setIconColor(wxStaticBitmap *aStaticBitmap, KIGFX::COLOR4D &aColor4D)
repaint a static bitmap with the aColor4D color
KIGFX::COLOR4D m_previousColor4D
the inital color4d
int DIALOG_SHIM::VertPixelsFromDU ( int  y)
protectedinherited

Convert an integer number of dialog units to pixels, vertically.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 148 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), and DIALOG_SHIM::GetUserUnits().

149 {
150  wxSize sz( 0, y );
151  return ConvertDialogToPixels( sz ).y;
152 }

Member Data Documentation

int DIALOG_COLOR_PICKER::m_ActivePage = 0
static

the active notebook page, stored during a session

Definition at line 82 of file dialog_color_picker.h.

Referenced by DIALOG_COLOR_PICKER(), and ~DIALOG_COLOR_PICKER().

bool DIALOG_COLOR_PICKER::m_allowMouseEvents
private
bool DIALOG_COLOR_PICKER::m_allowOpacityCtrl
private

true to show the widget, false to keep alpha channel = 1.0

Definition at line 94 of file dialog_color_picker.h.

Referenced by DIALOG_COLOR_PICKER().

wxBitmap* DIALOG_COLOR_PICKER::m_bitmapHSV
private
wxBitmap* DIALOG_COLOR_PICKER::m_bitmapRGB
private
std::vector<wxBitmapButton*> DIALOG_COLOR_PICKER::m_buttonsColor
private

list of defined colors buttons

Definition at line 115 of file dialog_color_picker.h.

Referenced by initDefinedColors(), and ~DIALOG_COLOR_PICKER().

std::vector<KIGFX::COLOR4D> DIALOG_COLOR_PICKER::m_Color4DList
private

the list of color4d ordered by button ID, for predefined colors

Definition at line 99 of file dialog_color_picker.h.

Referenced by buttColorClick(), and initDefinedColors().

wxPoint DIALOG_COLOR_PICKER::m_cursorBitmapBlue
private

the blue cursor on the RGB bitmap palette.

Definition at line 104 of file dialog_color_picker.h.

Referenced by drawRGBPalette(), onRGBMouseClick(), and onRGBMouseDrag().

wxPoint DIALOG_COLOR_PICKER::m_cursorBitmapGreen
private

the green cursor on the RGB bitmap palette.

Definition at line 103 of file dialog_color_picker.h.

Referenced by drawRGBPalette(), onRGBMouseClick(), and onRGBMouseDrag().

wxPoint DIALOG_COLOR_PICKER::m_cursorBitmapHSV
private

the cursor on the HSV bitmap palette.

Definition at line 105 of file dialog_color_picker.h.

Referenced by drawHSVPalette(), and setHSvaluesFromCursor().

wxPoint DIALOG_COLOR_PICKER::m_cursorBitmapRed
private

the red cursor on the RGB bitmap palette.

Definition at line 102 of file dialog_color_picker.h.

Referenced by drawRGBPalette(), onRGBMouseClick(), and onRGBMouseDrag().

int DIALOG_COLOR_PICKER::m_cursorsSize
private
wxFlexGridSizer* DIALOG_COLOR_PICKER_BASE::m_fgridColor
protectedinherited
bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 149 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

wxStaticBitmap* DIALOG_COLOR_PICKER_BASE::m_HsvBitmap
protectedinherited
double DIALOG_COLOR_PICKER::m_hue
private
wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 150 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint(), and DIALOG_SHIM::SetInitialFocus().

wxStaticBitmap* DIALOG_COLOR_PICKER_BASE::m_NewColorRect
protectedinherited
wxNotebook* DIALOG_COLOR_PICKER_BASE::m_notebook
protectedinherited
wxStaticBitmap* DIALOG_COLOR_PICKER_BASE::m_OldColorRect
protectedinherited
wxStaticText* DIALOG_COLOR_PICKER_BASE::m_opacityLabel
protectedinherited
wxPanel* DIALOG_COLOR_PICKER_BASE::m_panelDefinedColors
protectedinherited
wxPanel* DIALOG_COLOR_PICKER_BASE::m_panelFreeColors
protectedinherited
KIGFX::COLOR4D DIALOG_COLOR_PICKER::m_previousColor4D
private

the inital color4d

Definition at line 96 of file dialog_color_picker.h.

Referenced by DIALOG_COLOR_PICKER(), and TransferDataToWindow().

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 153 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited

Definition at line 154 of file dialog_shim.h.

Referenced by DIALOG_SHIM::IsQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

wxStaticBitmap* DIALOG_COLOR_PICKER_BASE::m_RgbBitmap
protectedinherited
double DIALOG_COLOR_PICKER::m_sat
private
wxStdDialogButtonSizer* DIALOG_COLOR_PICKER_BASE::m_sdbSizer
protectedinherited
wxButton* DIALOG_COLOR_PICKER_BASE::m_sdbSizerCancel
protectedinherited
wxButton* DIALOG_COLOR_PICKER_BASE::m_sdbSizerOK
protectedinherited
wxPoint* DIALOG_COLOR_PICKER::m_selectedCursor
private

the ref cursor to the selected curor, if any, or null.

Definition at line 106 of file dialog_color_picker.h.

Referenced by DIALOG_COLOR_PICKER(), onRGBMouseClick(), and onRGBMouseDrag().

wxBoxSizer* DIALOG_COLOR_PICKER_BASE::m_SizerDefinedColors
protectedinherited
wxBoxSizer* DIALOG_COLOR_PICKER_BASE::m_SizerTransparency
protectedinherited
wxSlider* DIALOG_COLOR_PICKER_BASE::m_sliderBrightness
protectedinherited
wxSlider* DIALOG_COLOR_PICKER_BASE::m_sliderTransparency
protectedinherited
wxSpinCtrl* DIALOG_COLOR_PICKER_BASE::m_spinCtrlBlue
protectedinherited
wxSpinCtrl* DIALOG_COLOR_PICKER_BASE::m_spinCtrlGreen
protectedinherited
wxSpinCtrl* DIALOG_COLOR_PICKER_BASE::m_spinCtrlHue
protectedinherited
wxSpinCtrl* DIALOG_COLOR_PICKER_BASE::m_spinCtrlRed
protectedinherited
wxSpinCtrl* DIALOG_COLOR_PICKER_BASE::m_spinCtrlSaturation
protectedinherited
wxStaticLine* DIALOG_COLOR_PICKER_BASE::m_staticline
protectedinherited
wxStaticText* DIALOG_COLOR_PICKER_BASE::m_staticTextB
protectedinherited
wxStaticText* DIALOG_COLOR_PICKER_BASE::m_staticTextBright
protectedinherited
wxStaticText* DIALOG_COLOR_PICKER_BASE::m_staticTextG
protectedinherited
wxStaticText* DIALOG_COLOR_PICKER_BASE::m_staticTextHue
protectedinherited
wxStaticText* DIALOG_COLOR_PICKER_BASE::m_staticTextOldColor
protectedinherited
wxStaticText* DIALOG_COLOR_PICKER_BASE::m_staticTextR
protectedinherited
wxStaticText* DIALOG_COLOR_PICKER_BASE::m_staticTextSat
protectedinherited
double DIALOG_COLOR_PICKER::m_val
private

The documentation for this class was generated from the following files: