some enhancements in pcbnew (see changelog) and Cmake files updated to handle a change in doc files

This commit is contained in:
charras 2009-05-01 16:46:56 +00:00
parent 5114b863e5
commit ac45264b4e
10 changed files with 532 additions and 188 deletions

View File

@ -4,6 +4,13 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-may-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew:
Better dialog options for zones on technical layers.
Zones on silk screen filled with segments are now plotted
Better support of multiline texts (work in progress)
2009-apr-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ Eeschema:

View File

@ -171,7 +171,7 @@ EDA_TextStruct::EDA_TextStruct( const wxString& text )
m_Orient = 0; /* Orient in 0.1 degrees */
m_Attributs = 0;
m_Mirror = false; // display mirror if true
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Justifications Horiz et Vert du texte */
m_Width = 0; /* thickness */
m_Italic = false; /* true = italic shape */
@ -267,6 +267,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
/***************************************************************/
/** Function Draw
* Draws this, that can be a multiline text
* @param aPanel = the current DrawPanel
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
@ -279,11 +280,18 @@ 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 );
RotatePoint( &offset, m_Orient );
if( m_Mirror )
offset.x = -offset.x;
for( unsigned i = 0; i<list->Count(); i++ )
{
wxString txt = list->Item( i );
wxSize size = DrawOneLine( aPanel,
DrawOneLineOfText( aPanel,
aDC,
aOffset,
aColor,
@ -292,18 +300,31 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
aAnchor_color,
txt,
pos );
pos.y += 1.5 * (size.y);
pos += offset;
}
delete (list);
}
wxSize EDA_TextStruct::DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC,
/** Function DrawOneLineOfText
* Draw a single text line.
* Used to draw each line of this EDA_TextStruct, that can be multiline
* @param aPanel = the current DrawPanel
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aDisplayMode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
* @param EDA_Colors aText = the single line of text to draw.
* @param EDA_Colors aPos = the position of this line ).
*/
void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode,
GRFillMode aDisplayMode, EDA_Colors aAnchor_color,
wxString txt, wxPoint pos )
wxString& aText, wxPoint aPos )
{
int width = m_Width;
@ -319,8 +340,8 @@ wxSize EDA_TextStruct::DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC,
int anchor_size = aPanel->GetScreen()->Unscale( 2 );
aAnchor_color = (EDA_Colors) (aAnchor_color & MASKCOLOR);
int cX = pos.x + aOffset.x;
int cY = pos.y + aOffset.y;
int cX = aPos.x + aOffset.x;
int cY = aPos.y + aOffset.y;
GRLine( &aPanel->m_ClipBox, aDC, cX - anchor_size, cY,
cX + anchor_size, cY, 0, aAnchor_color );
@ -339,10 +360,9 @@ wxSize EDA_TextStruct::DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC,
DrawGraphicText( aPanel, aDC,
aOffset + pos, aColor, txt,
aOffset + aPos, aColor, aText,
m_Orient, size,
m_HJustify, m_VJustify, width, m_Italic );
return size;
}

View File

@ -527,10 +527,26 @@ public:
int aDisplayMode, GRFillMode aDisplay_mode = FILAIRE,
EDA_Colors aAnchor_color = UNSPECIFIED_COLOR );
wxSize DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC,
private:
/** Function DrawOneLineOfText
* Draw a single text line.
* Used to draw each line of this EDA_TextStruct, that can be multiline
* @param aPanel = the current DrawPanel
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aDisplayMode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
* @param EDA_Colors aText = the single line of text to draw.
* @param EDA_Colors aPos = the position of this line ).
*/
void DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDisplayMode, GRFillMode aDisplay_mode = FILAIRE,
EDA_Colors aAnchor_color = UNSPECIFIED_COLOR, wxString txt=wxString(),wxPoint pos=wxPoint(0,0) );
int aDisplayMode, GRFillMode aDisplay_mode,
EDA_Colors aAnchor_color, wxString& aText,
wxPoint aPos );
public:
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.

View File

