ADDED: GUI feedback when grid setting is changed by hotkey
Can be extended to other cyclical hotkey settings Fixes https://gitlab.com/kicad/code/kicad/-/issues/14756
This commit is contained in:
parent
b1d5da3da3
commit
fc69939190
|
@ -140,6 +140,7 @@ set( COMMON_DLG_SRCS
|
|||
dialogs/eda_reorderable_list_dialog_base.cpp
|
||||
dialogs/eda_view_switcher.cpp
|
||||
dialogs/eda_view_switcher_base.cpp
|
||||
dialogs/hotkey_cycle_popup.cpp
|
||||
dialogs/html_message_box.cpp
|
||||
dialogs/panel_color_settings_base.cpp
|
||||
dialogs/panel_color_settings.cpp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -16,9 +16,11 @@ EDA_VIEW_SWITCHER_BASE::EDA_VIEW_SWITCHER_BASE( wxWindow* parent, wxWindowID id,
|
|||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText2 = new wxStaticText( this, wxID_ANY, _("View Preset Switcher"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText2->Wrap( -1 );
|
||||
bSizerMain->Add( m_staticText2, 0, wxALL|wxEXPAND, 5 );
|
||||
m_stTitle = new wxStaticText( this, wxID_ANY, _("View Preset Switcher"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_stTitle->Wrap( -1 );
|
||||
m_stTitle->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||
|
||||
bSizerMain->Add( m_stTitle, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_listBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0|wxBORDER_NONE );
|
||||
bSizerMain->Add( m_listBox, 1, wxEXPAND, 5 );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="15" />
|
||||
<FileVersion major="1" minor="16" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
|
@ -14,6 +14,7 @@
|
|||
<property name="file">eda_view_switcher_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">eda_view_switcher_base</property>
|
||||
|
@ -25,6 +26,7 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
|
@ -50,6 +52,7 @@
|
|||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">View Preset Switcher</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
|
@ -86,7 +89,7 @@
|
|||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="font">,90,700,-1,70,0</property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
|
@ -99,7 +102,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticText2</property>
|
||||
<property name="name">m_stTitle</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -32,12 +32,13 @@ class EDA_VIEW_SWITCHER_BASE : public DIALOG_SHIM
|
|||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticText2;
|
||||
wxStaticText* m_stTitle;
|
||||
wxListBox* m_listBox;
|
||||
|
||||
public:
|
||||
|
||||
EDA_VIEW_SWITCHER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("View Preset Switcher"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSTAY_ON_TOP );
|
||||
|
||||
~EDA_VIEW_SWITCHER_BASE();
|
||||
|
||||
};
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 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 <dialogs/hotkey_cycle_popup.h>
|
||||
#include <eda_draw_frame.h>
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#define LIST_BOX_H_PADDING 20
|
||||
#define LIST_BOX_V_PADDING 8
|
||||
#elif __WXMAC__
|
||||
#define LIST_BOX_H_PADDING 40
|
||||
#define LIST_BOX_V_PADDING 5
|
||||
#else
|
||||
#define LIST_BOX_H_PADDING 10
|
||||
#define LIST_BOX_V_PADDING 5
|
||||
#endif
|
||||
|
||||
#define SHOW_TIME_MS 500
|
||||
|
||||
|
||||
HOTKEY_CYCLE_POPUP::HOTKEY_CYCLE_POPUP( EDA_DRAW_FRAME* aParent ) :
|
||||
EDA_VIEW_SWITCHER_BASE( aParent ),
|
||||
m_drawFrame( aParent )
|
||||
{
|
||||
m_showTimer = new wxTimer( this );
|
||||
Bind( wxEVT_TIMER, [&]( wxTimerEvent& ) { Show( false ); },
|
||||
m_showTimer->GetId() );
|
||||
|
||||
// On macOS, we can't change focus to the canvas before sending the event, so the key events
|
||||
// just get discarded via the "don't steal from an input control" logic. So, set this input
|
||||
// control with a special flag because we really do want to steal from it.
|
||||
m_listBox->SetName( KIUI::s_FocusStealableInputName );
|
||||
|
||||
#ifdef __WXOSX__
|
||||
m_listBox->Bind( wxEVT_CHAR_HOOK, [=]( wxKeyEvent& aEvent )
|
||||
{
|
||||
aEvent.SetEventType( wxEVT_CHAR );
|
||||
m_drawFrame->GetCanvas()->SetFocus();
|
||||
m_drawFrame->GetCanvas()->OnEvent( aEvent );
|
||||
} );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
HOTKEY_CYCLE_POPUP::~HOTKEY_CYCLE_POPUP()
|
||||
{
|
||||
delete m_showTimer;
|
||||
}
|
||||
|
||||
|
||||
void HOTKEY_CYCLE_POPUP::Popup( const wxString& aTitle, const wxArrayString& aItems,
|
||||
int aSelection )
|
||||
{
|
||||
m_stTitle->SetLabel( aTitle );
|
||||
m_listBox->Clear();
|
||||
m_listBox->InsertItems( aItems, 0 );
|
||||
m_listBox->SetSelection( std::min( aSelection,
|
||||
static_cast<int>( m_listBox->GetCount() ) - 1 ) );
|
||||
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
for( const wxString& item : aItems )
|
||||
{
|
||||
wxSize extents = m_listBox->GetTextExtent( item );
|
||||
width = std::max( width, extents.x );
|
||||
height += extents.y + LIST_BOX_V_PADDING;
|
||||
}
|
||||
|
||||
m_listBox->SetMinSize( wxSize( width + LIST_BOX_H_PADDING, height ) );
|
||||
|
||||
// this line fixes an issue on Linux Ubuntu using Unity (dialog not shown),
|
||||
// and works fine on all systems
|
||||
GetSizer()->Fit( this );
|
||||
|
||||
if( m_showTimer->IsRunning() )
|
||||
{
|
||||
m_showTimer->StartOnce( SHOW_TIME_MS );
|
||||
SetFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
m_showTimer->StartOnce( SHOW_TIME_MS );
|
||||
|
||||
Show( true );
|
||||
Centre();
|
||||
SetFocus();
|
||||
}
|
||||
|
||||
|
||||
bool HOTKEY_CYCLE_POPUP::TryBefore( wxEvent& aEvent )
|
||||
{
|
||||
if( aEvent.GetEventType() == wxEVT_CHAR || aEvent.GetEventType() == wxEVT_CHAR_HOOK )
|
||||
{
|
||||
aEvent.SetEventType( wxEVT_CHAR );
|
||||
//m_drawFrame->GetCanvas()->SetFocus(); // on GTK causes focus flicker and is not needed
|
||||
m_drawFrame->GetCanvas()->OnEvent( aEvent );
|
||||
return true;
|
||||
}
|
||||
|
||||
return EDA_VIEW_SWITCHER_BASE::TryBefore( aEvent );
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 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 HOTKEY_CYCLE_POPUP_H
|
||||
#define HOTKEY_CYCLE_POPUP_H
|
||||
|
||||
#include <eda_view_switcher_base.h>
|
||||
|
||||
class EDA_DRAW_FRAME;
|
||||
|
||||
/**
|
||||
* Similar to EDA_VIEW_SWITCHER, this dialog is a popup that shows feedback when using a hotkey to
|
||||
* cycle through a set of options. This variant is designed for use with single-stroke hotkeys
|
||||
* (rather than chorded hotkeys like Ctrl+Tab) as feedback rather than as an interactive selector.
|
||||
*/
|
||||
class HOTKEY_CYCLE_POPUP : public EDA_VIEW_SWITCHER_BASE
|
||||
{
|
||||
public:
|
||||
HOTKEY_CYCLE_POPUP( EDA_DRAW_FRAME* aParent );
|
||||
|
||||
~HOTKEY_CYCLE_POPUP();
|
||||
|
||||
void Popup( const wxString& aTitle, const wxArrayString& aItems, int aSelection );
|
||||
|
||||
protected:
|
||||
bool TryBefore( wxEvent& aEvent ) override;
|
||||
|
||||
private:
|
||||
wxTimer* m_showTimer;
|
||||
EDA_DRAW_FRAME* m_drawFrame;
|
||||
};
|
||||
|
||||
#endif // HOTKEY_CYCLE_POPUP_H
|
|
@ -298,6 +298,7 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow()
|
|||
commonSettings->m_Appearance.hicontrast_dimming_factor = dimmingPercent / 100.0f;
|
||||
|
||||
commonSettings->m_Input.focus_follow_sch_pcb = m_focusFollowSchPcb->GetValue();
|
||||
commonSettings->m_Input.hotkey_feedback = m_hotkeyFeedback->GetValue();
|
||||
commonSettings->m_Input.immediate_actions = !m_NonImmediateActions->GetValue();
|
||||
commonSettings->m_Input.warp_mouse_on_move = m_warpMouseOnMove->GetValue();
|
||||
|
||||
|
@ -391,6 +392,7 @@ void PANEL_COMMON_SETTINGS::applySettingsToPanel( COMMON_SETTINGS& aSettings )
|
|||
m_highContrastCtrl->SetValue( wxString::Format( "%.0f", dimmingPercent ) );
|
||||
|
||||
m_focusFollowSchPcb->SetValue( aSettings.m_Input.focus_follow_sch_pcb );
|
||||
m_hotkeyFeedback->SetValue( aSettings.m_Input.hotkey_feedback );
|
||||
m_warpMouseOnMove->SetValue( aSettings.m_Input.warp_mouse_on_move );
|
||||
m_NonImmediateActions->SetValue( !aSettings.m_Input.immediate_actions );
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -154,6 +154,11 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
|
|||
|
||||
bSizer14->Add( m_focusFollowSchPcb, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_hotkeyFeedback = new wxCheckBox( this, wxID_ANY, _("Show popup indicator when toggling settings with hotkeys"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_hotkeyFeedback->SetToolTip( _("When enabled, certain hotkeys that cycle between settings will show a popup indicator briefly to indicate the change in settings.") );
|
||||
|
||||
bSizer14->Add( m_hotkeyFeedback, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bUserInterfaceSizer->Add( bSizer14, 0, wxEXPAND, 5 );
|
||||
|
||||
|
|
|
@ -1464,6 +1464,70 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show popup indicator when toggling settings with hotkeys</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_hotkeyFeedback</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">When enabled, certain hotkeys that cycle between settings will show a popup indicator briefly to indicate the change in settings.</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -62,6 +62,7 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL
|
|||
wxCheckBox* m_checkBoxIconsInMenus;
|
||||
wxCheckBox* m_showScrollbars;
|
||||
wxCheckBox* m_focusFollowSchPcb;
|
||||
wxCheckBox* m_hotkeyFeedback;
|
||||
wxStaticText* m_stIconTheme;
|
||||
wxRadioButton* m_rbIconThemeLight;
|
||||
wxRadioButton* m_rbIconThemeDark;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <core/arraydim.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <dialog_shim.h>
|
||||
#include <dialogs/hotkey_cycle_popup.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <file_history.h>
|
||||
#include <id.h>
|
||||
|
@ -113,6 +114,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
m_msgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight( this );
|
||||
m_polarCoords = false;
|
||||
m_findReplaceData = std::make_unique<EDA_SEARCH_DATA>();
|
||||
m_hotkeyPopup = nullptr;
|
||||
|
||||
SetUserUnits( EDA_UNITS::MILLIMETRES );
|
||||
|
||||
|
@ -1134,6 +1136,12 @@ void EDA_DRAW_FRAME::ShowChangedLanguage()
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::CreateHotkeyPopup()
|
||||
{
|
||||
m_hotkeyPopup = new HOTKEY_CYCLE_POPUP( this );
|
||||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* EDA_DRAW_FRAME::GetColorSettings( bool aForceRefresh ) const
|
||||
{
|
||||
if( !m_colorSettings || aForceRefresh )
|
||||
|
|
|
@ -248,6 +248,9 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
|
|||
m_params.emplace_back( new PARAM<bool>( "input.horizontal_pan",
|
||||
&m_Input.horizontal_pan, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "input.hotkey_feedback",
|
||||
&m_Input.hotkey_feedback, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "input.zoom_acceleration",
|
||||
&m_Input.zoom_acceleration, false ) );
|
||||
|
||||
|
|
|
@ -705,3 +705,6 @@ const TOOL_EVENT EVENTS::InhibitSelectionEditing( TC_MESSAGE, TA_ACTION, "common
|
|||
const TOOL_EVENT EVENTS::UninhibitSelectionEditing( TC_MESSAGE, TA_ACTION, "common.Interactive.uninhibit" );
|
||||
|
||||
const TOOL_EVENT EVENTS::DisambiguatePoint( TC_MESSAGE, TA_ACTION, "common.Interactive.disambiguate" );
|
||||
|
||||
const TOOL_EVENT EVENTS::GridChangedByKeyEvent( TC_MESSAGE, TA_ACTION,
|
||||
"common.Interactive.gridChangedByKey" );
|
||||
|
|
|
@ -75,7 +75,7 @@ void COMMON_TOOLS::Reset( RESET_REASON aReason )
|
|||
|
||||
m_grids.emplace_back( KiROUND<double, int>( userGridX ), KiROUND<double, int>( userGridY ) );
|
||||
|
||||
OnGridChanged();
|
||||
OnGridChanged( false );
|
||||
}
|
||||
|
||||
|
||||
|
@ -464,7 +464,7 @@ int COMMON_TOOLS::GridPreset( int idx )
|
|||
}
|
||||
|
||||
|
||||
int COMMON_TOOLS::OnGridChanged()
|
||||
int COMMON_TOOLS::OnGridChanged( bool aFromHotkey )
|
||||
{
|
||||
int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
|
||||
|
||||
|
@ -483,6 +483,10 @@ int COMMON_TOOLS::OnGridChanged()
|
|||
VECTOR2D gridCursor = getViewControls()->GetCursorPosition( true );
|
||||
getViewControls()->SetCrossHairCursorPosition( gridCursor, false );
|
||||
|
||||
// Show feedback
|
||||
if( aFromHotkey )
|
||||
m_toolMgr->PostEvent( EVENTS::GridChangedByKeyEvent );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
#include <bitmaps/bitmap_types.h>
|
||||
#include <string_utils.h>
|
||||
|
||||
|
||||
const wxString KIUI::s_FocusStealableInputName = wxS( "KI_NOFOCUS");
|
||||
|
||||
|
||||
int KIUI::GetStdMargin()
|
||||
{
|
||||
// This is the value used in (most) wxFB dialogs
|
||||
|
@ -270,6 +274,10 @@ bool KIUI::IsInputControlFocused( wxWindow* aFocus )
|
|||
if( !aFocus )
|
||||
return false;
|
||||
|
||||
// These widgets are never considered focused
|
||||
if( aFocus->GetName() == s_FocusStealableInputName )
|
||||
return false;
|
||||
|
||||
wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( aFocus );
|
||||
wxStyledTextCtrl* styledText = dynamic_cast<wxStyledTextCtrl*>( aFocus );
|
||||
wxListBox* listBox = dynamic_cast<wxListBox*>( aFocus );
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <dialogs/dialog_symbol_remap.h>
|
||||
#include <dialogs/dialog_assign_netclass.h>
|
||||
#include <dialogs/dialog_update_from_pcb.h>
|
||||
#include <dialogs/hotkey_cycle_popup.h>
|
||||
#include <project_rescue.h>
|
||||
#include <erc.h>
|
||||
#include <invoke_sch_dialog.h>
|
||||
|
@ -39,6 +40,7 @@
|
|||
#include <kiway.h>
|
||||
#include <netlist_exporters/netlist_exporter_spice.h>
|
||||
#include <paths.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/net_settings.h>
|
||||
#include <sch_edit_frame.h>
|
||||
|
@ -53,11 +55,14 @@
|
|||
#include <sch_view.h>
|
||||
#include <schematic.h>
|
||||
#include <sch_commit.h>
|
||||
#include <advanced_config.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <sim/simulator_frame.h>
|
||||
#include <sim/spice_generator.h>
|
||||
#include <sim/sim_lib_mgr.h>
|
||||
#include <symbol_library_manager.h>
|
||||
#include <symbol_viewer_frame.h>
|
||||
#include <tool/common_tools.h>
|
||||
#include <tool/picker_tool.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_actions.h>
|
||||
|
@ -2347,6 +2352,31 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int SCH_EDITOR_CONTROL::GridFeedback( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( !Pgm().GetCommonSettings()->m_Input.hotkey_feedback )
|
||||
return 0;
|
||||
|
||||
const std::vector<VECTOR2I>& grids = m_toolMgr->GetTool<COMMON_TOOLS>()->Grids();
|
||||
int currentIdx = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
|
||||
|
||||
wxArrayString gridsLabels;
|
||||
|
||||
for( const VECTOR2I& grid : grids )
|
||||
gridsLabels.Add( m_frame->StringFromValue( grid.x, true ) );
|
||||
|
||||
if( !m_frame->GetHotkeyPopup() )
|
||||
m_frame->CreateHotkeyPopup();
|
||||
|
||||
HOTKEY_CYCLE_POPUP* popup = m_frame->GetHotkeyPopup();
|
||||
|
||||
if( popup )
|
||||
popup->Popup( _( "Grid" ), gridsLabels, currentIdx );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDITOR_CONTROL::setTransitions()
|
||||
{
|
||||
Go( &SCH_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
|
||||
|
@ -2389,6 +2419,8 @@ void SCH_EDITOR_CONTROL::setTransitions()
|
|||
Go( &SCH_EDITOR_CONTROL::Paste, ACTIONS::pasteSpecial.MakeEvent() );
|
||||
Go( &SCH_EDITOR_CONTROL::Duplicate, ACTIONS::duplicate.MakeEvent() );
|
||||
|
||||
Go( &SCH_EDITOR_CONTROL::GridFeedback, EVENTS::GridChangedByKeyEvent );
|
||||
|
||||
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, EE_ACTIONS::editWithLibEdit.MakeEvent() );
|
||||
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, EE_ACTIONS::editLibSymbolWithLibEdit.MakeEvent() );
|
||||
Go( &SCH_EDITOR_CONTROL::ShowCvpcb, EE_ACTIONS::assignFootprints.MakeEvent() );
|
||||
|
|
|
@ -141,6 +141,8 @@ public:
|
|||
int ToggleAnnotateRecursive( const TOOL_EVENT& aEvent );
|
||||
int TogglePythonConsole( const TOOL_EVENT& aEvent );
|
||||
|
||||
int GridFeedback( const TOOL_EVENT& aEvent );
|
||||
|
||||
int RepairSchematic( const TOOL_EVENT& aEvent );
|
||||
|
||||
void AssignFootprints( const std::string& aChangedSetOfReferences );
|
||||
|
|
|
@ -43,6 +43,7 @@ class TOOL_MENU;
|
|||
class APP_SETTINGS_BASE;
|
||||
class wxFindReplaceData;
|
||||
class SEARCH_PANE;
|
||||
class HOTKEY_CYCLE_POPUP;
|
||||
|
||||
namespace KIGFX
|
||||
{
|
||||
|
@ -452,6 +453,10 @@ public:
|
|||
*/
|
||||
void ShowChangedLanguage() override;
|
||||
|
||||
HOTKEY_CYCLE_POPUP* GetHotkeyPopup() { return m_hotkeyPopup; }
|
||||
|
||||
virtual void CreateHotkeyPopup();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
|
@ -519,6 +524,8 @@ protected:
|
|||
COLOR_SETTINGS* m_colorSettings;
|
||||
SEARCH_PANE* m_searchPane;
|
||||
|
||||
HOTKEY_CYCLE_POPUP* m_hotkeyPopup;
|
||||
|
||||
///< The current canvas type.
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType;
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
bool immediate_actions;
|
||||
bool warp_mouse_on_move;
|
||||
bool horizontal_pan;
|
||||
bool hotkey_feedback;
|
||||
|
||||
bool zoom_acceleration;
|
||||
int zoom_speed;
|
||||
|
|
|
@ -222,6 +222,9 @@ public:
|
|||
|
||||
///< Used to inform tool that it should display the disambiguation menu
|
||||
const static TOOL_EVENT DisambiguatePoint;
|
||||
|
||||
///< Used for hotkey feedback
|
||||
const static TOOL_EVENT GridChangedByKeyEvent;
|
||||
};
|
||||
|
||||
#endif // __ACTIONS_H
|
||||
|
|
|
@ -85,7 +85,9 @@ public:
|
|||
int ToggleGrid( const TOOL_EVENT& aEvent );
|
||||
int GridProperties( const TOOL_EVENT& aEvent );
|
||||
int GridPreset( int idx );
|
||||
int OnGridChanged();
|
||||
int OnGridChanged( bool aFromHotkey = true );
|
||||
|
||||
const std::vector<VECTOR2I> Grids() const { return m_grids; }
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -123,6 +123,8 @@ bool IsModalDialogFocused();
|
|||
*/
|
||||
void Disable( wxWindow* aWindow );
|
||||
|
||||
extern const wxString s_FocusStealableInputName;
|
||||
|
||||
}
|
||||
|
||||
SEVERITY SeverityFromString( const wxString& aSeverity );
|
||||
|
|
Loading…
Reference in New Issue