mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-13 17:53:11 +02:00
Common folder housekeeping part 1.
This commit is contained in:
parent
4ba1c0130c
commit
5c8f4697ca
@ -169,7 +169,8 @@ wxString dumpParamCfg( const PARAM_CFG& aParam )
|
||||
s << *static_cast<const PARAM_CFG_FILENAME&>( aParam ).m_Pt_param;
|
||||
break;
|
||||
case paramcfg_id::PARAM_BOOL:
|
||||
s << ( *static_cast<const PARAM_CFG_BOOL&>( aParam ).m_Pt_param ? wxS( "true" ) : wxS( "false" ) );
|
||||
s << ( *static_cast<const PARAM_CFG_BOOL&>( aParam ).m_Pt_param ? wxS( "true" )
|
||||
: wxS( "false" ) );
|
||||
break;
|
||||
default: s << wxS( "Unsupported PARAM_CFG variant: " ) << aParam.m_Type;
|
||||
}
|
||||
@ -195,7 +196,7 @@ static void dumpCfg( const std::vector<PARAM_CFG*>& aArray )
|
||||
|
||||
|
||||
/**
|
||||
* Get the filename for the advanced config file
|
||||
* Get the filename for the advanced config file.
|
||||
*
|
||||
* The user must check the file exists if they care.
|
||||
*/
|
||||
@ -349,7 +350,7 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
m_ExtraClearance, 0.0, 1.0 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableCreepageSlot,
|
||||
&m_EnableCreepageSlot, m_EnableCreepageSlot ) );
|
||||
&m_EnableCreepageSlot, m_EnableCreepageSlot ) );
|
||||
|
||||
|
||||
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCEpsilon,
|
||||
@ -444,7 +445,8 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
&m_Skip3DModelFileCache, m_Skip3DModelFileCache ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Skip3DModelMemoryCache,
|
||||
&m_Skip3DModelMemoryCache, m_Skip3DModelMemoryCache ) );
|
||||
&m_Skip3DModelMemoryCache,
|
||||
m_Skip3DModelMemoryCache ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HideVersionFromTitle,
|
||||
&m_HideVersionFromTitle, m_HideVersionFromTitle ) );
|
||||
@ -540,12 +542,13 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
0, 2147483647 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MinorSchematicGraphSize,
|
||||
&m_MinorSchematicGraphSize, m_MinorSchematicGraphSize,
|
||||
0, 2147483647 ) );
|
||||
&m_MinorSchematicGraphSize,
|
||||
m_MinorSchematicGraphSize,
|
||||
0, 2147483647 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::ResolveTextRecursionDepth,
|
||||
&m_ResolveTextRecursionDepth,
|
||||
m_ResolveTextRecursionDepth, 0, 10 ) );
|
||||
&m_ResolveTextRecursionDepth,
|
||||
m_ResolveTextRecursionDepth, 0, 10 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableExtensionSnaps,
|
||||
&m_EnableExtensionSnaps,
|
||||
@ -568,7 +571,8 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
0.0, 45.0 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::HoleWallPaintingMultiplier,
|
||||
&m_HoleWallPaintingMultiplier, m_HoleWallPaintingMultiplier,
|
||||
&m_HoleWallPaintingMultiplier,
|
||||
m_HoleWallPaintingMultiplier,
|
||||
0.1, 100.0 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MsgPanelShowUuids,
|
||||
@ -602,7 +606,8 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
for( PARAM_CFG* param : configParams )
|
||||
delete param;
|
||||
|
||||
wxLogTrace( kicadTraceCoroutineStack, wxT( "Using coroutine stack size %d" ), m_CoroutineStackSize );
|
||||
wxLogTrace( kicadTraceCoroutineStack, wxT( "Using coroutine stack size %d" ),
|
||||
m_CoroutineStackSize );
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,16 +55,17 @@ public:
|
||||
m_stName = new wxStaticText( this, wxID_ANY, aJob->m_name );
|
||||
m_stName->Wrap( -1 );
|
||||
m_stName->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT,
|
||||
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false,
|
||||
wxEmptyString ) );
|
||||
mainSizer->Add( m_stName, 0, wxALL | wxEXPAND, 1 );
|
||||
|
||||
m_stStatus = new wxStaticText( this, wxID_ANY, aJob->m_status, wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
wxDefaultSize, 0 );
|
||||
m_stStatus->Wrap( -1 );
|
||||
mainSizer->Add( m_stStatus, 0, wxALL | wxEXPAND, 1 );
|
||||
|
||||
m_progress = new wxGauge( this, wxID_ANY, aJob->m_maxProgress, wxDefaultPosition, wxDefaultSize,
|
||||
wxGA_HORIZONTAL );
|
||||
m_progress = new wxGauge( this, wxID_ANY, aJob->m_maxProgress, wxDefaultPosition,
|
||||
wxDefaultSize, wxGA_HORIZONTAL );
|
||||
m_progress->SetValue( 0 );
|
||||
mainSizer->Add( m_progress, 0, wxALL | wxEXPAND, 1 );
|
||||
|
||||
@ -134,7 +135,7 @@ public:
|
||||
m_scrolledWindow->Layout();
|
||||
m_contentSizer->Fit( m_scrolledWindow );
|
||||
|
||||
// call this at this window otherwise the child panels dont resize width properly
|
||||
// call this at this window otherwise the child panels don't resize width properly
|
||||
Layout();
|
||||
|
||||
m_jobPanels[aJob] = panel;
|
||||
@ -261,9 +262,9 @@ void BACKGROUND_JOBS_MONITOR::Remove( std::shared_ptr<BACKGROUND_JOB> aJob )
|
||||
std::lock_guard<std::shared_mutex> lock( m_mutex );
|
||||
m_jobs.erase( std::remove_if( m_jobs.begin(), m_jobs.end(),
|
||||
[&]( std::shared_ptr<BACKGROUND_JOB> job )
|
||||
{
|
||||
{
|
||||
return job == aJob;
|
||||
} ) );
|
||||
} ) );
|
||||
|
||||
if( m_jobs.size() == 0 )
|
||||
{
|
||||
@ -370,4 +371,4 @@ void BACKGROUND_JOBS_MONITOR::UnregisterStatusBar( KISTATUSBAR* aStatusBar )
|
||||
{
|
||||
return statusBar == aStatusBar;
|
||||
} ) );
|
||||
}
|
||||
}
|
||||
|
@ -123,13 +123,13 @@ int KiIconScale( wxWindow* aWindow )
|
||||
{
|
||||
// For historical reasons, "4" here means unity (no scaling)
|
||||
|
||||
#if defined( __WXMSW__)
|
||||
// Basically don't try and scale within kicad and let wx do its thing
|
||||
#if defined( __WXMSW__)
|
||||
// Basically don't try and scale within KiCad and let wx do its thing
|
||||
// with wx introducing bitmap bundles, it will auto scale automatically with dpi
|
||||
// the issue is, none of the scaling factors have any tie to system scaling
|
||||
// this means wx is actually going to scale again causing even more distorted icons
|
||||
return 4;
|
||||
#else
|
||||
#else
|
||||
const int vert_size = aWindow->ConvertDialogToPixels( wxSize( 0, 8 ) ).y;
|
||||
|
||||
// Autoscale won't exceed unity until the system has quite high resolution,
|
||||
@ -140,7 +140,7 @@ int KiIconScale( wxWindow* aWindow )
|
||||
else if( vert_size > 29 ) return 7;
|
||||
else if( vert_size > 24 ) return 6;
|
||||
else return 4;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ wxBitmap KiScaledBitmap( const wxBitmap& aBitmap, wxWindow* aWindow )
|
||||
{
|
||||
wxImage image = aBitmap.ConvertToImage();
|
||||
image.Rescale( scale * image.GetWidth() / 4, scale * image.GetHeight() / 4,
|
||||
wxIMAGE_QUALITY_BILINEAR );
|
||||
wxIMAGE_QUALITY_BILINEAR );
|
||||
|
||||
return wxBitmap( image );
|
||||
}
|
||||
|
@ -195,8 +195,10 @@ bool BITMAP_BASE::SaveImageData( wxOutputStream& aOutStream ) const
|
||||
{
|
||||
if( m_imageData.IsEmpty() )
|
||||
{
|
||||
// If m_imageData is empty, use wxImage::Save() method to write m_image contents to the stream.
|
||||
wxBitmapType type = m_imageType == wxBITMAP_TYPE_JPEG ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG;
|
||||
// If m_imageData is empty, use wxImage::Save() method to write m_image contents to
|
||||
// the stream.
|
||||
wxBitmapType type = m_imageType == wxBITMAP_TYPE_JPEG ? wxBITMAP_TYPE_JPEG
|
||||
: wxBITMAP_TYPE_PNG;
|
||||
|
||||
if( !m_image->SaveFile( aOutStream, type ) )
|
||||
{
|
||||
@ -222,7 +224,7 @@ bool BITMAP_BASE::LoadLegacyData( LINE_READER& aLine, wxString& aErrorMsg )
|
||||
{
|
||||
if( !aLine.ReadLine() )
|
||||
{
|
||||
aErrorMsg = wxT("Unexpected end of data");
|
||||
aErrorMsg = wxT( "Unexpected end of data" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -298,16 +300,16 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos,
|
||||
// Now we have an issue on wxWidgets 3.1.6 to fix the clip area
|
||||
// and the bitmap position when using TransformMatrix
|
||||
// So for version == 3.1.6 do not use it
|
||||
// Be carefull before changing the code.
|
||||
// Be careful before changing the code.
|
||||
bool useTransform = aDC->CanUseTransformMatrix();
|
||||
|
||||
wxAffineMatrix2D init_matrix = aDC->GetTransformMatrix();
|
||||
|
||||
// Note: clipping bitmap area was made to fix a minor issue in old versions of
|
||||
// Kicad/wxWidgets (5.1 / wx 3.0)
|
||||
// KiCad/wxWidgets (5.1 / wx 3.0)
|
||||
// However SetClippingRegion creates a lot of issues (different ways to fix the
|
||||
// position and size of the area, depending on wxWidget version)because it changes with
|
||||
// each versions of wxWigets, so it is now disabled
|
||||
// position and size of the area, depending on wxWidgets version)because it changes with
|
||||
// each versions of wxWidgets, so it is now disabled
|
||||
// However the code is still here, just in case
|
||||
// #define USE_CLIP_AREA
|
||||
|
||||
@ -319,6 +321,7 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos,
|
||||
matrix.Translate( pos.x, pos.y );
|
||||
matrix.Scale( GetScalingFactor(), GetScalingFactor() );
|
||||
aDC->SetTransformMatrix( matrix );
|
||||
|
||||
// Needed on wx <= 3.1.5, and this is strange...
|
||||
// Nevertheless, this code has problem (the bitmap is not seen)
|
||||
// with wx version > 3.1.5
|
||||
@ -341,10 +344,10 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos,
|
||||
clipAreaPos.y = pos.y;
|
||||
}
|
||||
|
||||
#ifdef USE_CLIP_AREA
|
||||
#ifdef USE_CLIP_AREA
|
||||
aDC->DestroyClippingRegion();
|
||||
aDC->SetClippingRegion( clipAreaPos, wxSize( size.x, size.y ) );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if( aBackgroundColor != COLOR4D::UNSPECIFIED && m_bitmap->HasAlpha() )
|
||||
{
|
||||
@ -383,9 +386,9 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos,
|
||||
aDC->SetLogicalOrigin( logicalOriginX, logicalOriginY );
|
||||
}
|
||||
|
||||
#ifdef USE_CLIP_AREA
|
||||
#ifdef USE_CLIP_AREA
|
||||
aDC->DestroyClippingRegion();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -413,7 +416,7 @@ void BITMAP_BASE::Mirror( FLIP_DIRECTION aFlipDirection )
|
||||
// wxImage::Mirror() clear some parameters of the original image.
|
||||
// We need to restore them, especially resolution and unit, to be
|
||||
// sure image parameters saved in file are the right parameters, not
|
||||
// the defualt values
|
||||
// the default values
|
||||
int resX = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
|
||||
int resY = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
|
||||
int unit = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT );
|
||||
@ -442,16 +445,16 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
|
||||
// wxImage::Rotate90() clear some parameters of the original image.
|
||||
// We need to restore them, especially resolution and unit, to be
|
||||
// sure image parameters saved in file are the right parameters, not
|
||||
// the defualt values
|
||||
// the default values
|
||||
int resX = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
|
||||
int resY = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
|
||||
int unit = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT );
|
||||
|
||||
*m_image = m_image->Rotate90( aRotateCCW );
|
||||
|
||||
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONUNIT , unit);
|
||||
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONX, resX);
|
||||
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONY, resY);
|
||||
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONUNIT, unit );
|
||||
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONX, resX );
|
||||
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONY, resY );
|
||||
|
||||
m_rotation += ( aRotateCCW ? ANGLE_90 : -ANGLE_90 );
|
||||
rebuildBitmap( false );
|
||||
@ -492,7 +495,8 @@ void BITMAP_BASE::UpdateImageDataBuffer()
|
||||
if( m_image )
|
||||
{
|
||||
wxMemoryOutputStream stream;
|
||||
wxBitmapType type = m_imageType == wxBITMAP_TYPE_JPEG ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG;
|
||||
wxBitmapType type = m_imageType == wxBITMAP_TYPE_JPEG ? wxBITMAP_TYPE_JPEG
|
||||
: wxBITMAP_TYPE_PNG;
|
||||
|
||||
if( !m_image->SaveFile( stream, type ) )
|
||||
return;
|
||||
|
@ -125,6 +125,7 @@ wxString GetMajorMinorPatchVersion()
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
const std::tuple<int,int,int>& GetMajorMinorPatchTuple()
|
||||
{
|
||||
static std::tuple<int, int, int> retval = KICAD_MAJOR_MINOR_PATCH_TUPLE;
|
||||
|
@ -135,7 +135,8 @@ int COMMIT::GetStatus( EDA_ITEM* aItem, BASE_SCREEN *aScreen )
|
||||
}
|
||||
|
||||
|
||||
COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlags, BASE_SCREEN* aScreen )
|
||||
COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlags,
|
||||
BASE_SCREEN* aScreen )
|
||||
{
|
||||
EDA_ITEM* parent = parentObject( aItem );
|
||||
|
||||
@ -163,8 +164,8 @@ void COMMIT::makeEntry( EDA_ITEM* aItem, CHANGE_TYPE aType, EDA_ITEM* aCopy, BAS
|
||||
ent.m_copy = aCopy;
|
||||
ent.m_screen = aScreen;
|
||||
|
||||
// N.B. Do not throw an assertion for multiple changed items. An item can be changed multiple times
|
||||
// in a single commit such as when importing graphics and grouping them.
|
||||
// N.B. Do not throw an assertion for multiple changed items. An item can be changed
|
||||
// multiple times in a single commit such as when importing graphics and grouping them.
|
||||
|
||||
m_changedItems.insert( aItem );
|
||||
m_changes.push_back( ent );
|
||||
|
@ -139,7 +139,8 @@ bool IsTextVar( const wxString& aSource )
|
||||
//
|
||||
// Stolen from wxExpandEnvVars and then heavily optimized
|
||||
//
|
||||
wxString KIwxExpandEnvVars( const wxString& str, const PROJECT* aProject, std::set<wxString>* aSet = nullptr )
|
||||
wxString KIwxExpandEnvVars( const wxString& str, const PROJECT* aProject,
|
||||
std::set<wxString>* aSet = nullptr )
|
||||
{
|
||||
// If the same string is inserted twice, we have a loop
|
||||
if( aSet )
|
||||
@ -254,7 +255,8 @@ wxString KIwxExpandEnvVars( const wxString& str, const PROJECT* aProject, std::s
|
||||
// If the user has the older location defined, that will be matched
|
||||
// first above. But if they do not, this will ensure that their board still
|
||||
// displays correctly
|
||||
else if( strVarName.Contains( "KISYS3DMOD") || strVarName.Matches( "KICAD*_3DMODEL_DIR" ) )
|
||||
else if( strVarName.Contains( "KISYS3DMOD")
|
||||
|| strVarName.Matches( "KICAD*_3DMODEL_DIR" ) )
|
||||
{
|
||||
if( getVersionedEnvVar( "KICAD*_3DMODEL_DIR", strResult ) )
|
||||
expanded = true;
|
||||
@ -320,13 +322,14 @@ wxString KIwxExpandEnvVars( const wxString& str, const PROJECT* aProject, std::s
|
||||
|
||||
case wxT( '\\' ):
|
||||
// backslash can be used to suppress special meaning of % and $
|
||||
if( n < strlen - 1 && (str[n + 1] == wxT( '%' ) || str[n + 1] == wxT( '$' )) )
|
||||
if( n < strlen - 1 && (str[n + 1] == wxT( '%' ) || str[n + 1] == wxT( '$' ) ) )
|
||||
{
|
||||
str_n = str[++n];
|
||||
strResult += str_n;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
default:
|
||||
@ -475,7 +478,7 @@ bool matchWild( const char* pat, const char* text, bool dot_special )
|
||||
return false;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
for( ;; )
|
||||
{
|
||||
if( *m == '*' )
|
||||
{
|
||||
@ -565,13 +568,13 @@ bool matchWild( const char* pat, const char* text, bool dot_special )
|
||||
* A copy of ConvertFileTimeToWx() because wxWidgets left it as a static function
|
||||
* private to src/common/filename.cpp.
|
||||
*/
|
||||
#if wxUSE_DATETIME && defined(__WIN32__) && !defined(__WXMICROWIN__)
|
||||
#if wxUSE_DATETIME && defined( __WIN32__ ) && !defined( __WXMICROWIN__ )
|
||||
|
||||
// Convert between wxDateTime and FILETIME which is a 64-bit value representing
|
||||
// the number of 100-nanosecond intervals since January 1, 1601 UTC.
|
||||
//
|
||||
// This is the offset between FILETIME epoch and the Unix/wxDateTime Epoch.
|
||||
static wxInt64 EPOCH_OFFSET_IN_MSEC = wxLL(11644473600000);
|
||||
static wxInt64 EPOCH_OFFSET_IN_MSEC = wxLL( 11644473600000 );
|
||||
|
||||
|
||||
static void ConvertFileTimeToWx( wxDateTime* dt, const FILETIME& ft )
|
||||
|
@ -234,7 +234,7 @@ void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
|
||||
|
||||
// We cannot use aConfig->Write for a double, because
|
||||
// this function uses a format with very few digits in mantissa,
|
||||
// and truncature issues are frequent.
|
||||
// and truncate issues are frequent.
|
||||
// We uses our function.
|
||||
ConfigBaseWriteDouble( aConfig, m_Ident, *m_Pt_param * m_BIU_to_cfgunit );
|
||||
}
|
||||
@ -291,7 +291,7 @@ void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
|
||||
|
||||
// We cannot use aConfig->Write for a double, because
|
||||
// this function uses a format with very few digits in mantissa,
|
||||
// and truncature issues are frequent.
|
||||
// and truncate issues are frequent.
|
||||
// We uses our function.
|
||||
ConfigBaseWriteDouble( aConfig, m_Ident, *m_Pt_param );
|
||||
}
|
||||
@ -451,7 +451,7 @@ void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
|
||||
// under Window we must use \ instead of /
|
||||
// mainly if there is a server name in path (something like \\server\kicad)
|
||||
#ifdef __WINDOWS__
|
||||
prm.Replace(wxT("/"), wxT("\\"));
|
||||
prm.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||
#endif
|
||||
*m_Pt_param = prm;
|
||||
}
|
||||
@ -463,8 +463,9 @@ void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
|
||||
return;
|
||||
|
||||
wxString prm = *m_Pt_param;
|
||||
|
||||
// filenames are stored using Unix notation
|
||||
prm.Replace(wxT("\\"), wxT("/") );
|
||||
prm.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
aConfig->Write( m_Ident, prm );
|
||||
}
|
||||
|
||||
@ -497,13 +498,14 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
|
||||
|
||||
if( libname.IsEmpty() )
|
||||
break;
|
||||
|
||||
// file names are stored using Unix notation
|
||||
// under Window we must use \ instead of /
|
||||
// mainly if there is a server name in path (something like \\server\kicad)
|
||||
#ifdef __WINDOWS__
|
||||
libname.Replace(wxT("/"), wxT("\\"));
|
||||
libname.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||
#endif
|
||||
libname_list->Add( libname );
|
||||
libname_list->Add( libname );
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,11 +525,11 @@ void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
|
||||
configkey = m_Ident;
|
||||
|
||||
// We use indexlib+1 because first lib name is LibName1
|
||||
configkey << (indexlib + 1);
|
||||
configkey << ( indexlib + 1 );
|
||||
libname = libname_list->Item( indexlib );
|
||||
|
||||
// filenames are stored using Unix notation
|
||||
libname.Replace(wxT("\\"), wxT("/") );
|
||||
libname.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
aConfig->Write( configkey, libname );
|
||||
}
|
||||
}
|
||||
|
@ -45,17 +45,19 @@ public:
|
||||
{
|
||||
m_fields = std::move( aFields );
|
||||
}
|
||||
|
||||
const nlohmann::ordered_map<wxString, wxString>& GetFields() const { return m_fields; }
|
||||
|
||||
DESIGN_BLOCK() = default;
|
||||
///< This is the only way to get m_fields to compile as a class member
|
||||
|
||||
/// This is the only way to get m_fields to compile as a class member.
|
||||
DESIGN_BLOCK( DESIGN_BLOCK&& aOther ) = delete;
|
||||
|
||||
private:
|
||||
LIB_ID m_lib_id;
|
||||
wxString m_schematicFile; // File name and path for schematic symbol.
|
||||
wxString m_libDescription; // File name and path for documentation file.
|
||||
wxString m_keywords; // Search keywords to find footprint in library.
|
||||
wxString m_schematicFile; ///< File name and path for schematic symbol.
|
||||
wxString m_libDescription; ///< File name and path for documentation file.
|
||||
wxString m_keywords; ///< Search keywords to find footprint in library.
|
||||
|
||||
nlohmann::ordered_map<wxString, wxString> m_fields;
|
||||
};
|
||||
|
@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Functions to read design block libraries and fill m_design_blocks by available design blocks names
|
||||
* and their documentation (comments and keywords)
|
||||
* Functions to read design block libraries and fill m_design_blocks by available design blocks
|
||||
* names and their documentation (comments and keywords).
|
||||
*/
|
||||
|
||||
#include <design_block_info.h>
|
||||
|
@ -49,7 +49,7 @@ class KIWAY;
|
||||
class wxTextFile;
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Helper class to handle the list of design blocks available in libraries. It stores
|
||||
* design block names, doc and keywords.
|
||||
*
|
||||
|
@ -73,7 +73,8 @@ DESIGN_BLOCK_IO* DESIGN_BLOCK_IO_MGR::FindPlugin( DESIGN_BLOCK_FILE_T aFileType
|
||||
DESIGN_BLOCK_IO_MGR::DESIGN_BLOCK_FILE_T
|
||||
DESIGN_BLOCK_IO_MGR::GuessPluginTypeFromLibPath( const wxString& aLibPath, int aCtl )
|
||||
{
|
||||
if( IO_RELEASER<DESIGN_BLOCK_IO>( FindPlugin( KICAD_SEXP ) )->CanReadLibrary( aLibPath ) && aCtl != KICTL_NONKICAD_ONLY )
|
||||
if( IO_RELEASER<DESIGN_BLOCK_IO>( FindPlugin( KICAD_SEXP ) )->CanReadLibrary( aLibPath )
|
||||
&& aCtl != KICTL_NONKICAD_ONLY )
|
||||
return KICAD_SEXP;
|
||||
|
||||
return DESIGN_BLOCK_IO_MGR::FILE_TYPE_NONE;
|
||||
@ -152,8 +153,8 @@ long long DESIGN_BLOCK_IO::GetLibraryTimestamp( const wxString& aLibraryPath ) c
|
||||
{
|
||||
wxFileName blockDir( aLibraryPath, filename );
|
||||
|
||||
// Check if the directory ends with ".kicad_block", if so hash all the files in it.
|
||||
if( blockDir.GetFullName().EndsWith( FILEEXT::KiCadDesignBlockPathExtension ) )
|
||||
// Check if the directory ends with ".kicad_block", if so hash all the files in it
|
||||
ts += TimestampDir( blockDir.GetFullPath(), wxT( "*" ) );
|
||||
|
||||
hasMoreFiles = libDir.GetNext( &filename );
|
||||
@ -282,10 +283,11 @@ DESIGN_BLOCK* DESIGN_BLOCK_IO::DesignBlockLoad( const wxString& aLibraryPath,
|
||||
const wxString& aDesignBlockName, bool aKeepUUID,
|
||||
const std::map<std::string, UTF8>* aProperties )
|
||||
{
|
||||
wxString dbPath = aLibraryPath + wxFileName::GetPathSeparator() +
|
||||
aDesignBlockName + wxT( "." ) + FILEEXT::KiCadDesignBlockPathExtension + wxFileName::GetPathSeparator();
|
||||
wxString dbSchPath = dbPath + aDesignBlockName + wxT( "." ) + FILEEXT::KiCadSchematicFileExtension;
|
||||
wxString dbMetadataPath = dbPath + aDesignBlockName + wxT( "." ) + FILEEXT::JsonFileExtension;
|
||||
wxString dbPath = aLibraryPath + wxFileName::GetPathSeparator() + aDesignBlockName + wxT( "." )
|
||||
+ FILEEXT::KiCadDesignBlockPathExtension + wxFileName::GetPathSeparator();
|
||||
wxString dbSchPath = dbPath + aDesignBlockName + wxT( "." )
|
||||
+ FILEEXT::KiCadSchematicFileExtension;
|
||||
wxString dbMetadataPath = dbPath + aDesignBlockName + wxT( "." ) + FILEEXT::JsonFileExtension;
|
||||
|
||||
if( !wxFileExists( dbSchPath ) )
|
||||
return nullptr;
|
||||
|
@ -47,8 +47,9 @@ public:
|
||||
static DESIGN_BLOCK_IO* FindPlugin( DESIGN_BLOCK_FILE_T aFileType );
|
||||
static DESIGN_BLOCK_FILE_T EnumFromStr( const wxString& aFileType );
|
||||
static DESIGN_BLOCK_FILE_T GuessPluginTypeFromLibPath( const wxString& aLibPath, int aCtl = 0 );
|
||||
|
||||
/**
|
||||
* Convert a design block library to the latest KiCad format
|
||||
* Convert a design block library to the latest KiCad format.
|
||||
*/
|
||||
static bool ConvertLibrary( std::map<std::string, UTF8>* aOldFileProps,
|
||||
const wxString& aOldFilePath, const wxString& aNewFilePath );
|
||||
|
@ -158,6 +158,7 @@ void DESIGN_BLOCK_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
case T_uri:
|
||||
if( sawUri )
|
||||
in->Duplicate( tok );
|
||||
|
||||
sawUri = true;
|
||||
in->NeedSYMBOLorNUMBER();
|
||||
row->SetFullURI( in->FromUTF8() );
|
||||
@ -166,6 +167,7 @@ void DESIGN_BLOCK_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
case T_type:
|
||||
if( sawType )
|
||||
in->Duplicate( tok );
|
||||
|
||||
sawType = true;
|
||||
in->NeedSYMBOLorNUMBER();
|
||||
row->SetType( in->FromUTF8() );
|
||||
@ -174,6 +176,7 @@ void DESIGN_BLOCK_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
case T_options:
|
||||
if( sawOpts )
|
||||
in->Duplicate( tok );
|
||||
|
||||
sawOpts = true;
|
||||
in->NeedSYMBOLorNUMBER();
|
||||
row->SetOptions( in->FromUTF8() );
|
||||
@ -182,6 +185,7 @@ void DESIGN_BLOCK_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
case T_descr:
|
||||
if( sawDesc )
|
||||
in->Duplicate( tok );
|
||||
|
||||
sawDesc = true;
|
||||
in->NeedSYMBOLorNUMBER();
|
||||
row->SetDescr( in->FromUTF8() );
|
||||
@ -190,13 +194,14 @@ void DESIGN_BLOCK_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
case T_disabled:
|
||||
if( sawDisabled )
|
||||
in->Duplicate( tok );
|
||||
|
||||
sawDisabled = true;
|
||||
row->SetEnabled( false );
|
||||
break;
|
||||
|
||||
case T_hidden:
|
||||
// Hiding design block libraries is not yet supported. Unclear what path can set this
|
||||
// attribute, but clear it on load.
|
||||
// Hiding design block libraries is not yet supported. Unclear what path can
|
||||
// set this attribute, but clear it on load.
|
||||
row->SetVisible();
|
||||
break;
|
||||
|
||||
@ -358,7 +363,8 @@ static void setLibNickname( DESIGN_BLOCK* aModule, const wxString& aNickname,
|
||||
// having to copy the LIB_ID and its two strings, twice each.
|
||||
LIB_ID& dbid = (LIB_ID&) aModule->GetLibId();
|
||||
|
||||
// Catch any misbehaving plugin, which should be setting internal design block name properly:
|
||||
// Catch any misbehaving plugin, which should be setting internal design block name
|
||||
// properly:
|
||||
wxASSERT( aDesignBlockName == dbid.GetLibItemName().wx_str() );
|
||||
|
||||
// and clearing nickname
|
||||
@ -534,8 +540,9 @@ public:
|
||||
{
|
||||
wxFileName dir = wxFileName::DirName( dirPath );
|
||||
|
||||
// consider a directory to be a lib if it's name ends with the design block lib dir extension
|
||||
// it is under $KICADn_3RD_PARTY/design_blocks/<pkgid>/ i.e. has nested level of at least +3
|
||||
// consider a directory to be a lib if it's name ends with the design block lib dir
|
||||
// extension it is under $KICADn_3RD_PARTY/design_blocks/<pkgid>/ i.e. has nested
|
||||
// level of at least +3.
|
||||
if( dirPath.EndsWith( wxString::Format( wxS( ".%s" ),
|
||||
FILEEXT::KiCadDesignBlockLibPathExtension ) )
|
||||
&& dir.GetDirCount() >= m_prefix_dir_count + 3 )
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
void SetAppIcon( const wxIcon& aIcon ) { m_appIcon = aIcon; }
|
||||
wxIcon& GetAppIcon() { return m_appIcon; }
|
||||
|
||||
///< Wrapper to manage memory allocation for bitmaps
|
||||
/// Wrapper to manage memory allocation for bitmaps.
|
||||
wxBitmap* CreateKiBitmap( BITMAPS aBitmap )
|
||||
{
|
||||
m_bitmaps.emplace_back( KiBitmapNew( aBitmap ) );
|
||||
@ -136,7 +136,7 @@ private:
|
||||
|
||||
wxIcon m_appIcon;
|
||||
|
||||
///< Bitmaps to be freed when the dialog is closed
|
||||
/// Bitmaps to be freed when the dialog is closed.
|
||||
std::vector<std::unique_ptr<wxBitmap>> m_bitmaps;
|
||||
};
|
||||
|
||||
|
@ -397,7 +397,8 @@ void DIALOG_SHIM::SelectAllInTextCtrls( wxWindowList& children )
|
||||
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( child ) )
|
||||
{
|
||||
m_beforeEditValues[ scintilla ] = scintilla->GetText();
|
||||
scintilla->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
|
||||
scintilla->Connect( wxEVT_SET_FOCUS,
|
||||
wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
|
||||
nullptr, this );
|
||||
|
||||
if( !scintilla->GetSelectedText().IsEmpty() )
|
||||
|
@ -53,8 +53,10 @@ DIALOG_ASSIGN_NETCLASS::DIALOG_ASSIGN_NETCLASS( EDA_BASE_FRAME* aParent, const w
|
||||
m_matchingNets->SetFont( KIUI::GetInfoFont( this ) );
|
||||
m_info->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||
|
||||
// @translate the string below.
|
||||
if( aParent->GetFrameType() == FRAME_PCB_EDITOR )
|
||||
m_info->SetLabel( wxT( "Note: complete netclass assignments can be edited in Board Setup > Project." ) );
|
||||
m_info->SetLabel( wxT( "Note: complete netclass assignments can be edited in Board "
|
||||
"Setup > Project." ) );
|
||||
|
||||
SetupStandardButtons();
|
||||
|
||||
|
@ -110,7 +110,8 @@ DIALOG_COLOR_PICKER::~DIALOG_COLOR_PICKER()
|
||||
APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings();
|
||||
wxASSERT( cfg );
|
||||
|
||||
cfg->m_ColorPicker.default_tab = m_notebook->GetSelection();
|
||||
if( cfg )
|
||||
cfg->m_ColorPicker.default_tab = m_notebook->GetSelection();
|
||||
|
||||
delete m_bitmapRGB;
|
||||
delete m_bitmapHSV;
|
||||
@ -393,7 +394,7 @@ void DIALOG_COLOR_PICKER::createHSVBitmap()
|
||||
|
||||
color.FromHSV( hue, sat, 1.0 );
|
||||
|
||||
img.SetRGB( MAPX( xx ), MAPY( yy ), color.r*255, color.g*255, color.b*255 );
|
||||
img.SetRGB( MAPX( xx ), MAPY( yy ), color.r * 255, color.g * 255, color.b * 255 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -421,7 +422,8 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
|
||||
|
||||
// Use Y axis from bottom to top and origin to center
|
||||
bitmapDC.SetAxisOrientation( true, true );
|
||||
#if defined( __WXMSW__)
|
||||
|
||||
#if defined( __WXMSW__ )
|
||||
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
|
||||
bitmapDC.SetDeviceOrigin( half_size, -half_size );
|
||||
#else
|
||||
@ -429,7 +431,7 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
|
||||
#endif
|
||||
|
||||
// Reserve room to draw cursors inside the bitmap
|
||||
half_size -= m_cursorsSize/2;
|
||||
half_size -= m_cursorsSize / 2;
|
||||
|
||||
// Draw the 3 RGB cursors, using white color to make them always visible:
|
||||
wxPen pen( wxColor( 255, 255, 255 ), 2 ); // use 2 pixels for pen size
|
||||
@ -638,7 +640,7 @@ void DIALOG_COLOR_PICKER::onRGBMouseClick( wxMouseEvent& event )
|
||||
|
||||
dist = m_cursorBitmapGreen - mousePos;
|
||||
|
||||
if( std::abs( dist.x ) <= m_cursorsSize/2 && std::abs( dist.y ) <= m_cursorsSize/2 )
|
||||
if( std::abs( dist.x ) <= m_cursorsSize / 2 && std::abs( dist.y ) <= m_cursorsSize / 2 )
|
||||
{
|
||||
m_selectedCursor = &m_cursorBitmapGreen;
|
||||
return;
|
||||
@ -646,7 +648,7 @@ void DIALOG_COLOR_PICKER::onRGBMouseClick( wxMouseEvent& event )
|
||||
|
||||
dist = m_cursorBitmapBlue - mousePos;
|
||||
|
||||
if( std::abs( dist.x ) <= m_cursorsSize/2 && std::abs( dist.y ) <= m_cursorsSize/2 )
|
||||
if( std::abs( dist.x ) <= m_cursorsSize / 2 && std::abs( dist.y ) <= m_cursorsSize / 2 )
|
||||
{
|
||||
m_selectedCursor = &m_cursorBitmapBlue;
|
||||
return;
|
||||
|
@ -86,7 +86,8 @@ bool DIALOG_GLOBAL_DESIGN_BLOCK_LIB_TABLE_CONFIG::TransferDataFromWindow()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure the design block library table to copy is a valid design block library table file.
|
||||
// Make sure the design block library table to copy is a valid design block library
|
||||
// table file.
|
||||
DESIGN_BLOCK_LIB_TABLE tmpTable;
|
||||
|
||||
try
|
||||
|
@ -49,7 +49,8 @@ DIALOG_IMPORT_CHOOSE_PROJECT::DIALOG_IMPORT_CHOOSE_PROJECT( wxWindow* aParent,
|
||||
{
|
||||
m_listCtrl->InsertItem( row, convertName( desc.ComboName, desc.ComboId ) );
|
||||
m_listCtrl->SetItem( row, pcbNameColId, convertName( desc.PCBName, desc.PCBId ) );
|
||||
m_listCtrl->SetItem( row, schNameColId, convertName( desc.SchematicName, desc.SchematicId ) );
|
||||
m_listCtrl->SetItem( row, schNameColId, convertName( desc.SchematicName,
|
||||
desc.SchematicId ) );
|
||||
|
||||
++row;
|
||||
}
|
||||
|
@ -25,7 +25,8 @@
|
||||
#include <bitmaps.h>
|
||||
|
||||
|
||||
DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY( wxWindow* aParent, std::size_t aLockedItemCount,
|
||||
DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY( wxWindow* aParent,
|
||||
std::size_t aLockedItemCount,
|
||||
PCBNEW_SETTINGS::LOCKING_OPTIONS& aLockingOptions ) :
|
||||
DIALOG_LOCKED_ITEMS_QUERY_BASE( aParent ),
|
||||
m_lockingOptions( aLockingOptions )
|
||||
|
@ -78,7 +78,8 @@ static const wxString pageFmts[] =
|
||||
// to be recognized in code
|
||||
};
|
||||
|
||||
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, EMBEDDED_FILES* aEmbeddedFiles, double aIuPerMils,
|
||||
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent,
|
||||
EMBEDDED_FILES* aEmbeddedFiles, double aIuPerMils,
|
||||
const VECTOR2D& aMaxUserSizeMils ) :
|
||||
DIALOG_PAGES_SETTINGS_BASE( aParent ),
|
||||
m_parent( aParent ),
|
||||
@ -602,8 +603,10 @@ void DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample()
|
||||
{
|
||||
int lyWidth, lyHeight;
|
||||
|
||||
VECTOR2D clamped_layout_size( std::clamp( m_layout_size.x, (double)MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.x ),
|
||||
std::clamp( m_layout_size.y, (double)MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.y ) );
|
||||
VECTOR2D clamped_layout_size( std::clamp( m_layout_size.x, (double) MIN_PAGE_SIZE_MILS,
|
||||
m_maxPageSizeMils.x ),
|
||||
std::clamp( m_layout_size.y, (double) MIN_PAGE_SIZE_MILS,
|
||||
m_maxPageSizeMils.y ) );
|
||||
|
||||
double lyRatio = clamped_layout_size.x < clamped_layout_size.y ?
|
||||
(double) clamped_layout_size.y / clamped_layout_size.x :
|
||||
|
@ -34,7 +34,8 @@
|
||||
|
||||
|
||||
#define INITIAL_HELP \
|
||||
_( "Select an <b>Option Choice</b> in the listbox above, and then click the <b>Append Selected Option</b> button." )
|
||||
_( "Select an <b>Option Choice</b> in the listbox above, and then click the " \
|
||||
"<b>Append Selected Option</b> button." )
|
||||
|
||||
|
||||
DIALOG_PLUGIN_OPTIONS::DIALOG_PLUGIN_OPTIONS( wxWindow* aParent,
|
||||
@ -64,8 +65,8 @@ DIALOG_PLUGIN_OPTIONS::DIALOG_PLUGIN_OPTIONS( wxWindow* aParent,
|
||||
{
|
||||
unsigned int row = 0;
|
||||
|
||||
for( std::map<std::string, UTF8>::const_iterator it = m_choices.begin(); it != m_choices.end();
|
||||
++it, ++row )
|
||||
for( std::map<std::string, UTF8>::const_iterator it = m_choices.begin();
|
||||
it != m_choices.end(); ++it, ++row )
|
||||
{
|
||||
wxString item = From_UTF8( it->first.c_str() );
|
||||
|
||||
|
@ -35,14 +35,15 @@ static constexpr double MAX_SCALE = 100.0;
|
||||
|
||||
/**
|
||||
* Custom print preview frame.
|
||||
* This derived preview frame remembers its size and position during a session
|
||||
*
|
||||
* This derived preview frame remembers its size and position during a session.
|
||||
*/
|
||||
class KI_PREVIEW_FRAME : public wxPreviewFrame
|
||||
{
|
||||
public:
|
||||
KI_PREVIEW_FRAME( wxPrintPreview* aPreview, wxWindow* aParent,
|
||||
const wxString& aTitle, const wxPoint& aPos = wxDefaultPosition,
|
||||
const wxSize& aSize = wxDefaultSize ) :
|
||||
const wxString& aTitle, const wxPoint& aPos = wxDefaultPosition,
|
||||
const wxSize& aSize = wxDefaultSize ) :
|
||||
wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
|
||||
{
|
||||
}
|
||||
@ -271,7 +272,7 @@ void DIALOG_PRINT_GENERIC::onPrintPreview( wxCommandEvent& event )
|
||||
// Must be called after InitializeWithModality because otherwise in some wxWidget
|
||||
// versions it is not always taken in account
|
||||
frame->SetMinSize( wxSize( 650, 500 ) );
|
||||
frame->SetSize( (m_parent->GetSize() * 3) / 4 );
|
||||
frame->SetSize( ( m_parent->GetSize() * 3 ) / 4 );
|
||||
|
||||
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
|
||||
frame->Show( true );
|
||||
|
@ -303,7 +303,8 @@ void PANEL_COLOR_SETTINGS::ShowColorContextMenu( wxMouseEvent& aEvent, int aLaye
|
||||
KIUI::AddMenuItem( &menu, ID_PASTE, _( "Paste color" ), KiBitmap( BITMAPS::paste ) );
|
||||
|
||||
if( !readOnly && current != saved )
|
||||
KIUI::AddMenuItem( &menu, ID_REVERT, _( "Revert to saved color" ), KiBitmap( BITMAPS::undo ) );
|
||||
KIUI::AddMenuItem( &menu, ID_REVERT, _( "Revert to saved color" ),
|
||||
KiBitmap( BITMAPS::undo ) );
|
||||
|
||||
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
|
||||
[&]( wxCommandEvent& aCmd )
|
||||
|
@ -48,6 +48,7 @@ bool PANEL_DATA_COLLECTION::TransferDataToWindow()
|
||||
|
||||
KIPLATFORM::POLICY::PBOOL policyState =
|
||||
KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_DATACOLLECTION );
|
||||
|
||||
if( policyState != KIPLATFORM::POLICY::PBOOL::NOT_CONFIGURED )
|
||||
{
|
||||
Disable();
|
||||
@ -83,4 +84,4 @@ void PANEL_DATA_COLLECTION::OnResetIdClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
Pgm().ResetSentryId();
|
||||
m_sentryUid->SetValue( Pgm().GetSentryId() );
|
||||
}
|
||||
}
|
||||
|
@ -72,10 +72,11 @@
|
||||
*/
|
||||
struct SUPPORTED_FILE_TYPE
|
||||
{
|
||||
wxString m_Description; ///< Description shown in the file picker dialog
|
||||
wxString m_FileFilter; ///< Filter used for file pickers if m_IsFile is true
|
||||
wxString m_FolderSearchExtension; ///< In case of folders it stands for extensions of files stored inside
|
||||
bool m_IsFile; ///< Whether the library is a folder or a file
|
||||
wxString m_Description; ///< Description shown in the file picker dialog.
|
||||
wxString m_FileFilter; ///< Filter used for file pickers if m_IsFile is true.
|
||||
wxString m_FolderSearchExtension; ///< In case of folders it stands for extensions of files
|
||||
///< stored inside.
|
||||
bool m_IsFile; ///< Whether the library is a folder or a file.
|
||||
DESIGN_BLOCK_IO_MGR::DESIGN_BLOCK_FILE_T m_Plugin;
|
||||
};
|
||||
|
||||
@ -249,8 +250,8 @@ protected:
|
||||
|
||||
if( ndx != std::string::npos )
|
||||
{
|
||||
// paste the DESIGN_BLOCK_LIB_TABLE_ROWs of s-expression (design_block_lib_table), starting
|
||||
// at column 0 regardless of current cursor column.
|
||||
// paste the DESIGN_BLOCK_LIB_TABLE_ROWs of s-expression (design_block_lib_table),
|
||||
// starting at column 0 regardless of current cursor column.
|
||||
|
||||
STRING_LINE_READER slr( TO_UTF8( cb_text ), wxT( "Clipboard" ) );
|
||||
LIB_TABLE_LEXER lexer( &slr );
|
||||
@ -438,6 +439,7 @@ PANEL_DESIGN_BLOCK_LIB_TABLE::PANEL_DESIGN_BLOCK_LIB_TABLE( DIALOG_EDIT_LIBRARY_
|
||||
auto joinExts = []( const std::vector<std::string>& aExts )
|
||||
{
|
||||
wxString joined;
|
||||
|
||||
for( const std::string& ext : aExts )
|
||||
{
|
||||
if( !joined.empty() )
|
||||
@ -482,6 +484,7 @@ PANEL_DESIGN_BLOCK_LIB_TABLE::PANEL_DESIGN_BLOCK_LIB_TABLE( DIALOG_EDIT_LIBRARY_
|
||||
PANEL_DESIGN_BLOCK_LIB_TABLE::~PANEL_DESIGN_BLOCK_LIB_TABLE()
|
||||
{
|
||||
wxMenu* browseMenu = m_browseButton->GetSplitButtonMenu();
|
||||
|
||||
for( auto& [type, desc] : m_supportedDesignBlockFiles )
|
||||
{
|
||||
browseMenu->Unbind( wxEVT_COMMAND_MENU_SELECTED,
|
||||
@ -1175,7 +1178,8 @@ void InvokeEditDesignBlockLibTable( KIWAY* aKiway, wxWindow *aParent )
|
||||
if( aKiway->Prj().IsNullProject() )
|
||||
projectTable = nullptr;
|
||||
|
||||
dlg.InstallPanel( new PANEL_DESIGN_BLOCK_LIB_TABLE( &dlg, &aKiway->Prj(), globalTable, globalTablePath,
|
||||
dlg.InstallPanel( new PANEL_DESIGN_BLOCK_LIB_TABLE( &dlg, &aKiway->Prj(), globalTable,
|
||||
globalTablePath,
|
||||
projectTable, projectTablePath,
|
||||
aKiway->Prj().GetProjectPath() ) );
|
||||
|
||||
|
@ -170,7 +170,8 @@ bool PANEL_EMBEDDED_FILES::TransferDataFromWindow()
|
||||
|
||||
std::vector<EMBEDDED_FILES::EMBEDDED_FILE*> files;
|
||||
|
||||
for( auto it = m_localFiles->EmbeddedFileMap().begin(); it != m_localFiles->EmbeddedFileMap().end(); it++ )
|
||||
for( auto it = m_localFiles->EmbeddedFileMap().begin();
|
||||
it != m_localFiles->EmbeddedFileMap().end(); it++ )
|
||||
files.push_back( it->second );
|
||||
|
||||
for( auto& file : files )
|
||||
@ -197,8 +198,7 @@ void PANEL_EMBEDDED_FILES::onAddEmbeddedFile( wxCommandEvent& event )
|
||||
|
||||
if( m_localFiles->HasFile( name ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "File '%s' already exists." ),
|
||||
name );
|
||||
wxString msg = wxString::Format( _( "File '%s' already exists." ), name );
|
||||
|
||||
KIDIALOG errorDlg( m_parent, msg, _( "Confirmation" ),
|
||||
wxOK | wxCANCEL | wxICON_WARNING );
|
||||
@ -342,4 +342,4 @@ void PANEL_EMBEDDED_FILES::onExportFiles( wxCommandEvent& event )
|
||||
errorDlg.ShowModal();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ bool PANEL_PACKAGES_AND_UPDATES::TransferDataToWindow()
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
|
||||
|
||||
wxCHECK( cfg, false );
|
||||
|
||||
m_cbKicadUpdate->SetValue( cfg->m_KiCadUpdateCheck );
|
||||
m_cbPcmUpdate->SetValue( cfg->m_PcmUpdateCheck );
|
||||
m_libAutoAdd->SetValue( cfg->m_PcmLibAutoAdd );
|
||||
@ -65,6 +67,8 @@ bool PANEL_PACKAGES_AND_UPDATES::TransferDataFromWindow()
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
|
||||
|
||||
wxCHECK( cfg, false );
|
||||
|
||||
cfg->m_KiCadUpdateCheck = m_cbKicadUpdate->GetValue();
|
||||
cfg->m_PcmUpdateCheck = m_cbPcmUpdate->GetValue();
|
||||
cfg->m_PcmLibAutoAdd = m_libAutoAdd->GetValue();
|
||||
|
@ -306,19 +306,23 @@ void PANEL_SETUP_NETCLASSES::loadNetclasses()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_netclassGrid->SetCellValue(
|
||||
aRow, GRID_LINESTYLE,
|
||||
g_lineStyleNames[0] ); // <Not defined> line style in list
|
||||
// <Not defined> line style in list.
|
||||
m_netclassGrid->SetCellValue( aRow, GRID_LINESTYLE,
|
||||
g_lineStyleNames[0] );
|
||||
}
|
||||
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_CLEARANCE, nc->GetClearanceOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_TRACKSIZE, nc->GetTrackWidthOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_TRACKSIZE,
|
||||
nc->GetTrackWidthOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_VIASIZE, nc->GetViaDiameterOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_VIADRILL, nc->GetViaDrillOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_uVIASIZE, nc->GetuViaDiameterOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_uVIASIZE,
|
||||
nc->GetuViaDiameterOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_uVIADRILL, nc->GetuViaDrillOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_DIFF_PAIR_WIDTH, nc->GetDiffPairWidthOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_DIFF_PAIR_GAP, nc->GetDiffPairGapOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_DIFF_PAIR_WIDTH,
|
||||
nc->GetDiffPairWidthOpt() );
|
||||
m_netclassGrid->SetOptionalUnitValue( aRow, GRID_DIFF_PAIR_GAP,
|
||||
nc->GetDiffPairGapOpt() );
|
||||
|
||||
colorAsString = nc->GetPcbColor().ToCSSString();
|
||||
m_netclassGrid->SetCellValue( aRow, GRID_PCB_COLOR, colorAsString );
|
||||
@ -506,8 +510,10 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
|
||||
nc->SetViaDrill( m_netclassGrid->GetOptionalUnitValue( aRow, GRID_VIADRILL ) );
|
||||
nc->SetuViaDiameter( m_netclassGrid->GetOptionalUnitValue( aRow, GRID_uVIASIZE ) );
|
||||
nc->SetuViaDrill( m_netclassGrid->GetOptionalUnitValue( aRow, GRID_uVIADRILL ) );
|
||||
nc->SetDiffPairWidth( m_netclassGrid->GetOptionalUnitValue( aRow, GRID_DIFF_PAIR_WIDTH ) );
|
||||
nc->SetDiffPairGap( m_netclassGrid->GetOptionalUnitValue( aRow, GRID_DIFF_PAIR_GAP ) );
|
||||
nc->SetDiffPairWidth(
|
||||
m_netclassGrid->GetOptionalUnitValue( aRow, GRID_DIFF_PAIR_WIDTH ) );
|
||||
nc->SetDiffPairGap( m_netclassGrid->GetOptionalUnitValue( aRow,
|
||||
GRID_DIFF_PAIR_GAP ) );
|
||||
|
||||
if( !nc->IsDefault() )
|
||||
{
|
||||
|
@ -260,6 +260,7 @@ void PANEL_TEXT_VARIABLES::ImportSettingsFrom( const PROJECT* aOtherProject )
|
||||
{
|
||||
// Fetch from other project...
|
||||
m_lastLoaded = aOtherProject->GetTextVars();
|
||||
|
||||
// ... but use ticker from current project:
|
||||
m_lastCheckedTicker = m_project->GetTextVarsTicker();
|
||||
|
||||
|
@ -515,10 +515,13 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
|
||||
DisplayInfoMessage( m_parent, _( "Could not use OpenGL" ), errormsg );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GAL_TYPE_CAIRO: new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this ); break;
|
||||
case GAL_TYPE_CAIRO:
|
||||
new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxASSERT( false );
|
||||
|
@ -42,9 +42,7 @@
|
||||
using namespace DRAWINGSHEET_T;
|
||||
|
||||
/**
|
||||
* DRAWING_SHEET_PARSER
|
||||
* holds data and functions pertinent to parsing a S-expression file
|
||||
* for a DS_DATA_MODEL.
|
||||
* Hold data and functions pertinent to parsing a S-expression file for a #DS_DATA_MODEL.
|
||||
*/
|
||||
class DRAWING_SHEET_PARSER : public DRAWING_SHEET_LEXER
|
||||
{
|
||||
@ -296,6 +294,7 @@ void DRAWING_SHEET_PARSER::Parse( DS_DATA_MODEL* aLayout )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_PARSER::parseHeader( T aHeaderType )
|
||||
{
|
||||
// The older files had no versioning and their first token after the initial left parenthesis
|
||||
@ -328,6 +327,7 @@ void DRAWING_SHEET_PARSER::parseHeader( T aHeaderType )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_PARSER::parseSetup( DS_DATA_MODEL* aLayout )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
@ -453,6 +453,7 @@ void DRAWING_SHEET_PARSER::parsePolygon( DS_DATA_ITEM_POLYGONS * aItem )
|
||||
aItem->SetBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_PARSER::parsePolyOutline( DS_DATA_ITEM_POLYGONS * aItem )
|
||||
{
|
||||
VECTOR2D corner;
|
||||
@ -574,6 +575,7 @@ void DRAWING_SHEET_PARSER::parseBitmap( DS_DATA_ITEM_BITMAP * aItem )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_PARSER::readPngdata( DS_DATA_ITEM_BITMAP * aItem )
|
||||
{
|
||||
std::string tmp;
|
||||
@ -858,7 +860,7 @@ void DRAWING_SHEET_PARSER::parseText( DS_DATA_ITEM_TEXT* aItem )
|
||||
}
|
||||
}
|
||||
|
||||
// parse an expression like " 25 1 ltcorner)"
|
||||
|
||||
void DRAWING_SHEET_PARSER::parseCoordinate( POINT_COORD& aCoord)
|
||||
{
|
||||
aCoord.m_Pos.x = parseDouble();
|
||||
@ -877,6 +879,7 @@ void DRAWING_SHEET_PARSER::parseCoordinate( POINT_COORD& aCoord)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int DRAWING_SHEET_PARSER::parseInt()
|
||||
{
|
||||
T token = NextTok();
|
||||
@ -887,6 +890,7 @@ int DRAWING_SHEET_PARSER::parseInt()
|
||||
return atoi( CurText() );
|
||||
}
|
||||
|
||||
|
||||
int DRAWING_SHEET_PARSER::parseInt( int aMin, int aMax )
|
||||
{
|
||||
int val = parseInt();
|
||||
@ -911,24 +915,28 @@ double DRAWING_SHEET_PARSER::parseDouble()
|
||||
return DSNLEXER::parseDouble();
|
||||
}
|
||||
|
||||
|
||||
// defaultDrawingSheet is the default drawing sheet using the S expr.
|
||||
extern const char defaultDrawingSheet[];
|
||||
|
||||
|
||||
void DS_DATA_MODEL::SetDefaultLayout()
|
||||
{
|
||||
SetPageLayout( defaultDrawingSheet, false, wxT( "default page" ) );
|
||||
}
|
||||
|
||||
// Returns defaultDrawingSheet as a string;
|
||||
|
||||
wxString DS_DATA_MODEL::DefaultLayout()
|
||||
{
|
||||
return wxString( defaultDrawingSheet );
|
||||
}
|
||||
|
||||
|
||||
// emptyDrawingSheet is a "empty" drawing sheet using the S expr.
|
||||
// there is a 0 length line to fool something somewhere.
|
||||
extern const char emptyDrawingSheet[];
|
||||
|
||||
|
||||
void DS_DATA_MODEL::SetEmptyLayout()
|
||||
{
|
||||
SetPageLayout( emptyDrawingSheet, false, wxT( "empty page" ) );
|
||||
|
@ -688,7 +688,9 @@ void DS_DATA_ITEM_TEXT::SetConstrainedTextSize()
|
||||
// but this function uses integers
|
||||
// So, to avoid truncations with our unit in mm, use microns.
|
||||
VECTOR2I size_micron;
|
||||
#define FSCALE 1000.0
|
||||
|
||||
#define FSCALE 1000.0
|
||||
|
||||
int linewidth = 0;
|
||||
size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
|
||||
size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
|
||||
|
@ -72,9 +72,7 @@ DS_DATA_MODEL::DS_DATA_MODEL() :
|
||||
m_bottomMargin = 10.0; // the bottom page margin in mm
|
||||
}
|
||||
|
||||
/*
|
||||
* static function: returns the instance of DS_DATA_MODEL used in the application
|
||||
*/
|
||||
|
||||
DS_DATA_MODEL& DS_DATA_MODEL::GetTheInstance()
|
||||
{
|
||||
if( wksAltInstance )
|
||||
@ -83,12 +81,7 @@ DS_DATA_MODEL& DS_DATA_MODEL::GetTheInstance()
|
||||
return wksTheInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* static function: Set an alternate instance of DS_DATA_MODEL
|
||||
* mainly used in page setting dialog
|
||||
* @param aLayout = the alternate drawing sheet.
|
||||
* if null, restore the basic drawing sheet
|
||||
*/
|
||||
|
||||
void DS_DATA_MODEL::SetAltInstance( DS_DATA_MODEL* aLayout )
|
||||
{
|
||||
wksAltInstance = aLayout;
|
||||
@ -97,7 +90,7 @@ void DS_DATA_MODEL::SetAltInstance( DS_DATA_MODEL* aLayout )
|
||||
|
||||
void DS_DATA_MODEL::SetupDrawEnvironment( const PAGE_INFO& aPageInfo, double aMilsToIU )
|
||||
{
|
||||
#define MILS_TO_MM (25.4/1000)
|
||||
#define MILS_TO_MM ( 25.4 / 1000 )
|
||||
|
||||
m_WSunits2Iu = aMilsToIU / MILS_TO_MM;
|
||||
|
||||
|
@ -41,15 +41,20 @@
|
||||
|
||||
using namespace DRAWINGSHEET_T;
|
||||
|
||||
|
||||
// A helper function to write tokens:
|
||||
static const char* getTokenName( T aTok )
|
||||
{
|
||||
return DRAWING_SHEET_LEXER::TokenName( aTok );
|
||||
}
|
||||
|
||||
// A basic helper class to write a drawing sheet file
|
||||
// Not used alone, a file writer or a string writer should be derived to use it.
|
||||
// Therefore the constructor is protected.
|
||||
|
||||
/**
|
||||
* A basic helper class to write a drawing sheet file.
|
||||
*
|
||||
* Not used alone, a file writer or a string writer should be derived to use it.
|
||||
* Therefore the constructor is protected.
|
||||
*/
|
||||
class DS_DATA_MODEL_IO
|
||||
{
|
||||
public:
|
||||
@ -76,7 +81,9 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
// A helper class to write a drawing sheet to a file
|
||||
/**
|
||||
* A helper class to write a drawing sheet to a file.
|
||||
*/
|
||||
class DS_DATA_MODEL_FILEIO : public DS_DATA_MODEL_IO
|
||||
{
|
||||
public:
|
||||
@ -105,7 +112,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// A helper class to write a drawing sheet to a string
|
||||
/**
|
||||
* A helper class to write a drawing sheet to a string.
|
||||
*/
|
||||
class DS_DATA_MODEL_STRINGIO : public DS_DATA_MODEL_IO
|
||||
{
|
||||
public:
|
||||
@ -215,7 +224,8 @@ void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aSheet ) const
|
||||
FormatDouble2Str( aSheet->m_DefaultTextSize.x ).c_str(),
|
||||
FormatDouble2Str( aSheet->m_DefaultTextSize.y ).c_str() );
|
||||
m_out->Print( "(linewidth %s)", FormatDouble2Str( aSheet->m_DefaultLineWidth ).c_str() );
|
||||
m_out->Print( "(textlinewidth %s)", FormatDouble2Str( aSheet->m_DefaultTextThickness ).c_str() );
|
||||
m_out->Print( "(textlinewidth %s)",
|
||||
FormatDouble2Str( aSheet->m_DefaultTextThickness ).c_str() );
|
||||
|
||||
// Write margin values
|
||||
m_out->Print( "(left_margin %s)", FormatDouble2Str( aSheet->GetLeftMargin() ).c_str() );
|
||||
|
@ -90,7 +90,6 @@ std::vector<int> DS_DRAW_ITEM_BASE::ViewGetLayers() const
|
||||
}
|
||||
|
||||
|
||||
// A generic HitTest that can be used by some, but not all, sub-classes.
|
||||
bool DS_DRAW_ITEM_BASE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
||||
{
|
||||
BOX2I sel = aRect;
|
||||
@ -128,6 +127,7 @@ void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
||||
case DS_DATA_ITEM::DS_TEXT:
|
||||
{
|
||||
DS_DRAW_ITEM_TEXT* textItem = static_cast<DS_DRAW_ITEM_TEXT*>( this );
|
||||
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, textItem->GetText() ) );
|
||||
break;
|
||||
@ -333,7 +333,8 @@ bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const BOX2I& aRect, bool aContained, in
|
||||
}
|
||||
|
||||
|
||||
wxString DS_DRAW_ITEM_POLYPOLYGONS::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
|
||||
wxString DS_DRAW_ITEM_POLYPOLYGONS::GetItemDescription( UNITS_PROVIDER* aUnitsProvider,
|
||||
bool aFull ) const
|
||||
{
|
||||
return _( "Imported Shape" );
|
||||
}
|
||||
@ -434,9 +435,10 @@ bool DS_DRAW_ITEM_RECT::HitTest( const BOX2I& aRect, bool aContained, int aAccur
|
||||
|
||||
wxString DS_DRAW_ITEM_RECT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
|
||||
{
|
||||
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( GetStart().x - GetEnd().x ) ),
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( GetStart().y - GetEnd().y ) ) );
|
||||
return wxString::Format(
|
||||
_( "Rectangle, width %s height %s" ),
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( GetStart().x - GetEnd().x ) ),
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( GetStart().y - GetEnd().y ) ) );
|
||||
}
|
||||
|
||||
|
||||
@ -570,12 +572,6 @@ void DS_DRAW_ITEM_LIST::BuildDrawItemsList( const PAGE_INFO& aPageInfo,
|
||||
}
|
||||
|
||||
|
||||
/* Print the item list created by BuildDrawItemsList
|
||||
* aDC = the current Device Context
|
||||
* The not selected items are drawn first (most of items)
|
||||
* The selected items are drawn after (usually 0 or 1)
|
||||
* to be sure they are seen, even for overlapping items
|
||||
*/
|
||||
void DS_DRAW_ITEM_LIST::Print( const RENDER_SETTINGS* aSettings )
|
||||
{
|
||||
std::vector<DS_DRAW_ITEM_BASE*> second_items;
|
||||
|
@ -56,10 +56,10 @@ DS_RENDER_SETTINGS::DS_RENDER_SETTINGS()
|
||||
|
||||
void DS_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
|
||||
{
|
||||
for( int layer = SCH_LAYER_ID_START; layer < SCH_LAYER_ID_END; layer ++)
|
||||
for( int layer = SCH_LAYER_ID_START; layer < SCH_LAYER_ID_END; layer++ )
|
||||
m_layerColors[ layer ] = aSettings->GetColor( layer );
|
||||
|
||||
for( int layer = GAL_LAYER_ID_START; layer < GAL_LAYER_ID_END; layer ++)
|
||||
for( int layer = GAL_LAYER_ID_START; layer < GAL_LAYER_ID_END; layer++ )
|
||||
m_layerColors[ layer ] = aSettings->GetColor( layer );
|
||||
|
||||
m_backgroundColor = aSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
@ -110,8 +110,6 @@ void DS_DRAW_ITEM_LIST::GetTextVars( wxArrayString* aVars )
|
||||
}
|
||||
|
||||
|
||||
// Returns the full text corresponding to the aTextbase, after replacing any text variable
|
||||
// references.
|
||||
wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
||||
{
|
||||
std::function<bool( wxString* )> wsResolver =
|
||||
@ -375,6 +373,7 @@ void KIGFX::DS_PAINTER::DrawBorder( const PAGE_INFO* aPageInfo, int aScaleFactor
|
||||
aPageInfo->GetHeightMils() * aScaleFactor );
|
||||
|
||||
m_gal->SetIsStroke( true );
|
||||
|
||||
// Use a gray color for the border color
|
||||
m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
|
||||
m_gal->SetIsFill( false );
|
||||
|
@ -83,7 +83,8 @@ void DS_PROXY_UNDO_ITEM::Restore( EDA_DRAW_FRAME* aFrame, KIGFX::VIEW* aView )
|
||||
|
||||
dataItem->SyncDrawItems( nullptr, aView );
|
||||
|
||||
if( ii == m_selectedDataItem && m_selectedDrawItem < (int)dataItem->GetDrawItems().size() )
|
||||
if( ii == m_selectedDataItem
|
||||
&& m_selectedDrawItem < (int)dataItem->GetDrawItems().size() )
|
||||
{
|
||||
DS_DRAW_ITEM_BASE* drawItem = dataItem->GetDrawItems()[ m_selectedDrawItem ];
|
||||
drawItem->SetSelected();
|
||||
|
@ -461,7 +461,7 @@ inline bool isDigit( char cc )
|
||||
}
|
||||
|
||||
|
||||
///< @return true if @a cc is an s-expression separator character.
|
||||
/// @return true if @a cc is an s-expression separator character.
|
||||
inline bool isSep( char cc )
|
||||
{
|
||||
return isSpace( cc ) || cc == '(' || cc == ')' || cc == '|';
|
||||
@ -873,12 +873,14 @@ double DSNLEXER::parseDouble()
|
||||
|
||||
return fval;
|
||||
#else
|
||||
// Use std::from_chars which is designed to be locale independent and performance oriented for data interchange
|
||||
// Use std::from_chars which is designed to be locale independent and performance oriented
|
||||
// for data interchange
|
||||
|
||||
const std::string& str = CurStr();
|
||||
|
||||
// Offset any leading whitespace, this is one thing from_chars does not handle
|
||||
size_t woff = 0;
|
||||
|
||||
while( std::isspace( str[woff] ) && woff < str.length() )
|
||||
{
|
||||
woff++;
|
||||
|
@ -272,7 +272,7 @@ void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
|
||||
EDA_BASE_FRAME::~EDA_BASE_FRAME()
|
||||
{
|
||||
Disconnect( ID_AUTO_SAVE_TIMER, wxEVT_TIMER,
|
||||
wxTimerEventHandler( EDA_BASE_FRAME::onAutoSaveTimer ) );
|
||||
wxTimerEventHandler( EDA_BASE_FRAME::onAutoSaveTimer ) );
|
||||
Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_BASE_FRAME::windowClosing ) );
|
||||
|
||||
delete m_autoSaveTimer;
|
||||
@ -296,6 +296,7 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
|
||||
if( !IsEnabled() && IsActive() )
|
||||
{
|
||||
wxWindow* dlg = findQuasiModalDialog();
|
||||
|
||||
if( dlg )
|
||||
dlg->Raise();
|
||||
}
|
||||
@ -648,6 +649,7 @@ void EDA_BASE_FRAME::LoadWindowState( const WINDOW_STATE& aState )
|
||||
|
||||
// Ensure minimum size is set if the stored config was zero-initialized
|
||||
wxSize minSize = minSizeLookup( m_ident, this );
|
||||
|
||||
if( m_frameSize.x < minSize.x || m_frameSize.y < minSize.y )
|
||||
{
|
||||
m_frameSize = defaultSize( m_ident, this );
|
||||
@ -1114,19 +1116,19 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
|
||||
}, _( "Version Control" ) );
|
||||
}
|
||||
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
book->AddLazyPage(
|
||||
[]( wxWindow* aParent ) -> wxWindow*
|
||||
{
|
||||
return new PANEL_DATA_COLLECTION( aParent );
|
||||
}, _( "Data Collection" ) );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define LAZY_CTOR( key ) \
|
||||
[this, kiface]( wxWindow* aParent ) \
|
||||
{ \
|
||||
return kiface->CreateKiWindow( aParent, key, &Kiway() ); \
|
||||
}
|
||||
#define LAZY_CTOR( key ) \
|
||||
[this, kiface]( wxWindow* aParent ) \
|
||||
{ \
|
||||
return kiface->CreateKiWindow( aParent, key, &Kiway() ); \
|
||||
}
|
||||
|
||||
// If a dll is not loaded, the loader will show an error message.
|
||||
|
||||
@ -1157,7 +1159,8 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_FIELD_NAME_TEMPLATES ), _( "Field Name Templates" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_FIELD_NAME_TEMPLATES ),
|
||||
_( "Field Name Templates" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_SIMULATOR ), _( "Simulator" ) );
|
||||
}
|
||||
catch( ... )
|
||||
@ -1183,7 +1186,8 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_FIELDS ), _( "Footprint Defaults" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_GRAPHICS_VALUES ), _( "Graphics Defaults" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_GRAPHICS_VALUES ),
|
||||
_( "Graphics Defaults" ) );
|
||||
|
||||
if( GetFrameType() == FRAME_PCB_EDITOR )
|
||||
expand.push_back( (int) book->GetPageCount() );
|
||||
@ -1224,7 +1228,8 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_COLORS ), _( "Colors" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_GRIDS ), _( "Grids" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ),
|
||||
_( "Excellon Options" ) );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
@ -1398,7 +1403,8 @@ void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
|
||||
if( response == wxYES )
|
||||
{
|
||||
// Preserve the permissions of the current file
|
||||
KIPLATFORM::IO::DuplicatePermissions( aFileName.GetFullPath(), autoSaveFileName.GetFullPath() );
|
||||
KIPLATFORM::IO::DuplicatePermissions( aFileName.GetFullPath(),
|
||||
autoSaveFileName.GetFullPath() );
|
||||
|
||||
if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
|
||||
{
|
||||
@ -1632,13 +1638,6 @@ WXLRESULT EDA_BASE_FRAME::MSWWindowProc( WXUINT message, WXWPARAM wParam, WXLPAR
|
||||
#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 );
|
||||
|
@ -426,8 +426,9 @@ void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
||||
if( rel_error < last_approx )
|
||||
{
|
||||
last_approx = rel_error;
|
||||
|
||||
// zoom IDs in m_zoomSelectBox start with 1 (leaving 0 for auto-zoom choice)
|
||||
new_selection = jj+1;
|
||||
new_selection = jj + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,9 +436,10 @@ void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
||||
m_zoomSelectBox->SetSelection( new_selection );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
||||
{
|
||||
DisplayErrorMessage( this, wxT("EDA_DRAW_FRAME::PrintPage() error") );
|
||||
DisplayErrorMessage( this, wxT( "EDA_DRAW_FRAME::PrintPage() error" ) );
|
||||
}
|
||||
|
||||
|
||||
@ -474,6 +476,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
||||
|
||||
UpdateStatusBar();
|
||||
m_canvas->Refresh();
|
||||
|
||||
// Needed on Windows because clicking on m_gridSelectBox remove the focus from m_canvas
|
||||
// (Windows specific
|
||||
m_canvas->SetFocus();
|
||||
@ -569,6 +572,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
|
||||
m_toolManager->RunAction( ACTIONS::zoomPreset, id );
|
||||
UpdateStatusBar();
|
||||
m_canvas->Refresh();
|
||||
|
||||
// Needed on Windows because clicking on m_zoomSelectBox remove the focus from m_canvas
|
||||
// (Windows specific
|
||||
m_canvas->SetFocus();
|
||||
@ -792,8 +796,9 @@ void EDA_DRAW_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
if( COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>() )
|
||||
{
|
||||
aCfg->m_System.last_imperial_units = static_cast<int>( cmnTool->GetLastImperialUnits() );
|
||||
aCfg->m_System.last_metric_units = static_cast<int>( cmnTool->GetLastMetricUnits() );
|
||||
aCfg->m_System.last_imperial_units =
|
||||
static_cast<int>( cmnTool->GetLastImperialUnits() );
|
||||
aCfg->m_System.last_metric_units = static_cast<int>( cmnTool->GetLastMetricUnits() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -973,7 +978,6 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
|
||||
}
|
||||
|
||||
|
||||
// Find the first child dialog.
|
||||
std::vector<wxWindow*> EDA_DRAW_FRAME::findDialogs()
|
||||
{
|
||||
std::vector<wxWindow*> dialogs;
|
||||
@ -1003,8 +1007,9 @@ void EDA_DRAW_FRAME::FocusOnLocation( const VECTOR2I& aPos )
|
||||
|
||||
for( wxWindow* dialog : findDialogs() )
|
||||
{
|
||||
dialogScreenRects.emplace_back( ToVECTOR2D( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ) ),
|
||||
ToVECTOR2D( dialog->GetSize() ) );
|
||||
dialogScreenRects.emplace_back(
|
||||
ToVECTOR2D( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ) ),
|
||||
ToVECTOR2D( dialog->GetSize() ) );
|
||||
}
|
||||
|
||||
// Center if we're behind an obscuring dialog, or within 10% of its edge
|
||||
|
@ -29,7 +29,9 @@
|
||||
#include <algorithm>
|
||||
|
||||
// Helper to make the code cleaner when we want this operation
|
||||
#define CLAMPED_VAL_INT_MAX( x ) std::min( x, static_cast<size_t>( std::numeric_limits<int>::max() ) )
|
||||
#define CLAMPED_VAL_INT_MAX( x ) \
|
||||
std::min( x, static_cast<size_t>( std::numeric_limits<int>::max() ) )
|
||||
|
||||
|
||||
bool EDA_PATTERN_MATCH_SUBSTR::SetPattern( const wxString& aPattern )
|
||||
{
|
||||
@ -396,6 +398,7 @@ EDA_COMBINED_MATCHER::EDA_COMBINED_MATCHER( const wxString& aPattern,
|
||||
AddMatcher( aPattern, std::make_unique<EDA_PATTERN_MATCH_REGEX>() );
|
||||
AddMatcher( aPattern, std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
|
||||
AddMatcher( aPattern, std::make_unique<EDA_PATTERN_MATCH_RELATIONAL>() );
|
||||
|
||||
// If any of the above matchers couldn't be created because the pattern
|
||||
// syntax does not match, the substring will try its best.
|
||||
AddMatcher( aPattern, std::make_unique<EDA_PATTERN_MATCH_SUBSTR>() );
|
||||
|
@ -155,18 +155,18 @@ void EDA_SHAPE::Serialize( google::protobuf::Any &aContainer ) const
|
||||
|
||||
switch( GetLineStyle() )
|
||||
{
|
||||
case LINE_STYLE::DEFAULT: stroke->set_style( types::SLS_DEFAULT ); break;
|
||||
case LINE_STYLE::SOLID: stroke->set_style( types::SLS_SOLID ); break;
|
||||
case LINE_STYLE::DASH: stroke->set_style( types::SLS_DASH ); break;
|
||||
case LINE_STYLE::DOT: stroke->set_style( types::SLS_DOT ); break;
|
||||
case LINE_STYLE::DASHDOT: stroke->set_style( types::SLS_DASHDOT ); break;
|
||||
case LINE_STYLE::DEFAULT: stroke->set_style( types::SLS_DEFAULT ); break;
|
||||
case LINE_STYLE::SOLID: stroke->set_style( types::SLS_SOLID ); break;
|
||||
case LINE_STYLE::DASH: stroke->set_style( types::SLS_DASH ); break;
|
||||
case LINE_STYLE::DOT: stroke->set_style( types::SLS_DOT ); break;
|
||||
case LINE_STYLE::DASHDOT: stroke->set_style( types::SLS_DASHDOT ); break;
|
||||
case LINE_STYLE::DASHDOTDOT: stroke->set_style( types::SLS_DASHDOTDOT ); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
switch( GetFillMode() )
|
||||
{
|
||||
case FILL_T::FILLED_SHAPE: fill->set_fill_type( types::GFT_FILLED ); break;
|
||||
case FILL_T::FILLED_SHAPE: fill->set_fill_type( types::GFT_FILLED ); break;
|
||||
default: fill->set_fill_type( types::GFT_UNFILLED ); break;
|
||||
}
|
||||
|
||||
@ -401,6 +401,7 @@ double EDA_SHAPE::GetLength() const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int EDA_SHAPE::GetRectangleHeight() const
|
||||
{
|
||||
switch( m_shape )
|
||||
@ -414,6 +415,7 @@ int EDA_SHAPE::GetRectangleHeight() const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int EDA_SHAPE::GetRectangleWidth() const
|
||||
{
|
||||
switch( m_shape )
|
||||
@ -427,6 +429,7 @@ int EDA_SHAPE::GetRectangleWidth() const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_SHAPE::SetLength( const double& aLength )
|
||||
{
|
||||
switch( m_shape )
|
||||
@ -439,6 +442,7 @@ void EDA_SHAPE::SetLength( const double& aLength )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_SHAPE::SetRectangleHeight( const int& aHeight )
|
||||
{
|
||||
switch ( m_shape )
|
||||
@ -453,6 +457,7 @@ void EDA_SHAPE::SetRectangleHeight( const int& aHeight )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_SHAPE::SetRectangleWidth( const int& aWidth )
|
||||
{
|
||||
switch ( m_shape )
|
||||
@ -467,6 +472,7 @@ void EDA_SHAPE::SetRectangleWidth( const int& aWidth )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_SHAPE::SetRectangle( const long long int& aHeight, const long long int& aWidth )
|
||||
{
|
||||
switch ( m_shape )
|
||||
@ -495,6 +501,7 @@ void EDA_SHAPE::SetSegmentAngle( const EDA_ANGLE& aAngle )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool EDA_SHAPE::IsClosed() const
|
||||
{
|
||||
switch( m_shape )
|
||||
@ -526,7 +533,6 @@ bool EDA_SHAPE::IsClosed() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EDA_SHAPE::move( const VECTOR2I& aMoveVector )
|
||||
{
|
||||
switch ( m_shape )
|
||||
@ -846,7 +852,8 @@ int EDA_SHAPE::GetRadius() const
|
||||
}
|
||||
|
||||
|
||||
void EDA_SHAPE::SetCachedArcData( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd, const VECTOR2I& aCenter )
|
||||
void EDA_SHAPE::SetCachedArcData( const VECTOR2I& aStart, const VECTOR2I& aMid,
|
||||
const VECTOR2I& aEnd, const VECTOR2I& aCenter )
|
||||
{
|
||||
m_arcMidData.start = aStart;
|
||||
m_arcMidData.end = aEnd;
|
||||
@ -884,6 +891,7 @@ void EDA_SHAPE::SetArcGeometry( const VECTOR2I& aStart, const VECTOR2I& aMid, co
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EDA_ANGLE EDA_SHAPE::GetSegmentAngle() const
|
||||
{
|
||||
EDA_ANGLE angle( atan2( static_cast<double>( GetStart().y - GetEnd().y ),
|
||||
@ -978,7 +986,7 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
||||
|
||||
case SHAPE_T::ARC:
|
||||
aList.emplace_back( _( "Length" ), aFrame->MessageTextFromValue( GetLength() ) );
|
||||
|
||||
|
||||
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( GetArcAngle() );
|
||||
aList.emplace_back( _( "Angle" ), msg );
|
||||
|
||||
@ -1498,7 +1506,8 @@ std::vector<SHAPE*> EDA_SHAPE::makeEffectiveShapes( bool aEdgeOnly, bool aLineCh
|
||||
effectiveShapes.emplace_back( new SHAPE_CIRCLE( getCenter(), GetRadius() ) );
|
||||
|
||||
if( width > 0 || !IsFilled() || aEdgeOnly )
|
||||
effectiveShapes.emplace_back( new SHAPE_ARC( getCenter(), GetEnd(), ANGLE_360, width ) );
|
||||
effectiveShapes.emplace_back( new SHAPE_ARC( getCenter(), GetEnd(), ANGLE_360,
|
||||
width ) );
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1961,7 +1970,8 @@ void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance
|
||||
}
|
||||
|
||||
case SHAPE_T::ARC:
|
||||
TransformArcToPolygon( aBuffer, GetStart(), GetArcMid(), GetEnd(), width, aError, aErrorLoc );
|
||||
TransformArcToPolygon( aBuffer, GetStart(), GetArcMid(), GetEnd(), width, aError,
|
||||
aErrorLoc );
|
||||
break;
|
||||
|
||||
case SHAPE_T::SEGMENT:
|
||||
|
@ -346,15 +346,16 @@ void EDA_TEXT::SetBold( bool aBold )
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restore the original stroke width from `m_StoredStrokeWidth` if it was previously stored,
|
||||
// resetting the width after unbolding.
|
||||
// Restore the original stroke width from `m_StoredStrokeWidth` if it was
|
||||
// previously stored, resetting the width after unbolding.
|
||||
if( m_attributes.m_StoredStrokeWidth )
|
||||
m_attributes.m_StrokeWidth = m_attributes.m_StoredStrokeWidth;
|
||||
else
|
||||
{
|
||||
m_attributes.m_StrokeWidth = GetPenSizeForNormal( size );
|
||||
// Sets `m_StrokeWidth` to the normal pen size and stores it in `m_StoredStrokeWidth`
|
||||
// as the default, but only if the bold option was applied before this feature was implemented.
|
||||
// Sets `m_StrokeWidth` to the normal pen size and stores it in
|
||||
// `m_StoredStrokeWidth` as the default, but only if the bold option was
|
||||
// applied before this feature was implemented.
|
||||
m_attributes.m_StoredStrokeWidth = m_attributes.m_StrokeWidth;
|
||||
}
|
||||
}
|
||||
@ -472,7 +473,7 @@ int EDA_TEXT::GetEffectiveTextPenWidth( int aDefaultPenWidth ) const
|
||||
}
|
||||
|
||||
// Clip pen size for small texts:
|
||||
penWidth = Clamp_Text_PenSize( penWidth, GetTextSize() );
|
||||
penWidth = ClampTextPenSize( penWidth, GetTextSize() );
|
||||
|
||||
return penWidth;
|
||||
}
|
||||
@ -790,8 +791,8 @@ BOX2I EDA_TEXT::GetTextBox( int aLine ) const
|
||||
|
||||
// interline spacing is only *between* lines, so total height is the height of the first
|
||||
// line plus the interline distance (with interline spacing) for all subsequent lines
|
||||
textsize.y += KiROUND( ( strings.GetCount() - 1 ) * font->GetInterline( fontSize.y,
|
||||
getFontMetrics() ) );
|
||||
textsize.y += KiROUND( ( strings.GetCount() - 1 )
|
||||
* font->GetInterline( fontSize.y, getFontMetrics() ) );
|
||||
}
|
||||
|
||||
textsize.y += overbarOffset;
|
||||
@ -809,6 +810,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine ) const
|
||||
case GR_TEXT_H_ALIGN_LEFT:
|
||||
if( IsMirrored() )
|
||||
bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) );
|
||||
|
||||
break;
|
||||
|
||||
case GR_TEXT_H_ALIGN_CENTER:
|
||||
|
@ -42,10 +42,12 @@ bool IsFileFromEDATool( const wxFileName& aFileName, const EDA_TOOLS aTool )
|
||||
textFile.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
textFile.Close();
|
||||
}
|
||||
|
||||
|
@ -119,6 +119,7 @@ bool EDA_UNIT_UTILS::FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS
|
||||
aUnits = EDA_UNITS::DEGREES;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -256,6 +257,7 @@ bool EDA_UNIT_UTILS::ParseInternalUnits( const std::string& aInput, const EDA_IU
|
||||
#define IN_TO_IU( x, scale ) ( x * scale.IU_PER_MILS * 1000 )
|
||||
#define MILS_TO_IU( x, scale ) ( x * scale.IU_PER_MILS )
|
||||
|
||||
|
||||
double EDA_UNIT_UTILS::UI::ToUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnit,
|
||||
double aValue )
|
||||
{
|
||||
@ -285,18 +287,6 @@ double EDA_UNIT_UTILS::UI::ToUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS a
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a value to a string using double notation.
|
||||
*
|
||||
* For readability, the mantissa has 3 or more digits,
|
||||
* the trailing 0 are removed if the mantissa has more than 3 digits
|
||||
* and some trailing 0
|
||||
* This function should be used to display values in dialogs because a value
|
||||
* entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa
|
||||
* if displayed in inch to avoid truncation or rounding made just by the printf function.
|
||||
* otherwise the actual value is rounded when read from dialog and converted
|
||||
* in internal units, and therefore modified.
|
||||
*/
|
||||
wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||
double aValue, bool aAddUnitsText,
|
||||
EDA_DATA_TYPE aType )
|
||||
@ -362,19 +352,6 @@ wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convert a value to a string using double notation.
|
||||
*
|
||||
* For readability, the mantissa has 0, 1, 3 or 4 digits, depending on units
|
||||
* for unit = inch the mantissa has 3 digits (Eeschema) or 4 digits
|
||||
* for unit = mil the mantissa has 0 digits (Eeschema) or 1 digits
|
||||
* for unit = mm the mantissa has 3 digits (Eeschema) or 4 digits
|
||||
* Should be used only to display info in status,
|
||||
* but not in dialogs, because 4 digits only
|
||||
* could truncate the actual value
|
||||
*/
|
||||
|
||||
|
||||
// A lower-precision (for readability) version of StringFromValue()
|
||||
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||
int aValue,
|
||||
|
@ -112,6 +112,7 @@ void EMBEDDED_FILES::AddFile( EMBEDDED_FILE* aFile )
|
||||
m_files.insert( { aFile->name, aFile } );
|
||||
}
|
||||
|
||||
|
||||
// Remove a file from the collection
|
||||
void EMBEDDED_FILES::RemoveFile( const wxString& name, bool aErase )
|
||||
{
|
||||
@ -187,6 +188,7 @@ void EMBEDDED_FILES::WriteEmbeddedFiles( OUTPUTFORMATTER& aOut, bool aWriteData
|
||||
remaining == length ? "|" : "" );
|
||||
first += MIME_BASE64_LENGTH;
|
||||
}
|
||||
|
||||
aOut.Print( ")" ); // Close data
|
||||
}
|
||||
|
||||
@ -197,6 +199,7 @@ void EMBEDDED_FILES::WriteEmbeddedFiles( OUTPUTFORMATTER& aOut, bool aWriteData
|
||||
aOut.Print( ")" ); // Close embedded_files
|
||||
}
|
||||
|
||||
|
||||
// Compress and Base64 encode data
|
||||
EMBEDDED_FILES::RETURN_CODE EMBEDDED_FILES::CompressAndEncode( EMBEDDED_FILE& aFile )
|
||||
{
|
||||
@ -217,6 +220,7 @@ EMBEDDED_FILES::RETURN_CODE EMBEDDED_FILES::CompressAndEncode( EMBEDDED_FILE& aF
|
||||
aFile.compressedEncodedData.resize( dstLen );
|
||||
size_t retval = wxBase64Encode( aFile.compressedEncodedData.data(), dstLen,
|
||||
compressedData.data(), compressedSize );
|
||||
|
||||
if( retval != dstLen )
|
||||
{
|
||||
aFile.compressedEncodedData.clear();
|
||||
@ -230,6 +234,7 @@ EMBEDDED_FILES::RETURN_CODE EMBEDDED_FILES::CompressAndEncode( EMBEDDED_FILE& aF
|
||||
return RETURN_CODE::OK;
|
||||
}
|
||||
|
||||
|
||||
// Decompress and Base64 decode data
|
||||
EMBEDDED_FILES::RETURN_CODE EMBEDDED_FILES::DecompressAndDecode( EMBEDDED_FILE& aFile )
|
||||
{
|
||||
@ -240,7 +245,8 @@ EMBEDDED_FILES::RETURN_CODE EMBEDDED_FILES::DecompressAndDecode( EMBEDDED_FILE&
|
||||
{
|
||||
wxLogTrace( wxT( "KICAD_EMBED" ),
|
||||
wxT( "%s:%s:%d\n * Base64DecodedSize failed for file '%s' with size %zu" ),
|
||||
__FILE__, __FUNCTION__, __LINE__, aFile.name, aFile.compressedEncodedData.size() );
|
||||
__FILE__, __FUNCTION__, __LINE__, aFile.name,
|
||||
aFile.compressedEncodedData.size() );
|
||||
return RETURN_CODE::OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -304,6 +310,7 @@ EMBEDDED_FILES::RETURN_CODE EMBEDDED_FILES::DecompressAndDecode( EMBEDDED_FILE&
|
||||
return RETURN_CODE::OK;
|
||||
}
|
||||
|
||||
|
||||
// Parsing method
|
||||
void EMBEDDED_FILES_PARSER::ParseEmbedded( EMBEDDED_FILES* aFiles )
|
||||
{
|
||||
@ -341,7 +348,6 @@ void EMBEDDED_FILES_PARSER::ParseEmbedded( EMBEDDED_FILES* aFiles )
|
||||
|
||||
file = std::unique_ptr<EMBEDDED_FILES::EMBEDDED_FILE>( nullptr );
|
||||
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
@ -509,4 +515,4 @@ const std::vector<wxString>* EMBEDDED_FILES::UpdateFontFiles()
|
||||
}
|
||||
|
||||
return &m_fontFiles;
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,10 @@
|
||||
static bool normalizeAbsolutePaths( const wxFileName& aPathA, const wxFileName& aPathB,
|
||||
wxString* aResultPath )
|
||||
{
|
||||
wxCHECK_MSG( aPathA.IsAbsolute(), false, aPathA.GetPath() + wxS( " is not an absolute path." ) );
|
||||
wxCHECK_MSG( aPathB.IsAbsolute(), false, aPathB.GetPath() + wxS( " is not an absolute path." ) );
|
||||
wxCHECK_MSG( aPathA.IsAbsolute(), false,
|
||||
aPathA.GetPath() + wxS( " is not an absolute path." ) );
|
||||
wxCHECK_MSG( aPathB.IsAbsolute(), false,
|
||||
aPathB.GetPath() + wxS( " is not an absolute path." ) );
|
||||
|
||||
if( aPathA.GetPath() == aPathB.GetPath() )
|
||||
return true;
|
||||
|
@ -29,12 +29,11 @@
|
||||
|
||||
using STRING_MAP = std::map<wxString, wxString>;
|
||||
|
||||
/*
|
||||
* List of pre-defined environment variables
|
||||
/**
|
||||
* List of pre-defined environment variables.
|
||||
*
|
||||
* TODO - Instead of defining these values here,
|
||||
* extract them from elsewhere in the program
|
||||
* (where they are originally defined)
|
||||
* @todo Instead of defining these values here, extract them from elsewhere in the program
|
||||
* (where they are originally defined).
|
||||
*/
|
||||
static const ENV_VAR::ENV_VAR_LIST predefinedEnvVars = {
|
||||
wxS( "KIPRJMOD" ),
|
||||
@ -47,6 +46,7 @@ static const ENV_VAR::ENV_VAR_LIST predefinedEnvVars = {
|
||||
ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ),
|
||||
};
|
||||
|
||||
|
||||
const wxRegEx versionedEnvVarRegex( wxS( "KICAD[0-9]+_[A-Z0-9_]+(_DIR)?" ) );
|
||||
|
||||
|
||||
@ -133,7 +133,8 @@ static void initialiseEnvVarHelp( STRING_MAP& aMap )
|
||||
// Deprecated vars
|
||||
#define DEP( var ) wxString::Format( _( "Deprecated version of %s." ), var )
|
||||
|
||||
aMap[wxS( "KICAD_PTEMPLATES" )] = DEP( ENV_VAR::GetVersionedEnvVarName( wxS( "TEMPLATE_DIR" ) ) );
|
||||
aMap[wxS( "KICAD_PTEMPLATES" )] =
|
||||
DEP( ENV_VAR::GetVersionedEnvVarName( wxS( "TEMPLATE_DIR" ) ) );
|
||||
aMap[wxS( "KISYS3DMOD" )] = DEP( ENV_VAR::GetVersionedEnvVarName( wxS( "3DMODEL_DIR" ) ) );
|
||||
aMap[wxS( "KISYSMOD" )] = DEP( ENV_VAR::GetVersionedEnvVarName( wxS( "FOOTPRINT_DIR" ) ) );
|
||||
aMap[wxS( "KICAD_SYMBOL_DIR" )] = DEP( ENV_VAR::GetVersionedEnvVarName( wxS( "SYMBOL_DIR" ) ) );
|
||||
|
@ -55,7 +55,7 @@ void IO_ERROR::init( const wxString& aProblem, const char* aThrowersFile,
|
||||
{
|
||||
problem = aProblem;
|
||||
|
||||
// The throwers filename is a full filename, depending on Kicad source location.
|
||||
// The throwers filename is a full filename, depending on KiCad source location.
|
||||
// a short filename will be printed (it is better for user, the full filename has no meaning).
|
||||
wxString srcname = aThrowersFile;
|
||||
|
||||
@ -85,7 +85,7 @@ void PARSE_ERROR::init( const wxString& aProblem, const char* aThrowersFile,
|
||||
lineNumber = aLineNumber;
|
||||
byteIndex = aByteIndex;
|
||||
|
||||
// The throwers filename is a full filename, depending on Kicad source location.
|
||||
// The throwers filename is a full filename, depending on KiCad source location.
|
||||
// a short filename will be printed (it is better for user, the full filename has no meaning).
|
||||
wxString srcname = aThrowersFile;
|
||||
|
||||
@ -150,7 +150,8 @@ FUTURE_FORMAT_ERROR::FUTURE_FORMAT_ERROR( const PARSE_ERROR& aParseError,
|
||||
init( aRequiredVersion, aRequiredGenerator );
|
||||
|
||||
if( !aParseError.Problem().IsEmpty() )
|
||||
problem += wxS( "\n\n" ) + _( "Full error text:" ) + wxS( "\n" ) + aParseError.Problem();
|
||||
problem += wxS( "\n\n" ) + _( "Full error text:" ) + wxS( "\n" ) +
|
||||
aParseError.Problem();
|
||||
}
|
||||
|
||||
lineNumber = aParseError.lineNumber;
|
||||
|
@ -220,7 +220,7 @@ bool FILENAME_RESOLVER::createPathList()
|
||||
while( sPL != m_paths.end() )
|
||||
{
|
||||
wxLogTrace( MASK_3D_RESOLVER, wxS( " + %s : '%s'\n" ), (*sPL).m_Alias.GetData(),
|
||||
(*sPL).m_Pathexp.GetData() );
|
||||
(*sPL).m_Pathexp.GetData() );
|
||||
++sPL;
|
||||
}
|
||||
#endif
|
||||
@ -313,7 +313,8 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName, const wxStri
|
||||
if( !( m_errflags & ERRFLG_ENVPATH ) )
|
||||
{
|
||||
m_errflags |= ERRFLG_ENVPATH;
|
||||
wxString errmsg = "[3D File Resolver] No such path; ensure the environment var is defined";
|
||||
wxString errmsg = "[3D File Resolver] No such path; ensure the environment var is "
|
||||
"defined";
|
||||
errmsg.append( "\n" );
|
||||
errmsg.append( tname );
|
||||
errmsg.append( "\n" );
|
||||
@ -472,8 +473,9 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
||||
ENV_VAR::GetVersionedEnvVarName( wxS( "3DMODEL_DIR" ) ) );
|
||||
|
||||
if( aPath.m_Pathvar == versionedPath
|
||||
|| aPath.m_Pathvar == wxS( "${KIPRJMOD}" ) || aPath.m_Pathvar == wxS( "$(KIPRJMOD)" )
|
||||
|| aPath.m_Pathvar == wxS( "${KISYS3DMOD}" ) || aPath.m_Pathvar == wxS( "$(KISYS3DMOD)" ) )
|
||||
|| aPath.m_Pathvar == wxS( "${KIPRJMOD}" ) || aPath.m_Pathvar == wxS( "$(KIPRJMOD)" )
|
||||
|| aPath.m_Pathvar == wxS( "${KISYS3DMOD}" )
|
||||
|| aPath.m_Pathvar == wxS( "$(KISYS3DMOD)" ) )
|
||||
{
|
||||
// suppress the message if the missing pathvar is a system variable
|
||||
}
|
||||
@ -493,7 +495,7 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
||||
|
||||
#ifdef _WIN32
|
||||
while( tpath.m_Pathexp.EndsWith( wxT( "\\" ) ) )
|
||||
tpath.m_Pathexp.erase( tpath.m_Pathexp.length() - 1 );
|
||||
tpath.m_Pathexp.erase( tpath.m_Pathexp.length() - 1 );
|
||||
#else
|
||||
while( tpath.m_Pathexp.EndsWith( wxT( "/" ) ) && tpath.m_Pathexp.length() > 1 )
|
||||
tpath.m_Pathexp.erase( tpath.m_Pathexp.length() - 1 );
|
||||
@ -677,7 +679,6 @@ wxString FILENAME_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
||||
}
|
||||
|
||||
|
||||
|
||||
const std::list< SEARCH_PATH >* FILENAME_RESOLVER::GetPaths() const
|
||||
{
|
||||
return &m_paths;
|
||||
@ -801,6 +802,7 @@ bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAl
|
||||
// '\'and '/' used here because lpath can be a full path.
|
||||
// So remove separators
|
||||
wxString lpath_no_sep = lpath;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
lpath_no_sep.Replace( "/", " " );
|
||||
lpath_no_sep.Replace( "\\", " " );
|
||||
|
@ -157,7 +157,8 @@ FONT* FONT::GetFont( const wxString& aFontName, bool aBold, bool aItalic,
|
||||
font = s_fontMap[key];
|
||||
|
||||
if( !font )
|
||||
font = OUTLINE_FONT::LoadFont( aFontName, aBold, aItalic, aEmbeddedFiles, aForDrawingSheet );
|
||||
font = OUTLINE_FONT::LoadFont( aFontName, aBold, aItalic, aEmbeddedFiles,
|
||||
aForDrawingSheet );
|
||||
|
||||
if( !font )
|
||||
font = getDefaultFont();
|
||||
@ -245,16 +246,6 @@ void FONT::getLinePositions( const wxString& aText, const VECTOR2I& aPosition,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw a string.
|
||||
*
|
||||
* @param aGal
|
||||
* @param aText is the text to be drawn.
|
||||
* @param aPosition is the text object position in world coordinates.
|
||||
* @param aCursor is the current text position (for multiple text blocks within a single text
|
||||
* object, such as a run of superscript characters)
|
||||
* @param aAttrs are the styling attributes of the text, including its rotation
|
||||
*/
|
||||
void FONT::Draw( KIGFX::GAL* aGal, const wxString& aText, const VECTOR2I& aPosition,
|
||||
const VECTOR2I& aCursor, const TEXT_ATTRIBUTES& aAttrs,
|
||||
const METRICS& aFontMetrics ) const
|
||||
@ -283,7 +274,7 @@ void FONT::Draw( KIGFX::GAL* aGal, const wxString& aText, const VECTOR2I& aPosit
|
||||
|
||||
|
||||
/**
|
||||
* @return position of cursor for drawing next substring
|
||||
* @return position of cursor for drawing next substring.
|
||||
*/
|
||||
VECTOR2I drawMarkup( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const MARKUP::NODE* aNode, const VECTOR2I& aPosition,
|
||||
@ -478,9 +469,11 @@ VECTOR2I FONT::boundingBoxSingleLine( BOX2I* aBBox, const wxString& aText,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Break marked-up text into "words". In this context, a "word" is EITHER a run of marked-up
|
||||
* text (subscript, superscript or overbar), OR a run of non-marked-up text separated by spaces.
|
||||
/**
|
||||
* Break marked-up text into "words".
|
||||
*
|
||||
* In this context, a "word" is EITHER a run of marked-up text (subscript, superscript or
|
||||
* overbar), OR a run of non-marked-up text separated by spaces.
|
||||
*/
|
||||
void wordbreakMarkup( std::vector<std::pair<wxString, int>>* aWords,
|
||||
const std::unique_ptr<MARKUP::NODE>& aNode, const KIFONT::FONT* aFont,
|
||||
@ -575,17 +568,6 @@ void FONT::wordbreakMarkup( std::vector<std::pair<wxString, int>>* aWords, const
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is a highly simplified line-breaker. KiCad is an EDA tool, not a word processor.
|
||||
*
|
||||
* 1) It breaks only on spaces. If you type a word wider than the column width then you get
|
||||
* overflow.
|
||||
* 2) It treats runs of formatted text (superscript, subscript, overbar) as single words.
|
||||
* 3) It does not perform justification.
|
||||
*
|
||||
* The results of the linebreaking are the addition of \n in the text. It is presumed that this
|
||||
* function is called on m_shownText (or equivalent) rather than the original source text.
|
||||
*/
|
||||
void FONT::LinebreakText( wxString& aText, int aColumnWidth, const VECTOR2I& aSize, int aThickness,
|
||||
bool aBold, bool aItalic ) const
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ static bool g_fcInitSuccess = false;
|
||||
REPORTER* FONTCONFIG::s_reporter = nullptr;
|
||||
|
||||
/**
|
||||
* A simple wrapper to avoid exporing fontconfig in the header
|
||||
* A simple wrapper to avoid exporting fontconfig in the header
|
||||
*/
|
||||
struct fontconfig::FONTCONFIG_PAT
|
||||
{
|
||||
@ -68,11 +68,12 @@ void fontconfig::FONTCONFIG::SetReporter( REPORTER* aReporter )
|
||||
|
||||
|
||||
/**
|
||||
* This is simply a wrapper to call FcInit() with SEH for Windows
|
||||
* SEH on Windows can only be used in functions without objects that might be unwinded
|
||||
* (basically objects with destructors)
|
||||
* This is simply a wrapper to call FcInit() with SEH for Windows.
|
||||
*
|
||||
* SEH on Windows can only be used in functions without objects that might be unwound
|
||||
* (basically objects with destructors).
|
||||
* For example, new FONTCONFIG() in Fontconfig() is creating a object with a destructor
|
||||
* that *might* need to be unwinded. MSVC catches this and throws a compile error
|
||||
* that *might* need to be unwound. MSVC catches this and throws a compile error.
|
||||
*/
|
||||
static void bootstrapFc()
|
||||
{
|
||||
@ -88,6 +89,7 @@ static void bootstrapFc()
|
||||
: EXCEPTION_CONTINUE_SEARCH )
|
||||
{
|
||||
g_fcInitSuccess = false;
|
||||
|
||||
// We have documented cases that fontconfig while trying to cache fonts
|
||||
// ends up using freetype to try and get font info
|
||||
// freetype itself reads fonts through memory mapping instead of normal file APIs
|
||||
@ -158,12 +160,15 @@ void FONTCONFIG::getAllFamilyStrings( FONTCONFIG_PAT&
|
||||
std::string fam;
|
||||
|
||||
int langIdx = 0;
|
||||
|
||||
do
|
||||
{
|
||||
famLang = getFcString( aPat, FC_FAMILYLANG, langIdx );
|
||||
|
||||
if( famLang.empty() && langIdx != 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
fam = getFcString( aPat, FC_FAMILY, langIdx );
|
||||
@ -291,7 +296,7 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString& aFontName, wxString&
|
||||
wxString lower_style = styleStr.Lower();
|
||||
|
||||
if( lower_style.Contains( wxS( "thin" ) )
|
||||
|| lower_style.Contains( wxS( "light" ) ) // also cataches ultralight and extralight
|
||||
|| lower_style.Contains( wxS( "light" ) ) // catches ultra & extra light
|
||||
|| lower_style.Contains( wxS( "regular" ) )
|
||||
|| lower_style.Contains( wxS( "roman" ) )
|
||||
|| lower_style.Contains( wxS( "book" ) ) )
|
||||
@ -350,17 +355,20 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString& aFontName, wxString&
|
||||
if( retval == FF_RESULT::FF_ERROR )
|
||||
{
|
||||
if( s_reporter )
|
||||
s_reporter->Report( wxString::Format( _( "Error loading font '%s'." ), qualifiedFontName ) );
|
||||
s_reporter->Report( wxString::Format( _( "Error loading font '%s'." ),
|
||||
qualifiedFontName ) );
|
||||
}
|
||||
else if( retval == FF_RESULT::FF_SUBSTITUTE )
|
||||
{
|
||||
fontName.Replace( ':', ' ' );
|
||||
|
||||
// If we missed a case but the matching found the original font name, then we are not substituting
|
||||
// If we missed a case but the matching found the original font name, then we are
|
||||
// not substituting
|
||||
if( fontName.CmpNoCase( qualifiedFontName ) == 0 )
|
||||
retval = FF_RESULT::FF_OK;
|
||||
else if( s_reporter )
|
||||
s_reporter->Report( wxString::Format( _( "Font '%s' not found; substituting '%s'." ), qualifiedFontName, fontName ) );
|
||||
s_reporter->Report( wxString::Format( _( "Font '%s' not found; substituting '%s'." ),
|
||||
qualifiedFontName, fontName ) );
|
||||
}
|
||||
|
||||
FcPatternDestroy( pat );
|
||||
@ -451,7 +459,8 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts, const std::string&
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( traceFonts, wxS( "Font '%s' language '%s' not supported by OS." ),
|
||||
wxLogTrace( traceFonts,
|
||||
wxS( "Font '%s' language '%s' not supported by OS." ),
|
||||
theFamily, langWxStr );
|
||||
}
|
||||
|
||||
@ -490,3 +499,4 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts, const std::string&
|
||||
for( const std::pair<const std::string, FONTINFO>& entry : m_fontInfoCache )
|
||||
aFonts.push_back( entry.second.Family() );
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,8 @@ void OUTLINE_GLYPH::CacheTriangulation( bool aPartition, bool aSimplify )
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>> OUTLINE_GLYPH::GetTriangulationData() const
|
||||
std::vector<std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>>
|
||||
OUTLINE_GLYPH::GetTriangulationData() const
|
||||
{
|
||||
std::vector<std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>> data;
|
||||
|
||||
@ -173,7 +174,8 @@ std::vector<std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>> OUTLINE_GLYPH
|
||||
}
|
||||
|
||||
|
||||
void OUTLINE_GLYPH::CacheTriangulation( std::vector<std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>>& aHintData )
|
||||
void OUTLINE_GLYPH::CacheTriangulation(
|
||||
std::vector<std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>>& aHintData )
|
||||
{
|
||||
cacheTriangulation( false, false, &aHintData );
|
||||
}
|
||||
|
@ -66,16 +66,20 @@ OUTLINE_FONT::EMBEDDING_PERMISSION OUTLINE_FONT::GetEmbeddingPermission() const
|
||||
if( !os2 )
|
||||
return EMBEDDING_PERMISSION::RESTRICTED;
|
||||
|
||||
if( os2->fsType == FT_FSTYPE_INSTALLABLE_EMBEDDING ) // This allows the font to be exported from KiCad
|
||||
// This allows the font to be exported from KiCad
|
||||
if( os2->fsType == FT_FSTYPE_INSTALLABLE_EMBEDDING )
|
||||
return EMBEDDING_PERMISSION::INSTALLABLE;
|
||||
|
||||
if( os2->fsType & FT_FSTYPE_BITMAP_EMBEDDING_ONLY ) // We don't support bitmap fonts, so this disables embedding
|
||||
// We don't support bitmap fonts, so this disables embedding
|
||||
if( os2->fsType & FT_FSTYPE_BITMAP_EMBEDDING_ONLY )
|
||||
return EMBEDDING_PERMISSION::RESTRICTED;
|
||||
|
||||
if( os2->fsType & FT_FSTYPE_EDITABLE_EMBEDDING ) // This allows us to use the font in KiCad but not export
|
||||
// This allows us to use the font in KiCad but not export
|
||||
if( os2->fsType & FT_FSTYPE_EDITABLE_EMBEDDING )
|
||||
return EMBEDDING_PERMISSION::EDITABLE;
|
||||
|
||||
if( os2->fsType & FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING ) // This is not actually supported by KiCad ATM(2024)
|
||||
// This is not actually supported by KiCad ATM(2024)
|
||||
if( os2->fsType & FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING )
|
||||
return EMBEDDING_PERMISSION::PRINT_PREVIEW_ONLY;
|
||||
|
||||
// Anything else that is not explicitly enabled we treat as restricted.
|
||||
@ -139,10 +143,6 @@ FT_Error OUTLINE_FONT::loadFace( const wxString& aFontFileName, int aFaceIndex )
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute the distance (interline) between 2 lines of text (for multiline texts). This is
|
||||
* the distance between baselines, not the space between line bounding boxes.
|
||||
*/
|
||||
double OUTLINE_FONT::GetInterline( double aGlyphHeight, const METRICS& aFontMetrics ) const
|
||||
{
|
||||
double glyphToFontHeight = 1.0;
|
||||
@ -314,6 +314,7 @@ struct GLYPH_CACHE_KEY {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
@ -493,7 +494,8 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
|
||||
}
|
||||
|
||||
// Some lovely TTF fonts decided that winding didn't matter for outlines that
|
||||
// don't have holes, so holes that don't fit in any outline are added as outlines
|
||||
// don't have holes, so holes that don't fit in any outline are added as
|
||||
// outlines.
|
||||
if( !added_hole )
|
||||
glyph->AddOutline( std::move( hole ) );
|
||||
}
|
||||
@ -536,7 +538,7 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
|
||||
#undef OUTLINEFONT_RENDER_AS_PIXELS
|
||||
#ifdef OUTLINEFONT_RENDER_AS_PIXELS
|
||||
/*
|
||||
* WIP: eeschema (and PDF output?) should use pixel rendering instead of linear segmentation
|
||||
* WIP: Eeschema (and PDF output?) should use pixel rendering instead of linear segmentation
|
||||
*/
|
||||
void OUTLINE_FONT::RenderToOpenGLCanvas( KIGFX::OPENGL_GAL& aGal, const wxString& aString,
|
||||
const VECTOR2D& aGlyphSize, const VECTOR2I& aPosition,
|
||||
@ -544,7 +546,9 @@ void OUTLINE_FONT::RenderToOpenGLCanvas( KIGFX::OPENGL_GAL& aGal, const wxString
|
||||
{
|
||||
hb_buffer_t* buf = hb_buffer_create();
|
||||
hb_buffer_add_utf8( buf, UTF8( aString ).c_str(), -1, 0, -1 );
|
||||
hb_buffer_guess_segment_properties( buf ); // guess direction, script, and language based on contents
|
||||
|
||||
// guess direction, script, and language based on contents
|
||||
hb_buffer_guess_segment_properties( buf );
|
||||
|
||||
unsigned int glyphCount;
|
||||
hb_glyph_info_t* glyphInfo = hb_buffer_get_glyph_infos( buf, &glyphCount );
|
||||
@ -586,4 +590,5 @@ void OUTLINE_FONT::RenderToOpenGLCanvas( KIGFX::OPENGL_GAL& aGal, const wxString
|
||||
|
||||
hb_buffer_destroy( buf );
|
||||
}
|
||||
|
||||
#endif //OUTLINEFONT_RENDER_AS_PIXELS
|
||||
|
@ -41,10 +41,10 @@
|
||||
using namespace KIFONT;
|
||||
|
||||
|
||||
///< Scale factor for a glyph
|
||||
/// Scale factor for a glyph.
|
||||
static constexpr double STROKE_FONT_SCALE = 1.0 / 21.0;
|
||||
|
||||
///< Offset (in stroke font units) to move the origin to the baseline.
|
||||
/// Offset (in stroke font units) to move the origin to the baseline.
|
||||
static constexpr int FONT_OFFSET = -8;
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
wxString errMsg; // to collect error messages
|
||||
|
||||
// This table may be nested within a larger s-expression, or not.
|
||||
// Allow for parser of that optional containing s-epression to have looked ahead.
|
||||
// Allow for parser of that optional containing s-expression to have looked ahead.
|
||||
if( in->CurTok() != T_fp_lib_table )
|
||||
{
|
||||
in->NeedLEFT();
|
||||
@ -204,7 +204,7 @@ void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
|
||||
// All nickNames within this table fragment must be unique, so we do not use doReplace
|
||||
// in doInsertRow(). (However a fallBack table can have a conflicting nickName and ours
|
||||
// will supercede that one since in FindLib() we search this table before any fall back.)
|
||||
// will supersede that one since in FindLib() we search this table before any fall back.)
|
||||
wxString nickname = row->GetNickName(); // store it to be able to used it
|
||||
// after row deletion if an error occurs
|
||||
bool doReplace = false;
|
||||
@ -536,8 +536,8 @@ public:
|
||||
// it is under $KICADn_3RD_PARTY/footprints/<pkgid>/ i.e. has nested level of at least +3
|
||||
if( dirPath.EndsWith( wxS( ".pretty" ) ) && dir.GetDirCount() >= m_prefix_dir_count + 3 )
|
||||
{
|
||||
wxString versionedPath = wxString::Format( wxS( "${%s}" ),
|
||||
ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
|
||||
wxString versionedPath = wxString::Format(
|
||||
wxS( "${%s}" ), ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
|
||||
|
||||
wxArrayString parts = dir.GetDirs();
|
||||
parts.RemoveAt( 0, m_prefix_dir_count );
|
||||
@ -555,7 +555,8 @@ public:
|
||||
int increment = 1;
|
||||
do
|
||||
{
|
||||
nickname = wxString::Format( wxS( "%s%s_%d" ), m_lib_prefix, name, increment );
|
||||
nickname = wxString::Format( wxS( "%s%s_%d" ), m_lib_prefix, name,
|
||||
increment );
|
||||
increment++;
|
||||
} while( m_lib_table.HasLibrary( nickname ) );
|
||||
}
|
||||
|
@ -287,7 +287,8 @@ void CAMERA::rebuildProjection()
|
||||
|
||||
case PROJECTION_TYPE::ORTHO:
|
||||
|
||||
// Keep the viewed plane at (m_camera_pos_init * m_zoom) the same dimensions in both projections.
|
||||
// Keep the viewed plane at (m_camera_pos_init * m_zoom) the same dimensions in both
|
||||
// projections.
|
||||
m_frustum.angle = 45.0f;
|
||||
m_frustum.tang = glm::tan( glm::radians( m_frustum.angle ) * 0.5f );
|
||||
|
||||
|
@ -1368,6 +1368,7 @@ CAIRO_GAL::CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
|
||||
Connect( wxEVT_AUX2_UP, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
|
||||
Connect( wxEVT_AUX2_DCLICK, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
|
||||
Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
|
||||
|
||||
#if defined _WIN32 || defined _WIN64
|
||||
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
|
||||
#endif
|
||||
@ -1438,6 +1439,7 @@ void CAIRO_GAL::EndDrawing()
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[0];
|
||||
#endif
|
||||
|
||||
dst += 3;
|
||||
}
|
||||
|
||||
@ -1839,7 +1841,7 @@ void CAIRO_GAL_BASE::DrawGlyph( const KIFONT::GLYPH& aGlyph, int aNth, int aTota
|
||||
for( const std::vector<VECTOR2D>& pointList : glyph )
|
||||
drawPoly( pointList );
|
||||
}
|
||||
else if( aGlyph.IsOutline() )
|
||||
else if( aGlyph.IsOutline() )
|
||||
{
|
||||
const KIFONT::OUTLINE_GLYPH& glyph = static_cast<const KIFONT::OUTLINE_GLYPH&>( aGlyph );
|
||||
|
||||
|
@ -39,6 +39,7 @@ using namespace KIGFX;
|
||||
|
||||
GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
|
||||
m_options( aDisplayOptions ),
|
||||
|
||||
// m_currentNativeCursor is initialized with KICURSOR::DEFAULT value to avoid
|
||||
// if comparison with uninitialized value on SetNativeCursorStyle method.
|
||||
// Some classes inheriting from GAL has different SetNativeCursorStyle method
|
||||
@ -54,9 +55,11 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
|
||||
SetLookAtPoint( VECTOR2D( 0, 0 ) );
|
||||
SetZoomFactor( 1.0 );
|
||||
SetRotation( 0.0 );
|
||||
|
||||
// this value for SetWorldUnitLength is only suitable for Pcbnew.
|
||||
// Other editors/viewer must call SetWorldUnitLength with their internal units
|
||||
SetWorldUnitLength( 1e-9 /* 1 nm */ / 0.0254 /* 1 inch in meters */ );
|
||||
|
||||
// wxDC::GetPPI() reports 96 DPI, but somehow this value
|
||||
// is the closest match to the legacy renderer
|
||||
SetScreenDPI( 91 );
|
||||
@ -223,19 +226,24 @@ VECTOR2D GAL::GetGridPoint( const VECTOR2D& aPoint ) const
|
||||
{
|
||||
#if 0
|
||||
// This old code expects a non zero grid size, which can be wrong here.
|
||||
return VECTOR2D( KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) * m_gridSize.x + m_gridOffset.x,
|
||||
KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) * m_gridSize.y + m_gridOffset.y );
|
||||
return VECTOR2D( KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) *
|
||||
m_gridSize.x + m_gridOffset.x,
|
||||
KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) *
|
||||
m_gridSize.y + m_gridOffset.y );
|
||||
#else
|
||||
// if grid size == 0.0 there is no grid, so use aPoint as grid reference position
|
||||
double cx = m_gridSize.x > 0.0 ? KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) * m_gridSize.x + m_gridOffset.x
|
||||
double cx = m_gridSize.x > 0.0 ? KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) *
|
||||
m_gridSize.x + m_gridOffset.x
|
||||
: aPoint.x;
|
||||
double cy = m_gridSize.y > 0.0 ? KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) * m_gridSize.y + m_gridOffset.y
|
||||
double cy = m_gridSize.y > 0.0 ? KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) *
|
||||
m_gridSize.y + m_gridOffset.y
|
||||
: aPoint.y;
|
||||
|
||||
return VECTOR2D( cx, cy );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// MIN_DEPTH must be set to be - (VIEW::VIEW_MAX_LAYERS + abs(VIEW::TOP_LAYER_MODIFIER))
|
||||
// MAX_DEPTH must be set to be VIEW::VIEW_MAX_LAYERS + abs(VIEW::TOP_LAYER_MODIFIER) -1
|
||||
// VIEW_MAX_LAYERS and TOP_LAYER_MODIFIER are defined in view.h.
|
||||
@ -259,9 +267,6 @@ COLOR4D GAL::getCursorColor() const
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fallback for implementations that don't implement bitmap text: use stroke font
|
||||
*/
|
||||
void GAL::BitmapText( const wxString& aText, const VECTOR2I& aPosition, const EDA_ANGLE& aAngle )
|
||||
{
|
||||
KIFONT::FONT* font = KIFONT::FONT::GetFont();
|
||||
|
@ -32,7 +32,8 @@ HIDPI_GL_3D_CANVAS::HIDPI_GL_3D_CANVAS( const KIGFX::VC_SETTINGS& aVcSettings, C
|
||||
wxWindowID aId, const wxPoint& aPos,
|
||||
const wxSize& aSize, long aStyle, const wxString& aName,
|
||||
const wxPalette& aPalette ) :
|
||||
HIDPI_GL_CANVAS( aVcSettings, aParent, aGLAttribs, aId, aPos, aSize, aStyle, aName, aPalette ),
|
||||
HIDPI_GL_CANVAS( aVcSettings, aParent, aGLAttribs, aId, aPos, aSize, aStyle, aName,
|
||||
aPalette ),
|
||||
m_mouse_is_moving( false ),
|
||||
m_mouse_was_moved( false ),
|
||||
m_camera_is_moving( false ),
|
||||
|
@ -306,7 +306,8 @@ uniform vec4 SMAA_RT_METRICS;
|
||||
BUILTIN_SHADERS::glsl_smaa_base,
|
||||
BUILTIN_SHADERS::glsl_smaa_pass_1_vert );
|
||||
pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble,
|
||||
quality_string, BUILTIN_SHADERS::glsl_smaa_base, edge_detect_shader );
|
||||
quality_string, BUILTIN_SHADERS::glsl_smaa_base,
|
||||
edge_detect_shader );
|
||||
pass_1_shader->Link();
|
||||
checkGlError( "linking pass 1 shader", __FILE__, __LINE__ );
|
||||
|
||||
|
@ -30,113 +30,113 @@
|
||||
|
||||
namespace KIGFX {
|
||||
|
||||
class OPENGL_COMPOSITOR;
|
||||
class OPENGL_COMPOSITOR;
|
||||
|
||||
class OPENGL_PRESENTOR
|
||||
class OPENGL_PRESENTOR
|
||||
{
|
||||
public:
|
||||
virtual ~OPENGL_PRESENTOR()
|
||||
{
|
||||
public:
|
||||
virtual ~OPENGL_PRESENTOR()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool Init() = 0;
|
||||
virtual unsigned int CreateBuffer() = 0;
|
||||
virtual bool Init() = 0;
|
||||
virtual unsigned int CreateBuffer() = 0;
|
||||
|
||||
virtual VECTOR2I GetInternalBufferSize() = 0;
|
||||
virtual void OnLostBuffers() = 0;
|
||||
virtual VECTOR2I GetInternalBufferSize() = 0;
|
||||
virtual void OnLostBuffers() = 0;
|
||||
|
||||
virtual void Begin() = 0;
|
||||
virtual void DrawBuffer( GLuint aBuffer ) = 0;
|
||||
virtual void Present() = 0;
|
||||
};
|
||||
virtual void Begin() = 0;
|
||||
virtual void DrawBuffer( GLuint aBuffer ) = 0;
|
||||
virtual void Present() = 0;
|
||||
};
|
||||
|
||||
|
||||
class ANTIALIASING_NONE : public OPENGL_PRESENTOR
|
||||
{
|
||||
public:
|
||||
ANTIALIASING_NONE( OPENGL_COMPOSITOR* aCompositor );
|
||||
class ANTIALIASING_NONE : public OPENGL_PRESENTOR
|
||||
{
|
||||
public:
|
||||
ANTIALIASING_NONE( OPENGL_COMPOSITOR* aCompositor );
|
||||
|
||||
bool Init() override;
|
||||
unsigned int CreateBuffer() override;
|
||||
bool Init() override;
|
||||
unsigned int CreateBuffer() override;
|
||||
|
||||
VECTOR2I GetInternalBufferSize() override;
|
||||
void OnLostBuffers() override;
|
||||
VECTOR2I GetInternalBufferSize() override;
|
||||
void OnLostBuffers() override;
|
||||
|
||||
void Begin() override;
|
||||
void DrawBuffer( GLuint aBuffer ) override;
|
||||
void Present() override;
|
||||
void Begin() override;
|
||||
void DrawBuffer( GLuint aBuffer ) override;
|
||||
void Present() override;
|
||||
|
||||
private:
|
||||
OPENGL_COMPOSITOR* compositor;
|
||||
};
|
||||
private:
|
||||
OPENGL_COMPOSITOR* compositor;
|
||||
};
|
||||
|
||||
|
||||
class ANTIALIASING_SUPERSAMPLING : public OPENGL_PRESENTOR
|
||||
{
|
||||
public:
|
||||
ANTIALIASING_SUPERSAMPLING( OPENGL_COMPOSITOR* aCompositor );
|
||||
class ANTIALIASING_SUPERSAMPLING : public OPENGL_PRESENTOR
|
||||
{
|
||||
public:
|
||||
ANTIALIASING_SUPERSAMPLING( OPENGL_COMPOSITOR* aCompositor );
|
||||
|
||||
bool Init() override;
|
||||
unsigned int CreateBuffer() override;
|
||||
bool Init() override;
|
||||
unsigned int CreateBuffer() override;
|
||||
|
||||
VECTOR2I GetInternalBufferSize() override;
|
||||
void OnLostBuffers() override;
|
||||
VECTOR2I GetInternalBufferSize() override;
|
||||
void OnLostBuffers() override;
|
||||
|
||||
void Begin() override;
|
||||
void DrawBuffer( GLuint ) override;
|
||||
void Present() override;
|
||||
void Begin() override;
|
||||
void DrawBuffer( GLuint ) override;
|
||||
void Present() override;
|
||||
|
||||
private:
|
||||
OPENGL_COMPOSITOR* compositor;
|
||||
private:
|
||||
OPENGL_COMPOSITOR* compositor;
|
||||
|
||||
unsigned int ssaaMainBuffer;
|
||||
bool areBuffersCreated;
|
||||
unsigned int ssaaMainBuffer;
|
||||
bool areBuffersCreated;
|
||||
|
||||
bool areShadersCreated;
|
||||
};
|
||||
bool areShadersCreated;
|
||||
};
|
||||
|
||||
class ANTIALIASING_SMAA : public OPENGL_PRESENTOR
|
||||
{
|
||||
public:
|
||||
ANTIALIASING_SMAA( OPENGL_COMPOSITOR* aCompositor );
|
||||
class ANTIALIASING_SMAA : public OPENGL_PRESENTOR
|
||||
{
|
||||
public:
|
||||
ANTIALIASING_SMAA( OPENGL_COMPOSITOR* aCompositor );
|
||||
|
||||
bool Init() override;
|
||||
unsigned int CreateBuffer () override;
|
||||
bool Init() override;
|
||||
unsigned int CreateBuffer () override;
|
||||
|
||||
VECTOR2I GetInternalBufferSize() override;
|
||||
void OnLostBuffers() override;
|
||||
VECTOR2I GetInternalBufferSize() override;
|
||||
void OnLostBuffers() override;
|
||||
|
||||
void Begin() override;
|
||||
void DrawBuffer( GLuint buffer ) override;
|
||||
void Present() override;
|
||||
void Begin() override;
|
||||
void DrawBuffer( GLuint buffer ) override;
|
||||
void Present() override;
|
||||
|
||||
private:
|
||||
void loadShaders();
|
||||
void updateUniforms();
|
||||
private:
|
||||
void loadShaders();
|
||||
void updateUniforms();
|
||||
|
||||
bool areBuffersInitialized;
|
||||
bool areBuffersInitialized;
|
||||
|
||||
unsigned int smaaBaseBuffer; // base + overlay temporary
|
||||
unsigned int smaaEdgesBuffer;
|
||||
unsigned int smaaBlendBuffer;
|
||||
unsigned int smaaBaseBuffer; // base + overlay temporary
|
||||
unsigned int smaaEdgesBuffer;
|
||||
unsigned int smaaBlendBuffer;
|
||||
|
||||
// smaa shader lookup textures
|
||||
unsigned int smaaAreaTex;
|
||||
unsigned int smaaSearchTex;
|
||||
// smaa shader lookup textures
|
||||
unsigned int smaaAreaTex;
|
||||
unsigned int smaaSearchTex;
|
||||
|
||||
bool shadersLoaded;
|
||||
bool shadersLoaded;
|
||||
|
||||
std::unique_ptr<SHADER> pass_1_shader;
|
||||
GLint pass_1_metrics;
|
||||
std::unique_ptr<SHADER> pass_1_shader;
|
||||
GLint pass_1_metrics;
|
||||
|
||||
std::unique_ptr<SHADER> pass_2_shader;
|
||||
GLint pass_2_metrics;
|
||||
std::unique_ptr<SHADER> pass_2_shader;
|
||||
GLint pass_2_metrics;
|
||||
|
||||
std::unique_ptr<SHADER> pass_3_shader;
|
||||
GLint pass_3_metrics;
|
||||
std::unique_ptr<SHADER> pass_3_shader;
|
||||
GLint pass_3_metrics;
|
||||
|
||||
OPENGL_COMPOSITOR* compositor;
|
||||
};
|
||||
OPENGL_COMPOSITOR* compositor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
@ -90,6 +90,7 @@ void CACHED_CONTAINER::FinishItem()
|
||||
|
||||
// Add the not used memory back to the pool
|
||||
addFreeChunk( itemOffset + itemSize, m_chunkSize - itemSize );
|
||||
|
||||
// mergeFreeChunks(); // veery slow and buggy
|
||||
|
||||
m_maxIndex = std::max( itemOffset + itemSize, m_maxIndex );
|
||||
@ -284,7 +285,7 @@ void CACHED_CONTAINER::defragment( VERTEX* aTarget )
|
||||
#ifdef __WIN32__
|
||||
#ifdef __MINGW32__
|
||||
// currently, because SEH (Structured Exception Handling) is not documented on msys
|
||||
// (for intance __try or __try1 exists without doc) or is not supported, do nothing
|
||||
// (for instance __try or __try1 exists without doc) or is not supported, do nothing
|
||||
#else
|
||||
__try
|
||||
#endif
|
||||
@ -317,7 +318,7 @@ void CACHED_CONTAINER::defragment( VERTEX* aTarget )
|
||||
#ifdef __WIN32__
|
||||
#ifdef __MINGW32__
|
||||
// currently, because SEH (Structured Exception Handling) is not documented on msys
|
||||
// (for intance __except1 exists without doc) or is not supported, do nothing
|
||||
// (for instance __except1 exists without doc) or is not supported, do nothing
|
||||
#else
|
||||
__except( GetExceptionCode() == STATUS_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER
|
||||
: EXCEPTION_CONTINUE_SEARCH )
|
||||
@ -373,6 +374,7 @@ void CACHED_CONTAINER::mergeFreeChunks()
|
||||
// These chunks cannot be merged
|
||||
// So store the previous one
|
||||
m_freeChunks.insert( std::make_pair( size, offset ) );
|
||||
|
||||
// and let's check the next chunk
|
||||
offset = itf->first;
|
||||
size = itf->second;
|
||||
|
@ -259,6 +259,7 @@ bool CACHED_CONTAINER_GPU::defragmentResizeMemcpy( unsigned int aNewSize )
|
||||
glGetIntegerv( GL_ELEMENT_ARRAY_BUFFER_BINDING, &eaBuffer );
|
||||
wxASSERT( eaBuffer == 0 );
|
||||
#endif /* KICAD_GAL_PROFILE */
|
||||
|
||||
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, newBuffer );
|
||||
glBufferData( GL_ELEMENT_ARRAY_BUFFER, aNewSize * VERTEX_SIZE, nullptr, GL_DYNAMIC_DRAW );
|
||||
newBufferMem = static_cast<VERTEX*>( glMapBuffer( GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY ) );
|
||||
|
@ -211,6 +211,7 @@ void GPU_CACHED_MANAGER::EndDrawing()
|
||||
icnt++;
|
||||
}
|
||||
}
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
|
@ -389,6 +389,7 @@ OPENGL_GAL::OPENGL_GAL( const KIGFX::VC_SETTINGS& aVcSettings, GAL_DISPLAY_OPTIO
|
||||
Connect( wxEVT_AUX2_DCLICK, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
|
||||
Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
|
||||
Connect( wxEVT_MAGNIFY, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
|
||||
|
||||
#if defined _WIN32 || defined _WIN64
|
||||
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
|
||||
#endif
|
||||
@ -701,7 +702,7 @@ void OPENGL_GAL::BeginDrawing()
|
||||
m_shader->SetParameter( ufm_antialiasingOffset, renderingOffset );
|
||||
m_shader->Deactivate();
|
||||
|
||||
// Something betreen BeginDrawing and EndDrawing seems to depend on
|
||||
// Something between BeginDrawing and EndDrawing seems to depend on
|
||||
// this texture unit being active, but it does not assure it itself.
|
||||
glActiveTexture( GL_TEXTURE0 );
|
||||
|
||||
@ -720,14 +721,15 @@ void OPENGL_GAL::EndDrawing()
|
||||
{
|
||||
wxASSERT_MSG( m_isContextLocked, "What happened to the context lock?" );
|
||||
|
||||
PROF_TIMER cntTotal("gl-end-total");
|
||||
PROF_TIMER cntEndCached("gl-end-cached");
|
||||
PROF_TIMER cntEndNoncached("gl-end-noncached");
|
||||
PROF_TIMER cntEndOverlay("gl-end-overlay");
|
||||
PROF_TIMER cntComposite("gl-composite");
|
||||
PROF_TIMER cntSwap("gl-swap");
|
||||
PROF_TIMER cntTotal( "gl-end-total" );
|
||||
PROF_TIMER cntEndCached( "gl-end-cached" );
|
||||
PROF_TIMER cntEndNoncached( "gl-end-noncached" );
|
||||
PROF_TIMER cntEndOverlay( "gl-end-overlay" );
|
||||
PROF_TIMER cntComposite( "gl-composite" );
|
||||
PROF_TIMER cntSwap( "gl-swap" );
|
||||
|
||||
cntTotal.Start();
|
||||
|
||||
// Cached & non-cached containers are rendered to the same buffer
|
||||
m_compositor->SetBuffer( m_mainBuffer );
|
||||
|
||||
@ -748,6 +750,7 @@ void OPENGL_GAL::EndDrawing()
|
||||
cntEndOverlay.Stop();
|
||||
|
||||
cntComposite.Start();
|
||||
|
||||
// Be sure that the framebuffer is not colorized (happens on specific GPU&drivers combinations)
|
||||
glColor4d( 1.0, 1.0, 1.0, 1.0 );
|
||||
|
||||
@ -789,8 +792,9 @@ void OPENGL_GAL::UnlockContext( int aClientCookie )
|
||||
wxASSERT_MSG( m_isContextLocked, "Context not locked. A GAL_CONTEXT_LOCKER RAII object must "
|
||||
"be stacked rather than making separate lock/unlock calls." );
|
||||
|
||||
wxASSERT_MSG( m_lockClientCookie == aClientCookie, "Context was locked by a different client. "
|
||||
"Should not be possible with RAII objects." );
|
||||
wxASSERT_MSG( m_lockClientCookie == aClientCookie,
|
||||
"Context was locked by a different client. "
|
||||
"Should not be possible with RAII objects." );
|
||||
|
||||
m_isContextLocked = false;
|
||||
|
||||
@ -868,8 +872,8 @@ void OPENGL_GAL::drawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP
|
||||
else
|
||||
{
|
||||
EDA_ANGLE lineAngle( startEndVector );
|
||||
// Outlined tracks
|
||||
|
||||
// Outlined tracks
|
||||
SetLineWidth( 1.0 );
|
||||
m_currentManager->Color( m_strokeColor.r, m_strokeColor.g, m_strokeColor.b,
|
||||
m_strokeColor.a );
|
||||
@ -930,6 +934,7 @@ void OPENGL_GAL::drawCircle( const VECTOR2D& aCenterPoint, double aRadius, bool
|
||||
m_currentManager->Shader( SHADER_FILLED_CIRCLE, 3.0, aRadius );
|
||||
m_currentManager->Vertex( aCenterPoint.x, aCenterPoint.y, m_layerDepth );
|
||||
}
|
||||
|
||||
if( m_isStrokeEnabled )
|
||||
{
|
||||
if( aReserve )
|
||||
@ -1216,7 +1221,9 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn
|
||||
// DrawLine (and DrawPolyline )
|
||||
// has problem with 0 length lines so enforce minimum
|
||||
if( aStartPoint == aEndPoint )
|
||||
{
|
||||
DrawLine( aStartPoint + VECTOR2D( 1.0, 0.0 ), aEndPoint );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::deque<VECTOR2D> pointList;
|
||||
@ -2117,6 +2124,7 @@ bool OPENGL_GAL::HasTarget( RENDER_TARGET aTarget )
|
||||
void OPENGL_GAL::StartDiffLayer()
|
||||
{
|
||||
m_currentManager->EndDrawing();
|
||||
|
||||
if( m_tempBuffer )
|
||||
{
|
||||
SetTarget( TARGET_TEMP );
|
||||
@ -2822,6 +2830,7 @@ static void InitTesselatorCallbacks( GLUtesselator* aTesselator )
|
||||
gluTessCallback( aTesselator, GLU_TESS_ERROR, (void( CALLBACK* )()) ErrorCallback );
|
||||
}
|
||||
|
||||
|
||||
void OPENGL_GAL::EnableDepthTest( bool aEnabled )
|
||||
{
|
||||
m_cachedManager->EnableDepthTest( aEnabled );
|
||||
|
@ -155,6 +155,7 @@ void SHADER::SetParameter( int parameterNumber, int value ) const
|
||||
glUniform1i( parameterLocation[parameterNumber], value );
|
||||
}
|
||||
|
||||
|
||||
void SHADER::SetParameter( int parameterNumber, float f0, float f1, float f2, float f3 ) const
|
||||
{
|
||||
assert( (unsigned) parameterNumber < parameterLocation.size() );
|
||||
@ -162,10 +163,12 @@ void SHADER::SetParameter( int parameterNumber, float f0, float f1, float f2, fl
|
||||
glUniform4fv( parameterLocation[parameterNumber], 1, arr );
|
||||
}
|
||||
|
||||
|
||||
void SHADER::SetParameter( int aParameterNumber, const VECTOR2D& aValue ) const
|
||||
{
|
||||
assert( (unsigned) aParameterNumber < parameterLocation.size() );
|
||||
glUniform2f( parameterLocation[aParameterNumber], static_cast<GLfloat>( aValue.x ), static_cast<GLfloat>( aValue.y ) );
|
||||
glUniform2f( parameterLocation[aParameterNumber], static_cast<GLfloat>( aValue.x ),
|
||||
static_cast<GLfloat>( aValue.y ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +63,8 @@ wxString GbrMakeCreationDateAttributeString( GBR_NC_STRING_FORMAT aFormat )
|
||||
break;
|
||||
|
||||
case GBR_NC_STRING_FORMAT_X1:
|
||||
msg.Printf( wxS( "G04 #@! TF.CreationDate,%s%s*" ), date.FormatISOCombined(), timezone_offset );
|
||||
msg.Printf( wxS( "G04 #@! TF.CreationDate,%s%s*" ), date.FormatISOCombined(),
|
||||
timezone_offset );
|
||||
break;
|
||||
|
||||
case GBR_NC_STRING_FORMAT_GBRJOB:
|
||||
@ -71,9 +72,11 @@ wxString GbrMakeCreationDateAttributeString( GBR_NC_STRING_FORMAT aFormat )
|
||||
break;
|
||||
|
||||
case GBR_NC_STRING_FORMAT_NCDRILL:
|
||||
msg.Printf( wxS( "; #@! TF.CreationDate,%s%s" ), date.FormatISOCombined(), timezone_offset );
|
||||
msg.Printf( wxS( "; #@! TF.CreationDate,%s%s" ), date.FormatISOCombined(),
|
||||
timezone_offset );
|
||||
break;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
@ -755,11 +758,6 @@ void GBR_CMP_PNP_METADATA::ClearData()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return a string containing the formatted metadata in X2 syntax.
|
||||
* one line by non empty data
|
||||
* the orientation (.CRot) and mount type (.CMnt) are always generated
|
||||
*/
|
||||
wxString GBR_CMP_PNP_METADATA::FormatCmpPnPMetadata()
|
||||
{
|
||||
wxString text;
|
||||
|
@ -98,7 +98,7 @@ wxString FindKicadFile( const wxString& shortname )
|
||||
}
|
||||
|
||||
#if defined( __WINDOWS__ )
|
||||
// kicad can be installed highly portably on Windows, anywhere and concurrently
|
||||
// KiCad can be installed highly portably on Windows, anywhere and concurrently
|
||||
// either the "kicad file" is immediately adjacent to the exe or it's not a valid install
|
||||
return shortname;
|
||||
#else
|
||||
@ -347,7 +347,8 @@ bool RmDirRecursive( const wxString& aFileName, wxString* aErrors )
|
||||
catch( const fs::filesystem_error& e )
|
||||
{
|
||||
if( aErrors )
|
||||
*aErrors = wxString::Format( _( "Error removing directory '%s': %s" ), aFileName, e.what() );
|
||||
*aErrors = wxString::Format( _( "Error removing directory '%s': %s" ),
|
||||
aFileName, e.what() );
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -528,4 +529,4 @@ bool AddDirectoryToZip( wxZipOutputStream& aZip, const wxString& aSourceDir, wxS
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ GIT_ADD_TO_INDEX_HANDLER::GIT_ADD_TO_INDEX_HANDLER( git_repository* aRepository
|
||||
m_filesToAdd.clear();
|
||||
}
|
||||
|
||||
|
||||
GIT_ADD_TO_INDEX_HANDLER::~GIT_ADD_TO_INDEX_HANDLER()
|
||||
{
|
||||
}
|
||||
@ -96,7 +97,8 @@ bool GIT_ADD_TO_INDEX_HANDLER::PerformAddToIndex()
|
||||
{
|
||||
wxLogError( "Failed to write index" );
|
||||
m_filesFailedToAdd.clear();
|
||||
std::copy( m_filesToAdd.begin(), m_filesToAdd.end(), std::back_inserter( m_filesFailedToAdd ) );
|
||||
std::copy( m_filesToAdd.begin(), m_filesToAdd.end(),
|
||||
std::back_inserter( m_filesFailedToAdd ) );
|
||||
git_index_free( index );
|
||||
return false;
|
||||
}
|
||||
@ -104,4 +106,4 @@ bool GIT_ADD_TO_INDEX_HANDLER::PerformAddToIndex()
|
||||
git_index_free( index );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -40,11 +40,10 @@ public:
|
||||
bool PerformAddToIndex();
|
||||
|
||||
private:
|
||||
git_repository* m_repository;
|
||||
|
||||
git_repository* m_repository;
|
||||
std::vector<wxString> m_filesToAdd;
|
||||
std::vector<wxString> m_filesFailedToAdd;
|
||||
};
|
||||
|
||||
std::vector<wxString> m_filesToAdd;
|
||||
std::vector<wxString> m_filesFailedToAdd;
|
||||
};
|
||||
|
||||
#endif /* GIT_ADD_TO_INDEX_HANDLER_H_ */
|
||||
#endif /* GIT_ADD_TO_INDEX_HANDLER_H_ */
|
||||
|
@ -31,6 +31,7 @@
|
||||
GIT_CLONE_HANDLER::GIT_CLONE_HANDLER() : KIGIT_COMMON( nullptr )
|
||||
{}
|
||||
|
||||
|
||||
GIT_CLONE_HANDLER::~GIT_CLONE_HANDLER()
|
||||
{
|
||||
if( m_repo )
|
||||
@ -46,7 +47,8 @@ bool GIT_CLONE_HANDLER::PerformClone()
|
||||
{
|
||||
if( !clonePath.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
|
||||
{
|
||||
AddErrorString( wxString::Format( _( "Could not create directory '%s'" ), m_clonePath ) );
|
||||
AddErrorString( wxString::Format( _( "Could not create directory '%s'" ),
|
||||
m_clonePath ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -62,7 +64,8 @@ bool GIT_CLONE_HANDLER::PerformClone()
|
||||
|
||||
m_testedTypes = 0;
|
||||
|
||||
if( git_clone( &m_repo, m_URL.ToStdString().c_str(), m_clonePath.ToStdString().c_str(), &cloneOptions ) != 0 )
|
||||
if( git_clone( &m_repo, m_URL.ToStdString().c_str(), m_clonePath.ToStdString().c_str(),
|
||||
&cloneOptions ) != 0 )
|
||||
{
|
||||
AddErrorString( wxString::Format( _( "Could not clone repository '%s'" ), m_URL ) );
|
||||
return false;
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <git/kicad_git_common.h>
|
||||
#include <git/git_progress.h>
|
||||
|
||||
class GIT_CLONE_HANDLER : public KIGIT_COMMON, public GIT_PROGRESS
|
||||
{
|
||||
public:
|
||||
@ -46,11 +47,10 @@ public:
|
||||
void UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage ) override;
|
||||
|
||||
private:
|
||||
|
||||
wxString m_URL;
|
||||
wxString m_branch;
|
||||
wxString m_clonePath;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -27,21 +27,24 @@ GIT_COMMIT_HANDLER::GIT_COMMIT_HANDLER( git_repository* aRepo ) :
|
||||
KIGIT_COMMON( aRepo )
|
||||
{}
|
||||
|
||||
|
||||
GIT_COMMIT_HANDLER::~GIT_COMMIT_HANDLER()
|
||||
{}
|
||||
|
||||
|
||||
GIT_COMMIT_HANDLER::CommitResult GIT_COMMIT_HANDLER::PerformCommit( const std::vector<std::string>& aFilesToCommit )
|
||||
GIT_COMMIT_HANDLER::CommitResult
|
||||
GIT_COMMIT_HANDLER::PerformCommit( const std::vector<std::string>& aFilesToCommit )
|
||||
{
|
||||
|
||||
return CommitResult::Success;
|
||||
}
|
||||
|
||||
|
||||
std::string GIT_COMMIT_HANDLER::GetErrorString() const
|
||||
{
|
||||
return m_errorString;
|
||||
}
|
||||
|
||||
|
||||
void GIT_COMMIT_HANDLER::AddErrorString( const std::string& aErrorString )
|
||||
{
|
||||
m_errorString += aErrorString;
|
||||
|
@ -32,6 +32,7 @@
|
||||
GIT_PULL_HANDLER::GIT_PULL_HANDLER( git_repository* aRepo ) : KIGIT_COMMON( aRepo )
|
||||
{}
|
||||
|
||||
|
||||
GIT_PULL_HANDLER::~GIT_PULL_HANDLER()
|
||||
{}
|
||||
|
||||
@ -148,10 +149,13 @@ PullResult GIT_PULL_HANDLER::PerformPull()
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::vector<std::pair<std::string, std::vector<CommitDetails>>>& GIT_PULL_HANDLER::GetFetchResults() const {
|
||||
const std::vector<std::pair<std::string, std::vector<CommitDetails>>>&
|
||||
GIT_PULL_HANDLER::GetFetchResults() const
|
||||
{
|
||||
return m_fetchResults;
|
||||
}
|
||||
|
||||
|
||||
std::string GIT_PULL_HANDLER::getFirstLineFromCommitMessage( const std::string& aMessage )
|
||||
{
|
||||
size_t firstLineEnd = aMessage.find_first_of( '\n' );
|
||||
@ -162,6 +166,7 @@ std::string GIT_PULL_HANDLER::getFirstLineFromCommitMessage( const std::string&
|
||||
return aMessage;
|
||||
}
|
||||
|
||||
|
||||
std::string GIT_PULL_HANDLER::getFormattedCommitDate( const git_time& aTime )
|
||||
{
|
||||
char dateBuffer[64];
|
||||
@ -186,9 +191,11 @@ PullResult GIT_PULL_HANDLER::handleFastForward()
|
||||
git_reference_free( updatedRef );
|
||||
|
||||
git_oid updatedRefOid;
|
||||
|
||||
if( git_reference_name_to_id( &updatedRefOid, m_repo, updatedRefName ) )
|
||||
{
|
||||
AddErrorString( wxString::Format( _( "Could not get reference OID for reference '%s'" ), updatedRefName ) );
|
||||
AddErrorString( wxString::Format( _( "Could not get reference OID for reference '%s'" ),
|
||||
updatedRefName ) );
|
||||
return PullResult::Error;
|
||||
}
|
||||
|
||||
@ -208,13 +215,15 @@ PullResult GIT_PULL_HANDLER::handleFastForward()
|
||||
git_revwalk_push_glob( revWalker, updatedRefName );
|
||||
|
||||
git_oid commitOid;
|
||||
|
||||
while( git_revwalk_next( &commitOid, revWalker ) == 0 )
|
||||
{
|
||||
git_commit* commit = nullptr;
|
||||
|
||||
if( git_commit_lookup( &commit, m_repo, &commitOid ) )
|
||||
{
|
||||
AddErrorString( wxString::Format( _( "Could not lookup commit '{}'" ), git_oid_tostr_s( &commitOid ) ) );
|
||||
AddErrorString( wxString::Format( _( "Could not lookup commit '{}'" ),
|
||||
git_oid_tostr_s( &commitOid ) ) );
|
||||
git_revwalk_free( revWalker );
|
||||
return PullResult::Error;
|
||||
}
|
||||
@ -260,6 +269,7 @@ PullResult GIT_PULL_HANDLER::handleMerge( const git_annotated_commit** aMergeHea
|
||||
|
||||
// Get the repository index
|
||||
git_index* index = nullptr;
|
||||
|
||||
if( git_repository_index( &index, m_repo ) )
|
||||
{
|
||||
AddErrorString( _( "Could not get repository index" ) );
|
||||
@ -268,6 +278,7 @@ PullResult GIT_PULL_HANDLER::handleMerge( const git_annotated_commit** aMergeHea
|
||||
|
||||
// Check for conflicts
|
||||
git_index_conflict_iterator* conflicts = nullptr;
|
||||
|
||||
if( git_index_conflict_iterator_new( &conflicts, index ) )
|
||||
{
|
||||
AddErrorString( _( "Could not get conflict iterator" ) );
|
||||
|
@ -29,9 +29,11 @@
|
||||
GIT_PUSH_HANDLER::GIT_PUSH_HANDLER( git_repository* aRepo ) : KIGIT_COMMON( aRepo )
|
||||
{}
|
||||
|
||||
|
||||
GIT_PUSH_HANDLER::~GIT_PUSH_HANDLER()
|
||||
{}
|
||||
|
||||
|
||||
PushResult GIT_PUSH_HANDLER::PerformPush()
|
||||
{
|
||||
PushResult result = PushResult::Success;
|
||||
|
@ -32,10 +32,12 @@ GIT_REMOVE_FROM_INDEX_HANDLER::GIT_REMOVE_FROM_INDEX_HANDLER( git_repository* aR
|
||||
m_filesToRemove.clear();
|
||||
}
|
||||
|
||||
|
||||
GIT_REMOVE_FROM_INDEX_HANDLER::~GIT_REMOVE_FROM_INDEX_HANDLER()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool GIT_REMOVE_FROM_INDEX_HANDLER::RemoveFromIndex( const wxString& aFilePath )
|
||||
{
|
||||
// Test if file is currently in the index
|
||||
@ -62,6 +64,7 @@ bool GIT_REMOVE_FROM_INDEX_HANDLER::RemoveFromIndex( const wxString& aFilePath )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GIT_REMOVE_FROM_INDEX_HANDLER::PerformRemoveFromIndex()
|
||||
{
|
||||
for( auto& file : m_filesToRemove )
|
||||
@ -95,4 +98,4 @@ void GIT_REMOVE_FROM_INDEX_HANDLER::PerformRemoveFromIndex()
|
||||
|
||||
git_index_free( index );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,12 +28,14 @@ GIT_RESOLVE_CONFLICT_HANDLER::GIT_RESOLVE_CONFLICT_HANDLER( git_repository* aRep
|
||||
m_repository = aRepository;
|
||||
}
|
||||
|
||||
|
||||
GIT_RESOLVE_CONFLICT_HANDLER::~GIT_RESOLVE_CONFLICT_HANDLER()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool GIT_RESOLVE_CONFLICT_HANDLER::PerformResolveConflict()
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -31,67 +31,68 @@
|
||||
|
||||
class BLOB_BUFFER_STREAM : public std::streambuf
|
||||
{
|
||||
public:
|
||||
BLOB_BUFFER_STREAM( git_blob* aBlob )
|
||||
{
|
||||
// Yay C++
|
||||
setg( const_cast<char*>( static_cast<const char*>( git_blob_rawcontent( aBlob ) ) ),
|
||||
const_cast<char*>( static_cast<const char*>( git_blob_rawcontent( aBlob ) ) ),
|
||||
const_cast<char*>( static_cast<const char*>( git_blob_rawcontent( aBlob ) ) ) + git_blob_rawsize( aBlob ) );
|
||||
}
|
||||
public:
|
||||
BLOB_BUFFER_STREAM( git_blob* aBlob )
|
||||
{
|
||||
// Yay C++
|
||||
setg( const_cast<char*>( static_cast<const char*>( git_blob_rawcontent( aBlob ) ) ),
|
||||
const_cast<char*>( static_cast<const char*>( git_blob_rawcontent( aBlob ) ) ),
|
||||
const_cast<char*>( static_cast<const char*>( git_blob_rawcontent( aBlob ) ) ) +
|
||||
git_blob_rawsize( aBlob ) );
|
||||
}
|
||||
|
||||
~BLOB_BUFFER_STREAM() override
|
||||
{
|
||||
}
|
||||
~BLOB_BUFFER_STREAM() override
|
||||
{
|
||||
}
|
||||
|
||||
int overflow( int c ) override
|
||||
{
|
||||
return traits_type::eof();
|
||||
}
|
||||
int overflow( int c ) override
|
||||
{
|
||||
return traits_type::eof();
|
||||
}
|
||||
|
||||
std::streamsize xsputn( const char* s, std::streamsize n ) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
std::streamsize xsputn( const char* s, std::streamsize n ) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Build a class that implements LINE_READER for git_blobs
|
||||
class BLOB_READER : public LINE_READER
|
||||
{
|
||||
public:
|
||||
BLOB_READER( git_blob* aBlob ) : m_blob( aBlob )
|
||||
{
|
||||
m_stream = new BLOB_BUFFER_STREAM( m_blob );
|
||||
m_istream = new std::istream( m_stream );
|
||||
m_line = nullptr;
|
||||
m_lineNum = 0;
|
||||
}
|
||||
public:
|
||||
BLOB_READER( git_blob* aBlob ) : m_blob( aBlob )
|
||||
{
|
||||
m_stream = new BLOB_BUFFER_STREAM( m_blob );
|
||||
m_istream = new std::istream( m_stream );
|
||||
m_line = nullptr;
|
||||
m_lineNum = 0;
|
||||
}
|
||||
|
||||
~BLOB_READER() override
|
||||
{
|
||||
delete m_istream;
|
||||
delete m_stream;
|
||||
}
|
||||
~BLOB_READER() override
|
||||
{
|
||||
delete m_istream;
|
||||
delete m_stream;
|
||||
}
|
||||
|
||||
char* ReadLine() override
|
||||
{
|
||||
getline( *m_istream, m_buffer );
|
||||
char* ReadLine() override
|
||||
{
|
||||
getline( *m_istream, m_buffer );
|
||||
|
||||
m_buffer.append( 1, '\n' );
|
||||
m_buffer.append( 1, '\n' );
|
||||
|
||||
m_length = m_buffer.size();
|
||||
m_line = (char*) m_buffer.data(); //ew why no const??
|
||||
m_length = m_buffer.size();
|
||||
m_line = (char*) m_buffer.data(); //ew why no const??
|
||||
|
||||
// lineNum is incremented even if there was no line read, because this
|
||||
// leads to better error reporting when we hit an end of file.
|
||||
++m_lineNum;
|
||||
// lineNum is incremented even if there was no line read, because this
|
||||
// leads to better error reporting when we hit an end of file.
|
||||
++m_lineNum;
|
||||
|
||||
return m_istream->eof() ? nullptr : m_line;
|
||||
}
|
||||
return m_istream->eof() ? nullptr : m_line;
|
||||
}
|
||||
|
||||
private:
|
||||
git_blob* m_blob;
|
||||
BLOB_BUFFER_STREAM* m_stream;
|
||||
std::istream* m_istream;
|
||||
std::string m_buffer;
|
||||
};
|
||||
private:
|
||||
git_blob* m_blob;
|
||||
BLOB_BUFFER_STREAM* m_stream;
|
||||
std::istream* m_istream;
|
||||
std::string m_buffer;
|
||||
};
|
||||
|
@ -32,9 +32,11 @@ KIGIT_COMMON::KIGIT_COMMON( git_repository* aRepo ) :
|
||||
m_repo( aRepo ), m_connType( GIT_CONN_TYPE::GIT_CONN_LOCAL ), m_testedTypes( 0 )
|
||||
{}
|
||||
|
||||
|
||||
KIGIT_COMMON::~KIGIT_COMMON()
|
||||
{}
|
||||
|
||||
|
||||
git_repository* KIGIT_COMMON::GetRepo() const
|
||||
{
|
||||
return m_repo;
|
||||
@ -414,17 +416,20 @@ extern "C" int progress_cb( const char* str, int len, void* data )
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern "C" int transfer_progress_cb( const git_transfer_progress* aStats, void* aPayload )
|
||||
{
|
||||
KIGIT_COMMON* parent = (KIGIT_COMMON*) aPayload;
|
||||
wxString progressMessage = wxString::Format( _( "Received %u of %u objects" ),
|
||||
aStats->received_objects, aStats->total_objects );
|
||||
aStats->received_objects,
|
||||
aStats->total_objects );
|
||||
|
||||
parent->UpdateProgress( aStats->received_objects, aStats->total_objects, progressMessage );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern "C" int update_cb( const char* aRefname, const git_oid* aFirst, const git_oid* aSecond,
|
||||
void* aPayload )
|
||||
{
|
||||
@ -497,7 +502,7 @@ extern "C" int push_update_reference_cb( const char* aRefname, const char* aStat
|
||||
|
||||
|
||||
extern "C" int credentials_cb( git_cred** aOut, const char* aUrl, const char* aUsername,
|
||||
unsigned int aAllowedTypes, void* aPayload )
|
||||
unsigned int aAllowedTypes, void* aPayload )
|
||||
{
|
||||
KIGIT_COMMON* parent = static_cast<KIGIT_COMMON*>( aPayload );
|
||||
|
||||
@ -533,9 +538,9 @@ extern "C" int credentials_cb( git_cred** aOut, const char* aUrl, const char* aU
|
||||
wxString password = parent->GetPassword().Trim().Trim( false );
|
||||
|
||||
git_cred_ssh_key_new( aOut, username.ToStdString().c_str(),
|
||||
sshPubKey.ToStdString().c_str(),
|
||||
sshKey.ToStdString().c_str(),
|
||||
password.ToStdString().c_str() );
|
||||
sshPubKey.ToStdString().c_str(),
|
||||
sshKey.ToStdString().c_str(),
|
||||
password.ToStdString().c_str() );
|
||||
parent->TestedTypes() |= GIT_CREDTYPE_SSH_KEY;
|
||||
}
|
||||
else
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
* Return a pair of sets of files that differ locally from the remote repository
|
||||
* The first set is files that have been committed locally but not pushed
|
||||
* The second set is files that have been committed remotely but not pulled
|
||||
*/
|
||||
*/
|
||||
std::pair<std::set<wxString>,std::set<wxString>> GetDifferentFiles() const;
|
||||
|
||||
enum class GIT_STATUS
|
||||
@ -140,6 +140,6 @@ extern "C" int push_update_reference_cb( const char* aRefname, const char* aStat
|
||||
extern "C" int fetchhead_foreach_cb( const char*, const char*,
|
||||
const git_oid* aOID, unsigned int aIsMerge, void* aPayload );
|
||||
extern "C" int credentials_cb( git_cred** aOut, const char* aUrl, const char* aUsername,
|
||||
unsigned int aAllowedTypes, void* aPayload );
|
||||
unsigned int aAllowedTypes, void* aPayload );
|
||||
|
||||
#endif // _GIT_COMMON_H_
|
||||
#endif // _GIT_COMMON_H_
|
||||
|
@ -30,50 +30,51 @@
|
||||
_Pragma( "GCC diagnostic push" ) \
|
||||
_Pragma( "GCC diagnostic ignored \"-Wunused-const-variable\"" )
|
||||
#endif
|
||||
|
||||
namespace KIGIT_ERROR
|
||||
{
|
||||
#undef _
|
||||
#define _(a) a
|
||||
#undef _
|
||||
#define _(a) a
|
||||
|
||||
// General errors
|
||||
const char* const kInvalidRepository = _("Invalid repository.");
|
||||
const char* const kCommitFailed = _("Failed to commit changes.");
|
||||
const char* const kMergeFailed = _("Failed to merge branches.");
|
||||
// General errors
|
||||
const char* const kInvalidRepository = _( "Invalid repository." );
|
||||
const char* const kCommitFailed = _( "Failed to commit changes." );
|
||||
const char* const kMergeFailed = _( "Failed to merge branches." );
|
||||
|
||||
// Clone errors
|
||||
const char* const kCloneFailed = _("Failed to clone repository.");
|
||||
const char* const kRemoteNotFound = _("Remote repository not found.");
|
||||
const char* const kAuthenticationFailed = _("Authentication failed for remote repository.");
|
||||
// Clone errors
|
||||
const char* const kCloneFailed = _( "Failed to clone repository." );
|
||||
const char* const kRemoteNotFound = _( "Remote repository not found." );
|
||||
const char* const kAuthenticationFailed = _( "Authentication failed for remote repository." );
|
||||
|
||||
// Branch errors
|
||||
const char* const kBranchNotFound = _("Branch not found.");
|
||||
const char* const kBranchCreationFailed = _("Failed to create branch.");
|
||||
const char* const kBranchDeletionFailed = _("Failed to delete branch.");
|
||||
// Branch errors
|
||||
const char* const kBranchNotFound = _( "Branch not found." );
|
||||
const char* const kBranchCreationFailed = _( "Failed to create branch." );
|
||||
const char* const kBranchDeletionFailed = _( "Failed to delete branch." );
|
||||
|
||||
// Checkout errors
|
||||
const char* const kCheckoutFailed = _("Failed to perform checkout operation.");
|
||||
const char* const kFileNotFoundInCheckout = _("File not found during checkout operation.");
|
||||
// Checkout errors
|
||||
const char* const kCheckoutFailed = _( "Failed to perform checkout operation." );
|
||||
const char* const kFileNotFoundInCheckout = _( "File not found during checkout operation." );
|
||||
|
||||
// Conflict errors
|
||||
const char* const kMergeConflict = _("Merge conflict encountered.");
|
||||
const char* const kRebaseConflict = _("Rebase conflict encountered.");
|
||||
// Conflict errors
|
||||
const char* const kMergeConflict = _( "Merge conflict encountered." );
|
||||
const char* const kRebaseConflict = _( "Rebase conflict encountered." );
|
||||
|
||||
// Pull/Push errors
|
||||
const char* const kPullFailed = _("Failed to pull changes from remote repository.");
|
||||
const char* const kPushFailed = _("Failed to push changes to remote repository.");
|
||||
const char* const kNoUpstreamBranch = _("No upstream branch configured.");
|
||||
const char* const kRemoteConnectionError = _("Failed to establish connection with remote repository.");
|
||||
// Pull/Push errors
|
||||
const char* const kPullFailed = _( "Failed to pull changes from remote repository." );
|
||||
const char* const kPushFailed = _( "Failed to push changes to remote repository." );
|
||||
const char* const kNoUpstreamBranch = _( "No upstream branch configured." );
|
||||
const char* const kRemoteConnectionError =
|
||||
_( "Failed to establish connection with remote repository." );
|
||||
|
||||
// Tag errors
|
||||
const char* const kTagNotFound = _("Tag not found.");
|
||||
const char* const kTagCreationFailed = _("Failed to create tag.");
|
||||
const char* const kTagDeletionFailed = _("Failed to delete tag.");
|
||||
|
||||
const char* const kUnknownError = _("Unknown error.");
|
||||
const char* const kNoError = _("No error.");
|
||||
// Tag errors
|
||||
const char* const kTagNotFound = _( "Tag not found." );
|
||||
const char* const kTagCreationFailed = _( "Failed to create tag." );
|
||||
const char* const kTagDeletionFailed = _( "Failed to delete tag." );
|
||||
|
||||
const char* const kUnknownError = _( "Unknown error." );
|
||||
const char* const kNoError = _( "No error." );
|
||||
}
|
||||
|
||||
#ifdef HAVE_WUNUSED_CONST_VARIABLE
|
||||
_Pragma( "GCC diagnostic pop" )
|
||||
#endif
|
||||
#endif
|
||||
|
@ -282,6 +282,7 @@ void GRFilledSegment( wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, i
|
||||
winDrawLine( aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw a new polyline and fill it if Fill, in screen space.
|
||||
*/
|
||||
|
@ -33,10 +33,6 @@
|
||||
#include <callback_gal.h>
|
||||
|
||||
|
||||
/**
|
||||
* @param aTextSize is the char size (height or width).
|
||||
* @return the "best" value for a pen size to draw/plot a bold text.
|
||||
*/
|
||||
int GetPenSizeForBold( int aTextSize )
|
||||
{
|
||||
return KiROUND( aTextSize / 5.0 );
|
||||
@ -73,18 +69,7 @@ int GetPenSizeForNormal( const wxSize& aTextSize )
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pen width should not allow characters to become cluttered up in their own fatness. Normal
|
||||
* text is normally around 15% the fontsize, and bold text around 20%. So we set a hard limit
|
||||
* at 25%, and a secondary limit for non-decorative text that must be readable at small sizes
|
||||
* at 18%.
|
||||
*
|
||||
* @param aPenSize is the pen size to clamp.
|
||||
* @param aSize is the character size (height or width).
|
||||
* @param aBold use true if text accept bold pen size.
|
||||
* @return the max pen size allowed.
|
||||
*/
|
||||
int Clamp_Text_PenSize( int aPenSize, int aSize, bool aStrict )
|
||||
int ClampTextPenSize( int aPenSize, int aSize, bool aStrict )
|
||||
{
|
||||
double scale = aStrict ? 0.18 : 0.25;
|
||||
int maxWidth = KiROUND( (double) aSize * scale );
|
||||
@ -93,7 +78,7 @@ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aStrict )
|
||||
}
|
||||
|
||||
|
||||
float Clamp_Text_PenSize( float aPenSize, int aSize, bool aStrict )
|
||||
float ClampTextPenSize( float aPenSize, int aSize, bool aStrict )
|
||||
{
|
||||
double scale = aStrict ? 0.18 : 0.25;
|
||||
float maxWidth = (float) aSize * scale;
|
||||
@ -102,11 +87,11 @@ float Clamp_Text_PenSize( float aPenSize, int aSize, bool aStrict )
|
||||
}
|
||||
|
||||
|
||||
int Clamp_Text_PenSize( int aPenSize, const VECTOR2I& aSize, bool aStrict )
|
||||
int ClampTextPenSize( int aPenSize, const VECTOR2I& aSize, bool aStrict )
|
||||
{
|
||||
int size = std::min( std::abs( aSize.x ), std::abs( aSize.y ) );
|
||||
|
||||
return Clamp_Text_PenSize( aPenSize, size, aStrict );
|
||||
return ClampTextPenSize( aPenSize, size, aStrict );
|
||||
}
|
||||
|
||||
|
||||
@ -121,24 +106,6 @@ int GRTextWidth( const wxString& aText, KIFONT::FONT* aFont, const VECTOR2I& aSi
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print a graphic text through wxDC.
|
||||
*
|
||||
* @param aDC is the current Device Context.
|
||||
* @param aPos is the text position (according to h_justify, v_justify).
|
||||
* @param aColor is the text color.
|
||||
* @param aText is the text to draw.
|
||||
* @param aOrient is the angle.
|
||||
* @param aSize is the text size (size.x or size.y can be < 0 for mirrored texts).
|
||||
* @param aH_justify is the horizontal justification (Left, center, right).
|
||||
* @param aV_justify is the vertical justification (bottom, center, top).
|
||||
* @param aWidth is the line width (pen width) (use default width if aWidth = 0).
|
||||
* if width < 0 : draw segments in sketch mode, width = abs(width)
|
||||
* Use a value min(aSize.x, aSize.y) / 5 for a bold text.
|
||||
* @param aItalic is the true to simulate an italic font.
|
||||
* @param aBold use true to use a bold font. Useful only with default width value (aWidth = 0).
|
||||
* @param aFont is the font to use, or nullptr for the KiCad stroke font
|
||||
*/
|
||||
void GRPrintText( wxDC* aDC, const VECTOR2I& aPos, const COLOR4D& aColor, const wxString& aText,
|
||||
const EDA_ANGLE& aOrient, const VECTOR2I& aSize,
|
||||
enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||
|
@ -1057,8 +1057,8 @@ void SCH_PAINTER::draw( const SCH_PIN* aPin, int aLayer, bool aDimmed )
|
||||
float nameStrokeWidth = getLineWidth( aPin, false );
|
||||
float numStrokeWidth = getLineWidth( aPin, false );
|
||||
|
||||
nameStrokeWidth = Clamp_Text_PenSize( nameStrokeWidth, aPin->GetNameTextSize(), true );
|
||||
numStrokeWidth = Clamp_Text_PenSize( numStrokeWidth, aPin->GetNumberTextSize(), true );
|
||||
nameStrokeWidth = ClampTextPenSize( nameStrokeWidth, aPin->GetNameTextSize(), true );
|
||||
numStrokeWidth = ClampTextPenSize( numStrokeWidth, aPin->GetNumberTextSize(), true );
|
||||
|
||||
float shadowWidth = 0.0f;
|
||||
|
||||
|
@ -51,9 +51,9 @@ public:
|
||||
static DS_DATA_MODEL& GetTheInstance();
|
||||
|
||||
/**
|
||||
* Set an alternate instance of DS_DATA_MODEL.
|
||||
* Set an alternate instance of #DS_DATA_MODEL.
|
||||
*
|
||||
* @param aLayout the alternate drawing sheet; if null restore the default drawing sheet
|
||||
* @param aLayout the alternate drawing sheet; if null restore the default drawing sheet.
|
||||
*/
|
||||
static void SetAltInstance( DS_DATA_MODEL* aLayout = nullptr );
|
||||
|
||||
@ -144,7 +144,7 @@ public:
|
||||
|
||||
/**
|
||||
* Populate the list with a custom layout or the default layout if no custom layout
|
||||
* is available.
|
||||
* is available.
|
||||
*
|
||||
* @param aFullFileName is the custom drawing sheet file. If empty, load the file defined by
|
||||
* KICAD_WKSFILE and if its not defined, the default internal drawing
|
||||
|
@ -689,7 +689,12 @@ protected:
|
||||
*/
|
||||
virtual void OnDropFiles( wxDropFilesEvent& aEvent );
|
||||
|
||||
|
||||
/**
|
||||
* Create 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 );
|
||||
|
||||
/**
|
||||
@ -776,14 +781,14 @@ private:
|
||||
|
||||
ORIGIN_TRANSFORMS m_originTransforms; // Default display origin transforms object.
|
||||
|
||||
///< Map containing the UI update handlers registered with wx for each action.
|
||||
/// Map containing the UI update handlers registered with wx for each action.
|
||||
std::map<int, UIUpdateHandler> m_uiUpdateMap;
|
||||
|
||||
///< Set by the close window event handler after frames are asked if they can close.
|
||||
///< Allows other functions when called to know our state is cleanup.
|
||||
/// Set by the close window event handler after frames are asked if they can close.
|
||||
/// Allows other functions when called to know our state is cleanup.
|
||||
bool m_isClosing;
|
||||
|
||||
///< Set by #NonUserClose() to indicate that the user did not request the current close.
|
||||
/// Set by #NonUserClose() to indicate that the user did not request the current close.
|
||||
bool m_isNonUserClose;
|
||||
|
||||
/**
|
||||
|
@ -179,6 +179,16 @@ public:
|
||||
|
||||
/**
|
||||
* Insert \n characters into text to ensure that no lines are wider than \a aColumnWidth.
|
||||
*
|
||||
* This is a highly simplified line-breaker. KiCad is an EDA tool, not a word processor.
|
||||
*
|
||||
* -# It breaks only on spaces. If you type a word wider than the column width then you get
|
||||
* overflow.
|
||||
* -# It treats runs of formatted text (superscript, subscript, overbar) as single words.
|
||||
* -# It does not perform justification.
|
||||
*
|
||||
* The results of the linebreaking are the addition of \n in the text. It is presumed that this
|
||||
* function is called on m_shownText (or equivalent) rather than the original source text.
|
||||
*/
|
||||
void LinebreakText( wxString& aText, int aColumnWidth, const VECTOR2I& aGlyphSize,
|
||||
int aThickness, bool aBold, bool aItalic ) const;
|
||||
|
@ -72,6 +72,9 @@ public:
|
||||
void ClearData(); // Clear all strings
|
||||
|
||||
/**
|
||||
* One line by non empty data the orientation (.CRot) and mount type (.CMnt) are always
|
||||
* generated.
|
||||
*
|
||||
* @return a string containing the formatted metadata in X2 syntax.
|
||||
*/
|
||||
wxString FormatCmpPnPMetadata();
|
||||
|
@ -54,9 +54,9 @@ class PLOTTER;
|
||||
* @param aBold true if text accept bold pen size.
|
||||
* @return the max pen size allowed.
|
||||
*/
|
||||
int Clamp_Text_PenSize( int aPenSize, int aSize, bool aStrict = false );
|
||||
float Clamp_Text_PenSize( float aPenSize, int aSize, bool aStrict = false );
|
||||
int Clamp_Text_PenSize( int aPenSize, const VECTOR2I& aSize, bool aStrict = false );
|
||||
int ClampTextPenSize( int aPenSize, int aSize, bool aStrict = false );
|
||||
float ClampTextPenSize( float aPenSize, int aSize, bool aStrict = false );
|
||||
int ClampTextPenSize( int aPenSize, const VECTOR2I& aSize, bool aStrict = false );
|
||||
|
||||
/**
|
||||
* @param aTextSize the char size (height or width).
|
||||
@ -90,7 +90,7 @@ inline void InferBold( TEXT_ATTRIBUTES* aAttrs )
|
||||
|
||||
|
||||
/**
|
||||
* Returns the margin for knocking out text.
|
||||
* Return the margin for knocking out text.
|
||||
*/
|
||||
inline int GetKnockoutTextMargin( const VECTOR2I& aSize, int aThickness )
|
||||
{
|
||||
|
@ -466,7 +466,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::Validate()
|
||||
}
|
||||
|
||||
// Test for acceptable values for thickness and size and clamp if fails
|
||||
int maxPenWidth = Clamp_Text_PenSize( field.GetTextThickness(), field.GetTextSize() );
|
||||
int maxPenWidth = ClampTextPenSize( field.GetTextThickness(), field.GetTextSize() );
|
||||
|
||||
if( field.GetTextThickness() > maxPenWidth )
|
||||
{
|
||||
|
@ -456,7 +456,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate()
|
||||
}
|
||||
|
||||
// Test for acceptable values for thickness and size and clamp if fails
|
||||
int maxPenWidth = Clamp_Text_PenSize( field.GetTextThickness(), field.GetTextSize() );
|
||||
int maxPenWidth = ClampTextPenSize( field.GetTextThickness(), field.GetTextSize() );
|
||||
|
||||
if( field.GetTextThickness() > maxPenWidth )
|
||||
{
|
||||
|
@ -510,7 +510,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
||||
m_item->SetFPRelativePosition( VECTOR2I( m_posX.GetValue(), m_posY.GetValue() ) );
|
||||
|
||||
// Test for acceptable values for thickness and size and clamp if fails
|
||||
int maxPenWidth = Clamp_Text_PenSize( m_item->GetTextThickness(), m_item->GetTextSize() );
|
||||
int maxPenWidth = ClampTextPenSize( m_item->GetTextThickness(), m_item->GetTextSize() );
|
||||
|
||||
if( m_item->GetTextThickness() > maxPenWidth )
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow()
|
||||
m_textBox->SetTextThickness( m_thickness.GetValue() );
|
||||
|
||||
// Test for acceptable values for thickness and size and clamp if fails
|
||||
int maxPenWidth = Clamp_Text_PenSize( m_textBox->GetTextThickness(), m_textBox->GetTextSize() );
|
||||
int maxPenWidth = ClampTextPenSize( m_textBox->GetTextThickness(), m_textBox->GetTextSize() );
|
||||
|
||||
if( m_textBox->GetTextThickness() > maxPenWidth )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user