Commit 348cfa79 authored by charras's avatar charras

More about italic and bold texts options in fields and graphic texts + code cleanup

parent f08585f9
...@@ -6,6 +6,12 @@ Please add newer entries at the top, list the date and your name with ...@@ -6,6 +6,12 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Dec-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++Eeschema:
More about italic and bold texts options in fields and graphic texts
2008-Dec-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Dec-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
++Pcbnew: ++Pcbnew:
......
...@@ -32,6 +32,7 @@ set(EESCHEMA_SRCS ...@@ -32,6 +32,7 @@ set(EESCHEMA_SRCS
delete.cpp delete.cpp
delsheet.cpp delsheet.cpp
# dialog_backanno.cpp # dialog_backanno.cpp
dialog_bodygraphictext_properties_base.cpp
dialog_build_BOM.cpp dialog_build_BOM.cpp
# dialog_cmp_graphic_properties.cpp # dialog_cmp_graphic_properties.cpp
dialog_create_component.cpp dialog_create_component.cpp
...@@ -94,7 +95,7 @@ set(EESCHEMA_SRCS ...@@ -94,7 +95,7 @@ set(EESCHEMA_SRCS
sheetlab.cpp sheetlab.cpp
symbdraw.cpp symbdraw.cpp
symbedit.cpp symbedit.cpp
symbtext.cpp edit_graphic_bodyitem_text.cpp
tool_lib.cpp tool_lib.cpp
tool_sch.cpp tool_sch.cpp
tool_viewlib.cpp tool_viewlib.cpp
......
...@@ -126,6 +126,7 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame ) ...@@ -126,6 +126,7 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame )
*/ */
{ {
wxString msg; wxString msg;
int thickness = 0;
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
...@@ -135,21 +136,27 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame ) ...@@ -135,21 +136,27 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame )
switch( Type() ) switch( Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
thickness = ( (LibDrawArc*) this )->m_Width;
msg = wxT( "Arc" ); break; msg = wxT( "Arc" ); break;
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
thickness = ( (LibDrawCircle*) this )->m_Width;
msg = wxT( "Circle" ); break; msg = wxT( "Circle" ); break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
thickness = ( (LibDrawText*) this )->m_Width;
msg = wxT( "Text" ); break; msg = wxT( "Text" ); break;
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
thickness = ( (LibDrawSquare*) this )->m_Width;
msg = wxT( "Rect" ); break; msg = wxT( "Rect" ); break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
thickness = ( (LibDrawPolyline*) this )->m_Width;
msg = wxT( "PolyLine" ); break; msg = wxT( "PolyLine" ); break;
case COMPONENT_LINE_DRAW_TYPE: case COMPONENT_LINE_DRAW_TYPE:
thickness = ( (LibDrawSegment*) this )->m_Width;
msg = wxT( "Segment" ); break; msg = wxT( "Segment" ); break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
...@@ -181,9 +188,9 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame ) ...@@ -181,9 +188,9 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame )
msg = wxT( "?" ); msg = wxT( "?" );
Affiche_1_Parametre( frame, 14, _( "Convert" ), msg, BROWN ); Affiche_1_Parametre( frame, 14, _( "Convert" ), msg, BROWN );
if( m_Width ) if( thickness )
msg = ReturnStringFromValue( g_UnitMetric, m_Width, EESCHEMA_INTERNAL_UNIT, true ); msg = ReturnStringFromValue( g_UnitMetric, thickness, EESCHEMA_INTERNAL_UNIT, true );
else else
msg = _( "default" ); msg = _( "default" );
Affiche_1_Parametre( frame, 20, _( "Width" ), msg, BLUE ); Affiche_1_Parametre( frame, 20, _( "Thickness" ), msg, BLUE );
} }
...@@ -12,11 +12,6 @@ ...@@ -12,11 +12,6 @@
#include "protos.h" #include "protos.h"
/*******************************************************/
/* Methodes relatives a la manipulation des librairies */
/*******************************************************/
/***************************************************************************************/ /***************************************************************************************/
LibraryStruct::LibraryStruct( int type, const wxString& name, const wxString& fullname ) LibraryStruct::LibraryStruct( int type, const wxString& name, const wxString& fullname )
/***************************************************************************************/ /***************************************************************************************/
...@@ -396,11 +391,6 @@ LibDrawField::LibDrawField( int idfield ) : LibEDA_BaseStruct( COMPONENT_FIELD_D ...@@ -396,11 +391,6 @@ LibDrawField::LibDrawField( int idfield ) : LibEDA_BaseStruct( COMPONENT_FIELD_D
if( m_FieldId >= NUMBER_OF_FIELDS ) if( m_FieldId >= NUMBER_OF_FIELDS )
m_FieldId = NUMBER_OF_FIELDS - 1; m_FieldId = NUMBER_OF_FIELDS - 1;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
m_Orient = 0; /* Orientation */
m_Attributs = 0; /* Attributs = unvisible ... */
m_Width = 0;
m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Horizontal and vertical text justification */
} }
...@@ -432,6 +422,7 @@ void LibDrawField::Copy( LibDrawField* Target ) ...@@ -432,6 +422,7 @@ void LibDrawField::Copy( LibDrawField* Target )
Target->m_Name = m_Name; Target->m_Name = m_Name;
Target->m_HJustify = m_HJustify; Target->m_HJustify = m_HJustify;
Target->m_VJustify = m_VJustify; Target->m_VJustify = m_VJustify;
Target->m_Italic = m_Italic;
} }
...@@ -494,13 +485,11 @@ LibDrawCircle* LibDrawCircle::GenCopy() ...@@ -494,13 +485,11 @@ LibDrawCircle* LibDrawCircle::GenCopy()
/*****************************************************************/ /*****************************************************************/
LibDrawText::LibDrawText() : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) LibDrawText::LibDrawText() : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ),
EDA_TextStruct()
/*****************************************************************/ /*****************************************************************/
{ {
m_Horiz = TEXT_ORIENT_HORIZ;
m_Size = wxSize( 50, 50 ); m_Size = wxSize( 50, 50 );
m_Type = 0;
m_Width = 0;
} }
...@@ -511,14 +500,17 @@ LibDrawText* LibDrawText::GenCopy() ...@@ -511,14 +500,17 @@ LibDrawText* LibDrawText::GenCopy()
LibDrawText* newitem = new LibDrawText(); LibDrawText* newitem = new LibDrawText();
newitem->m_Pos = m_Pos; newitem->m_Pos = m_Pos;
newitem->m_Horiz = m_Horiz; newitem->m_Orient = m_Orient;
newitem->m_Size = m_Size; newitem->m_Size = m_Size;
newitem->m_Type = m_Type; newitem->m_Attributs = m_Attributs;
newitem->m_Unit = m_Unit; newitem->m_Unit = m_Unit;
newitem->m_Convert = m_Convert; newitem->m_Convert = m_Convert;
newitem->m_Flags = m_Flags; newitem->m_Flags = m_Flags;
newitem->m_Text = m_Text; newitem->m_Text = m_Text;
newitem->m_Width = m_Width; newitem->m_Width = m_Width;
newitem->m_Italic = m_Italic;
newitem->m_HJustify = m_HJustify;
newitem->m_VJustify = m_VJustify;
return newitem; return newitem;
} }
...@@ -589,7 +581,6 @@ LibDrawPolyline* LibDrawPolyline::GenCopy() ...@@ -589,7 +581,6 @@ LibDrawPolyline* LibDrawPolyline::GenCopy()
newitem->m_PolyList = (int*) MyMalloc( size ); newitem->m_PolyList = (int*) MyMalloc( size );
memcpy( newitem->m_PolyList, m_PolyList, size ); memcpy( newitem->m_PolyList, m_PolyList, size );
} }
newitem->m_Pos = m_Pos;
newitem->m_Width = m_Width; newitem->m_Width = m_Width;
newitem->m_Unit = m_Unit; newitem->m_Unit = m_Unit;
newitem->m_Convert = m_Convert; newitem->m_Convert = m_Convert;
......
...@@ -198,14 +198,16 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const ...@@ -198,14 +198,16 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
vjustify = 'T'; vjustify = 'T';
if( fprintf( aFile, "F %d \"%s\" %c %-3d %-3d %-3d %4.4X %c %c", if( fprintf( aFile, "F %d \"%s\" %c %-3d %-3d %-3d %4.4X %c %c%c%c",
m_FieldId, m_FieldId,
CONV_TO_UTF8( m_Text ), CONV_TO_UTF8( m_Text ),
m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V', m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V',
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Size.x, m_Size.x,
m_Attributs, m_Attributs,
hjustify, vjustify ) == EOF ) hjustify, vjustify,
m_Italic ? 'I' : 'N',
m_Width > 1 ? 'B' : 'N' ) == EOF )
{ {
return false; return false;
} }
......
...@@ -23,9 +23,7 @@ LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) : ...@@ -23,9 +23,7 @@ LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) :
* 0 if the item is common to all units */ * 0 if the item is common to all units */
m_Convert = 0; /* Shape identification (for parts which have a convert shape) m_Convert = 0; /* Shape identification (for parts which have a convert shape)
* 0 if the item is common to all shapes */ * 0 if the item is common to all shapes */
m_Width = 0; /* Default value to draw lines or arc ... */ m_Fill = NO_FILL;
m_Fill = NO_FILL; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR.
* has meaning only for some items */
} }
...@@ -159,12 +157,12 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOff ...@@ -159,12 +157,12 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOff
/* The text orientation may need to be flipped if the /* The text orientation may need to be flipped if the
* transformation matrix causes xy axes to be flipped. */ * transformation matrix causes xy axes to be flipped. */
int t1 = (aTransformMatrix[0][0] != 0) ^ (m_Horiz != 0); int t1 = (aTransformMatrix[0][0] != 0) ^ (m_Orient != 0);
DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text, DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
m_Size, m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, linewidth ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, linewidth, m_Italic );
} }
...@@ -299,7 +297,7 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOf ...@@ -299,7 +297,7 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOf
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) int aDrawMode, void* aData, int aTransformMatrix[2][2] )
/*************************************************************************************************/ /*************************************************************************************************/
/* if aData not NULL, adat must point a wxString which is used instead of the m_Text /* if aData not NULL, aData must point a wxString which is used instead of the m_Text
*/ */
{ {
wxPoint text_pos; wxPoint text_pos;
...@@ -340,7 +338,7 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOf ...@@ -340,7 +338,7 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOf
(EDA_Colors) color, text->GetData(), (EDA_Colors) color, text->GetData(),
m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
m_Size, m_Size,
m_HJustify, m_VJustify, linewidth ); m_HJustify, m_VJustify, linewidth, m_Italic );
} }
......
...@@ -130,8 +130,6 @@ public: ...@@ -130,8 +130,6 @@ public:
* 0 if the item is common to all units */ * 0 if the item is common to all units */
int m_Convert; /* Shape identification (for parts which have a convert shape) int m_Convert; /* Shape identification (for parts which have a convert shape)
* 0 if the item is common to all shapes */ * 0 if the item is common to all shapes */
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
int m_Width; /* Tickness */
FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. has meaning only for some items */ FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. has meaning only for some items */
public: public:
...@@ -189,6 +187,8 @@ public: ...@@ -189,6 +187,8 @@ public:
int m_PinNumSize, m_PinNameSize; /* Pin num and Pin name sizes */ int m_PinNumSize, m_PinNameSize; /* Pin num and Pin name sizes */
// int m_PinNumWidth, m_PinNameWidth; /* (Currently Unused) Pin num and Pin name text width */ // int m_PinNumWidth, m_PinNameWidth; /* (Currently Unused) Pin num and Pin name text width */
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
int m_Width; /* Tickness */
public: public:
LibDrawPin(); LibDrawPin();
...@@ -246,6 +246,8 @@ public: ...@@ -246,6 +246,8 @@ public:
int m_Rayon; int m_Rayon;
int t1, t2; /* position des 2 extremites de l'arc en 0.1 degres */ int t1, t2; /* position des 2 extremites de l'arc en 0.1 degres */
wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/ wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
int m_Width; /* Tickness */
public: public:
LibDrawArc(); LibDrawArc();
...@@ -278,6 +280,8 @@ class LibDrawCircle : public LibEDA_BaseStruct ...@@ -278,6 +280,8 @@ class LibDrawCircle : public LibEDA_BaseStruct
{ {
public: public:
int m_Rayon; int m_Rayon;
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
int m_Width; /* Tickness */
public: public:
LibDrawCircle(); LibDrawCircle();
...@@ -311,12 +315,8 @@ public: ...@@ -311,12 +315,8 @@ public:
/* they are a separate class */ /* they are a separate class */
/*********************************************/ /*********************************************/
class LibDrawText : public LibEDA_BaseStruct class LibDrawText : public LibEDA_BaseStruct
, public EDA_TextStruct
{ {
public:
int m_Horiz;
wxSize m_Size;
int m_Type;
wxString m_Text;
public: public:
LibDrawText(); LibDrawText();
...@@ -350,6 +350,8 @@ class LibDrawSquare : public LibEDA_BaseStruct ...@@ -350,6 +350,8 @@ class LibDrawSquare : public LibEDA_BaseStruct
{ {
public: public:
wxPoint m_End; wxPoint m_End;
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
int m_Width; /* Tickness */
public: public:
LibDrawSquare(); LibDrawSquare();
...@@ -382,6 +384,8 @@ class LibDrawSegment : public LibEDA_BaseStruct ...@@ -382,6 +384,8 @@ class LibDrawSegment : public LibEDA_BaseStruct
{ {
public: public:
wxPoint m_End; wxPoint m_End;
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
int m_Width; /* Tickness */
public: public:
LibDrawSegment(); LibDrawSegment();
...@@ -415,6 +419,7 @@ class LibDrawPolyline : public LibEDA_BaseStruct ...@@ -415,6 +419,7 @@ class LibDrawPolyline : public LibEDA_BaseStruct
public: public:
int m_CornersCount; int m_CornersCount;
int* m_PolyList; int* m_PolyList;
int m_Width; /* Tickness */
public: public:
LibDrawPolyline(); LibDrawPolyline();
...@@ -458,6 +463,7 @@ public: ...@@ -458,6 +463,7 @@ public:
* Name (74LS00..) used to find the component in libraries, and give the default value in schematic * Name (74LS00..) used to find the component in libraries, and give the default value in schematic
*/ */
class LibDrawField : public LibEDA_BaseStruct class LibDrawField : public LibEDA_BaseStruct
, public EDA_TextStruct
{ {
public: public:
int m_FieldId; /* 0 a 11 int m_FieldId; /* 0 a 11
...@@ -465,13 +471,7 @@ public: ...@@ -465,13 +471,7 @@ public:
* 2 = Default footprint, 3 = subsheet (not used, reserved) * 2 = Default footprint, 3 = subsheet (not used, reserved)
* .. 11 other fields * .. 11 other fields
*/ */
wxSize m_Size; wxString m_Name; /* Field Name (not the fielsd text itself, that is .m_Text) */
int m_Orient; /* Orientation */
int m_Attributs; /* Attributes (Non visible ...) */
enum GRTextHorizJustifyType m_HJustify; /* Horizontal Text Justify */
enum GRTextVertJustifyType m_VJustify; /* Vertical Text Justify */
wxString m_Text; /* Field Data */
wxString m_Name; /* Field Name */
public: public:
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_bodygraphictext_properties_base.h"
///////////////////////////////////////////////////////////////////////////
Dialog_BodyGraphicText_Properties_base::Dialog_BodyGraphicText_Properties_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 );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bLeftSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextValue->SetMinSize( wxSize( 200,-1 ) );
bLeftSizer->Add( m_TextValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxStaticBoxSizer* sOptionsSizer;
sOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _(" Text Options : ") ), wxVERTICAL );
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to Units"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_CommonUnit, 0, wxALL, 5 );
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to convert"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_CommonConvert, 0, wxALL, 5 );
m_Orient = new wxCheckBox( this, wxID_ANY, _("Vertical"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_Orient, 0, wxALL, 5 );
bLeftSizer->Add( sOptionsSizer, 0, 0, 5 );
bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_TextSizeText = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextSizeText->Wrap( -1 );
bRightSizer->Add( m_TextSizeText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_TextShapeOptNChoices = sizeof( m_TextShapeOptChoices ) / sizeof( wxString );
m_TextShapeOpt = new wxRadioBox( this, wxID_ANY, _("Text Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeOptNChoices, m_TextShapeOptChoices, 1, wxRA_SPECIFY_COLS );
m_TextShapeOpt->SetSelection( 3 );
bRightSizer->Add( m_TextShapeOpt, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bRightSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_buttonOK, 0, wxALL, 5 );
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_buttonCANCEL, 0, wxALL, 5 );
bMainSizer->Add( bSizer4, 0, wxALIGN_CENTER_VERTICAL, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( Dialog_BodyGraphicText_Properties_base::OnInitDialog ) );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnCancelClick ), NULL, this );
}
Dialog_BodyGraphicText_Properties_base::~Dialog_BodyGraphicText_Properties_base()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( Dialog_BodyGraphicText_Properties_base::OnInitDialog ) );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( Dialog_BodyGraphicText_Properties_base::OnCancelClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_bodygraphictext_properties_base__
#define __dialog_bodygraphictext_properties_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class Dialog_BodyGraphicText_Properties_base
///////////////////////////////////////////////////////////////////////////////
class Dialog_BodyGraphicText_Properties_base : public wxDialog
{
private:
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_TextValue;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxCheckBox* m_Orient;
wxStaticText* m_TextSizeText;
wxTextCtrl* m_TextSize;
wxRadioBox* m_TextShapeOpt;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public:
Dialog_BodyGraphicText_Properties_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic text properties:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 360,180 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~Dialog_BodyGraphicText_Properties_base();
};
#endif //__dialog_bodygraphictext_properties_base__
...@@ -435,6 +435,13 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() ...@@ -435,6 +435,13 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT ); rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
int style = 0;
if ( field.m_Italic )
style = 1;
if ( field.m_Width > 1 )
style |= 2;
m_StyleRadioBox->SetSelection(style);
fieldNameTextCtrl->SetValue( field.m_Name ); fieldNameTextCtrl->SetValue( field.m_Name );
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable editing // if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable editing
...@@ -499,6 +506,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -499,6 +506,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT ); rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
field.m_Name = fieldNameTextCtrl->GetValue(); field.m_Name = fieldNameTextCtrl->GetValue();
field.m_Text = fieldValueTextCtrl->GetValue(); field.m_Text = fieldValueTextCtrl->GetValue();
...@@ -507,6 +515,17 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -507,6 +515,17 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize( textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UnitMetric ); field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize( textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UnitMetric );
field.m_Size.y = field.m_Size.x; field.m_Size.y = field.m_Size.x;
int style = m_StyleRadioBox->GetSelection( );
if ( (style & 1 ) != 0 )
field.m_Italic = true;
else
field.m_Italic = false;
if ( (style & 2 ) != 0 )
field.m_Width = field.m_Size.x / 4;
else
field.m_Width = 0;
double value; double value;
posXTextCtrl->GetValue().ToDouble( &value ); posXTextCtrl->GetValue().ToDouble( &value );
......
...@@ -727,9 +727,9 @@ ...@@ -727,9 +727,9 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Visibility</property> <property name="label">Visibility</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
...@@ -739,8 +739,17 @@ ...@@ -739,8 +739,17 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bShowRotateSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="checked">0</property> <property name="checked">0</property>
...@@ -792,7 +801,7 @@ ...@@ -792,7 +801,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALL</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="checked">0</property> <property name="checked">0</property>
...@@ -843,6 +852,62 @@ ...@@ -843,6 +852,62 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Normal&quot; &quot;Italic&quot; &quot;Bold&quot; &quot;Bold Italic&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Style:</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_StyleRadioBox</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">0</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
......
...@@ -114,19 +114,30 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -114,19 +114,30 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
wxStaticBoxSizer* visibilitySizer; wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL ); visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL );
wxBoxSizer* bShowRotateSizer;
bShowRotateSizer = new wxBoxSizer( wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 ); showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") ); showCheckBox->SetToolTip( _("Check if you want this field visible") );
visibilitySizer->Add( showCheckBox, 1, wxALL, 5 ); bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 ); rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") ); rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
visibilitySizer->Add( rotateCheckBox, 1, wxALL, 5 ); bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 );
visibilitySizer->Add( bShowRotateSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 0 );
visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( visibilitySizer, 0, wxALL|wxEXPAND, 5 ); fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND, 5 );
wxBoxSizer* fieldNameBoxSizer; wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
......
...@@ -49,6 +49,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog ...@@ -49,6 +49,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
wxButton* moveUpButton; wxButton* moveUpButton;
wxCheckBox* showCheckBox; wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox; wxCheckBox* rotateCheckBox;
wxRadioBox* m_StyleRadioBox;
wxStaticText* fieldNameLabel; wxStaticText* fieldNameLabel;
wxTextCtrl* fieldNameTextCtrl; wxTextCtrl* fieldNameTextCtrl;
wxStaticText* fieldValueLabel; wxStaticText* fieldValueLabel;
......
/**********************************************/
/* EESchema - symbtext.cpp for Library Editor */
/**********************************************/
/* Menu et routines de creation, modification, suppression de textes
du type symbole
(textes autres que Fields)
*/
#include "fctsys.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "dialog_bodygraphictext_properties_base.h"
#include "protos.h"
class Dialog_BodyGraphicText_Properties : public Dialog_BodyGraphicText_Properties_base
{
private:
WinEDA_LibeditFrame * m_Parent;
LibDrawText * m_GraphicText;
public:
Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText);
~Dialog_BodyGraphicText_Properties() {};
private:
void OnInitDialog( wxInitDialogEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
};
Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText) :
Dialog_BodyGraphicText_Properties_base(aParent)
{
m_Parent = aParent;
m_GraphicText = aGraphicText;
}
/********************************************************************************/
void Dialog_BodyGraphicText_Properties::OnInitDialog( wxInitDialogEvent& event )
/********************************************************************************/
{
wxString msg;
SetFocus();
if ( m_GraphicText )
{
msg = ReturnStringFromValue(g_UnitMetric, m_GraphicText->m_Size.x, m_Parent->m_InternalUnits);
m_TextSize->SetValue(msg);
m_TextValue->SetValue(m_GraphicText->m_Text);
if ( m_GraphicText->m_Unit == 0 ) m_CommonUnit->SetValue(TRUE);
if ( m_GraphicText->m_Convert == 0 ) m_CommonConvert->SetValue(TRUE);
if ( m_GraphicText->m_Orient == TEXT_ORIENT_VERT ) m_Orient->SetValue(TRUE);
int shape = 0;
if ( m_GraphicText->m_Italic)
shape = 1;
if ( m_GraphicText->m_Width > 1)
shape |= 2;
m_TextShapeOpt->SetSelection(shape);
}
else
{
msg = ReturnStringFromValue(g_UnitMetric, g_LastTextSize, m_Parent->m_InternalUnits);
m_TextSize->SetValue(msg);
if ( ! g_FlDrawSpecificUnit ) m_CommonUnit->SetValue(TRUE);
if ( ! g_FlDrawSpecificConvert ) m_CommonConvert->SetValue(TRUE);
if ( g_LastTextOrient == TEXT_ORIENT_VERT ) m_Orient->SetValue(TRUE);
}
msg = m_TextSizeText->GetLabel() + ReturnUnitSymbol();
m_TextSizeText->SetLabel(msg);
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
}
void Dialog_BodyGraphicText_Properties::OnCancelClick( wxCommandEvent& event )
{
event.Skip();
}
/***************************************************************************/
void Dialog_BodyGraphicText_Properties::OnOkClick( wxCommandEvent& event )
/***************************************************************************/
/* Met a jour les differents parametres pour le composant en cours d'edition
*/
{
wxString Line;
Line = m_TextValue->GetValue();
g_LastTextOrient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue();
g_LastTextSize = ReturnValueFromString(g_UnitMetric, msg, m_Parent->m_InternalUnits);
g_FlDrawSpecificConvert = m_CommonConvert->GetValue() ? FALSE : TRUE;
g_FlDrawSpecificUnit = m_CommonUnit->GetValue() ? FALSE : TRUE;
if ( m_GraphicText )
{
if ( ! Line.IsEmpty() ) m_GraphicText->m_Text = Line;
else m_GraphicText->m_Text = wxT("[null]");
m_GraphicText->m_Size.x = m_GraphicText->m_Size.y = g_LastTextSize;
m_GraphicText->m_Orient = g_LastTextOrient;
if( g_FlDrawSpecificUnit ) m_GraphicText->m_Unit = CurrentUnit;
else m_GraphicText->m_Unit = 0;
if( g_FlDrawSpecificConvert ) m_GraphicText->m_Convert = CurrentConvert;
else m_GraphicText->m_Convert = 0;
if ( (m_TextShapeOpt->GetSelection() & 1 ) != 0 )
m_GraphicText->m_Italic = true;
else
m_GraphicText->m_Italic = false;
if ( (m_TextShapeOpt->GetSelection() & 2 ) != 0 )
m_GraphicText->m_Width = m_GraphicText->m_Size.x / 4;
else
m_GraphicText->m_Width = 0;
}
Close();
if ( CurrentDrawItem )
CurrentDrawItem->Display_Infos_DrawEntry(m_Parent);
Close();
}
/*******************************************************/
void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC,
LibEDA_BaseStruct * DrawItem)
/*******************************************************/
{
int DrawMode = g_XorMode;
if ( DrawItem == NULL ) return;
if ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) return;
/* Effacement ancien texte */
if( ((LibDrawText*)DrawItem)->m_Text && DC)
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, DrawMode);
Dialog_BodyGraphicText_Properties * frame =
new Dialog_BodyGraphicText_Properties(this, (LibDrawText *) DrawItem);
frame->ShowModal(); frame->Destroy();
GetScreen()->SetModify();
/* Affichage nouveau texte */
if( ((LibDrawText*)DrawItem)->m_Text && DC)
{
if ( (DrawItem->m_Flags & IS_MOVED) == 0 )
DrawMode = GR_DEFAULT_DRAWMODE;
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, DrawMode);
}
}
/****************************************************/
void WinEDA_LibeditFrame::RotateSymbolText(wxDC * DC)
/****************************************************/
/*
90 deg Graphic text Rotation .
*/
{
LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
if(DrawItem == NULL) return;
/* Erase drawing (can be within a move command) */
if ( DrawPanel->ManageCurseur == NULL)
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, g_XorMode);
else DrawPanel->ManageCurseur(DrawPanel, DC, FALSE);
if( DrawItem->m_Orient == TEXT_ORIENT_HORIZ)
DrawItem->m_Orient = TEXT_ORIENT_VERT;
else DrawItem->m_Orient = TEXT_ORIENT_HORIZ;
GetScreen()->SetModify();
/* Redraw item with new orient */
if ( DrawPanel->ManageCurseur == NULL)
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, GR_DEFAULT_DRAWMODE);
else DrawPanel->ManageCurseur(DrawPanel, DC, FALSE);
}
...@@ -59,7 +59,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) ...@@ -59,7 +59,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
m_CurrentText->m_Italic = 0; m_CurrentText->m_Italic = 0;
if ( ( style & 2 ) ) if ( ( style & 2 ) )
m_CurrentText->m_Width = m_CurrentText->m_Size.x / 5; m_CurrentText->m_Width = m_CurrentText->m_Size.x / 4;
else else
m_CurrentText->m_Width = 0; m_CurrentText->m_Width = 0;
......
...@@ -350,7 +350,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, ...@@ -350,7 +350,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
DrawGraphicText( panel, DC, pos, color, m_Text, DrawGraphicText( panel, DC, pos, color, m_Text,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
m_Size, m_Size,
hjustify, vjustify, LineWidth ); hjustify, vjustify, LineWidth, m_Italic );
} }
else // For more than one part per package, we must add the part selection to the reference ) else // For more than one part per package, we must add the part selection to the reference )
{ {
...@@ -366,7 +366,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, ...@@ -366,7 +366,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
DrawGraphicText( panel, DC, pos, color, fulltext, DrawGraphicText( panel, DC, pos, color, fulltext,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
m_Size, m_Size,
hjustify, vjustify, LineWidth ); hjustify, vjustify, LineWidth, m_Italic );
} }
} }
......
...@@ -610,14 +610,21 @@ LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, ...@@ -610,14 +610,21 @@ LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame,
New = Text; New = Text;
Buffer[0] = 0; Buffer[0] = 0;
Error = sscanf( &Line[2], "%d %d %d %d %d %d %d %s", chartmp[0] = 0; // For italic option, Not in old versions
&Text->m_Horiz, int thickness = 0; // Not in old versions
Error = sscanf( &Line[2], "%d %d %d %d %d %d %d %s %s %d",
&Text->m_Orient,
&Text->m_Pos.x, &Text->m_Pos.y, &Text->m_Pos.x, &Text->m_Pos.y,
&Text->m_Size.x, &Text->m_Type, &Text->m_Size.x, &Text->m_Attributs,
&Unit, &Convert, Buffer ) != 8; &Unit, &Convert, Buffer, chartmp, &thickness ) < 8;
Text->m_Unit = Unit; Text->m_Convert = Convert; Text->m_Unit = Unit; Text->m_Convert = Convert;
Text->m_Size.y = Text->m_Size.x; Text->m_Size.y = Text->m_Size.x;
if ( strnicmp(chartmp, "Italic", 6) == 0 )
Text->m_Italic = true;
Text->m_Width = thickness;
if( !Error ) if( !Error )
{ /* Convert '~' to spaces. */ { /* Convert '~' to spaces. */
Text->m_Text = CONV_FROM_UTF8( Buffer ); Text->m_Text = CONV_FROM_UTF8( Buffer );
...@@ -909,8 +916,8 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry, ...@@ -909,8 +916,8 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry,
line++; line++;
FieldUserName[0] = 0; FieldUserName[0] = 0;
memset( Char4, 0, sizeof(Char4));
nbparam = sscanf( line, " %d %d %d %c %c %c %c", nbparam = sscanf( line, " %d %d %d %c %c %c %s",
&posx, &posy, &size, Char1, Char2, Char3, Char4 ); &posx, &posy, &size, Char1, Char2, Char3, Char4 );
orient = TEXT_ORIENT_HORIZ; orient = TEXT_ORIENT_HORIZ;
...@@ -928,10 +935,15 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry, ...@@ -928,10 +935,15 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry,
hjustify = GR_TEXT_HJUSTIFY_LEFT; hjustify = GR_TEXT_HJUSTIFY_LEFT;
else if( *Char3 == 'R' ) else if( *Char3 == 'R' )
hjustify = GR_TEXT_HJUSTIFY_RIGHT; hjustify = GR_TEXT_HJUSTIFY_RIGHT;
if( *Char4 == 'B' ) if( Char4[0] == 'B' )
vjustify = GR_TEXT_VJUSTIFY_BOTTOM; vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
else if( *Char4 == 'T' ) else if( Char4[0] == 'T' )
vjustify = GR_TEXT_VJUSTIFY_TOP; vjustify = GR_TEXT_VJUSTIFY_TOP;
if ( Char4[1] == 'I' ) // Italic
Field->m_Italic = true;
if ( Char4[2] == 'B' ) // Bold
Field->m_Width = size / 4;
} }
switch( NumOfField ) switch( NumOfField )
......
...@@ -913,7 +913,7 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen, ...@@ -913,7 +913,7 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
ii = 2; ii = 2;
dx = (Text->m_Size.x * ii) / 2; dx = (Text->m_Size.x * ii) / 2;
dy = Text->m_Size.y / 2; dy = Text->m_Size.y / 2;
if( Text->m_Horiz == TEXT_ORIENT_VERT ) if( Text->m_Orient == TEXT_ORIENT_VERT )
{ {
EXCHG( dx, dy ); EXCHG( dx, dy );
} }
......
...@@ -56,6 +56,7 @@ OBJECTS = eeschema.o\ ...@@ -56,6 +56,7 @@ OBJECTS = eeschema.o\
edit_component_in_schematic.o\ edit_component_in_schematic.o\
dialog_edit_component_in_schematic_fbp.o \ dialog_edit_component_in_schematic_fbp.o \
dialog_edit_component_in_schematic.o \ dialog_edit_component_in_schematic.o \
dialog_bodygraphictext_properties_base.o\
locate.o \ locate.o \
save_schemas.o sheet.o \ save_schemas.o sheet.o \
read_from_file_schematic_items_descriptions.o\ read_from_file_schematic_items_descriptions.o\
...@@ -67,7 +68,8 @@ OBJECTS = eeschema.o\ ...@@ -67,7 +68,8 @@ OBJECTS = eeschema.o\
libfield.o \ libfield.o \
edit_component_in_lib.o \ edit_component_in_lib.o \
menubar.o \ menubar.o \
savelib.o symbtext.o \ savelib.o\
edit_graphic_bodyitem_text.o \
symbdraw.o \ symbdraw.o \
hierarch.o files-io.o \ hierarch.o files-io.o \
annotate.o\ annotate.o\
......
...@@ -249,7 +249,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -249,7 +249,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
/* The text orientation may need to be flipped if the /* The text orientation may need to be flipped if the
* transformation matrix causes xy axes to be flipped. */ * transformation matrix causes xy axes to be flipped. */
t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0); t1 = (TransMat[0][0] != 0) ^ (Text->m_Orient != 0);
pos = TransformCoordinate( TransMat, Text->m_Pos ) + DrawLibItem->m_Pos; pos = TransformCoordinate( TransMat, Text->m_Pos ) + DrawLibItem->m_Pos;
SetCurrentLineWidth( -1 ); SetCurrentLineWidth( -1 );
int thickness = Text->m_Width; int thickness = Text->m_Width;
......
...@@ -695,8 +695,8 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, ...@@ -695,8 +695,8 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
{ {
int newNdx = component->GetFieldCount(); int newNdx = component->GetFieldCount();
SCH_CMP_FIELD f( wxPoint( 0, 0 ), newNdx, component, fieldName ); SCH_CMP_FIELD field( wxPoint( 0, 0 ), newNdx, component, fieldName );
component->AddField( f ); component->AddField( field );
} }
} }
else else
...@@ -705,7 +705,7 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, ...@@ -705,7 +705,7 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
} }
component->GetField( fieldNdx )->m_Text = CONV_FROM_UTF8( Name1 ); component->GetField( fieldNdx )->m_Text = CONV_FROM_UTF8( Name1 );
memset(Char3, 0, sizeof(Char3) );
if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1, if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1,
&component->GetField( fieldNdx )->m_Pos.x, &component->GetField( fieldNdx )->m_Pos.x,
&component->GetField( fieldNdx )->m_Pos.y, &component->GetField( fieldNdx )->m_Pos.y,
...@@ -735,10 +735,18 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, ...@@ -735,10 +735,18 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
hjustify = GR_TEXT_HJUSTIFY_LEFT; hjustify = GR_TEXT_HJUSTIFY_LEFT;
else if( *Char2 == 'R' ) else if( *Char2 == 'R' )
hjustify = GR_TEXT_HJUSTIFY_RIGHT; hjustify = GR_TEXT_HJUSTIFY_RIGHT;
if( *Char3 == 'B' ) if( Char3[0] == 'B' )
vjustify = GR_TEXT_VJUSTIFY_BOTTOM; vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
else if( *Char3 == 'T' ) else if( Char3[0] == 'T' )
vjustify = GR_TEXT_VJUSTIFY_TOP; vjustify = GR_TEXT_VJUSTIFY_TOP;
if( Char3[1] == 'I' )
component->GetField( fieldNdx )->m_Italic = true;
else
component->GetField( fieldNdx )->m_Italic = false;
if( Char3[2] == 'B' )
component->GetField( fieldNdx )->m_Width = component->GetField( fieldNdx )->m_Size.x / 4;
else
component->GetField( fieldNdx )->m_Width = 0;
component->GetField( fieldNdx )->m_HJustify = hjustify; component->GetField( fieldNdx )->m_HJustify = hjustify;
component->GetField( fieldNdx )->m_VJustify = vjustify; component->GetField( fieldNdx )->m_VJustify = vjustify;
......
...@@ -68,15 +68,19 @@ bool LibDrawText::Save( FILE* ExportFile ) const ...@@ -68,15 +68,19 @@ bool LibDrawText::Save( FILE* ExportFile ) const
/************************************************/ /************************************************/
{ {
wxString text = m_Text; wxString text = m_Text;
// Spaces are not allowed in text because it is not double quoted: changed to '~'
text.Replace( wxT( " " ), wxT( "~" ) );
text.Replace( wxT( " " ), wxT( "~" ) ); // Spaces are not allowed: changed to '~' fprintf( ExportFile, "T %d %d %d %d %d %d %d %s ",
m_Orient,
fprintf( ExportFile, "T %d %d %d %d %d %d %d %s\n",
m_Horiz,
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Size.x, m_Type, m_Size.x, m_Attributs,
m_Unit, m_Convert, m_Unit, m_Convert,
CONV_TO_UTF8( text ) ); CONV_TO_UTF8( text ));
fprintf( ExportFile, " %s %d", m_Italic ? "Italic" : "Normal", m_Width );
fprintf( ExportFile, "\n");
return true; return true;
} }
...@@ -200,13 +204,15 @@ bool LibDrawField::Save( FILE* ExportFile ) const ...@@ -200,13 +204,15 @@ bool LibDrawField::Save( FILE* ExportFile ) const
vjustify = 'T'; vjustify = 'T';
if( text.IsEmpty() ) if( text.IsEmpty() )
text = wxT( "~" ); text = wxT( "~" );
fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c", fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c%c%c",
m_FieldId, CONV_TO_UTF8( text ), m_FieldId, CONV_TO_UTF8( text ),
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Size.x, m_Size.x,
m_Orient == 0 ? 'H' : 'V', m_Orient == 0 ? 'H' : 'V',
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V', (m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
hjustify, vjustify ); hjustify, vjustify,
m_Italic ? 'I' : 'N',
m_Width > 1 ? 'B' : 'N');
// Save field name, if necessary // Save field name, if necessary
if( m_FieldId >= FIELD1 && !m_Name.IsEmpty() ) if( m_FieldId >= FIELD1 && !m_Name.IsEmpty() )
...@@ -222,7 +228,8 @@ LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame, ...@@ -222,7 +228,8 @@ LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame,
LibEDA_BaseStruct* DrawItem ) LibEDA_BaseStruct* DrawItem )
/**********************************************************/ /**********************************************************/
/* Duplicate a DrawLibItem /** Function CopyDrawEntryStruct
* Duplicate a DrawLibItem
* the new item is only created, it is not put in the current component linked list * the new item is only created, it is not put in the current component linked list
* @param DrawEntry = DrawLibItem * item to duplicate * @param DrawEntry = DrawLibItem * item to duplicate
* @return a pointer to the new item * @return a pointer to the new item
......
...@@ -304,7 +304,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -304,7 +304,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
CurrentDrawItem = Text; CurrentDrawItem = Text;
Text->m_Size.x = Text->m_Size.y = g_LastTextSize; Text->m_Size.x = Text->m_Size.y = g_LastTextSize;
Text->m_Horiz = g_LastTextOrient; Text->m_Orient = g_LastTextOrient;
Text->m_Pos.x = GetScreen()->m_Curseur.x; Text->m_Pos.x = GetScreen()->m_Curseur.x;
Text->m_Pos.y = -( GetScreen()->m_Curseur.y ); Text->m_Pos.y = -( GetScreen()->m_Curseur.y );
EditSymbolText( NULL, Text ); EditSymbolText( NULL, Text );
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////
// Name: symbtext.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 12/02/2006 14:04:59
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 12/02/2006 14:04:59
#ifndef _SYMBTEXT_H_
#define _SYMBTEXT_H_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "symbtext.h"
#endif
/*!
* Includes
*/
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_TEXTCTRL 10001
#define ID_TEXTCTRL1 10002
#define ID_CHECKBOX 10003
#define ID_CHECKBOX1 10004
#define ID_CHECKBOX2 10005
#define SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_TITLE _("Graphic text properties")
#define SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* WinEDA_bodytext_PropertiesFrame class declaration
*/
class WinEDA_bodytext_PropertiesFrame: public wxDialog
{
DECLARE_DYNAMIC_CLASS( WinEDA_bodytext_PropertiesFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_bodytext_PropertiesFrame( );
WinEDA_bodytext_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_BODYTEXT_PROPERTIESFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_bodytext_PropertiesFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
////@end WinEDA_bodytext_PropertiesFrame event handler declarations
////@begin WinEDA_bodytext_PropertiesFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_bodytext_PropertiesFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
void bodytext_PropertiesAccept(wxCommandEvent& event);
////@begin WinEDA_bodytext_PropertiesFrame member variables
wxTextCtrl* m_NewText;
wxStaticText* m_SizeText;
wxTextCtrl* m_Size;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxCheckBox* m_Orient;
wxButton* m_btClose;
////@end WinEDA_bodytext_PropertiesFrame member variables
WinEDA_LibeditFrame * m_Parent;
};
#endif
// _SYMBTEXT_H_
This diff is collapsed.
#include "wx/msw/wx.rc"
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