@ -51,48 +51,80 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
/****************************************************************/
int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
/****************************************************************/
/** Function ReadTextePcbDescr
* Read a pcb text description
* The format is like:
* $TEXTPCB
* Te "Text example"
* Po 66750 53450 600 800 150 0
* De 24 1 0 Italic
* $EndTEXTPCB
* for a single line text
*
* or
*
* $TEXTPCB
* Te "Text example"
* nl "ligne 2"
* Po 66750 53450 600 800 150 0
* De 24 1 0 Italic
* $EndTEXTPCB
* for a multi line text
* nl "ligne nn" is a line added to the current text
*/
{
char text[1024], Line[1024];
char style[256];
char style[256];
while( GetLine( File, Line, LineNum ) != NULL )
{
if( strnicmp( Line, "$EndTEXTPCB", 11 ) == 0 )
return 0;
if( strncmp( Line, "Te", 2 ) == 0 ) /* Texte */
if( strncmp( Line, "Te", 2 ) == 0 ) /* Text line (first line for multi line texts */
{
ReadDelimitedText( text, Line + 2, sizeof(text) );
m_Text = CONV_FROM_UTF8( text );
continue;
}
if( strncmp( Line, "nl", 2 ) == 0 ) /* next line of the current text */
{
ReadDelimitedText( text, Line + 2, sizeof(text) );
m_Text.Append( '\n' );
m_Text += CONV_FROM_UTF8( text );
continue;
}
if( strncmp( Line, "Po", 2 ) == 0 )
{
sscanf( Line + 2, " %d %d %d %d %d %d",
&m_Pos.x, &m_Pos.y, &m_Size.x, &m_Size.y,
&m_Width, &m_Orient );
// Ensure the text has minimal size to see this text on screen:
if ( m_Size.x < 5 ) m_Size.x = 5;
if ( m_Size.y < 5 ) m_Size.y = 5;
if( m_Size.x < 5 )
m_Size.x = 5;
if( m_Size.y < 5 )
m_Size.y = 5;
continue;
}
if( strncmp( Line, "De", 2 ) == 0 )
{
style[0] = 0;
int normal_display = 1;
style[0] = 0;
int normal_display = 1;
sscanf( Line + 2, " %d %d %lX %s\n", &m_Layer, &normal_display,
&m_TimeStamp, style );
m_Mirror = normal_display ? false : true;
m_Mirror = normal_display ? false : true;
if( m_Layer < FIRST_COPPER_LAYER )
m_Layer = FIRST_COPPER_LAYER;
if( m_Layer > LAST_NO_COPPER_LAYER )
m_Layer = LAST_NO_COPPER_LAYER;
if ( strnicmp( style, "Italic", 6) == 0 )
m_Italic = 1;
else
m_Italic = 0;
if( strnicmp( style, "Italic", 6 ) == 0 )
m_Italic = 1;
else
m_Italic = 0;
continue;
}
}
@ -111,30 +143,36 @@ bool TEXTE_PCB::Save( FILE* aFile ) const
if( m_Text.IsEmpty() )
return true;
bool rc = false;
const char * style = m_Italic ? "Italic" : "Normal";
if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n") - 1 )
return false;
if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n")-1 )
goto out;
bool rc = false;
const char* style = m_Italic ? "Italic" : "Normal";
wxArrayString* list = wxStringSplit( m_Text, '\n' );
for( unsigned ii = 0; ii < list->Count(); ii++ )
{
wxString txt = list->Item( ii );
if ( ii == 0 )
fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( txt ) );
else
fprintf( aFile, "nl \"%s\"\n", CONV_TO_UTF8( txt ) );
}
delete (list);
fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( m_Text ) );
fprintf( aFile, "Po %d %d %d %d %d %d\n",
m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Width, m_Orient );
fprintf( aFile, "De %d %d %lX %s\n", m_Layer,
m_Mirror ? 0 : 1,
m_TimeStamp, style );
m_Mirror ? 0 : 1,
m_TimeStamp, style );
if( fprintf( aFile, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n")-1 )
goto out;
if( fprintf( aFile, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n") - 1 )
return false;
rc = true;
out:
return rc;
return true;
}
/**********************************************************************/
void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int DrawMode, const wxPoint& offset )
@ -149,20 +187,26 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( color & ITEM_NOT_SHOW )
return;
EDA_TextStruct::Draw( panel, DC, offset, (EDA_Colors) color,
DrawMode, (GRFillMode)DisplayOpt.DisplayDrawItems,
(g_AnchorColor & ITEM_NOT_SHOW) ? UNSPECIFIED_COLOR : (EDA_Colors)g_AnchorColor );
EDA_TextStruct::Draw(
panel,
DC,
offset,
(EDA_Colors) color,
DrawMode,
(GRFillMode) DisplayOpt.DisplayDrawItems,
(g_AnchorColor &
ITEM_NOT_SHOW) ? UNSPECIFIED_COLOR : (EDA_Colors) g_AnchorColor );
}
// see class_pcb_text.h
void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame )
{
wxString msg;
wxString msg;
BOARD* board;
BOARD_ITEM* parent = (BOARD_ITEM*) m_Parent;
wxASSERT( parent );
if( parent->Type() == TYPE_COTATION )
@ -183,7 +227,7 @@ void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame )
g_DesignSettings.m_LayerColor[m_Layer] & MASKCOLOR );
Affiche_1_Parametre( frame, 36, _( "Mirror" ), wxEmptyString, GREEN );
if( ! m_Mirror )
if( !m_Mirror )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
@ -215,9 +259,10 @@ void TEXTE_PCB::Show( int nestLevel, std::ostream& os )
{
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" string=\"" << m_Text.mb_str() << "\"/>\n";
" string=\"" << m_Text.mb_str() << "\"/>\n";
// NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif

View File

@ -49,8 +49,6 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
{
BOARD* board = m_Parent->GetBoard();
SetFont( *g_DialogFont );
SetFocus(); // Required under wxGTK if we want to demiss the dialog with the ESC key
wxString msg;

View File

@ -10,7 +10,6 @@
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, wxDialog )
EVT_INIT_DIALOG( DialogNonCopperZonesPropertiesBase::_wxFB_InitDialog )
EVT_BUTTON( wxID_OK, DialogNonCopperZonesPropertiesBase::_wxFB_OnOkClick )
EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick )
END_EVENT_TABLE()
@ -25,17 +24,40 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
wxBoxSizer* m_UpperSizer;
m_UpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxRadioBox( this, wxID_ANY, _("Outlines Appearence"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_OutlineAppearanceCtrl->SetSelection( 1 );
m_UpperSizer->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxStaticBoxSizer* sbLeftSizer_;
sbLeftSizer_ = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Zone Fill Options:") ), wxVERTICAL );
wxString m_FillModeCtrlChoices[] = { _("Use polygons"), _("Use segments") };
int m_FillModeCtrlNChoices = sizeof( m_FillModeCtrlChoices ) / sizeof( wxString );
m_FillModeCtrl = new wxRadioBox( this, wxID_ANY, _("Filling Mode:"), wxDefaultPosition, wxDefaultSize, m_FillModeCtrlNChoices, m_FillModeCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FillModeCtrl->SetSelection( 0 );
sbLeftSizer_->Add( m_FillModeCtrl, 0, wxALL|wxEXPAND, 5 );
m_MinThicknessValueTitle = new wxStaticText( this, wxID_ANY, _("Zone min thickness value"), wxDefaultPosition, wxDefaultSize, 0 );
m_MinThicknessValueTitle->Wrap( -1 );
sbLeftSizer_->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbLeftSizer_->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_UpperSizer->Add( sbLeftSizer_, 0, 0, 5 );
wxStaticBoxSizer* m_OutilinesBoxOpt;
m_OutilinesBoxOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outlines Options:") ), wxVERTICAL );
wxString m_OrientEdgesOptChoices[] = { _("Any"), _("H, V and 45 deg") };
int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString );
m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone Edges Orient"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS );
m_OrientEdgesOpt->SetSelection( 0 );
m_UpperSizer->Add( m_OrientEdgesOpt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxRadioBox( this, wxID_ANY, _("Outlines Appearence"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_OutlineAppearanceCtrl->SetSelection( 1 );
m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_UpperSizer->Add( m_OutilinesBoxOpt, 0, 0, 5 );
wxBoxSizer* m_ButtonsSizer;
m_ButtonsSizer = new wxBoxSizer( wxVERTICAL );

View File

@ -32,7 +32,7 @@
<property name="minimum_size"></property>
<property name="name">DialogNonCopperZonesPropertiesBase</property>
<property name="pos"></property>
<property name="size">366,221</property>
<property name="size">416,287</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Non Copper Zones Properties</property>
@ -49,7 +49,7 @@
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog">InitDialog</event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
@ -86,110 +86,298 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Line&quot; &quot;Hatched Outline&quot; &quot;Full Hatched&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>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Outlines Appearence</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="label">Zone Fill Options:</property>
<property name="minimum_size"></property>
<property name="name">m_OutlineAppearanceCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">1</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>
<property name="name">sbLeftSizer_</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Use polygons&quot; &quot;Use segments&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">Filling Mode:</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_FillModeCtrl</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 class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></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">Zone min thickness value</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_MinThicknessValueTitle</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></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>
<property name="wrap">-1</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="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 class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></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="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_ZoneMinThicknessCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="value"></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="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Any&quot; &quot;H, V and 45 deg&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>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Zone Edges Orient</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="label">Outlines Options:</property>
<property name="minimum_size"></property>
<property name="name">m_OrientEdgesOpt</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>
<property name="name">m_OutilinesBoxOpt</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Any&quot; &quot;H, V and 45 deg&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">Zone Edges Orient</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_OrientEdgesOpt</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 class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Line&quot; &quot;Hatched Outline&quot; &quot;Full Hatched&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">Outlines Appearence</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_OutlineAppearanceCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">1</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">

View File

@ -16,9 +16,11 @@
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/listbox.h>
#include <wx/dialog.h>
@ -33,27 +35,28 @@ class DialogNonCopperZonesPropertiesBase : public wxDialog
private:
// Private event handlers
void _wxFB_InitDialog( wxInitDialogEvent& event ){ InitDialog( event ); }
void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); }
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
protected:
wxRadioBox* m_OutlineAppearanceCtrl;
wxRadioBox* m_FillModeCtrl;
wxStaticText* m_MinThicknessValueTitle;
wxTextCtrl* m_ZoneMinThicknessCtrl;
wxRadioBox* m_OrientEdgesOpt;
wxRadioBox* m_OutlineAppearanceCtrl;
wxButton* m_buttonOk;
wxButton* m_buttonCancel;
wxStaticText* m_staticTextLayerSelection;
wxListBox* m_LayerSelectionCtrl;
// Virtual event handlers, overide them in your derived class
virtual void InitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public:
DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 366,221 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER );
DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 416,287 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER );
~DialogNonCopperZonesPropertiesBase();
};

