Double click on defined colour executes OK action

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8778
This commit is contained in:
Pradeepa Senanayake 2021-07-14 22:05:45 +10:00 committed by Jon Evans
parent ae55db77c5
commit 6cde086ef9
2 changed files with 13 additions and 0 deletions

View File

@ -184,6 +184,9 @@ void DIALOG_COLOR_PICKER::initDefinedColors( CUSTOM_COLORS_LIST* aPredefinedColo
swatch->Connect( wxEVT_LEFT_DOWN, swatch->Connect( wxEVT_LEFT_DOWN,
wxMouseEventHandler( DIALOG_COLOR_PICKER::buttColorClick ), wxMouseEventHandler( DIALOG_COLOR_PICKER::buttColorClick ),
NULL, this ); NULL, this );
swatch->Connect( wxEVT_LEFT_DCLICK,
wxMouseEventHandler( DIALOG_COLOR_PICKER::colorDClick ),
NULL, this );
}; };
// If no predefined list is given, build the default predefined colors: // If no predefined list is given, build the default predefined colors:
@ -523,6 +526,13 @@ void DIALOG_COLOR_PICKER::drawAll()
} }
void DIALOG_COLOR_PICKER::colorDClick( wxMouseEvent& event )
{
buttColorClick( event );
wxDialog::EndModal( wxID_OK );
}
void DIALOG_COLOR_PICKER::buttColorClick( wxMouseEvent& event ) void DIALOG_COLOR_PICKER::buttColorClick( wxMouseEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();

View File

@ -177,6 +177,9 @@ private:
///< Event handler for defined color buttons ///< Event handler for defined color buttons
void buttColorClick( wxMouseEvent& event ); void buttColorClick( wxMouseEvent& event );
///< Event handler for double click on color buttons
void colorDClick( wxMouseEvent& event );
///< called when creating the dialog ///< called when creating the dialog
bool TransferDataToWindow() override; bool TransferDataToWindow() override;