Code cleanup.

This commit is contained in:
Jeff Young 2024-01-04 16:08:29 +00:00
parent fceace93da
commit 5aae8e2fd0
2 changed files with 43 additions and 43 deletions

View File

@ -1617,51 +1617,51 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2I& aPosition,
int braceNesting = 0;
auto iterateString =
[&]( std::function<void( int aOverbarLength, int aOverbarHeight )> overbarFn,
std::function<int( unsigned long aChar )> bitmapCharFn )
{
for( UTF8::uni_iter chIt = text.ubegin(), end = text.uend(); chIt < end; ++chIt )
{
wxASSERT_MSG( *chIt != '\n' && *chIt != '\r',
"No support for multiline bitmap text yet" );
if( *chIt == '~' && overbarDepth == -1 )
[&]( const std::function<void( int aOverbarLength, int aOverbarHeight )>& overbarFn,
const std::function<int( unsigned long aChar )>& bitmapCharFn )
{
UTF8::uni_iter lookahead = chIt;
if( ++lookahead != end && *lookahead == '{' )
for( UTF8::uni_iter chIt = text.ubegin(), end = text.uend(); chIt < end; ++chIt )
{
chIt = lookahead;
overbarDepth = braceNesting;
braceNesting++;
continue;
wxASSERT_MSG( *chIt != '\n' && *chIt != '\r',
"No support for multiline bitmap text yet" );
if( *chIt == '~' && overbarDepth == -1 )
{
UTF8::uni_iter lookahead = chIt;
if( ++lookahead != end && *lookahead == '{' )
{
chIt = lookahead;
overbarDepth = braceNesting;
braceNesting++;
continue;
}
}
else if( *chIt == '{' )
{
braceNesting++;
}
else if( *chIt == '}' )
{
if( braceNesting > 0 )
braceNesting--;
if( braceNesting == overbarDepth )
{
overbarFn( overbarLength, overbarHeight );
overbarLength = 0;
overbarDepth = -1;
continue;
}
}
if( overbarDepth != -1 )
overbarLength += bitmapCharFn( *chIt );
else
bitmapCharFn( *chIt );
}
}
else if( *chIt == '{' )
{
braceNesting++;
}
else if( *chIt == '}' )
{
if( braceNesting > 0 )
braceNesting--;
if( braceNesting == overbarDepth )
{
overbarFn( overbarLength, overbarHeight );
overbarLength = 0;
overbarDepth = -1;
continue;
}
}
if( overbarDepth != -1 )
overbarLength += bitmapCharFn( *chIt );
else
bitmapCharFn( *chIt );
}
};
};
// First, calculate the amount of characters and overbars to reserve

View File

@ -69,7 +69,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const TOOL_EVENT& aTool,
aPlacer->m_modifiers = 0;
auto makeNewItem =
[&]( VECTOR2I aPosition )
[&]( const VECTOR2I& aPosition )
{
if( frame()->GetModel() )
newItem = aPlacer->CreateItem();