View File

@ -196,7 +196,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
trace_val = Sel_Texte_Valeur;
trace_ref = Sel_Texte_Reference; // les 2 autorisations de tracer sont donnees
TEXTE_MODULE* text = Module->m_Reference;
TEXTE_MODULE* text = Module->m_Reference;
unsigned textLayer = text->GetLayer();
if( textLayer >= 32 )
@ -216,7 +216,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
if( text->m_NoShow && !Sel_Texte_Invisible )
trace_ref = FALSE;
text = Module->m_Value;
text = Module->m_Value;
textLayer = text->GetLayer();
if( textLayer > 32 )
@ -287,6 +287,28 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
PlotFilledAreas( edge_zone, format_plot );
}
// Plot segments used to fill zone areas:
for( SEGZONE* seg = m_Pcb->m_Zone; seg != NULL; seg = seg->Next() )
{
if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 )
continue;
switch( format_plot )
{
case PLOT_FORMAT_GERBER:
SelectD_CODE_For_LineDraw( seg->m_Width );
PlotGERBERLine( seg->m_Start, seg->m_End, seg->m_Width );
break;
case PLOT_FORMAT_HPGL:
Plot_Filled_Segment_HPGL( seg->m_Start, seg->m_End, seg->m_Width, FILLED );
break;
case PLOT_FORMAT_POST:
PlotFilledSegmentPS( seg->m_Start, seg->m_End, seg->m_Width );
break;
}
}
exit:
;
}
@ -497,7 +519,7 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
break;
case PLOT_FORMAT_HPGL:
Plot_Filled_Segment_HPGL( pos, end, thickness, (GRFillMode)g_Plot_Mode );
Plot_Filled_Segment_HPGL( pos, end, thickness, (GRFillMode) g_Plot_Mode );
break;
case PLOT_FORMAT_POST:
@ -508,12 +530,12 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
break; /* Fin trace segment simple */
case S_CIRCLE:
radius = (int) hypot( (double) (end.x - pos.x), (double) (end.y - pos.y) );
radius = (int) hypot( (double) ( end.x - pos.x ), (double) ( end.y - pos.y ) );
PlotCircle( format_plot, thickness, pos, radius );
break;
case S_ARC:
radius = (int) hypot( (double) (end.x - pos.x), (double) (end.y - pos.y) );
radius = (int) hypot( (double) ( end.x - pos.x ), (double) ( end.y - pos.y ) );
StAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
EndAngle = StAngle + PtEdge->m_Angle;
if( StAngle > EndAngle )
@ -556,7 +578,7 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
PlotFilledPolygon( format_plot, PtEdge->m_PolyPoints.size(), ptr_base );
free( ptr_base );
}
break;
break;
}
}
@ -626,13 +648,13 @@ void PlotFilledAreas( ZONE_CONTAINER* aZone, int aFormat )
if( CornersBuffer == NULL )
{
CornersBufferSize = imax * 4;
CornersBuffer = (int*) MyMalloc( CornersBufferSize * sizeof(int) );
CornersBuffer = (int*) MyMalloc( CornersBufferSize * sizeof(int) );
}
if( (imax * 4) > CornersBufferSize )
{
CornersBufferSize = imax * 4;
CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) );
CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) );
}
imax--;
@ -692,12 +714,12 @@ void PlotDrawSegment( DRAWSEGMENT* pt_segm, int Format, int masque_layer )
if( pt_segm->m_Shape == S_CIRCLE )
{
radius = (int) hypot( (double) (end.x - start.x), (double) (end.y - start.y) );
radius = (int) hypot( (double) ( end.x - start.x ), (double) ( end.y - start.y ) );
}
if( pt_segm->m_Shape == S_ARC )
{
radius = (int) hypot( (double) (end.x - start.x), (double) (end.y - start.y) );
radius = (int) hypot( (double) ( end.x - start.x ), (double) ( end.y - start.y ) );
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
EndAngle = StAngle + pt_segm->m_Angle;
if( StAngle > EndAngle )
@ -723,7 +745,7 @@ void PlotDrawSegment( DRAWSEGMENT* pt_segm, int Format, int masque_layer )
else if( pt_segm->m_Shape == S_ARC )
PlotArc( PLOT_FORMAT_HPGL, start, StAngle, EndAngle, radius, thickness );
else
Plot_Filled_Segment_HPGL( start, end, thickness, (GRFillMode)g_Plot_Mode );
Plot_Filled_Segment_HPGL( start, end, thickness, (GRFillMode) g_Plot_Mode );
break;
case PLOT_FORMAT_POST:
@ -815,13 +837,13 @@ void PlotPolygon( int format_plot, int nbpoints, int* coord, int width )
for( int ii = 1; ii < nbpoints; ii++ )
{
end.x = *coord++;
end.y = *coord++;
Plot_Filled_Segment_HPGL( start, end, width, (GRFillMode)g_Plot_Mode );
end.y = *coord++;
Plot_Filled_Segment_HPGL( start, end, width, (GRFillMode) g_Plot_Mode );
start = end;
}
}
}
break;
break;
case PLOT_FORMAT_POST:
PlotPolyPS( nbpoints, coord, false, width );
@ -890,9 +912,9 @@ void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle,
break;
case PLOT_FORMAT_HPGL:
Plot_Filled_Segment_HPGL( wxPoint(centre.x + ox, centre.y + oy),
wxPoint(centre.x + fx, centre.y + fy),
thickness, (GRFillMode)g_Plot_Mode );
Plot_Filled_Segment_HPGL( wxPoint( centre.x + ox, centre.y + oy ),
wxPoint( centre.x + fx, centre.y + fy ),
thickness, (GRFillMode) g_Plot_Mode );
break;
case PLOT_FORMAT_POST:
@ -916,9 +938,9 @@ void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle,
break;
case PLOT_FORMAT_HPGL:
Plot_Filled_Segment_HPGL( wxPoint(centre.x + ox, centre.y + oy),
wxPoint(centre.x + fx, centre.y + fy),
thickness, (GRFillMode)g_Plot_Mode );
Plot_Filled_Segment_HPGL( wxPoint( centre.x + ox, centre.y + oy ),
wxPoint( centre.x + fx, centre.y + fy ),
thickness, (GRFillMode) g_Plot_Mode );
break;
case PLOT_FORMAT_POST:

