AddMenuLanguageList should live in EDA_BASE_FRAME, its only user

This commit is contained in:
Marek Roszko 2023-10-16 19:49:52 -04:00
parent 584757f2df
commit bee6e6be01
31 changed files with 43 additions and 144 deletions

View File

@ -39,7 +39,6 @@
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <bitmaps.h>
#include <macros.h>
#include <menus_helpers.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <tool/tool_dispatcher.h>

View File

@ -28,7 +28,6 @@
#include <bitmaps.h>
#include <tool/conditional_menu.h>
#include <eda_3d_viewer_frame.h>
#include <menus_helpers.h>
#include <3d_viewer_id.h>
#include <3d_viewer/tools/eda_3d_actions.h>
#include <tool/tool_manager.h>

View File

@ -31,7 +31,6 @@
#include <bitmaps.h>
#include <dialogs/eda_view_switcher.h>
#include <eda_3d_viewer_frame.h>
#include <menus_helpers.h>
#include <tool/action_toolbar.h>
#include <tools/eda_3d_actions.h>
#include <3d_viewer_id.h>

View File

@ -32,7 +32,6 @@
#include <kiface_base.h>
#include <pgm_base.h>
#include <widgets/wx_menubar.h>
#include <menus_helpers.h>
#include <wildcards_and_files_ext.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>

View File

