From 6cde086ef9c931dc20cdd1dd50767d8cc56c2a25 Mon Sep 17 00:00:00 2001 From: Pradeepa Senanayake Date: Wed, 14 Jul 2021 22:05:45 +1000 Subject: [PATCH] Double click on defined colour executes OK action Fixes https://gitlab.com/kicad/code/kicad/-/issues/8778 --- common/dialogs/dialog_color_picker.cpp | 10 ++++++++++ include/dialogs/dialog_color_picker.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/common/dialogs/dialog_color_picker.cpp b/common/dialogs/dialog_color_picker.cpp index 1d7e5c73f9..4cad19925c 100644 --- a/common/dialogs/dialog_color_picker.cpp +++ b/common/dialogs/dialog_color_picker.cpp @@ -184,6 +184,9 @@ void DIALOG_COLOR_PICKER::initDefinedColors( CUSTOM_COLORS_LIST* aPredefinedColo swatch->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_COLOR_PICKER::buttColorClick ), 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: @@ -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 ) { int id = event.GetId(); diff --git a/include/dialogs/dialog_color_picker.h b/include/dialogs/dialog_color_picker.h index 31501cfd57..4a8819a132 100644 --- a/include/dialogs/dialog_color_picker.h +++ b/include/dialogs/dialog_color_picker.h @@ -177,6 +177,9 @@ private: ///< Event handler for defined color buttons void buttColorClick( wxMouseEvent& event ); + ///< Event handler for double click on color buttons + void colorDClick( wxMouseEvent& event ); + ///< called when creating the dialog bool TransferDataToWindow() override;