View File

@ -23,28 +23,34 @@ class DialogNonCopperZonesEditor : public DialogNonCopperZonesPropertiesBase
private:
WinEDA_PcbFrame* m_Parent;
ZONE_CONTAINER* m_Zone_Container;
ZONE_SETTING* m_Zone_Setting;
private:
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void InitDialog( wxInitDialogEvent& event );
void Init();
public:
DialogNonCopperZonesEditor( WinEDA_PcbFrame* parent,
ZONE_CONTAINER* zone_container );
ZONE_CONTAINER* zone_container,
ZONE_SETTING* zone_setting );
~DialogNonCopperZonesEditor();
};
/*******************************************************************************************/
DialogNonCopperZonesEditor::DialogNonCopperZonesEditor( WinEDA_PcbFrame* parent,
ZONE_CONTAINER* zone_container ) :
ZONE_CONTAINER* zone_container,
ZONE_SETTING* zone_setting ) :
DialogNonCopperZonesPropertiesBase( parent )
/*******************************************************************************************/
{
m_Parent = parent;
m_Zone_Container = zone_container;
SetFont( *g_DialogFont );
m_Zone_Setting = zone_setting;
Init();
/* the size of some items has changed, so we must call SetSizeHints() */
GetSizer()->SetSizeHints( this );
}
@ -54,24 +60,32 @@ DialogNonCopperZonesEditor::~DialogNonCopperZonesEditor()
{
}
/* install function for DialogNonCopperZonesEditor dialog frame :*/
bool InstallDialogNonCopperZonesEditor(WinEDA_PcbFrame* aParent, ZONE_CONTAINER* aZone)
bool InstallDialogNonCopperZonesEditor( WinEDA_PcbFrame* aParent, ZONE_CONTAINER* aZone )
{
DialogNonCopperZonesEditor* frame = new DialogNonCopperZonesEditor( aParent, aZone );
bool diag = frame->ShowModal();
frame->Destroy();
DialogNonCopperZonesEditor frame( aParent, aZone, &g_Zone_Default_Setting );
bool diag = frame.ShowModal();
return diag;
}
/********************************************************************/
void DialogNonCopperZonesEditor::InitDialog( wxInitDialogEvent& event )
void DialogNonCopperZonesEditor::Init()
/********************************************************************/
{
SetFocus();
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
m_FillModeCtrl->SetSelection( m_Zone_Setting->m_FillMode ? 1 : 0 );
AddUnitSymbol( *m_MinThicknessValueTitle, g_UnitMetric );
wxString msg = ReturnStringFromValue( g_UnitMetric,
m_Zone_Setting->m_ZoneMinThickness,
m_Parent->m_InternalUnits );
m_ZoneMinThicknessCtrl->SetValue( msg );
if( g_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
@ -106,13 +120,10 @@ void DialogNonCopperZonesEditor::InitDialog( wxInitDialogEvent& event )
}
else
{
if( ( (PCB_SCREEN*) ( m_Parent->GetScreen() ) )->m_Active_Layer == layer_number )
if( ( (PCB_SCREEN*)( m_Parent->GetScreen() ) )->m_Active_Layer == layer_number )
m_LayerSelectionCtrl->SetSelection( ii );
}
}
/* the size of m_LayerSelectionCtrl has changed, so we must recall SetSizeHints() */
GetSizer()->SetSizeHints(this);
}
@ -120,6 +131,19 @@ void DialogNonCopperZonesEditor::InitDialog( wxInitDialogEvent& event )
void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
/******************************************************************/
{
wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness =
ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits );
if( m_Zone_Setting->m_ZoneMinThickness < 10 )
{
DisplayError( this,
_(
"Error :\nyou must choose a copper min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) );
return;
}
m_Zone_Setting->m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1;
switch( m_OutlineAppearanceCtrl->GetSelection() )
{
case 0:
@ -138,7 +162,7 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
if( wxGetApp().m_EDA_Config )
{
wxGetApp().m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) g_Zone_Default_Setting.m_Zone_HatchingStyle );
(long) g_Zone_Default_Setting.m_Zone_HatchingStyle );
}
if( m_OrientEdgesOpt->GetSelection() == 0 )
@ -164,4 +188,3 @@ void DialogNonCopperZonesEditor::OnCancelClick( wxCommandEvent& event )
{
EndModal( ZONE_ABORT );
}