Commit fdb18547 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: fix bug 676532. Minor enhancements.

parent 67b14484
......@@ -463,6 +463,27 @@ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
m_HJustify, m_VJustify, width, m_Italic, m_Bold );
}
/**
* Function GetStyleName
* @return a wwString withe the style name( Normal, Italic, Bold, Bold+Italic)
*/
wxString EDA_TextStruct::GetTextStyleName()
{
int style = 0;
if( m_Italic )
style = 1;
if( m_Bold )
style += 2;
wxString stylemsg[4] = {
_("Normal"),
_("Italic"),
_("Bold"),
_("Bold+Italic")
};
return stylemsg[style];
}
/******************/
/* Class EDA_Rect */
......@@ -666,3 +687,23 @@ void EDA_Rect::Merge( const EDA_Rect& aRect )
end.y = MAX( end.y, rect_end.y );
SetEnd( end );
}
/**
* Function Merge
* modifies Position and Size of this in order to contain the given point
* mainly used to calculate bounding boxes
* @param aPoint = given point to merge with this
*/
void EDA_Rect::Merge( const wxPoint& aPoint )
{
Normalize(); // ensure width and height >= 0
wxPoint end = GetEnd();
// Change origin and size in order to contain the given rect
m_Pos.x = MIN( m_Pos.x, aPoint.x );
m_Pos.y = MIN( m_Pos.y, aPoint.y );
end.x = MAX( end.x, aPoint.x );
end.y = MAX( end.y, aPoint.y );
SetEnd( end );
}
......@@ -56,8 +56,8 @@ set(EESCHEMA_SRCS
dialog_libedit_dimensions_base.cpp
dialog_lib_edit_draw_item.cpp
dialog_lib_edit_draw_item_base.cpp
dialog_lib_edit_pin.cpp
dialog_lib_edit_pin_base.cpp
dialogs/dialog_lib_edit_pin.cpp
dialogs/dialog_lib_edit_pin_base.cpp
dialog_lib_new_component.cpp
dialog_lib_new_component_base.cpp
dialogs/dialog_print_using_printer_base.cpp
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,10 @@
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_LIB_EDIT_PIN_BASE, wxDialog )
EVT_CHECKBOX( wxID_ANY, DIALOG_LIB_EDIT_PIN_BASE::_wxFB_OnCBpartSelection )
END_EVENT_TABLE()
DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_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 );
......@@ -101,10 +105,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 0, wxEXPAND, 3 );
......@@ -120,10 +124,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
mainSizer->Add( fgSizer1, 0, wxALL|wxEXPAND, 12 );
......@@ -131,16 +135,13 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
boarderSizer = new wxBoxSizer( wxVERTICAL );
m_checkApplyToAllParts = new wxCheckBox( this, wxID_ANY, _("Add to all &parts in package"), wxDefaultPosition, wxDefaultSize, 0 );
boarderSizer->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Add to all alternate &body styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
boarderSizer->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_checkShow = new wxCheckBox( this, wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShow->SetValue(true);
boarderSizer->Add( m_checkShow, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -32,8 +32,13 @@ class wxBitmapComboBox;
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnCBpartSelection( wxCommandEvent& event ){ OnCBpartSelection( event ); }
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_textName;
......@@ -72,7 +77,12 @@ class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCBpartSelection( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_EDIT_PIN_BASE();
......
......@@ -232,6 +232,11 @@ public:
return EDA_BaseStruct::GetBoundingBox();
}
/**
* Displays basic info (type, part and convert) about item
* in msg panel
* @param aFrame = main frame where the message manel info is.
*/
virtual void DisplayInfo( WinEDA_DrawFrame* aFrame );
/**
......
......@@ -298,6 +298,9 @@ void LIB_FIELD::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint&
int color;
int linewidth = GetPenSize();
if( m_Bold )
linewidth = GetPenSizeForBold( m_Size.x );
else
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( ( m_Attributs & TEXT_NO_VISIBLE ) && ( aColor < 0 ) )
......@@ -339,8 +342,7 @@ void LIB_FIELD::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint&
EDA_Rect bBox = GetBoundingBox();
m_Text = tmp;
bBox.Inflate( 1, 1 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
GRRect( &aPanel->m_ClipBox, aDC, bBox, 0, LIGHTMAGENTA );
#endif
}
......@@ -703,3 +705,28 @@ void LIB_FIELD::calcEdit( const wxPoint& aPosition )
Move( m_initialPos + aPosition - m_initialCursorPos );
}
}
void LIB_FIELD::DisplayInfo( WinEDA_DrawFrame* aFrame )
{
wxString msg;
LIB_DRAW_ITEM::DisplayInfo( aFrame );
// Display style:
msg = GetTextStyleName();
aFrame->AppendMsgPanel( _( "Style" ), msg, MAGENTA );
msg = ReturnStringFromValue( g_UserUnit, m_Size.x, EESCHEMA_INTERNAL_UNIT, true );
aFrame->AppendMsgPanel( _( "Size X" ), msg, BLUE );
msg = ReturnStringFromValue( g_UserUnit, m_Size.y, EESCHEMA_INTERNAL_UNIT, true );
aFrame->AppendMsgPanel( _( "Size Y" ), msg, BLUE );
// Display field name (ref, value ...)
msg = GetName();
aFrame->AppendMsgPanel( _( "Field" ), msg, BROWN );
// Display field text:
aFrame->AppendMsgPanel( _( "Value" ), m_Text, BROWN );
}
......@@ -107,6 +107,13 @@ public:
*/
virtual EDA_Rect GetBoundingBox();
/**
* Displays info (type, part convert filed name and value)
* in msg panel
* @param aFrame = main frame where the message manel info is.
*/
virtual void DisplayInfo( WinEDA_DrawFrame* aFrame );
/**
* Test if the given point is within the bounds of this object.
*
......
......@@ -58,6 +58,7 @@ SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy()
newitem->SetEdge( GetEdge() );
newitem->m_Shape = m_Shape;
newitem->m_Size = m_Size;
newitem->SetNumber( GetNumber() );
return newitem;
}
......
......@@ -243,6 +243,14 @@ public:
* @param aRect = given rect to merge with this
*/
void Merge( const EDA_Rect& aRect );
/**
* Function Merge
* Modify Position and Size of this in order to contain the given point
* mainly used to calculate bounding boxes
* @param aPoint = given point to merge with this
*/
void Merge( const wxPoint& aPoint );
};
......@@ -676,6 +684,12 @@ public:
{
return (( m_Size.y * 14 ) / 10) + m_Width;
}
/**
* Function GetTextStyleName
* @return a wwString withe the style name( Normal, Italic, Bold, Bold+Italic)
*/
wxString GetTextStyleName();
};
#endif /* BASE_STRUCT_H */
......@@ -155,7 +155,7 @@ int CPolyLine::NormalizeWithKbool( std::vector<CPolyLine*> * aExtraPolyList, boo
{
// find the polygon that contains this hole
// testing one corner inside is enought because a hole is entirely inside the polygon
// sowe test only the first corner
// so we test only the first corner
int x = (*hole)[0];
int y = (*hole)[1];
if( TestPointInside( x, y ) )
......@@ -1196,8 +1196,9 @@ void CPolyLine::Hatch()
int layer = GetLayer();
if( GetClosed() ) // If not closed, the poly is beeing created and not finalised. Not not hatch
{
if( !GetClosed() ) // If not closed, the poly is beeing created and not finalised. Not not hatch
return;
enum {
MAXPTS = 100
};
......@@ -1302,9 +1303,9 @@ void CPolyLine::Hatch()
} while( npts % 2 != 0 && nloops < 3 );
/* DICK 1/22/08: this was firing repeatedly on me, needed to comment out to get
* my work done:
* wxASSERT( npts%2==0 ); // odd number of intersection points, error
*/
* my work done:
* wxASSERT( npts%2==0 ); // odd number of intersection points, error
*/
// sort points in order of descending x (if more than 2)
if( npts>2 )
......@@ -1357,9 +1358,6 @@ void CPolyLine::Hatch()
}
}
}
// end for
}
}
......
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