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
This commit is contained in:
parent
3196857449
commit
68ca385e07
|
@ -753,7 +753,7 @@ void EDA_DRAW_FRAME::SetMsgPanel( EDA_ITEM* aItem )
|
|||
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -26,6 +26,7 @@
|
|||
#include <core/arraydim.h>
|
||||
#include <lib_pin.h>
|
||||
#include <pin_type.h>
|
||||
#include "pgm_base.h"
|
||||
|
||||
|
||||
// These are true singletons so it's OK for them to be globals.
|
||||
|
@ -46,8 +47,8 @@ struct pinTypeStruct
|
|||
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_OUTPUT, { _( "Output" ), BITMAPS::pintype_output } },
|
||||
{ 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_NC, { _( "Unconnected" ), BITMAPS::pintype_noconnect } },
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
int g_pinTypesLanguage = wxLANGUAGE_UNKNOWN;
|
||||
|
||||
|
||||
struct pinShapeStruct
|
||||
|
@ -236,9 +239,27 @@ const std::vector<BITMAPS>& PinOrientationIcons()
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -246,10 +267,9 @@ wxString ElectricalPinTypeGetText( 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,
|
||||
"Could not find pin type in lookup map" );
|
||||
wxCHECK_MSG( findIt != g_pinTypes.end(), BITMAPS::INVALID_BITMAP, wxT( "Pin type not found!" ) );
|
||||
|
||||
return findIt->second.bitmap;
|
||||
}
|
||||
|
@ -259,7 +279,7 @@ wxString PinShapeGetText( GRAPHIC_PINSHAPE aShape )
|
|||
{
|
||||
auto findIt = pinShapes.find( aShape );
|
||||
|
||||
wxCHECK_MSG( findIt != pinShapes.end(), wxT( "?" ), "Could not find pinshape in lookup map" );
|
||||
wxCHECK_MSG( findIt != pinShapes.end(), wxT( "?" ), wxT( "Pin type not found!" ) );
|
||||
|
||||
return findIt->second.name;
|
||||
}
|
||||
|
@ -269,8 +289,7 @@ BITMAPS PinShapeGetBitmap( GRAPHIC_PINSHAPE aShape )
|
|||
{
|
||||
auto findIt = pinShapes.find( aShape );
|
||||
|
||||
wxCHECK_MSG( findIt != pinShapes.end(), BITMAPS::INVALID_BITMAP,
|
||||
"Could not find pinshape in lookup map" );
|
||||
wxCHECK_MSG( findIt != pinShapes.end(), BITMAPS::INVALID_BITMAP, wxT( "Pin type not found!" ) );
|
||||
|
||||
return findIt->second.bitmap;
|
||||
}
|
||||
|
|
|
@ -1594,6 +1594,8 @@ void SCH_EDIT_FRAME::ShowChangedLanguage()
|
|||
// status bar
|
||||
UpdateMsgPanel();
|
||||
|
||||
UpdateTitle();
|
||||
|
||||
// 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
|
||||
// wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
|
||||
|
|
|
@ -1410,10 +1410,10 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
|||
c = getRenderColor( aPin, LAYER_HIDDEN, drawingShadows );
|
||||
}
|
||||
|
||||
float insideOffset = textOffset - thickness[INSIDE] / 2.0;
|
||||
float outsideOffset = 2 * Mils2iu( PIN_TEXT_MARGIN ) - thickness[OUTSIDE] / 2.0;
|
||||
float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[ABOVE] + penWidth ) / 2.0;
|
||||
float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[BELOW] + penWidth ) / 2.0;
|
||||
float insideOffset = textOffset - thickness[INSIDE] / 2.0;
|
||||
float outsideOffset = Mils2iu( PIN_TEXT_MARGIN ) + TARGET_PIN_RADIUS - thickness[OUTSIDE] / 2.0;
|
||||
float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[ABOVE] / 2.0;
|
||||
float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[BELOW] / 2.0;
|
||||
|
||||
if( isDangling )
|
||||
outsideOffset += TARGET_PIN_RADIUS / 2.0;
|
||||
|
|
|
@ -1143,6 +1143,14 @@ void SYMBOL_EDIT_FRAME::ShowChangedLanguage()
|
|||
|
||||
// status bar
|
||||
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 );
|
||||
tree_pane_info.Show( tree_shown );
|
||||
m_auimgr.Update();
|
||||
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1304,6 +1304,8 @@ void PCB_EDIT_FRAME::ShowChangedLanguage()
|
|||
|
||||
m_appearancePanel->OnLanguageChanged();
|
||||
m_selectionFilterPanel->OnLanguageChanged();
|
||||
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue