On-the-fly translations for pin electrical types.
Also add on-the-fly translation for editor title bars.
Fixes https://gitlab.com/kicad/code/kicad/issues/11324
(cherry picked from commit 68ca385e07
)
This commit is contained in:
parent
e02229a234
commit
43929781a2
|
@ -694,7 +694,7 @@ void EDA_DRAW_FRAME::SetMsgPanel( EDA_ITEM* aItem )
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::UpdateMsgPanel()
|
void EDA_DRAW_FRAME::UpdateMsgPanel()
|
||||||
{
|
{
|
||||||
GetToolManager()->PostEvent( EVENTS::SelectedItemsModified );
|
GetToolManager()->ProcessEvent( EVENTS::SelectedItemsModified );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2022 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
#include <core/arraydim.h>
|
#include <core/arraydim.h>
|
||||||
#include <lib_pin.h>
|
#include <lib_pin.h>
|
||||||
#include <pin_type.h>
|
#include <pin_type.h>
|
||||||
|
#include "pgm_base.h"
|
||||||
|
|
||||||
|
|
||||||
// These are true singletons so it's OK for them to be globals.
|
// These are true singletons so it's OK for them to be globals.
|
||||||
|
@ -46,8 +47,8 @@ struct pinTypeStruct
|
||||||
BITMAPS bitmap;
|
BITMAPS bitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
const std::map<ELECTRICAL_PINTYPE, struct pinTypeStruct> pinTypes = {
|
std::map<ELECTRICAL_PINTYPE, struct pinTypeStruct> g_pinTypes = {
|
||||||
{ ELECTRICAL_PINTYPE::PT_INPUT, { _( "Input" ), BITMAPS::pintype_input } },
|
{ ELECTRICAL_PINTYPE::PT_INPUT, { _( "Input" ), BITMAPS::pintype_input } },
|
||||||
{ ELECTRICAL_PINTYPE::PT_OUTPUT, { _( "Output" ), BITMAPS::pintype_output } },
|
{ ELECTRICAL_PINTYPE::PT_OUTPUT, { _( "Output" ), BITMAPS::pintype_output } },
|
||||||
{ ELECTRICAL_PINTYPE::PT_BIDI, { _( "Bidirectional" ), BITMAPS::pintype_bidi } },
|
{ ELECTRICAL_PINTYPE::PT_BIDI, { _( "Bidirectional" ), BITMAPS::pintype_bidi } },
|
||||||
|
@ -61,7 +62,9 @@ const std::map<ELECTRICAL_PINTYPE, struct pinTypeStruct> pinTypes = {
|
||||||
{ ELECTRICAL_PINTYPE::PT_OPENEMITTER, { _( "Open emitter" ), BITMAPS::pintype_openemit } },
|
{ ELECTRICAL_PINTYPE::PT_OPENEMITTER, { _( "Open emitter" ), BITMAPS::pintype_openemit } },
|
||||||
{ ELECTRICAL_PINTYPE::PT_NC, { _( "Unconnected" ), BITMAPS::pintype_noconnect } },
|
{ ELECTRICAL_PINTYPE::PT_NC, { _( "Unconnected" ), BITMAPS::pintype_noconnect } },
|
||||||
};
|
};
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
|
int g_pinTypesLanguage = wxLANGUAGE_UNKNOWN;
|
||||||
|
|
||||||
|
|
||||||
struct pinShapeStruct
|
struct pinShapeStruct
|
||||||
|
@ -236,9 +239,27 @@ const std::vector<BITMAPS>& PinOrientationIcons()
|
||||||
|
|
||||||
wxString ElectricalPinTypeGetText( ELECTRICAL_PINTYPE aType )
|
wxString ElectricalPinTypeGetText( ELECTRICAL_PINTYPE aType )
|
||||||
{
|
{
|
||||||
auto findIt = pinTypes.find( aType );
|
if( g_pinTypesLanguage != Pgm().GetSelectedLanguageIdentifier() )
|
||||||
|
{
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_INPUT].name = _( "Input" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_OUTPUT].name = _( "Output" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_BIDI].name = _( "Bidirectional" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_TRISTATE].name = _( "Tri-state" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_PASSIVE].name = _( "Passive" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_NIC].name = _( "Free" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_UNSPECIFIED].name = _( "Unspecified" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_POWER_IN].name = _( "Power input" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_POWER_OUT].name = _( "Power output" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR].name = _( "Open collector" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_OPENEMITTER].name = _( "Open emitter" );
|
||||||
|
g_pinTypes[ELECTRICAL_PINTYPE::PT_NC].name = _( "Unconnected" );
|
||||||
|
|
||||||
wxCHECK_MSG( findIt != pinTypes.end(), wxT( "???" ), "Could not find pin type in lookup map" );
|
g_pinTypesLanguage = Pgm().GetSelectedLanguageIdentifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto findIt = g_pinTypes.find( aType );
|
||||||
|
|
||||||
|
wxCHECK_MSG( findIt != g_pinTypes.end(), wxT( "???" ), wxT( "Pin type not found!" ) );
|
||||||
|
|
||||||
return findIt->second.name;
|
return findIt->second.name;
|
||||||
}
|
}
|
||||||
|
@ -246,7 +267,7 @@ wxString ElectricalPinTypeGetText( ELECTRICAL_PINTYPE aType )
|
||||||
|
|
||||||
BITMAPS ElectricalPinTypeGetBitmap( ELECTRICAL_PINTYPE aType )
|
BITMAPS ElectricalPinTypeGetBitmap( ELECTRICAL_PINTYPE aType )
|
||||||
{
|
{
|
||||||
auto findIt = pinTypes.find( aType );
|
auto findIt = g_pinTypes.find( aType );
|
||||||
|
|
||||||
wxCHECK_MSG( findIt != pinTypes.end(), BITMAPS::INVALID_BITMAP,
|
wxCHECK_MSG( findIt != pinTypes.end(), BITMAPS::INVALID_BITMAP,
|
||||||
wxT( "Could not find pin type in lookup map" ) );
|
wxT( "Could not find pin type in lookup map" ) );
|
||||||
|
|
|
@ -1502,6 +1502,8 @@ void SCH_EDIT_FRAME::ShowChangedLanguage()
|
||||||
// status bar
|
// status bar
|
||||||
UpdateMsgPanel();
|
UpdateMsgPanel();
|
||||||
|
|
||||||
|
UpdateTitle();
|
||||||
|
|
||||||
// This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
|
// This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
|
||||||
// windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
|
// windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
|
||||||
// wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
|
// wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
|
||||||
|
|
|
@ -1014,9 +1014,9 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
}
|
}
|
||||||
|
|
||||||
float insideOffset = textOffset - thickness[INSIDE] / 2.0;
|
float insideOffset = textOffset - thickness[INSIDE] / 2.0;
|
||||||
float outsideOffset = 2 * Mils2iu( PIN_TEXT_MARGIN ) - thickness[OUTSIDE] / 2.0;
|
float outsideOffset = Mils2iu( PIN_TEXT_MARGIN ) + TARGET_PIN_RADIUS - thickness[OUTSIDE] / 2.0;
|
||||||
float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[ABOVE] + penWidth ) / 2.0;
|
float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[ABOVE] / 2.0;
|
||||||
float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[BELOW] + penWidth ) / 2.0;
|
float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[BELOW] / 2.0;
|
||||||
|
|
||||||
if( isDangling )
|
if( isDangling )
|
||||||
outsideOffset += TARGET_PIN_RADIUS / 2.0;
|
outsideOffset += TARGET_PIN_RADIUS / 2.0;
|
||||||
|
|
|
@ -1137,6 +1137,14 @@ void SYMBOL_EDIT_FRAME::ShowChangedLanguage()
|
||||||
|
|
||||||
// status bar
|
// status bar
|
||||||
UpdateMsgPanel();
|
UpdateMsgPanel();
|
||||||
|
|
||||||
|
if( GetRenderSettings()->m_ShowPinsElectricalType )
|
||||||
|
{
|
||||||
|
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
||||||
|
GetCanvas()->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -810,6 +810,8 @@ void FOOTPRINT_EDIT_FRAME::ShowChangedLanguage()
|
||||||
lm_pane_info.Show( lm_shown );
|
lm_pane_info.Show( lm_shown );
|
||||||
tree_pane_info.Show( tree_shown );
|
tree_pane_info.Show( tree_shown );
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1255,6 +1255,8 @@ void PCB_EDIT_FRAME::ShowChangedLanguage()
|
||||||
|
|
||||||
m_appearancePanel->OnLanguageChanged();
|
m_appearancePanel->OnLanguageChanged();
|
||||||
m_selectionFilterPanel->OnLanguageChanged();
|
m_selectionFilterPanel->OnLanguageChanged();
|
||||||
|
|
||||||
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue