Commit b49c2d2b authored by charras's avatar charras

code cleanup, remove multiline text option in eeschema (multiline text is a...

code cleanup, remove multiline text option in eeschema (multiline text is a work in progress) and minor enhancements
parent f28062ac
...@@ -15,9 +15,9 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) ...@@ -15,9 +15,9 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON) option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)
# Russian GOST and CYRILLIC patch # Russian GOST and CYRILLIC patch
option(KICAD_CYRILLIC "enable/disable building unicode (default OFF)") option(KICAD_CYRILLIC "enable/disable building using cyrillic (needs unicode) (default OFF)")
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)") option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
option(KICAD_GOST "enable/disable building unicode (default OFF)") option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
# Comment this out if you don't want to build with Python support. # Comment this out if you don't want to build with Python support.
# OPTION(KICAD_PYTHON "enable/disable building with Python support (default OFF)") # OPTION(KICAD_PYTHON "enable/disable building with Python support (default OFF)")
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#define BUILD_VERSION wxT("(20090421-unstable)") #define BUILD_VERSION wxT("(20090504-unstable)")
wxString g_BuildVersion wxString g_BuildVersion
......
...@@ -175,6 +175,7 @@ EDA_TextStruct::EDA_TextStruct( const wxString& text ) ...@@ -175,6 +175,7 @@ EDA_TextStruct::EDA_TextStruct( const wxString& text )
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Justifications Horiz et Vert du texte */ m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Justifications Horiz et Vert du texte */
m_Width = 0; /* thickness */ m_Width = 0; /* thickness */
m_Italic = false; /* true = italic shape */ m_Italic = false; /* true = italic shape */
m_MultilineAllowed = false; // Set to true only for texts that can use multiline.
m_Text = text; m_Text = text;
} }
...@@ -245,9 +246,9 @@ bool EDA_TextStruct::HitTest( EDA_Rect& refArea ) ...@@ -245,9 +246,9 @@ bool EDA_TextStruct::HitTest( EDA_Rect& refArea )
} }
/*******************************/ /*********************************************/
int EDA_TextStruct::Pitch( int aMinTickness ) int EDA_TextStruct::Pitch( int aMinTickness )
/*******************************/ /*********************************************/
/** /**
* Function Pitch * Function Pitch
...@@ -278,6 +279,9 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -278,6 +279,9 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
*/ */
{ {
if ( m_MultilineAllowed )
{
wxPoint pos = m_Pos; wxPoint pos = m_Pos;
wxArrayString* list = wxStringSplit( m_Text, '\n' ); wxArrayString* list = wxStringSplit( m_Text, '\n' );
wxPoint offset; wxPoint offset;
...@@ -287,7 +291,6 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -287,7 +291,6 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
RotatePoint( &offset, m_Orient ); RotatePoint( &offset, m_Orient );
if( m_Mirror ) if( m_Mirror )
offset.x = -offset.x; offset.x = -offset.x;
for( unsigned i = 0; i<list->Count(); i++ ) for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
...@@ -304,6 +307,18 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -304,6 +307,18 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
} }
delete (list); delete (list);
}
else
DrawOneLineOfText( aPanel,
aDC,
aOffset,
aColor,
aDrawMode,
aDisplayMode,
aAnchor_color,
m_Text,
m_Pos );
} }
...@@ -358,11 +373,10 @@ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -358,11 +373,10 @@ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( m_Mirror ) if( m_Mirror )
size.x = -size.x; size.x = -size.x;
DrawGraphicText( aPanel, aDC, DrawGraphicText( aPanel, aDC,
aOffset + aPos, aColor, aText, aOffset + aPos, aColor, aText,
m_Orient, size, m_Orient, size,
m_HJustify, m_VJustify, width, m_Italic ); m_HJustify, m_VJustify, width, m_Italic, true );
} }
......
...@@ -189,51 +189,30 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -189,51 +189,30 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
dx = (pitch * char_count) / 2; dx = (pitch * char_count) / 2;
dy = size_v / 2; /* dx, dy = draw offset between first letter and text center */ dy = size_v / 2; /* dx, dy = draw offset between first letter and text center */
ux0 = uy0 = 0; /* Decalage du centre du texte / coord de ref */ ux0 = uy0 = 0; /* for ux0 = uy0 = 0, the text is centered */
if( (aOrient == 0) || (aOrient == 1800) ) /* Horizontal Text */ wxPoint offset_org( dx, dy );
{ int irot = aOrient;
switch( aH_justify ) while( irot >= 1800 )
{ irot -= 1800;
case GR_TEXT_HJUSTIFY_CENTER:
break;
case GR_TEXT_HJUSTIFY_RIGHT: while( irot < 0 )
ux0 = -dx; irot += 1800;
break;
case GR_TEXT_HJUSTIFY_LEFT: if( irot != 0 )
ux0 = dx; EXCHG( offset_org.x, offset_org.y );
break;
}
switch( aV_justify )
{
case GR_TEXT_VJUSTIFY_CENTER:
break;
case GR_TEXT_VJUSTIFY_TOP:
uy0 = dy;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
uy0 = -dy;
break;
}
}
else /* Vertical Text */
{
switch( aH_justify ) switch( aH_justify )
{ {
case GR_TEXT_HJUSTIFY_CENTER: case GR_TEXT_HJUSTIFY_CENTER:
break; break;
case GR_TEXT_HJUSTIFY_RIGHT: case GR_TEXT_HJUSTIFY_RIGHT:
ux0 = -dy; ux0 = -offset_org.x;
break; break;
case GR_TEXT_HJUSTIFY_LEFT: case GR_TEXT_HJUSTIFY_LEFT:
ux0 = dy; ux0 = offset_org.x;
break; break;
} }
...@@ -243,14 +222,14 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -243,14 +222,14 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
break; break;
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP:
uy0 = dx; uy0 = offset_org.y;
break; break;
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM:
uy0 = -dx; uy0 = -offset_org.y;
break; break;
} }
}
cX += ux0; cX += ux0;
cY += uy0; cY += uy0;
......
...@@ -440,14 +440,6 @@ bool WinEDA_App::SetBinDir() ...@@ -440,14 +440,6 @@ bool WinEDA_App::SetBinDir()
while( m_BinDir.Last() != '/' && !m_BinDir.IsEmpty() ) while( m_BinDir.Last() != '/' && !m_BinDir.IsEmpty() )
m_BinDir.RemoveLast(); m_BinDir.RemoveLast();
wxFileName pfn( wxT( "/posix/path/specification" ), wxT( "filename" ) );
wxFileName wfn( wxT( "\\windows\\path\\specification" ), wxT( "filename" ) );
wxLogDebug( wxT( "Posix path: " ) + pfn.GetFullPath() );
wxLogDebug( wxT( "Windows path: " ) + wfn.GetFullPath() );
wxLogDebug( wxT( "Executable path the Kicad way: " ) + m_BinDir );
wxLogDebug( wxT( "Executable path the wxWidgets way: " ) +
GetTraits()->GetStandardPaths().GetExecutablePath() );
return TRUE; return TRUE;
} }
......
...@@ -704,7 +704,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -704,7 +704,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
if( !CompactForm ) if( !CompactForm )
{ {
msg = _( "#End Cmp\n" ); msg = _( "#End Cmp\n" );
fprintf( f, CONV_TO_UTF8( msg ) ); fputs( CONV_TO_UTF8( msg ), f );
} }
return 0; return 0;
} }
...@@ -731,7 +731,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( ...@@ -731,7 +731,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
if( aIncludeSubComponents ) if( aIncludeSubComponents )
msg << _( " (with SubCmp)" ); msg << _( " (with SubCmp)" );
msg << wxT( "\n" ); msg << wxT( "\n" );
fprintf( f, CONV_TO_UTF8( msg ) ); fputs( CONV_TO_UTF8( msg ), f );
for( unsigned ii = 0; ii < aList.size(); ii++ ) for( unsigned ii = 0; ii < aList.size(); ii++ )
{ {
...@@ -781,11 +781,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( ...@@ -781,11 +781,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
PrintFieldData( f, DrawLibItem ); PrintFieldData( f, DrawLibItem );
fprintf( f, "\n" ); fputs( "\n", f );
} }
msg = _( "#End Cmp\n" ); msg = _( "#End Cmp\n" );
fprintf( f, CONV_TO_UTF8( msg ) ); fputs( CONV_TO_UTF8( msg ), f );
return 0; return 0;
} }
...@@ -821,7 +821,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -821,7 +821,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
(float) DrawTextItem->m_Pos.x / 1000, (float) DrawTextItem->m_Pos.x / 1000,
(float) DrawTextItem->m_Pos.y / 1000 ); (float) DrawTextItem->m_Pos.y / 1000 );
fprintf( f, CONV_TO_UTF8( msg ) ); fputs( CONV_TO_UTF8( msg ), f );
break; break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
...@@ -840,7 +840,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -840,7 +840,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
aList[ii].m_SheetPath.PathHumanReadable().GetData(), aList[ii].m_SheetPath.PathHumanReadable().GetData(),
(float) DrawSheetLabel->m_Pos.x / 1000, (float) DrawSheetLabel->m_Pos.x / 1000,
(float) DrawSheetLabel->m_Pos.y / 1000 ); (float) DrawSheetLabel->m_Pos.y / 1000 );
fprintf( f, CONV_TO_UTF8( msg ) ); fputs( CONV_TO_UTF8( msg ), f );
} }
break; break;
...@@ -850,7 +850,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -850,7 +850,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
} }
msg = _( "#End labels\n" ); msg = _( "#End labels\n" );
fprintf( f, CONV_TO_UTF8( msg ) ); fputs( CONV_TO_UTF8( msg ), f );
return 0; return 0;
} }
......
...@@ -231,10 +231,6 @@ void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen ) ...@@ -231,10 +231,6 @@ void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen )
} }
m_List.Add( testscreen ); m_List.Add( testscreen );
#ifdef DEBUG
printf( "EDA_ScreenList::AddScreenToList adding %s\n",
(const char*) testscreen->m_FileName.mb_str() );
#endif
} }
......
...@@ -34,6 +34,11 @@ const char* SheetLabelType[] = ...@@ -34,6 +34,11 @@ const char* SheetLabelType[] =
"?????" "?????"
}; };
/* Coding polygons for global symbol graphic shapes.
* the first parml is the number of corners
* others are the corners coordinates in reduced units
* the real coordinate is the reduced coordinate * text half size
*/
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 }; int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 }; int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 }; int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
...@@ -71,8 +76,8 @@ int* TemplateShape[5][4] = ...@@ -71,8 +76,8 @@ int* TemplateShape[5][4] =
/**************************************************************************/ /**************************************************************************/
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) : SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
SCH_ITEM( NULL, aType ) SCH_ITEM( NULL, aType ),
, EDA_TextStruct( text ) EDA_TextStruct( text )
/**************************************************************************/ /**************************************************************************/
{ {
m_Layer = LAYER_NOTES; m_Layer = LAYER_NOTES;
...@@ -81,6 +86,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) : ...@@ -81,6 +86,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
m_IsDangling = FALSE; m_IsDangling = FALSE;
} }
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test * @param aPosRef = a wxPoint to test
...@@ -88,6 +94,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) : ...@@ -88,6 +94,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
bool SCH_TEXT::HitTest( const wxPoint& aPosRef ) bool SCH_TEXT::HitTest( const wxPoint& aPosRef )
{ {
EDA_Rect rect = GetBoundingBox(); EDA_Rect rect = GetBoundingBox();
return rect.Inside( aPosRef ); return rect.Inside( aPosRef );
} }
...@@ -172,8 +179,9 @@ void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -172,8 +179,9 @@ void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
SCH_ITEM::Place( frame, DC ); SCH_ITEM::Place( frame, DC );
} }
/*******************************************************************************************/ /*******************************************************************************************/
void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
int DrawMode, int Color ) int DrawMode, int Color )
/*******************************************************************************************/ /*******************************************************************************************/
...@@ -184,74 +192,55 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, ...@@ -184,74 +192,55 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) if( Color >= 0 )
color = (EDA_Colors)Color; color = (EDA_Colors) Color;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
wxArrayString* list = wxStringSplit(m_Text, '\n');
wxPoint pos;
int orientation; int orientation;
GRTextHorizJustifyType Hjustify; wxPoint text_offset = aOffset;
GRTextVertJustifyType Vjustify;
pos = m_Pos + offset;
switch( m_Orient ) switch( m_Orient )
{ {
default: default:
case 0: /* Horiz Normal Orientation (left justified) */ case 0: /* Horiz Normal Orientation (left justified) */
orientation = TEXT_ORIENT_HORIZ; orientation = TEXT_ORIENT_HORIZ;
Hjustify = GR_TEXT_HJUSTIFY_LEFT; m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
Vjustify = GR_TEXT_VJUSTIFY_BOTTOM; m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
pos.y-=TXTMARGE; text_offset.y -= TXTMARGE;
break; break;
case 1: /* Vert Orientation UP */ case 1: /* Vert Orientation UP */
orientation = TEXT_ORIENT_VERT; orientation = TEXT_ORIENT_VERT;
Hjustify = GR_TEXT_HJUSTIFY_RIGHT; m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
Vjustify = GR_TEXT_VJUSTIFY_BOTTOM; m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
pos.x-=TXTMARGE; text_offset.x -= TXTMARGE;
break; break;
case 2: /* Horiz Orientation - Right justified */ case 2: /* Horiz Orientation - Right justified */
orientation = TEXT_ORIENT_HORIZ; orientation = TEXT_ORIENT_HORIZ;
Hjustify = GR_TEXT_HJUSTIFY_RIGHT; m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
Vjustify = GR_TEXT_VJUSTIFY_BOTTOM; m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
pos.y-=TXTMARGE; text_offset.y -= TXTMARGE;
break; break;
case 3: /* Vert Orientation BOTTOM */ case 3: /* Vert Orientation BOTTOM */
orientation = TEXT_ORIENT_VERT; orientation = TEXT_ORIENT_VERT;
Hjustify = GR_TEXT_HJUSTIFY_RIGHT; m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
Vjustify = GR_TEXT_VJUSTIFY_TOP; m_VJustify = GR_TEXT_VJUSTIFY_TOP;
pos.x-=TXTMARGE; text_offset.x -= TXTMARGE;
break; break;
} }
for( unsigned i=0;i<list->Count();i++) // Due to eeschema history; texts orientations are in 0.1 deg, and m_Orient is 0,1,2,3 for label
{ // Set m_Orient to is value in deg, and after call EDA_TextStruct::Draw retrieve its previous value
wxString txt = list->Item(i); EXCHG( orientation, m_Orient );
EXCHG( width, m_Width ); // Set the minimum width
EDA_TextStruct::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
DrawGraphicText( panel, DC, EXCHG( orientation, m_Orient ); // set initial value
pos, EXCHG( width, m_Width ); // set initial value
color, txt, orientation, m_Size,
Hjustify,
Vjustify, width, m_Italic, true );
if (orientation == TEXT_ORIENT_HORIZ)
pos.y+= 1.5*(m_Size.y);
else
pos.x+= 1.5*(m_Size.x);
}
delete (list);
if( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
} }
...@@ -264,8 +253,9 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, ...@@ -264,8 +253,9 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
bool SCH_TEXT::Save( FILE* aFile ) const bool SCH_TEXT::Save( FILE* aFile ) const
{ {
bool success = true; bool success = true;
const char * shape = "~"; const char* shape = "~";
if (m_Italic )
if( m_Italic )
shape = "Italic"; shape = "Italic";
if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n", if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
...@@ -296,6 +286,7 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os ) ...@@ -296,6 +286,7 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os )
<< "</" << s.Lower().mb_str() << ">\n"; << "</" << s.Lower().mb_str() << ">\n";
} }
#endif #endif
/****************************************************************************/ /****************************************************************************/
...@@ -318,8 +309,9 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) : ...@@ -318,8 +309,9 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
bool SCH_LABEL::Save( FILE* aFile ) const bool SCH_LABEL::Save( FILE* aFile ) const
{ {
bool success = true; bool success = true;
const char * shape = "~"; const char* shape = "~";
if (m_Italic )
if( m_Italic )
shape = "Italic"; shape = "Italic";
if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n", if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n",
...@@ -354,8 +346,9 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : ...@@ -354,8 +346,9 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
bool SCH_GLOBALLABEL::Save( FILE* aFile ) const bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
{ {
bool success = true; bool success = true;
const char * shape = "~"; const char* shape = "~";
if (m_Italic )
if( m_Italic )
shape = "Italic"; shape = "Italic";
if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n", if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
...@@ -370,20 +363,22 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const ...@@ -370,20 +363,22 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
return success; return success;
} }
/************************************************/ /************************************************/
bool SCH_GLOBALLABEL::HitTest( const wxPoint& aPosRef ) bool SCH_GLOBALLABEL::HitTest( const wxPoint& aPosRef )
/************************************************/ /************************************************/
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test * @param aPosRef = a wxPoint to test
*/ */
{ {
EDA_Rect rect = GetBoundingBox(); EDA_Rect rect = GetBoundingBox();
return rect.Inside( aPosRef ); return rect.Inside( aPosRef );
} }
/***********************************************************************************/ /***********************************************************************************/
SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) : SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) :
SCH_TEXT( pos, text, TYPE_SCH_HIERLABEL ) SCH_TEXT( pos, text, TYPE_SCH_HIERLABEL )
...@@ -404,8 +399,9 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) : ...@@ -404,8 +399,9 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) :
bool SCH_HIERLABEL::Save( FILE* aFile ) const bool SCH_HIERLABEL::Save( FILE* aFile ) const
{ {
bool success = true; bool success = true;
const char * shape = "~"; const char* shape = "~";
if (m_Italic )
if( m_Italic )
shape = "Italic"; shape = "Italic";
if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n", if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
...@@ -420,15 +416,18 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const ...@@ -420,15 +416,18 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
return success; return success;
} }
/************************************************/ /************************************************/
bool SCH_HIERLABEL::HitTest( const wxPoint& aPosRef ) bool SCH_HIERLABEL::HitTest( const wxPoint& aPosRef )
/************************************************/ /************************************************/
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test * @param aPosRef = a wxPoint to test
*/ */
{ {
EDA_Rect rect = GetBoundingBox(); EDA_Rect rect = GetBoundingBox();
return rect.Inside( aPosRef ); return rect.Inside( aPosRef );
} }
...@@ -450,15 +449,15 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs ...@@ -450,15 +449,15 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/ */
{ {
int Poly[40]; static std::vector <wxPoint> Poly;
int ii; int ii;
EDA_Colors color; EDA_Colors color;
wxPoint AnchorPos = m_Pos + offset;; wxPoint AnchorPos = m_Pos + offset;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) if( Color >= 0 )
color = (EDA_Colors)Color; color = (EDA_Colors) Color;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
...@@ -498,7 +497,7 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs ...@@ -498,7 +497,7 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
} }
CreateGraphicShape( Poly, AnchorPos ); CreateGraphicShape( Poly, AnchorPos );
GRPoly( &panel->m_ClipBox, DC, Poly[0], (wxPoint*)(Poly + 1), 0, width, color, color ); GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, width, color, color );
if( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
...@@ -508,29 +507,33 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs ...@@ -508,29 +507,33 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
/** /**
* Function CreateGraphicShape * Function CreateGraphicShape
* calculates the graphic shape (a polygon) associated to the text * calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20) * @param aCorner_list = coordinates list fill with polygon corners ooordinates (size > 20)
* @param Pos = Postion of the shape * @param Pos = Postion of the shape
* format list is * format list is
* corner_count, x0, y0, ... xn, yn * corner_count, x0, y0, ... xn, yn
*/ */
void SCH_HIERLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos ) void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
{ {
int* Template = TemplateShape[m_Shape][m_Orient]; int* Template = TemplateShape[m_Shape][m_Orient];
int HalfSize = m_Size.x / 2; int HalfSize = m_Size.x / 2;
int imax = *Template; Template++; int imax = *Template; Template++;
*corner_list++ = imax; aCorner_list.clear();
for( int ii = 0; ii < imax; ii++ ) for( int ii = 0; ii < imax; ii++ )
{ {
*corner_list++ = ( HalfSize * (*Template) ) + Pos.x; wxPoint corner;
corner.x = ( HalfSize * (*Template) ) + Pos.x;
Template++; Template++;
*corner_list++ = ( HalfSize * (*Template) ) + Pos.y; corner.y = ( HalfSize * (*Template) ) + Pos.y;
Template++; Template++;
aCorner_list.push_back( corner );
} }
} }
/****************************************/ /****************************************/
EDA_Rect SCH_HIERLABEL::GetBoundingBox() EDA_Rect SCH_HIERLABEL::GetBoundingBox()
/****************************************/ /****************************************/
...@@ -542,8 +545,8 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox() ...@@ -542,8 +545,8 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
dx = dy = 0; dx = dy = 0;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
height = m_Size.y + 2*TXTMARGE; height = m_Size.y + 2 * TXTMARGE;
length = ( Pitch(width) * NegableTextLength(m_Text) ) + height + 2*DANGLING_SYMBOL_SIZE; // add height for triangular shapes length = ( Pitch( width ) * NegableTextLength( m_Text ) ) + height + 2 * DANGLING_SYMBOL_SIZE; // add height for triangular shapes
switch( m_Orient ) // respect orientation switch( m_Orient ) // respect orientation
{ {
...@@ -551,13 +554,13 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox() ...@@ -551,13 +554,13 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
dx = -length; dx = -length;
dy = height; dy = height;
x += DANGLING_SYMBOL_SIZE; x += DANGLING_SYMBOL_SIZE;
y -= height/2; y -= height / 2;
break; break;
case 1: /* Vert Orientation UP */ case 1: /* Vert Orientation UP */
dx = height; dx = height;
dy = length; dy = length;
x -= height/2; x -= height / 2;
y -= DANGLING_SYMBOL_SIZE; y -= DANGLING_SYMBOL_SIZE;
break; break;
...@@ -565,22 +568,23 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox() ...@@ -565,22 +568,23 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
dx = length; dx = length;
dy = height; dy = height;
x -= DANGLING_SYMBOL_SIZE; x -= DANGLING_SYMBOL_SIZE;
y -= height/2; y -= height / 2;
break; break;
case 3: /* Vert Orientation BOTTOM */ case 3: /* Vert Orientation BOTTOM */
dx = height; dx = height;
dy = -length; dy = -length;
x -= height/2; x -= height / 2;
y += DANGLING_SYMBOL_SIZE; y += DANGLING_SYMBOL_SIZE;
break; break;
} }
EDA_Rect box(wxPoint(x,y), wxSize(dx,dy) ); EDA_Rect box( wxPoint( x, y ), wxSize( dx, dy ) );
box.Normalize(); box.Normalize();
return box; return box;
} }
/*******************************************************************************************/ /*******************************************************************************************/
void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& draw_offset, void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& draw_offset,
int DrawMode, int Color ) int DrawMode, int Color )
...@@ -589,7 +593,7 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr ...@@ -589,7 +593,7 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/ */
{ {
int Poly[20]; static std::vector <wxPoint> Poly;
int offset; int offset;
EDA_Colors color; EDA_Colors color;
int HalfSize; int HalfSize;
...@@ -598,7 +602,7 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr ...@@ -598,7 +602,7 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) if( Color >= 0 )
color = (EDA_Colors)Color; color = (EDA_Colors) Color;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
...@@ -655,7 +659,7 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr ...@@ -655,7 +659,7 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
} }
CreateGraphicShape( Poly, AnchorPos ); CreateGraphicShape( Poly, AnchorPos );
GRPoly( &panel->m_ClipBox, DC, Poly[0], (wxPoint*) (Poly + 1), 0, width, color, color ); GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, width, color, color );
if( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol( panel, DC, AnchorPos, color ); DrawDanglingSymbol( panel, DC, AnchorPos, color );
...@@ -664,28 +668,27 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr ...@@ -664,28 +668,27 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
/** function CreateGraphicShape /** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text * Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = oordinates list fill with polygon corners ooordinates (size >= 14) * @param aCorner_list = list to fill with polygon corners coordinates
* @param Pos = Postion of the shape * @param Pos = Position of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/ */
void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos ) void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
{ {
int HalfSize = m_Size.y / 2; int HalfSize = m_Size.y / 2;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
*corner_list = 7; corner_list++; // 7 corners in list aCorner_list.clear();
int symb_len = ( Pitch( width ) * NegableTextLength( m_Text ) ) + (TXTMARGE * 2);
int symb_len = ( Pitch(width) * NegableTextLength(m_Text) ) + (TXTMARGE * 2);
// Create outline shape : 6 points // Create outline shape : 6 points
int x = symb_len + width + 3; int x = symb_len + width + 3;
int y = HalfSize*1.5 + width + 3; /* 50% more for negation bar */ int y = HalfSize * 1.5 + width + 3; // 50% more for negation bar
corner_list[0] = 0; corner_list[1] = 0; // Starting point (anchor) aCorner_list.push_back( wxPoint( 0, 0 ) ); // Starting point (anchor)
corner_list[2] = 0; corner_list[3] = -y; // Up aCorner_list.push_back( wxPoint( 0, -y ) ); // Up
corner_list[4] = -x; corner_list[5] = -y; // left Up aCorner_list.push_back( wxPoint( -x, -y ) ); // left Up
corner_list[6] = -x; corner_list[7] = 0; // left aCorner_list.push_back( wxPoint( -x, 0 ) ); // left
corner_list[8] = -x; corner_list[9] = y; // left down aCorner_list.push_back( wxPoint( -x, y ) ); // left down
corner_list[10] = 0; corner_list[11] = y; // down aCorner_list.push_back( wxPoint( 0, y ) ); // down
int x_offset = 0; int x_offset = 0;
...@@ -693,18 +696,18 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos ) ...@@ -693,18 +696,18 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
{ {
case NET_INPUT: case NET_INPUT:
x_offset = -HalfSize; x_offset = -HalfSize;
corner_list[0] += HalfSize; aCorner_list[0].x += HalfSize;
break; break;
case NET_OUTPUT: case NET_OUTPUT:
corner_list[6] -= HalfSize; aCorner_list[3].x -= HalfSize;
break; break;
case NET_BIDI: case NET_BIDI:
case NET_TRISTATE: case NET_TRISTATE:
x_offset = -HalfSize; x_offset = -HalfSize;
corner_list[0] += HalfSize; aCorner_list[0].x += HalfSize;
corner_list[6] -= HalfSize; aCorner_list[3].x -= HalfSize;
break; break;
case NET_UNSPECIFIED: case NET_UNSPECIFIED:
...@@ -732,17 +735,16 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos ) ...@@ -732,17 +735,16 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
break; break;
} }
// Rotate outlines and move in real position // Rotate outlines and move corners in real position
for( int ii = 0; ii < 12; ii += 2 ) for( unsigned ii = 0; ii < aCorner_list.size(); ii ++ )
{ {
corner_list[ii] += x_offset; aCorner_list[ii].x += x_offset;
if( angle ) if( angle )
RotatePoint( &corner_list[ii], &corner_list[ii + 1], angle ); RotatePoint( &aCorner_list[ii], angle );
corner_list[ii] += Pos.x; aCorner_list[ii] += Pos;
corner_list[ii + 1] += Pos.y;
} }
corner_list[12] = corner_list[0]; corner_list[13] = corner_list[1]; // closing aCorner_list.push_back( aCorner_list[0] ); // closing
} }
...@@ -757,8 +759,9 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox() ...@@ -757,8 +759,9 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
dx = dy = 0; dx = dy = 0;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
height = m_Size.y + 2*TXTMARGE; height = m_Size.y + 2 * TXTMARGE;
length = ( Pitch(width) * NegableTextLength(m_Text) ) + 2* height + 2*DANGLING_SYMBOL_SIZE; // add 2*height for triangular shapes (bidirectional) length =
( Pitch( width ) * NegableTextLength( m_Text ) ) + 2 * height + 2 * DANGLING_SYMBOL_SIZE; // add 2*height for triangular shapes (bidirectional)
switch( m_Orient ) // respect orientation switch( m_Orient ) // respect orientation
{ {
...@@ -766,13 +769,13 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox() ...@@ -766,13 +769,13 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
dx = -length; dx = -length;
dy = height; dy = height;
x += DANGLING_SYMBOL_SIZE; x += DANGLING_SYMBOL_SIZE;
y -= height/2; y -= height / 2;
break; break;
case 1: /* Vert Orientation UP */ case 1: /* Vert Orientation UP */
dx = height; dx = height;
dy = length; dy = length;
x -= height/2; x -= height / 2;
y -= DANGLING_SYMBOL_SIZE; y -= DANGLING_SYMBOL_SIZE;
break; break;
...@@ -780,18 +783,18 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox() ...@@ -780,18 +783,18 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
dx = length; dx = length;
dy = height; dy = height;
x -= DANGLING_SYMBOL_SIZE; x -= DANGLING_SYMBOL_SIZE;
y -= height/2; y -= height / 2;
break; break;
case 3: /* Vert Orientation BOTTOM */ case 3: /* Vert Orientation BOTTOM */
dx = height; dx = height;
dy = -length; dy = -length;
x -= height/2; x -= height / 2;
y += DANGLING_SYMBOL_SIZE; y += DANGLING_SYMBOL_SIZE;
break; break;
} }
EDA_Rect box(wxPoint(x,y), wxSize(dx,dy) ); EDA_Rect box( wxPoint( x, y ), wxSize( dx, dy ) );
box.Normalize(); box.Normalize();
return box; return box;
} }
...@@ -806,43 +809,42 @@ EDA_Rect SCH_TEXT::GetBoundingBox() ...@@ -806,43 +809,42 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
x = m_Pos.x; x = m_Pos.x;
y = m_Pos.y; y = m_Pos.y;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
length = ( Pitch(width) * NegableTextLength(m_Text) ); length = ( Pitch( width ) * NegableTextLength( m_Text ) );
height = m_Size.y; height = m_Size.y;
dx = dy = 0; dx = dy = 0;
switch( m_Orient ) // respect orientation switch( m_Orient ) // respect orientation
{ {
case 0: /* Horiz Normal Orientation (left justified) */ case 0: /* Horiz Normal Orientation (left justified) */
dx = 2*DANGLING_SYMBOL_SIZE + length; dx = 2 * DANGLING_SYMBOL_SIZE + length;
dy = -2*DANGLING_SYMBOL_SIZE - height - TXTMARGE; dy = -2 * DANGLING_SYMBOL_SIZE - height - TXTMARGE;
x -= DANGLING_SYMBOL_SIZE; x -= DANGLING_SYMBOL_SIZE;
y += DANGLING_SYMBOL_SIZE; y += DANGLING_SYMBOL_SIZE;
break; break;
case 1: /* Vert Orientation UP */ case 1: /* Vert Orientation UP */
dx = -2*DANGLING_SYMBOL_SIZE - height - TXTMARGE; dx = -2 * DANGLING_SYMBOL_SIZE - height - TXTMARGE;
dy = -2*DANGLING_SYMBOL_SIZE - length; dy = -2 * DANGLING_SYMBOL_SIZE - length;
x += DANGLING_SYMBOL_SIZE; x += DANGLING_SYMBOL_SIZE;
y += DANGLING_SYMBOL_SIZE; y += DANGLING_SYMBOL_SIZE;
break; break;
case 2: /* Horiz Orientation - Right justified */ case 2: /* Horiz Orientation - Right justified */
dx = -2*DANGLING_SYMBOL_SIZE - length; dx = -2 * DANGLING_SYMBOL_SIZE - length;
dy = -2*DANGLING_SYMBOL_SIZE - height - TXTMARGE; dy = -2 * DANGLING_SYMBOL_SIZE - height - TXTMARGE;
x += DANGLING_SYMBOL_SIZE; x += DANGLING_SYMBOL_SIZE;
y += DANGLING_SYMBOL_SIZE; y += DANGLING_SYMBOL_SIZE;
break; break;
case 3: /* Vert Orientation BOTTOM */ case 3: /* Vert Orientation BOTTOM */
dx = -2*DANGLING_SYMBOL_SIZE - height - TXTMARGE; dx = -2 * DANGLING_SYMBOL_SIZE - height - TXTMARGE;
dy = 2*DANGLING_SYMBOL_SIZE + length; dy = 2 * DANGLING_SYMBOL_SIZE + length;
x += DANGLING_SYMBOL_SIZE; x += DANGLING_SYMBOL_SIZE;
y -= DANGLING_SYMBOL_SIZE; y -= DANGLING_SYMBOL_SIZE;
break; break;
} }
EDA_Rect box(wxPoint(x,y), wxSize(dx,dy) ); EDA_Rect box( wxPoint( x, y ), wxSize( dx, dy ) );
box.Normalize(); box.Normalize();
return box; return box;
} }
...@@ -112,15 +112,6 @@ public: ...@@ -112,15 +112,6 @@ public:
} }
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20)
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void CreateGraphicShape( int* corner_list, const wxPoint & Pos );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
...@@ -136,6 +127,16 @@ public: ...@@ -136,6 +127,16 @@ public:
bool HitTest( const wxPoint& aPosRef ); bool HitTest( const wxPoint& aPosRef );
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = coordinates list fill with polygon corners ooordinates
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint & Pos );
}; };
...@@ -157,12 +158,12 @@ public: ...@@ -157,12 +158,12 @@ public:
/** function CreateGraphicShape /** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text * Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size >= 14) * @param aCorner_list = coordinates list fill with polygon corners ooordinates
* @param Pos = Postion of the shape * @param Pos = Postion of the shape
* format list is * format list is
* <corner_count>, x0, y0, ... xn, yn * <corner_count>, x0, y0, ... xn, yn
*/ */
void CreateGraphicShape( int* corner_list, const wxPoint & Pos ); void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint & Pos );
/** /**
* Function Save * Function Save
......
...@@ -21,22 +21,7 @@ ...@@ -21,22 +21,7 @@
int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText ) int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText )
{ {
int ret; int ret;
bool multiline; DialogLabelEditor* dialog = new DialogLabelEditor( parent, CurrentText );
switch( CurrentText->Type() )
{
case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL:
case TYPE_SCH_LABEL:
multiline = false;
break;
default:
multiline = true;
break;
}
DialogLabelEditor* dialog = new DialogLabelEditor( parent, CurrentText, multiline );
// doing any post construction resizing is better done here than in // doing any post construction resizing is better done here than in
// OnInitDialog() since it tends to flash/redraw the dialog less. // OnInitDialog() since it tends to flash/redraw the dialog less.
...@@ -49,8 +34,8 @@ int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * C ...@@ -49,8 +34,8 @@ int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * C
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText,bool multiline ) : DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText ) :
DialogLabelEditor_Base( parent,wxID_ANY,multiline ) DialogLabelEditor_Base( parent )
{ {
m_Parent = parent; m_Parent = parent;
m_CurrentText = CurrentText; m_CurrentText = CurrentText;
......
...@@ -18,7 +18,7 @@ private: ...@@ -18,7 +18,7 @@ private:
protected: protected:
// these are protected so that the static ShowModally() gets used. // these are protected so that the static ShowModally() gets used.
DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText, bool multiline); DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText);
~DialogLabelEditor(){}; ~DialogLabelEditor(){};
......
...@@ -9,31 +9,23 @@ ...@@ -9,31 +9,23 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, bool multiline, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer; wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL ); bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer2; bSizerTextCtrl = new wxBoxSizer( wxVERTICAL );
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 ); m_staticText1->Wrap( -1 );
bSizer2->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerTextCtrl->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
if (multiline)
{
m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER | wxTE_MULTILINE );
}
else
{
m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
}
m_TextLabel->SetToolTip( _("Enter the text to be used within the schematic") ); m_TextLabel->SetToolTip( _("Enter the text to be used within the schematic") );
bSizer2->Add( m_TextLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizerTextCtrl->Add( m_TextLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxBoxSizer* m_OptionsSizer; wxBoxSizer* m_OptionsSizer;
m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL ); m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
...@@ -56,9 +48,9 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, ...@@ -56,9 +48,9 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
m_TextShape->SetSelection( 0 ); m_TextShape->SetSelection( 0 );
m_OptionsSizer->Add( m_TextShape, 1, wxALL, 5 ); m_OptionsSizer->Add( m_TextShape, 1, wxALL, 5 );
bSizer2->Add( m_OptionsSizer, 1, wxEXPAND, 5 ); bSizerTextCtrl->Add( m_OptionsSizer, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizer2, 5, wxEXPAND, 5 ); bMainSizer->Add( bSizerTextCtrl, 5, wxEXPAND, 5 );
wxBoxSizer* bSizer4; wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL ); bSizer4 = new wxBoxSizer( wxVERTICAL );
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DialogLabelEditor_Base</property> <property name="name">DialogLabelEditor_Base</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">600,300</property> <property name="size">600,216</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Text Editor</property> <property name="title">Text Editor</property>
...@@ -81,9 +81,9 @@ ...@@ -81,9 +81,9 @@
<property name="proportion">5</property> <property name="proportion">5</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer2</property> <property name="name">bSizerTextCtrl</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
......
...@@ -38,6 +38,7 @@ class DialogLabelEditor_Base : public wxDialog ...@@ -38,6 +38,7 @@ class DialogLabelEditor_Base : public wxDialog
wxID_SIZE, wxID_SIZE,
}; };
wxBoxSizer* bSizerTextCtrl;
wxStaticText* m_staticText1; wxStaticText* m_staticText1;
wxTextCtrl* m_TextLabel; wxTextCtrl* m_TextLabel;
wxRadioBox* m_TextOrient; wxRadioBox* m_TextOrient;
...@@ -56,7 +57,7 @@ class DialogLabelEditor_Base : public wxDialog ...@@ -56,7 +57,7 @@ class DialogLabelEditor_Base : public wxDialog
public: public:
DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, bool multiline = false, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,300 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,216 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogLabelEditor_Base(); ~DialogLabelEditor_Base();
}; };
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "general.h" #include "general.h"
#include <wx/dcps.h> #include <wx/dcps.h>
#include "dialog_print_using_printer_base.h" #include "dialog_print_using_printer_base.h"
...@@ -275,7 +276,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) ...@@ -275,7 +276,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
wxString title = _("Preview"); wxString title = _("Preview");
EDA_Printout printout( this, m_Parent, title, print_ref ); EDA_Printout printout( this, m_Parent, title, print_ref );
#ifndef __WINDOWS__ #if !defined(__WINDOWS__) && !wxCHECK_VERSION(2,9,0)
wxDC* dc = printout.GetDC(); wxDC* dc = printout.GetDC();
( (wxPostScriptDC*) dc )->SetResolution( 600 ); // Postscript DC resolution is 600 ppi ( (wxPostScriptDC*) dc )->SetResolution( 600 ); // Postscript DC resolution is 600 ppi
#endif #endif
......
...@@ -311,7 +311,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, ...@@ -311,7 +311,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
fprintf( tmpfile, "Footprint=%s\n", CONV_TO_UTF8( FootprintName ) ); fprintf( tmpfile, "Footprint=%s\n", CONV_TO_UTF8( FootprintName ) );
Line = wxT( "Reference=" ) + Component->GetRef( sheet ) + wxT( "\n" ); Line = wxT( "Reference=" ) + Component->GetRef( sheet ) + wxT( "\n" );
Line.Replace( wxT( " " ), wxT( "_" ) ); Line.Replace( wxT( " " ), wxT( "_" ) );
fprintf( tmpfile, CONV_TO_UTF8( Line ) ); fputs( CONV_TO_UTF8( Line ), tmpfile );
Line = Component->GetField( VALUE )->m_Text; Line = Component->GetField( VALUE )->m_Text;
Line.Replace( wxT( " " ), wxT( "_" ) ); Line.Replace( wxT( " " ), wxT( "_" ) );
......
...@@ -613,23 +613,20 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame ) ...@@ -613,23 +613,20 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK,
_( "Zoom Block" ), zoom_selected_xpm ); _( "Window Zoom" ), zoom_selected_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
{ { // After a block move (that is also a block selection) one can reselect a block function:
wxMenu* menu_other_block_commands = new wxMenu; ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_other_block_commands, ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK,
-1, _( "Other Block Commands" ), right_xpm );
ADD_MENUITEM( menu_other_block_commands, wxID_COPY, _( "Save Block" ), copy_button );
ADD_MENUITEM( menu_other_block_commands, ID_POPUP_COPY_BLOCK,
_( "Copy Block" ), copyblock_xpm ); _( "Copy Block" ), copyblock_xpm );
ADD_MENUITEM( menu_other_block_commands, ID_POPUP_DRAG_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_DRAG_BLOCK,
_( "Drag Block" ), move_xpm ); _( "Drag Block" ), move_xpm );
ADD_MENUITEM( menu_other_block_commands, ID_POPUP_DELETE_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK,
_( "Delete Block" ), delete_xpm ); _( "Delete Block" ), delete_xpm );
ADD_MENUITEM( menu_other_block_commands, ID_POPUP_MIRROR_Y_BLOCK, _( ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _(
"Mirror Block ||" ), mirror_H_xpm ); "Mirror Block ||" ), mirror_H_xpm );
#if 0 #if 0
#ifdef __WINDOWS__ #ifdef __WINDOWS__
......
...@@ -616,7 +616,7 @@ void PlotTextStruct( EDA_BaseStruct* Struct ) ...@@ -616,7 +616,7 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
* Les textes peuvent avoir 4 directions. * Les textes peuvent avoir 4 directions.
*/ */
{ {
int Poly[50]; static std::vector <wxPoint> Poly;
int pX, pY, Shape = 0, Orient = 0, offset; int pX, pY, Shape = 0, Orient = 0, offset;
wxSize Size; wxSize Size;
wxString Text; wxString Text;
...@@ -737,12 +737,12 @@ void PlotTextStruct( EDA_BaseStruct* Struct ) ...@@ -737,12 +737,12 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
if( Struct->Type() == TYPE_SCH_GLOBALLABEL ) if( Struct->Type() == TYPE_SCH_GLOBALLABEL )
{ {
( (SCH_GLOBALLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) ); ( (SCH_GLOBALLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) );
PlotPoly( Poly[0], Poly + 1, NOFILL ); PlotPoly( Poly.size(), &Poly[0].x, NOFILL );
} }
if( Struct->Type() == TYPE_SCH_HIERLABEL ) if( Struct->Type() == TYPE_SCH_HIERLABEL )
{ {
( (SCH_HIERLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) ); ( (SCH_HIERLABEL*) Struct )->CreateGraphicShape( Poly, wxPoint(pX, pY) );
PlotPoly( Poly[0], Poly + 1, NOFILL ); PlotPoly( Poly.size(), &Poly[0].x, NOFILL );
} }
} }
......
...@@ -114,7 +114,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() ...@@ -114,7 +114,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
SetToolBar( m_HToolBar ); SetToolBar( m_HToolBar );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString, wxBitmap( save_library_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString,
wxBitmap( save_library_xpm ),
_( "Save current loaded library on disk (file update)" ) ); _( "Save current loaded library on disk (file update)" ) );
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString, wxBitmap( library_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString, wxBitmap( library_xpm ),
...@@ -127,7 +128,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() ...@@ -127,7 +128,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, wxBitmap( new_component_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, wxBitmap( new_component_xpm ),
_( "New component" ) ); _( "New component" ) );
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxBitmap( add_component_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxEmptyString,
wxBitmap( add_component_xpm ),
_( "Select component to edit" ) ); _( "Select component to edit" ) );
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString, m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString,
...@@ -151,23 +153,17 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() ...@@ -151,23 +153,17 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_LIBEDIT_REDO, wxEmptyString, wxBitmap( redo_xpm ), msg ); m_HToolBar->AddTool( ID_LIBEDIT_REDO, wxEmptyString, wxBitmap( redo_xpm ), msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxBitmap( part_properties_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString,
wxNullBitmap, wxBitmap( part_properties_xpm ),
FALSE,
-1, -1, (wxObject*) NULL,
_( "Edit component properties" ) ); _( "Edit component properties" ) );
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxBitmap( add_text_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString,
wxNullBitmap, wxBitmap( add_text_xpm ),
FALSE,
-1, -1, (wxObject*) NULL,
_( "Add, remove fields and edit fields properties" ) ); _( "Add, remove fields and edit fields properties" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxBitmap( erc_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString,
wxNullBitmap, wxBitmap( erc_xpm ),
FALSE,
-1, -1, (wxObject*) NULL,
_( "Test duplicate pins" ) ); _( "Test duplicate pins" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
...@@ -201,10 +197,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() ...@@ -201,10 +197,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
(CurrentConvert >= 2) ? TRUE : FALSE ); (CurrentConvert >= 2) ? TRUE : FALSE );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxBitmap( datasheet_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString,
wxNullBitmap, wxBitmap( datasheet_xpm ),
FALSE,
-1, -1, (wxObject*) NULL,
_( "Documents" ) ); _( "Documents" ) );
m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE ); m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE );
...@@ -218,10 +212,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() ...@@ -218,10 +212,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
m_HToolBar->AddControl( m_SelAliasBox ); m_HToolBar->AddControl( m_SelAliasBox );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxBitmap( pin2pin_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxEmptyString,
wxNullBitmap, wxBitmap( pin2pin_xpm ),
TRUE,
-1, -1, (wxObject*) NULL,
_( "Edit pins part per part (Carefully use!)" ) ); _( "Edit pins part per part (Carefully use!)" ) );
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn ); m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
......
...@@ -135,7 +135,10 @@ bool WinEDA_GerberFrame::LoadOneGerberFile( const wxString& FullFileName, ...@@ -135,7 +135,10 @@ bool WinEDA_GerberFrame::LoadOneGerberFile( const wxString& FullFileName,
g_PenFilenameExt.c_str(), g_PenFilenameExt.c_str()); g_PenFilenameExt.c_str(), g_PenFilenameExt.c_str());
wildcard += AllFilesWildcard; wildcard += AllFilesWildcard;
wxFileDialog dlg( this, _( "Open Gerber File" ), fn.GetPath(), wxString currpath = fn.GetPath();
if ( currpath.IsEmpty() )
currpath = wxGetCwd();
wxFileDialog dlg( this, _( "Open Gerber File" ), currpath,
fn.GetFullName(), wildcard, fn.GetFullName(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
......
...@@ -499,6 +499,8 @@ public: ...@@ -499,6 +499,8 @@ public:
bool m_Italic; /* true to simulate an italic font... */ bool m_Italic; /* true to simulate an italic font... */
GRTextHorizJustifyType m_HJustify; /* Horiz Justify */ GRTextHorizJustifyType m_HJustify; /* Horiz Justify */
GRTextVertJustifyType m_VJustify; /* Vertical and Vert Justify */ GRTextVertJustifyType m_VJustify; /* Vertical and Vert Justify */
bool m_MultilineAllowed; /* true to use multiline option, false to use only single line text
* Single line is faster in calculations than multiline */
public: public:
EDA_TextStruct( const wxString& text = wxEmptyString ); EDA_TextStruct( const wxString& text = wxEmptyString );
......
...@@ -19,6 +19,7 @@ TEXTE_PCB::TEXTE_PCB( BOARD_ITEM* parent ) : ...@@ -19,6 +19,7 @@ TEXTE_PCB::TEXTE_PCB( BOARD_ITEM* parent ) :
BOARD_ITEM( parent, TYPE_TEXTE ), BOARD_ITEM( parent, TYPE_TEXTE ),
EDA_TextStruct() EDA_TextStruct()
{ {
m_MultilineAllowed = true;
} }
...@@ -43,6 +44,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source ) ...@@ -43,6 +44,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
m_Italic = source->m_Italic; m_Italic = source->m_Italic;
m_HJustify = source->m_HJustify; m_HJustify = source->m_HJustify;
m_VJustify = source->m_VJustify; m_VJustify = source->m_VJustify;
m_MultilineAllowed = m_MultilineAllowed;
m_Text = source->m_Text; m_Text = source->m_Text;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment