Commit 53870013 authored by stambaughw's avatar stambaughw

Replace component library editor draw item dialog box.

* Created new component library editor draw item dialog box with
  wxFormBuilder.
* Removed previous DialogBlocks version of the draw item dialog box.
* Removed some additional global variables used in component library
  editor.
* Add IsFillable() method to draw item base object.
parent b9c40ba9
...@@ -42,7 +42,6 @@ set(EESCHEMA_SRCS ...@@ -42,7 +42,6 @@ set(EESCHEMA_SRCS
dialog_bodygraphictext_properties_base.cpp dialog_bodygraphictext_properties_base.cpp
dialog_build_BOM.cpp dialog_build_BOM.cpp
dialog_build_BOM_base.cpp dialog_build_BOM_base.cpp
# dialog_cmp_graphic_properties.cpp
dialog_edit_component_in_lib.cpp dialog_edit_component_in_lib.cpp
dialog_edit_component_in_lib_base.cpp dialog_edit_component_in_lib_base.cpp
dialog_edit_component_in_schematic_fbp.cpp dialog_edit_component_in_schematic_fbp.cpp
...@@ -56,6 +55,8 @@ set(EESCHEMA_SRCS ...@@ -56,6 +55,8 @@ set(EESCHEMA_SRCS
dialog_erc.cpp dialog_erc.cpp
dialog_erc_base.cpp dialog_erc_base.cpp
# dialog_find.cpp # dialog_find.cpp
dialog_lib_edit_draw_item.cpp
dialog_lib_edit_draw_item_base.cpp
dialog_lib_new_component.cpp dialog_lib_new_component.cpp
dialog_lib_new_component_base.cpp dialog_lib_new_component_base.cpp
dialog_options.cpp dialog_options.cpp
......
...@@ -43,17 +43,17 @@ ...@@ -43,17 +43,17 @@
LIB_FIELD::LIB_FIELD(LIB_COMPONENT * aParent, int idfield ) : LIB_FIELD::LIB_FIELD(LIB_COMPONENT * aParent, int idfield ) :
LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, aParent )
{ {
m_FieldId = idfield; Init( idfield );
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
} }
LIB_FIELD::LIB_FIELD( int idfield ) : LIB_FIELD::LIB_FIELD( int idfield ) :
LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, NULL ) LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, NULL )
{ {
m_FieldId = idfield; Init( idfield );
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
} }
LIB_FIELD::LIB_FIELD( const LIB_FIELD& field ) : LIB_DRAW_ITEM( field ) LIB_FIELD::LIB_FIELD( const LIB_FIELD& field ) : LIB_DRAW_ITEM( field )
{ {
m_Pos = field.m_Pos; m_Pos = field.m_Pos;
...@@ -75,6 +75,14 @@ LIB_FIELD::~LIB_FIELD() ...@@ -75,6 +75,14 @@ LIB_FIELD::~LIB_FIELD()
} }
void LIB_FIELD::Init( int id )
{
m_FieldId = id;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
m_typeName = _( "Field" );
}
bool LIB_FIELD::Save( FILE* ExportFile ) const bool LIB_FIELD::Save( FILE* ExportFile ) const
{ {
int hjustify, vjustify; int hjustify, vjustify;
......
...@@ -40,11 +40,16 @@ public: ...@@ -40,11 +40,16 @@ public:
LIB_FIELD( LIB_COMPONENT * aParent, int idfield = 2 ); LIB_FIELD( LIB_COMPONENT * aParent, int idfield = 2 );
LIB_FIELD( const LIB_FIELD& field ); LIB_FIELD( const LIB_FIELD& field );
~LIB_FIELD(); ~LIB_FIELD();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LIB_FIELD" ); return wxT( "LIB_FIELD" );
} }
/**
* Object constructor initialization helper.
*/
void Init( int idfield );
/** Function GetPenSize virtual pure /** Function GetPenSize virtual pure
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
......
...@@ -26,13 +26,14 @@ static int fill_tab[3] = { 'N', 'F', 'f' }; ...@@ -26,13 +26,14 @@ static int fill_tab[3] = { 'N', 'F', 'f' };
LIB_DRAW_ITEM::LIB_DRAW_ITEM( KICAD_T struct_type, LIB_COMPONENT* aParent ) : LIB_DRAW_ITEM::LIB_DRAW_ITEM( KICAD_T struct_type, LIB_COMPONENT* aParent ) :
EDA_BaseStruct( struct_type ) EDA_BaseStruct( struct_type )
{ {
m_Unit = 0; /* Unit identification (for multi part per package) m_Unit = 0; /* Unit identification (for multi part per package)
* 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 m_Convert = 0; /* Shape identification (for parts which have a convert
* shape) 0 if the item is common to all shapes */ * shape) 0 if the item is common to all shapes */
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_Parent = (EDA_BaseStruct*) aParent; m_Parent = (EDA_BaseStruct*) aParent;
m_typeName = _( "Undefined" ); m_typeName = _( "Undefined" );
m_isFillable = false;
} }
...@@ -44,6 +45,7 @@ LIB_DRAW_ITEM::LIB_DRAW_ITEM( const LIB_DRAW_ITEM& item ) : ...@@ -44,6 +45,7 @@ LIB_DRAW_ITEM::LIB_DRAW_ITEM( const LIB_DRAW_ITEM& item ) :
m_Fill = item.m_Fill; m_Fill = item.m_Fill;
m_Parent = item.m_Parent; m_Parent = item.m_Parent;
m_typeName = item.m_typeName; m_typeName = item.m_typeName;
m_isFillable = item.m_isFillable;
} }
...@@ -117,12 +119,13 @@ bool LIB_DRAW_ITEM::operator<( const LIB_DRAW_ITEM& other ) const ...@@ -117,12 +119,13 @@ bool LIB_DRAW_ITEM::operator<( const LIB_DRAW_ITEM& other ) const
LIB_ARC::LIB_ARC( LIB_COMPONENT* aParent ) : LIB_ARC::LIB_ARC( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_ARC_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_ARC_DRAW_TYPE, aParent )
{ {
m_Radius = 0; m_Radius = 0;
m_t1 = 0; m_t1 = 0;
m_t2 = 0; m_t2 = 0;
m_Width = 0; m_Width = 0;
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_typeName = _( "Arc" ); m_isFillable = true;
m_typeName = _( "Arc" );
} }
...@@ -540,9 +543,10 @@ void LIB_ARC::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -540,9 +543,10 @@ void LIB_ARC::DisplayInfo( WinEDA_DrawFrame* frame )
LIB_CIRCLE::LIB_CIRCLE( LIB_COMPONENT* aParent ) : LIB_CIRCLE::LIB_CIRCLE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_CIRCLE_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_CIRCLE_DRAW_TYPE, aParent )
{ {
m_Radius = 0; m_Radius = 0;
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_typeName = _( "Circle" ); m_isFillable = true;
m_typeName = _( "Circle" );
} }
...@@ -804,9 +808,10 @@ void LIB_CIRCLE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -804,9 +808,10 @@ void LIB_CIRCLE::DisplayInfo( WinEDA_DrawFrame* frame )
LIB_RECTANGLE::LIB_RECTANGLE( LIB_COMPONENT* aParent ) : LIB_RECTANGLE::LIB_RECTANGLE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_RECT_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_RECT_DRAW_TYPE, aParent )
{ {
m_Width = 0; m_Width = 0;
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_typeName = _( "Rectangle" ); m_isFillable = true;
m_typeName = _( "Rectangle" );
} }
...@@ -1309,9 +1314,10 @@ bool LIB_SEGMENT::HitTest( wxPoint aPosRef, int aThreshold, ...@@ -1309,9 +1314,10 @@ bool LIB_SEGMENT::HitTest( wxPoint aPosRef, int aThreshold,
LIB_POLYLINE::LIB_POLYLINE( LIB_COMPONENT* aParent ) : LIB_POLYLINE::LIB_POLYLINE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_POLYLINE_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_POLYLINE_DRAW_TYPE, aParent )
{ {
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_Width = 0; m_Width = 0;
m_typeName = _( "PolyLine" ); m_isFillable = true;
m_typeName = _( "PolyLine" );
} }
...@@ -1683,9 +1689,10 @@ void LIB_POLYLINE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1683,9 +1689,10 @@ void LIB_POLYLINE::DisplayInfo( WinEDA_DrawFrame* frame )
LIB_BEZIER::LIB_BEZIER( LIB_COMPONENT* aParent ) : LIB_BEZIER::LIB_BEZIER( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_BEZIER_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_BEZIER_DRAW_TYPE, aParent )
{ {
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_Width = 0; m_Width = 0;
m_typeName = _( "Bezier" ); m_isFillable = true;
m_typeName = _( "Bezier" );
} }
......
...@@ -303,6 +303,16 @@ public: ...@@ -303,6 +303,16 @@ public:
int GetWidth( void ) { return DoGetWidth(); } int GetWidth( void ) { return DoGetWidth(); }
void SetWidth( int width ) { DoSetWidth( width ); } void SetWidth( int width ) { DoSetWidth( width ); }
/**
* Check if draw object can be filled.
*
* The default setting is false. If the derived object support filling,
* set the m_isFillable member to true.
*
* @return bool - True if draw object can be fill. Default is false.
*/
bool IsFillable( void ) { return m_isFillable; }
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy() = 0; virtual LIB_DRAW_ITEM* DoGenCopy() = 0;
...@@ -327,6 +337,9 @@ protected: ...@@ -327,6 +337,9 @@ protected:
const int transform[2][2] ) = 0; const int transform[2][2] ) = 0;
virtual int DoGetWidth( void ) = 0; virtual int DoGetWidth( void ) = 0;
virtual void DoSetWidth( int width ) = 0; virtual void DoSetWidth( int width ) = 0;
/** Flag to indicate if draw item is fillable. Default is false. */
bool m_isFillable;
}; };
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_cmp_graphic_properties.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 12/02/2006 11:38:02
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 12/02/2006 11:38:02
////@begin includes
////@end includes
#include "dialog_cmp_graphic_properties.h"
////@begin XPM images
////@end XPM images
/*!
* WinEDA_bodygraphics_PropertiesFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_bodygraphics_PropertiesFrame, wxDialog )
/*!
* WinEDA_bodygraphics_PropertiesFrame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_bodygraphics_PropertiesFrame, wxDialog )
////@begin WinEDA_bodygraphics_PropertiesFrame event table entries
EVT_BUTTON( wxID_OK, WinEDA_bodygraphics_PropertiesFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_bodygraphics_PropertiesFrame::OnCancelClick )
////@end WinEDA_bodygraphics_PropertiesFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_bodygraphics_PropertiesFrame constructors
*/
WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( )
{
}
WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
LIB_DRAW_ITEM * CurrentItem = parent->GetDrawItem();
m_Parent = parent;
Create(parent, id, caption, pos, size, style);
/* Set the dialog items: */
if ( CurrentItem )
{
if ( CurrentItem->m_Unit == 0 )
m_CommonUnit->SetValue( TRUE );
}
else if ( ! m_Parent->m_drawSpecificUnit )
{
m_CommonUnit->SetValue( TRUE );
}
if ( CurrentItem )
{
if ( CurrentItem->m_Convert == 0 )
m_CommonConvert->SetValue( TRUE );
}
else if ( !m_Parent->m_drawSpecificConvert )
{
m_CommonConvert->SetValue( TRUE );
}
bool show_fill_option = false;
int fill_option = 0;
if( CurrentItem )
{
fill_option = CurrentItem->m_Fill;
switch( CurrentItem->Type() )
{
case COMPONENT_ARC_DRAW_TYPE:
case COMPONENT_CIRCLE_DRAW_TYPE:
case COMPONENT_RECT_DRAW_TYPE:
case COMPONENT_POLYLINE_DRAW_TYPE:
show_fill_option = true;
default:
break;
}
m_GraphicShapeWidthCtrl->SetValue( CurrentItem->GetWidth() );
}
if ( show_fill_option )
m_Filled->SetSelection( fill_option );
else
m_Filled->Enable( false );
}
/*!
* WinEDA_bodygraphics_PropertiesFrame creator
*/
bool WinEDA_bodygraphics_PropertiesFrame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
////@begin WinEDA_bodygraphics_PropertiesFrame member initialisation
m_CommonUnit = NULL;
m_CommonConvert = NULL;
m_ShapeWidthBoxSizer = NULL;
m_Filled = NULL;
m_btClose = NULL;
////@end WinEDA_bodygraphics_PropertiesFrame member initialisation
////@begin WinEDA_bodygraphics_PropertiesFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
////@end WinEDA_bodygraphics_PropertiesFrame creation
return true;
}
/*!
* Control creation for WinEDA_bodygraphics_PropertiesFrame
*/
void WinEDA_bodygraphics_PropertiesFrame::CreateControls()
{
////@begin WinEDA_bodygraphics_PropertiesFrame content construction
// Generated by DialogBlocks, 24/04/2009 14:19:31 (unregistered)
WinEDA_bodygraphics_PropertiesFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options :"));
wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
itemBoxSizer2->Add(itemStaticBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_CommonUnit = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Common to Units"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_CommonUnit->SetValue(false);
itemStaticBoxSizer3->Add(m_CommonUnit, 0, wxALIGN_LEFT|wxALL, 5);
m_CommonConvert = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Common to convert"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_CommonConvert->SetValue(false);
itemStaticBoxSizer3->Add(m_CommonConvert, 0, wxALIGN_LEFT|wxALL, 5);
m_ShapeWidthBoxSizer = new wxBoxSizer(wxVERTICAL);
itemStaticBoxSizer3->Add(m_ShapeWidthBoxSizer, 0, wxGROW|wxTOP|wxBOTTOM, 5);
wxArrayString m_FilledStrings;
m_FilledStrings.Add(_("Void"));
m_FilledStrings.Add(_("Filled"));
m_FilledStrings.Add(_("BgFilled"));
m_Filled = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Fill:"), wxDefaultPosition, wxDefaultSize, m_FilledStrings, 1, wxRA_SPECIFY_COLS );
m_Filled->SetSelection(0);
itemStaticBoxSizer3->Add(m_Filled, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton* itemButton9 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton9->SetDefault();
itemBoxSizer8->Add(itemButton9, 0, wxGROW|wxALL, 5);
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(m_btClose, 0, wxGROW|wxALL, 5);
////@end WinEDA_bodygraphics_PropertiesFrame content construction
m_btClose->SetFocus();
m_GraphicShapeWidthCtrl = new WinEDA_ValueCtrl(this, _("Width"), 0,
g_UnitMetric,m_ShapeWidthBoxSizer, EESCHEMA_INTERNAL_UNIT);
}
/*!
* Should we show tooltips?
*/
bool WinEDA_bodygraphics_PropertiesFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_bodygraphics_PropertiesFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_bodygraphics_PropertiesFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end WinEDA_bodygraphics_PropertiesFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_bodygraphics_PropertiesFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_bodygraphics_PropertiesFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end WinEDA_bodygraphics_PropertiesFrame icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void WinEDA_bodygraphics_PropertiesFrame::OnOkClick( wxCommandEvent& event )
{
bodygraphics_PropertiesAccept(event);
Close();
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void WinEDA_bodygraphics_PropertiesFrame::OnCancelClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_bodygraphics_PropertiesFrame.
// Before editing this code, remove the block markers.
event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_bodygraphics_PropertiesFrame.
}
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_cmp_graphic_properties.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 12/02/2006 11:38:02
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 12/02/2006 11:38:02
#ifndef _DIALOG_CMP_GRAPHIC_PROPERTIES_H_
#define _DIALOG_CMP_GRAPHIC_PROPERTIES_H_
/*!
* Includes
*/
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
class wxBoxSizer;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_CHECKBOX 10001
#define ID_CHECKBOX1 10002
#define ID_RADIOBOX 10003
#define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_TITLE _("Graphic shape properties")
#define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* WinEDA_bodygraphics_PropertiesFrame class declaration
*/
class WinEDA_bodygraphics_PropertiesFrame: public wxDialog
{
DECLARE_DYNAMIC_CLASS( WinEDA_bodygraphics_PropertiesFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_bodygraphics_PropertiesFrame( );
WinEDA_bodygraphics_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_IDNAME,
const wxString& caption = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_TITLE,
const wxPoint& pos = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_POSITION,
const wxSize& size = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_SIZE,
long style = SYMBOL_WINEDA_BODYGRAPHICS_PROPERTIESFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_bodygraphics_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_bodygraphics_PropertiesFrame event handler declarations
////@begin WinEDA_bodygraphics_PropertiesFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_bodygraphics_PropertiesFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
void bodygraphics_PropertiesAccept(wxCommandEvent& event);
////@begin WinEDA_bodygraphics_PropertiesFrame member variables
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxBoxSizer* m_ShapeWidthBoxSizer;
wxRadioBox* m_Filled;
wxButton* m_btClose;
////@end WinEDA_bodygraphics_PropertiesFrame member variables
WinEDA_LibeditFrame * m_Parent;
WinEDA_ValueCtrl * m_GraphicShapeWidthCtrl;
};
#endif
// _DIALOG_CMP_GRAPHIC_PROPERTIES_H_
This diff is collapsed.
#include "dialog_lib_edit_draw_item.h"
DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM( wxWindow* parent,
const wxString& itemName ) :
DIALOG_LIB_EDIT_DRAW_ITEM_BASE( parent )
{
SetTitle( itemName + wxT( " " ) + GetTitle() );
}
void DIALOG_LIB_EDIT_DRAW_ITEM::SetWidth( const wxString& width )
{
m_textWidth->SetValue( width );
}
wxString DIALOG_LIB_EDIT_DRAW_ITEM::GetWidth( void )
{
return m_textWidth->GetValue();
}
bool DIALOG_LIB_EDIT_DRAW_ITEM::GetApplyToAllConversions( void )
{
return m_checkApplyToAllConversions->IsChecked();
}
void DIALOG_LIB_EDIT_DRAW_ITEM::SetApplyToAllConversions( bool applyToAll )
{
m_checkApplyToAllConversions->SetValue( applyToAll );
}
void DIALOG_LIB_EDIT_DRAW_ITEM::EnableApplyToAllConversions( bool enable )
{
m_checkApplyToAllConversions->Enable( enable );
}
bool DIALOG_LIB_EDIT_DRAW_ITEM::GetApplyToAllUnits( void )
{
return m_checkApplyToAllUnits->IsChecked();
}
void DIALOG_LIB_EDIT_DRAW_ITEM::SetApplyToAllUnits( bool applyToAll )
{
m_checkApplyToAllUnits->SetValue( applyToAll );
}
void DIALOG_LIB_EDIT_DRAW_ITEM::EnableApplyToAllUnits( bool enable )
{
m_checkApplyToAllUnits->Enable( enable );
}
int DIALOG_LIB_EDIT_DRAW_ITEM::GetFillStyle( void )
{
if( m_radioFillNone->GetValue() )
return 0;
if( m_radioFillForeground->GetValue() )
return 1;
if( m_radioFillBackground->GetValue() )
return 2;
return 0;
}
void DIALOG_LIB_EDIT_DRAW_ITEM::SetFillStyle( int fillStyle )
{
if( fillStyle == 1 )
m_radioFillForeground->SetValue( true );
else if( fillStyle == 2 )
m_radioFillBackground->SetValue( true );
else
m_radioFillNone->SetValue( true );
}
void DIALOG_LIB_EDIT_DRAW_ITEM::EnableFillStyle( bool enable )
{
m_radioFillNone->Enable( enable );
m_radioFillForeground->Enable( enable );
m_radioFillBackground->Enable( enable );
}
void DIALOG_LIB_EDIT_DRAW_ITEM::SetWidthUnits( const wxString& units )
{
m_staticWidthUnits->SetLabel( units );
}
This diff is collapsed.
#ifndef __dialog_lib_edit_draw_item__
#define __dialog_lib_edit_draw_item__
/**
* @file
* Subclass of DIALOG_LIB_EDIT_DRAW_ITEM_BASE, which is generated by
* wxFormBuilder.
*/
class LIB_DRAW_ITEM;
#include "dialog_lib_edit_draw_item_base.h"
/**
* Dialog to edit library component graphic items.
*/
class DIALOG_LIB_EDIT_DRAW_ITEM : public DIALOG_LIB_EDIT_DRAW_ITEM_BASE
{
public:
/** Constructor */
DIALOG_LIB_EDIT_DRAW_ITEM( wxWindow* parent, const wxString& itemName );
wxString GetWidth( void );
void SetWidth( const wxString& width );
bool GetApplyToAllConversions( void );
void SetApplyToAllConversions( bool applyToAll );
void EnableApplyToAllConversions( bool enable = true );
bool GetApplyToAllUnits( void );
void SetApplyToAllUnits( bool applyToAll );
void EnableApplyToAllUnits( bool enable = true );
int GetFillStyle( void );
void SetFillStyle( int fillStyle );
void EnableFillStyle( bool enable = true );
void SetWidthUnits( const wxString& units );
};
#endif // __dialog_lib_edit_draw_item__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_lib_edit_draw_item_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LIB_EDIT_DRAW_ITEM_BASE::DIALOG_LIB_EDIT_DRAW_ITEM_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* mainSizer;
mainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* dlgBorderSizer;
dlgBorderSizer = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("General"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
m_staticText1->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
dlgBorderSizer->Add( m_staticText1, 0, wxALIGN_LEFT, 3 );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
bSizer3->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticWidth = new wxStaticText( this, wxID_ANY, _("&Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticWidth->Wrap( -1 );
bSizer3->Add( m_staticWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer3->Add( 0, 0, 1, wxEXPAND, 3 );
m_textWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_textWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticWidthUnits->Wrap( -1 );
bSizer3->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
dlgBorderSizer->Add( bSizer3, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
bSizer4->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkApplyToAllUnits = new wxCheckBox( this, wxID_ANY, _("Apply changes to all &parts in component"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_checkApplyToAllUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
dlgBorderSizer->Add( bSizer4, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
bSizer5->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Apply changes to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
dlgBorderSizer->Add( bSizer5, 0, wxEXPAND, 3 );
dlgBorderSizer->Add( 0, 0, 0, wxALL|wxEXPAND, 10 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Fill Style"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
m_staticText4->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
dlgBorderSizer->Add( m_staticText4, 0, wxALIGN_LEFT|wxBOTTOM, 3 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
bSizer6->Add( 12, 0, 0, wxEXPAND, 3 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
m_radioFillNone = new wxRadioButton( this, wxID_ANY, _("Do &not fill"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_radioFillNone->SetValue( true );
bSizer7->Add( m_radioFillNone, 0, wxALL, 3 );
m_radioFillForeground = new wxRadioButton( this, wxID_ANY, _("Fill &foreground"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer7->Add( m_radioFillForeground, 0, wxALL, 3 );
m_radioFillBackground = new wxRadioButton( this, wxID_ANY, _("Fill &background"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer7->Add( m_radioFillBackground, 0, wxALL, 3 );
bSizer6->Add( bSizer7, 0, wxEXPAND, 0 );
dlgBorderSizer->Add( bSizer6, 1, wxALL|wxEXPAND, 0 );
dlgBorderSizer->Add( 0, 0, 0, wxALL|wxEXPAND, 10 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
dlgBorderSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 0 );
mainSizer->Add( dlgBorderSizer, 1, wxALL|wxEXPAND, 12 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
}
DIALOG_LIB_EDIT_DRAW_ITEM_BASE::~DIALOG_LIB_EDIT_DRAW_ITEM_BASE()
{
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_lib_edit_draw_item_base__
#define __dialog_lib_edit_draw_item_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/sizer.h>
#include <wx/checkbox.h>
#include <wx/radiobut.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LIB_EDIT_DRAW_ITEM_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_EDIT_DRAW_ITEM_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticText1;
wxStaticText* m_staticWidth;
wxTextCtrl* m_textWidth;
wxStaticText* m_staticWidthUnits;
wxCheckBox* m_checkApplyToAllUnits;
wxCheckBox* m_checkApplyToAllConversions;
wxStaticText* m_staticText4;
wxRadioButton* m_radioFillNone;
wxRadioButton* m_radioFillForeground;
wxRadioButton* m_radioFillBackground;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
public:
DIALOG_LIB_EDIT_DRAW_ITEM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drawing Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_LIB_EDIT_DRAW_ITEM_BASE();
};
#endif //__dialog_lib_edit_draw_item_base__
...@@ -68,10 +68,6 @@ LayerStruct g_LayerDescr; /* couleurs des couches */ ...@@ -68,10 +68,6 @@ LayerStruct g_LayerDescr; /* couleurs des couches */
bool g_EditPinByPinIsOn = false; /* true to do not synchronize pins edition bool g_EditPinByPinIsOn = false; /* true to do not synchronize pins edition
* when they are at the same location */ * when they are at the same location */
int g_LibSymbolDefaultLineWidth = 0; /* default line width (in EESCHEMA units)
* used when creating a new graphic item in libedit.
* 0 = use default line thicknes
*/
int g_DrawDefaultLineThickness = 6; /* Default line (in EESCHEMA units) thickness int g_DrawDefaultLineThickness = 6; /* Default line (in EESCHEMA units) thickness
* used to draw/plot items having a default thickness line value (i.e. = 0 ). * used to draw/plot items having a default thickness line value (i.e. = 0 ).
* 0 = single pixel line width * 0 = single pixel line width
......
...@@ -175,10 +175,6 @@ extern LayerStruct g_LayerDescr; /* couleurs des couches */ ...@@ -175,10 +175,6 @@ extern LayerStruct g_LayerDescr; /* couleurs des couches */
extern bool g_EditPinByPinIsOn; /* true to do not synchronize pins edition extern bool g_EditPinByPinIsOn; /* true to do not synchronize pins edition
* when they are at the same location */ * when they are at the same location */
extern int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA units)
* used when creating a new graphic item in libedit.
* 0 = use default line thicknes
*/
extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA units) thickness extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA units) thickness
* used to draw/plot items having a default thickness line value (i.e. = 0 ). * used to draw/plot items having a default thickness line value (i.e. = 0 ).
* 0 = single pixel line width * 0 = single pixel line width
......
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
LIB_DRAW_ITEM* GetLastDrawItem( void ) { return m_lastDrawItem; } LIB_DRAW_ITEM* GetLastDrawItem( void ) { return m_lastDrawItem; }
void SetLastDrawItem( LIB_DRAW_ITEM* drawItem ) void SetLastDrawItem( LIB_DRAW_ITEM* drawItem )
{ {
m_lastDrawItem = drawItem; m_lastDrawItem = drawItem;
} }
...@@ -116,11 +116,13 @@ public: ...@@ -116,11 +116,13 @@ public:
LIB_DRAW_ITEM* GetDrawItem( void ) { return m_drawItem; } LIB_DRAW_ITEM* GetDrawItem( void ) { return m_drawItem; }
void SetDrawItem( LIB_DRAW_ITEM* drawItem ); void SetDrawItem( LIB_DRAW_ITEM* drawItem );
bool GetShowDeMorgan( void ) { return m_showDeMorgan; } bool GetShowDeMorgan( void ) { return m_showDeMorgan; }
void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; } void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; }
FILL_T GetFillStyle( void ) { return m_drawFillStyle; }
private: private:
...@@ -190,14 +192,27 @@ protected: ...@@ -190,14 +192,27 @@ protected:
wxString m_LastLibImportPath; wxString m_LastLibImportPath;
wxString m_LastLibExportPath; wxString m_LastLibExportPath;
/// Convert of the item currently being drawn. /** Convert of the item currently being drawn. */
bool m_drawSpecificConvert; bool m_drawSpecificConvert;
/**
* Specify which component parts the current draw item applies to.
*
* If true, the item being drawn or edited applies only to the selected
* part. Otherwise it applies to all parts in the component.
*/
bool m_drawSpecificUnit; bool m_drawSpecificUnit;
// The current edited component (NULL if no component) /** The current draw or edit graphic item fill style. */
static FILL_T m_drawFillStyle;
/** Default line width for drawing or editing graphic items. */
static int m_drawLineWidth;
/** The current component being edited. NULL if no component is selected. */
static LIB_COMPONENT* m_component; static LIB_COMPONENT* m_component;
// The current active libary (NULL if none) /** The current active libary. NULL if no library is active. */
static CMP_LIBRARY* m_library; static CMP_LIBRARY* m_library;
static LIB_DRAW_ITEM* m_lastDrawItem; static LIB_DRAW_ITEM* m_lastDrawItem;
static LIB_DRAW_ITEM* m_drawItem; static LIB_DRAW_ITEM* m_drawItem;
...@@ -225,7 +240,6 @@ protected: ...@@ -225,7 +240,6 @@ protected:
static wxSize m_clientSize; static wxSize m_clientSize;
friend class WinEDA_bodygraphics_PropertiesFrame;
friend class Dialog_BodyGraphicText_Properties; friend class Dialog_BodyGraphicText_Properties;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
......
...@@ -50,6 +50,8 @@ bool WinEDA_LibeditFrame::m_showDeMorgan = false; ...@@ -50,6 +50,8 @@ bool WinEDA_LibeditFrame::m_showDeMorgan = false;
wxSize WinEDA_LibeditFrame::m_clientSize = wxSize( -1, -1 ); wxSize WinEDA_LibeditFrame::m_clientSize = wxSize( -1, -1 );
int WinEDA_LibeditFrame::m_textSize = DEFAULT_SIZE_TEXT; int WinEDA_LibeditFrame::m_textSize = DEFAULT_SIZE_TEXT;
int WinEDA_LibeditFrame::m_textOrientation = TEXT_ORIENT_HORIZ; int WinEDA_LibeditFrame::m_textOrientation = TEXT_ORIENT_HORIZ;
int WinEDA_LibeditFrame::m_drawLineWidth = 0;
FILL_T WinEDA_LibeditFrame::m_drawFillStyle = NO_FILL;
/*****************************/ /*****************************/
......
This diff is collapsed.
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