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,19 +279,37 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -278,19 +279,37 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
*/ */
{ {
wxPoint pos = m_Pos;
wxArrayString* list = wxStringSplit( m_Text, '\n' );
wxPoint offset;
offset.y = (int) (m_Size.y * 1.5 ); if ( m_MultilineAllowed )
{
wxPoint pos = m_Pos;
wxArrayString* list = wxStringSplit( m_Text, '\n' );
wxPoint offset;
RotatePoint( &offset, m_Orient ); offset.y = (int) (m_Size.y * 1.5 );
if( m_Mirror )
offset.x = -offset.x;
for( unsigned i = 0; i<list->Count(); i++ ) RotatePoint( &offset, m_Orient );
{ if( m_Mirror )
wxString txt = list->Item( i ); offset.x = -offset.x;
for( unsigned i = 0; i<list->Count(); i++ )
{
wxString txt = list->Item( i );
DrawOneLineOfText( aPanel,
aDC,
aOffset,
aColor,
aDrawMode,
aDisplayMode,
aAnchor_color,
txt,
pos );
pos += offset;
}
delete (list);
}
else
DrawOneLineOfText( aPanel, DrawOneLineOfText( aPanel,
aDC, aDC,
aOffset, aOffset,
...@@ -298,12 +317,8 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -298,12 +317,8 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
aDrawMode, aDrawMode,
aDisplayMode, aDisplayMode,
aAnchor_color, aAnchor_color,
txt, m_Text,
pos ); m_Pos );
pos += offset;
}
delete (list);
} }
...@@ -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,69 +189,48 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -189,69 +189,48 @@ 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:
ux0 = -dx;
break;
case GR_TEXT_HJUSTIFY_LEFT: while( irot < 0 )
ux0 = dx; irot += 1800;
break;
}
switch( aV_justify )
{
case GR_TEXT_VJUSTIFY_CENTER:
break;
case GR_TEXT_VJUSTIFY_TOP: if( irot != 0 )
uy0 = dy; EXCHG( offset_org.x, offset_org.y );
break;
case GR_TEXT_VJUSTIFY_BOTTOM: switch( aH_justify )
uy0 = -dy;
break;
}
}
else /* Vertical Text */
{ {
switch( aH_justify ) case GR_TEXT_HJUSTIFY_CENTER:
{ break;
case GR_TEXT_HJUSTIFY_CENTER:
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;
} }
switch( aV_justify ) switch( aV_justify )
{ {
case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_CENTER:
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,53 +34,59 @@ const char* SheetLabelType[] = ...@@ -34,53 +34,59 @@ const char* SheetLabelType[] =
"?????" "?????"
}; };
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 }; /* Coding polygons for global symbol graphic shapes.
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 }; * the first parml is the number of corners
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 }; * others are the corners coordinates in reduced units
int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 }; * the real coordinate is the reduced coordinate * text half size
*/
int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 }; int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 }; int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 }; int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 }; int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 }; int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 }; int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 }; int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 }; int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 }; int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 }; int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 }; int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 }; int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 }; int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 }; int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 }; int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 }; int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int* TemplateShape[5][4] = int* TemplateShape[5][4] =
{ {
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM }, { TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM }, { TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM }, { TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM },
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM }, { Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM },
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM } { TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM }
}; };
/**************************************************************************/ /**************************************************************************/
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;
m_Pos = pos; m_Pos = pos;
m_Shape = 0; m_Shape = 0;
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,86 +179,68 @@ void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -172,86 +179,68 @@ 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 )
/*******************************************************************************************/ /*******************************************************************************************/
/* Texts type Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter /* Texts type Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter
*/ */
{ {
EDA_Colors color; EDA_Colors color;
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'); int orientation;
wxPoint text_offset = aOffset;
wxPoint pos;
int orientation;
GRTextHorizJustifyType Hjustify;
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 );
} }
...@@ -263,15 +252,16 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, ...@@ -263,15 +252,16 @@ 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,
m_Orient, m_Size.x, m_Orient, m_Size.x,
shape, m_Width, shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF ) CONV_TO_UTF8( m_Text ) ) == EOF )
{ {
success = false; success = false;
} }
...@@ -288,14 +278,15 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os ) ...@@ -288,14 +278,15 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os )
wxString s = GetClass(); wxString s = GetClass();
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str()
<< " layer=\"" << m_Layer << '"' << " layer=\"" << m_Layer << '"'
<< " shape=\"" << m_Shape << '"' << " shape=\"" << m_Shape << '"'
<< " dangling=\"" << m_IsDangling << '"' << " dangling=\"" << m_IsDangling << '"'
<< '>' << '>'
<< CONV_TO_UTF8( m_Text ) << CONV_TO_UTF8( m_Text )
<< "</" << s.Lower().mb_str() << ">\n"; << "</" << s.Lower().mb_str() << ">\n";
} }
#endif #endif
/****************************************************************************/ /****************************************************************************/
...@@ -303,8 +294,8 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) : ...@@ -303,8 +294,8 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
SCH_TEXT( pos, text, TYPE_SCH_LABEL ) SCH_TEXT( pos, text, TYPE_SCH_LABEL )
/****************************************************************************/ /****************************************************************************/
{ {
m_Layer = LAYER_LOCLABEL; m_Layer = LAYER_LOCLABEL;
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
...@@ -317,15 +308,16 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) : ...@@ -317,15 +308,16 @@ 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",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Orient, m_Size.x, shape, m_Width, m_Orient, m_Size.x, shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF ) CONV_TO_UTF8( m_Text ) ) == EOF )
{ {
success = false; success = false;
} }
...@@ -339,8 +331,8 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : ...@@ -339,8 +331,8 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
SCH_TEXT( pos, text, TYPE_SCH_GLOBALLABEL ) SCH_TEXT( pos, text, TYPE_SCH_GLOBALLABEL )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_Layer = LAYER_GLOBLABEL; m_Layer = LAYER_GLOBLABEL;
m_Shape = NET_BIDI; m_Shape = NET_BIDI;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
...@@ -353,16 +345,17 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : ...@@ -353,16 +345,17 @@ 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,
m_Orient, m_Size.x, m_Orient, m_Size.x,
SheetLabelType[m_Shape], SheetLabelType[m_Shape],
shape, m_Width, shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF ) CONV_TO_UTF8( m_Text ) ) == EOF )
{ {
success = false; success = false;
} }
...@@ -370,27 +363,29 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const ...@@ -370,27 +363,29 @@ 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 )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_Layer = LAYER_HIERLABEL; m_Layer = LAYER_HIERLABEL;
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
...@@ -403,16 +398,17 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text ) : ...@@ -403,16 +398,17 @@ 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,
m_Orient, m_Size.x, m_Orient, m_Size.x,
SheetLabelType[m_Shape], SheetLabelType[m_Shape],
shape, m_Width, shape, m_Width,
CONV_TO_UTF8( m_Text ) ) == EOF ) CONV_TO_UTF8( m_Text ) ) == EOF )
{ {
success = false; success = false;
} }
...@@ -420,22 +416,25 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const ...@@ -420,22 +416,25 @@ 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 );
} }
/*********************************************************************************************/ /*********************************************************************************************/
void SCH_LABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void SCH_LABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/*********************************************************************************************/ /*********************************************************************************************/
{ {
SCH_TEXT::Draw( panel, DC, offset, DrawMode, Color ); SCH_TEXT::Draw( panel, DC, offset, DrawMode, Color );
...@@ -444,21 +443,21 @@ void SCH_LABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, ...@@ -444,21 +443,21 @@ void SCH_LABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
/*******************************************************************************************/ /*******************************************************************************************/
void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/******************************************************************************************/ /******************************************************************************************/
/* 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,104 +507,109 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs ...@@ -508,104 +507,109 @@ 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()
/****************************************/ /****************************************/
{ {
int x, y, dx, dy, length, height; int x, y, dx, dy, length, height;
x = m_Pos.x; x = m_Pos.x;
y = m_Pos.y; y = m_Pos.y;
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
{ {
case 0: /* Horiz Normal Orientation (left justified) */ case 0: /* Horiz Normal Orientation (left justified) */
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;
case 2: /* Horiz Orientation - Right justified */ case 2: /* Horiz Orientation - Right justified */
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 )
/******************************************************************************************/ /******************************************************************************************/
/* 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;
wxPoint AnchorPos = m_Pos + draw_offset;; wxPoint AnchorPos = m_Pos + draw_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 );
HalfSize = m_Size.x / 2; HalfSize = m_Size.x / 2;
offset = width; offset = width;
switch( m_Shape ) switch( m_Shape )
{ {
...@@ -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 );
aCorner_list.clear();
*corner_list = 7; corner_list++; // 7 corners in list 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
} }
...@@ -752,46 +754,47 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox() ...@@ -752,46 +754,47 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
{ {
int x, y, dx, dy, length, height; int x, y, dx, dy, length, height;
x = m_Pos.x; x = m_Pos.x;
y = m_Pos.y; y = m_Pos.y;
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
{ {
case 0: /* Horiz Normal Orientation (left justified) */ case 0: /* Horiz Normal Orientation (left justified) */
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;
case 2: /* Horiz Orientation - Right justified */ case 2: /* Horiz Orientation - Right justified */
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;
} }
...@@ -805,44 +808,43 @@ EDA_Rect SCH_TEXT::GetBoundingBox() ...@@ -805,44 +808,43 @@ 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 ); bSizerTextCtrl->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bSizer2->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
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->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,61 +114,57 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() ...@@ -114,61 +114,57 @@ 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,
_( "Save current loaded library on disk (file update)" ) ); wxBitmap( save_library_xpm ),
_( "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 ),
_( "Select working library" ) ); _( "Select working library" ) );
m_HToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString, wxBitmap( delete_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString, wxBitmap( delete_xpm ),
_( "Delete component in current library" ) ); _( "Delete component in current library" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
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,
_( "Select component to edit" ) ); wxBitmap( add_component_xpm ),
_( "Select component to edit" ) );
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString, m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString,
wxBitmap( save_part_in_mem_xpm ), wxBitmap( save_part_in_mem_xpm ),
_( "Save current component into current loaded library (in memory)" ) ); _( "Save current component into current loaded library (in memory)" ) );
m_HToolBar->AddTool( ImportPartId, wxEmptyString, wxBitmap( import_xpm ), m_HToolBar->AddTool( ImportPartId, wxEmptyString, wxBitmap( import_xpm ),
_( "import component" ) ); _( "import component" ) );
m_HToolBar->AddTool( ExportPartId, wxEmptyString, wxBitmap( export_xpm ), m_HToolBar->AddTool( ExportPartId, wxEmptyString, wxBitmap( export_xpm ),
_( "export component" ) ); _( "export component" ) );
m_HToolBar->AddTool( CreateNewLibAndSavePartId, wxEmptyString, m_HToolBar->AddTool( CreateNewLibAndSavePartId, wxEmptyString,
wxBitmap( new_library_xpm ), wxBitmap( new_library_xpm ),
_( "Create a new library an save current component into" ) ); _( "Create a new library an save current component into" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO ); msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO );
m_HToolBar->AddTool( ID_LIBEDIT_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg ); m_HToolBar->AddTool( ID_LIBEDIT_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg );
msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO ); msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO );
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, _( "Edit component properties" ) );
-1, -1, (wxObject*) NULL,
_( "Edit component properties" ) ); m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString,
wxBitmap( add_text_xpm ),
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxBitmap( add_text_xpm ), _( "Add, remove fields and edit fields properties" ) );
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
_( "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, _( "Test duplicate pins" ) );
-1, -1, (wxObject*) NULL,
_( "Test duplicate pins" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN ); msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
...@@ -184,8 +180,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() ...@@ -184,8 +180,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
msg ); msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ), wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) ); _( "Zoom auto" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
...@@ -201,28 +197,24 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() ...@@ -201,28 +197,24 @@ 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, _( "Documents" ) );
-1, -1, (wxObject*) NULL,
_( "Documents" ) );
m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE ); m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_SelpartBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_PART_NUMBER, m_SelpartBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) ); wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) );
m_HToolBar->AddControl( m_SelpartBox ); m_HToolBar->AddControl( m_SelpartBox );
m_SelAliasBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_ALIAS, m_SelAliasBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_ALIAS,
wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) ); wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) );
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, _( "Edit pins part per part (Carefully use!)" ) );
-1, -1, (wxObject*) NULL,
_( "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 );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes // after adding the buttons to the toolbar, must call Realize() to reflect the changes
......
...@@ -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