@ -450,7 +450,6 @@ set( COMMON_SRCS
kiway_express.cpp
kiway_holder.cpp
kiway_player.cpp
languages_menu.cpp
launch_ext.cpp
lib_table_base.cpp
lib_table_grid_tricks.cpp

View File

@ -26,7 +26,6 @@
#include <bitmaps.h>
#include <confirm.h>
#include <menus_helpers.h>
#include <validators.h>
#include <dialogs/html_message_box.h>
#include <filename_resolver.h>

View File

@ -21,7 +21,6 @@
#include <bitmaps.h>
#include <launch_ext.h>
#include <layer_ids.h>
#include <menus_helpers.h>
#include <dialogs/panel_color_settings.h>
#include <pgm_base.h>
#include <settings/color_settings.h>

View File

@ -33,7 +33,6 @@
#include <file_history.h>
#include <id.h>
#include <kiface_base.h>
#include <menus_helpers.h>
#include <hotkeys_basic.h>
#include <panel_hotkeys_editor.h>
#include <paths.h>
@ -516,7 +515,7 @@ void EDA_BASE_FRAME::AddStandardHelpMenu( wxMenuBar* aMenuBar )
helpMenu->AppendSeparator();
helpMenu->Add( ACTIONS::about );
// Trailing space keeps OSX from hijacking our menu (and disabling everything in it).
aMenuBar->Append( helpMenu, _( "&Help" ) + wxS( " " ) );
helpMenu->wxMenu::SetTitle( _( "&Help" ) + wxS( " " ) );
@ -1553,3 +1552,40 @@ WXLRESULT EDA_BASE_FRAME::MSWWindowProc( WXUINT message, WXWPARAM wParam, WXLPAR
return wxFrame::MSWWindowProc( message, wParam, lParam );
}
#endif
/**
* Function AddMenuLanguageList
* creates a menu list for language choice, and add it as submenu to \a MasterMenu.
*
* @param aMasterMenu is the main menu.
* @param aControlTool is the tool to associate with the menu
*/
void EDA_BASE_FRAME::AddMenuLanguageList( ACTION_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool )
{
ACTION_MENU* langsMenu = new ACTION_MENU( false, aControlTool );
langsMenu->SetTitle( _( "Set Language" ) );
langsMenu->SetIcon( BITMAPS::language );
wxString tooltip;
for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
{
wxString label;
if( LanguagesList[ii].m_DoNotTranslate )
label = LanguagesList[ii].m_Lang_Label;
else
label = wxGetTranslation( LanguagesList[ii].m_Lang_Label );
wxMenuItem* item =
new wxMenuItem( langsMenu,
LanguagesList[ii].m_KI_Lang_Identifier, // wxMenuItem wxID
label, tooltip, wxITEM_CHECK );
langsMenu->Append( item );
}
// This must be done after the items are added
aMasterMenu->Add( langsMenu );
}

View File

@ -1,73 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2020 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
*/
/**
* @file languages_menu.cpp
*
* @brief build the standard menu to show the list of available translations
*/
#include <id.h>
#include <menus_helpers.h>
#include <pgm_base.h> // LanguagesList
#include <tool/tool_interactive.h>
#include <tool/action_menu.h>
#include <tool/conditional_menu.h>
#include <bitmaps.h>
/**
* Function AddMenuLanguageList
* creates a menu list for language choice, and add it as submenu to \a MasterMenu.
*
* @param aMasterMenu is the main menu.
* @param aControlTool is the tool to associate with the menu
*/
void AddMenuLanguageList( ACTION_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool )
{
ACTION_MENU* langsMenu = new ACTION_MENU( false, aControlTool );
langsMenu->SetTitle( _( "Set Language" ) );
langsMenu->SetIcon( BITMAPS::language );
wxString tooltip;
for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
{
wxString label;
if( LanguagesList[ii].m_DoNotTranslate )
label = LanguagesList[ii].m_Lang_Label;
else
label = wxGetTranslation( LanguagesList[ii].m_Lang_Label );
wxMenuItem* item = new wxMenuItem( langsMenu,
LanguagesList[ii].m_KI_Lang_Identifier, // wxMenuItem wxID
label,
tooltip,
wxITEM_CHECK );
langsMenu->Append( item );
}
// This must be done after the items are added
aMasterMenu->Add( langsMenu );
}

View File

@ -29,7 +29,6 @@
#include <functional>
#include <id.h>
#include <kiface_base.h>
#include <menus_helpers.h>
#include <tool/action_menu.h>
#include <tool/actions.h>
#include <tool/tool_event.h>

View File

@ -26,7 +26,6 @@
#include <bitmaps.h>
#include <tool/conditional_menu.h>
#include <tool/action_menu.h>
#include <menus_helpers.h>
#include <kiface_base.h>
#include <widgets/ui_common.h>

View File

@ -23,7 +23,6 @@
*/
#include <bitmaps.h>
#include <menus_helpers.h>
#include <tool/actions.h>
#include <tool/common_control.h>
#include <tool/conditional_menu.h>

View File

@ -27,7 +27,6 @@
#include <bitmaps.h>
#include <file_history.h>
#include <kiface_base.h>
#include <menus_helpers.h>
#include <schematic.h>
#include <tool/action_manager.h>
#include <tool/action_menu.h>

View File

@ -25,7 +25,6 @@
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <widgets/wx_menubar.h>
#include "menus_helpers.h"
void SIMULATOR_FRAME::ReCreateHToolbar()

View File

@ -24,7 +24,6 @@
*/
#include <bitmaps.h>
#include <menus_helpers.h>
#include <tool/action_menu.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>

View File

@ -36,7 +36,6 @@
#include <symbol_viewer_frame.h>
#include <math/util.h>
#include <geometry/shape_rect.h>
#include <menus_helpers.h>
#include <sch_painter.h>
#include <preview_items/selection_area.h>
#include <sch_base_frame.h>

View File

@ -28,7 +28,6 @@
#include <bitmaps.h>
#include "gerbview_id.h"
#include <kiface_base.h>
#include <menus_helpers.h>
#include <tool/action_manager.h>
#include <tool/action_menu.h>
#include <tool/actions.h>

View File

@ -29,7 +29,6 @@
#include <gerbview_settings.h>
#include <string_utils.h>
#include <excellon_image.h>
#include <menus_helpers.h>
#include <tool/tool_manager.h>
#include <project.h>
#include <view/view.h>

View File

@ -26,7 +26,6 @@
#include <wx/checkbox.h>
#include <wx/filedlg.h>
#include <bitmaps.h>
#include <menus_helpers.h>
#include <gerbview.h>
#include "gerbview_draw_panel_gal.h"
#include <gerbview_frame.h>

View File

@ -37,7 +37,6 @@
#include <bitmaps.h>
#include <macros.h>
#include <menus_helpers.h>
#include <widgets/indicator_icon.h>
#include <widgets/wx_ellipsized_static_text.h>
#include <wx/checkbox.h>

View File

@ -82,6 +82,8 @@ class APP_SETTINGS_BASE;
class APPEARANCE_CONTROLS_3D;
struct WINDOW_SETTINGS;
struct WINDOW_STATE;
class ACTION_MENU;
class TOOL_INTERACTIVE;
#define DEFAULT_MAX_UNDO_ITEMS 0
#define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
@ -681,6 +683,9 @@ protected:
*/
virtual void OnDropFiles( wxDropFilesEvent& aEvent );
void AddMenuLanguageList( ACTION_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool );
/**
* Execute action on accepted dropped file.
* Called in OnDropFiles and should be populated with

View File

@ -1,41 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers.
*
* 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 MENUS_HELPERS_H_
#define MENUS_HELPERS_H_
/**
* @file menus_helpers.h
* @brief Macros and inline functions to create menus items in menubars or popup menus.
*/
#include <wx/menu.h>
#include <wx/menuitem.h>
class ACTION_MENU;
class TOOL_INTERACTIVE;
void AddMenuLanguageList( ACTION_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool );
#endif // MENUS_HELPERS_H_

View File

@ -27,7 +27,6 @@
#include <bitmaps.h>
#include <file_history.h>
#include <kiplatform/policy.h>
#include <menus_helpers.h>
#include <paths.h>
#include <policy_keys.h>
#include <tool/action_manager.h>

View File

@ -35,7 +35,6 @@
#include <bitmap_store.h>
#include <gestfich.h>
#include <macros.h>
#include <menus_helpers.h>
#include <trace_helpers.h>
#include <wildcards_and_files_ext.h>
#include <kiplatform/environment.h>

View File

@ -26,7 +26,6 @@
#include <bitmaps.h>
#include <file_history.h>
#include <kiface_base.h>
#include <menus_helpers.h>
#include <tool/action_manager.h>
#include <tool/action_menu.h>
#include <tool/tool_manager.h>

View File

@ -27,7 +27,6 @@
#include <bitmap_store.h>
#include <geometry/shape_poly_set.h>
#include <kiface_base.h>
#include <menus_helpers.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>

View File

@ -27,7 +27,6 @@
#include "footprint_edit_frame.h"
#include "pcbnew_id.h"
#include <bitmaps.h>
#include <menus_helpers.h>
#include <tool/actions.h>
#include <tool/action_menu.h>
#include <tool/tool_manager.h>

View File

@ -28,7 +28,6 @@
#include <bitmaps.h>
#include <file_history.h>
#include <kiface_base.h>
#include <menus_helpers.h>
#include <pcb_edit_frame.h>
#include <pcbnew_id.h>
#include <python_scripting.h>

View File

@ -33,7 +33,6 @@
#include <gal/graphics_abstraction_layer.h>
#include <pcb_track.h>
#include <zone.h>
#include <menus_helpers.h>
#include <pcbnew_settings.h>
#include <tool/action_menu.h>
#include <tool/action_toolbar.h>

View File

@ -35,8 +35,6 @@
#include <board_commit.h>
#include <bitmaps.h>
#include <menus_helpers.h>
ALIGN_DISTRIBUTE_TOOL::ALIGN_DISTRIBUTE_TOOL() :
TOOL_INTERACTIVE( "pcbnew.Placement" ),

View File

@ -28,7 +28,6 @@
#include <eda_list_dialog.h>
#include <string_utils.h>
#include <footprint_edit_frame.h>
#include <menus_helpers.h>
#include <confirm.h>
#include <pcb_display_options.h>
#include <pcb_edit_frame.h>