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
} }
......
This diff is collapsed.
...@@ -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