Create a singular point for events like EDA_EVT_UNITS_CHANGED to be exported out of kicommon

This commit is contained in:
Marek Roszko 2024-03-02 16:28:48 -05:00
parent ed18a9bcc2
commit 585cf841e5
5 changed files with 60 additions and 4 deletions

View File

@ -122,6 +122,7 @@ set( KICOMMON_SRCS
paths.cpp
richio.cpp
string_utils.cpp
ui_events.cpp
trace_helpers.cpp
wildcards_and_files_ext.cpp
wx_filename.cpp

View File

@ -72,8 +72,6 @@
#include <functional>
#include <kiface_ids.h>
wxDEFINE_EVENT( EDA_EVT_UNITS_CHANGED, wxCommandEvent );
// Minimum window size
static const wxSize minSizeLookup( FRAME_T aFrameType, wxWindow* aWindow )

26
common/ui_events.cpp Normal file
View File

@ -0,0 +1,26 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <ui_events.h>
wxDEFINE_EVENT( EDA_EVT_UNITS_CHANGED, wxCommandEvent );

View File

@ -47,6 +47,7 @@
#include <undo_redo_container.h>
#include <units_provider.h>
#include <origin_transforms.h>
#include <ui_events.h>
// Option for main frames
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
@ -92,8 +93,6 @@ class TOOL_INTERACTIVE;
/// This is the handler functor for the update UI events
typedef std::function< void( wxUpdateUIEvent& ) > UIUpdateHandler;
wxDECLARE_EVENT( EDA_EVT_UNITS_CHANGED, wxCommandEvent );
/**
* The base frame for deriving all KiCad main window classes.

32
include/ui_events.h Normal file
View File

@ -0,0 +1,32 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef UI_EVENTS_H
#define UI_EVENTS_H
#include <kicommon.h>
#include <wx/event.h>
wxDECLARE_EXPORTED_EVENT( KICOMMON_API, EDA_EVT_UNITS_CHANGED, wxCommandEvent );
#endif