Commit 92e0eb62 authored by jean-pierre charras's avatar jean-pierre charras

Minor changes in dialogs to ensure a better likeness between dialogs on Linux...

Minor changes in dialogs to ensure a better likeness between dialogs on Linux and Windows (mainly, remove some wxStaticBoxSizer in dialogs)
parent 0dd413a7
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__ #ifndef __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__
#define __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__ #define __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/choice.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/sizer.h> #include <wx/choice.h>
#include <wx/statbox.h> #include <wx/radiobox.h>
#include <wx/radiobox.h> #include <wx/sizer.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/stattext.h> #include <wx/button.h>
#include <wx/button.h> #include <wx/statbox.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP /// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
{ {
private: private:
protected: protected:
wxChoice* unitChoice; wxStaticText* m_staticTextUnit;
wxRadioBox* orientationRadioBox; wxChoice* unitChoice;
wxRadioBox* mirrorRadioBox; wxRadioBox* orientationRadioBox;
wxTextCtrl* chipnameTextCtrl; wxRadioBox* mirrorRadioBox;
wxCheckBox* convertCheckBox; wxStaticText* m_staticTextChipname;
wxStaticText* partsAreLockedLabel; wxTextCtrl* chipnameTextCtrl;
wxButton* defaultsButton; wxCheckBox* convertCheckBox;
wxListCtrl* fieldListCtrl; wxStaticText* partsAreLockedLabel;
wxButton* addFieldButton; wxButton* defaultsButton;
wxButton* deleteFieldButton; wxListCtrl* fieldListCtrl;
wxButton* moveUpButton; wxButton* addFieldButton;
wxRadioBox* m_FieldHJustifyCtrl; wxButton* deleteFieldButton;
wxRadioBox* m_FieldVJustifyCtrl; wxButton* moveUpButton;
wxCheckBox* showCheckBox; wxRadioBox* m_FieldHJustifyCtrl;
wxCheckBox* rotateCheckBox; wxRadioBox* m_FieldVJustifyCtrl;
wxRadioBox* m_StyleRadioBox; wxCheckBox* showCheckBox;
wxStaticText* fieldNameLabel; wxCheckBox* rotateCheckBox;
wxTextCtrl* fieldNameTextCtrl; wxRadioBox* m_StyleRadioBox;
wxStaticText* fieldValueLabel; wxStaticText* fieldNameLabel;
wxTextCtrl* fieldValueTextCtrl; wxTextCtrl* fieldNameTextCtrl;
wxStaticText* textSizeLabel; wxStaticText* fieldValueLabel;
wxTextCtrl* textSizeTextCtrl; wxTextCtrl* fieldValueTextCtrl;
wxStaticText* posXLabel; wxStaticText* textSizeLabel;
wxTextCtrl* posXTextCtrl; wxTextCtrl* textSizeTextCtrl;
wxStaticText* posYLabel; wxStaticText* m_staticTextUnitSize;
wxTextCtrl* posYTextCtrl; wxStaticText* posXLabel;
wxStdDialogButtonSizer* stdDialogButtonSizer; wxTextCtrl* posXTextCtrl;
wxButton* stdDialogButtonSizerOK; wxStaticText* m_staticTextUnitPosX;
wxButton* stdDialogButtonSizerCancel; wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
// Virtual event handlers, overide them in your derived class wxStaticText* m_staticTextUnitPosY;
virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); } wxStdDialogButtonSizer* stdDialogButtonSizer;
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } wxButton* stdDialogButtonSizerOK;
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); } wxButton* stdDialogButtonSizerCancel;
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } // Virtual event handlers, overide them in your derived class
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); } virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
public: virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,521 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP();
}; public:
#endif //__DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,482 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP();
};
#endif //__DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__
...@@ -34,8 +34,8 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB : public DIALOG_EDIT_LIBENTRY_FIELDS_IN ...@@ -34,8 +34,8 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB : public DIALOG_EDIT_LIBENTRY_FIELDS_IN
/*****************************************************************************************/ /*****************************************************************************************/
{ {
private: private:
LIB_EDIT_FRAME* m_Parent; LIB_EDIT_FRAME* m_parent;
LIB_COMPONENT* m_LibEntry; LIB_COMPONENT* m_libEntry;
bool m_skipCopyFromPanel; bool m_skipCopyFromPanel;
/// a copy of the edited component's LIB_FIELDs /// a copy of the edited component's LIB_FIELDs
...@@ -64,10 +64,10 @@ private: ...@@ -64,10 +64,10 @@ private:
int getSelectedFieldNdx(); int getSelectedFieldNdx();
/** /**
* Function InitBuffers * Function initBuffers
* sets up to edit the given component. * sets up to edit the given component.
*/ */
void InitBuffers(); void initBuffers();
/** /**
* Function findField * Function findField
...@@ -133,8 +133,8 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( ...@@ -133,8 +133,8 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( aParent ) DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( aParent )
/***********************************************************************/ /***********************************************************************/
{ {
m_Parent = aParent; m_parent = aParent;
m_LibEntry = aLibEntry; m_libEntry = aLibEntry;
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre(); Centre();
...@@ -163,20 +163,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event ...@@ -163,20 +163,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event
columnLabel.SetText( _( "Value" ) ); columnLabel.SetText( _( "Value" ) );
fieldListCtrl->InsertColumn( COLUMN_TEXT, columnLabel ); fieldListCtrl->InsertColumn( COLUMN_TEXT, columnLabel );
wxString label = _( "Size" ) + ReturnUnitSymbol( g_UserUnit ); m_staticTextUnitSize->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
textSizeLabel->SetLabel( label ); m_staticTextUnitPosX->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_staticTextUnitPosY->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
label = _( "Pos " ); initBuffers();
label += _( "X" );
label += ReturnUnitSymbol( g_UserUnit );
posXLabel->SetLabel( label );
label = _( "Pos " );
label += _( "Y" );
label += ReturnUnitSymbol( g_UserUnit );
posYLabel->SetLabel( label );
InitBuffers();
copySelectedFieldToPanel(); copySelectedFieldToPanel();
stdDialogButtonSizerOK->SetDefault(); stdDialogButtonSizerOK->SetDefault();
...@@ -237,7 +228,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event ...@@ -237,7 +228,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
* or root alias of the component */ * or root alias of the component */
wxString newvalue = m_FieldsBuf[VALUE].GetText(); wxString newvalue = m_FieldsBuf[VALUE].GetText();
if( m_LibEntry->HasAlias( newvalue ) && !m_LibEntry->GetAlias( newvalue )->IsRoot() ) if( m_libEntry->HasAlias( newvalue ) && !m_libEntry->GetAlias( newvalue )->IsRoot() )
{ {
wxString msg; wxString msg;
msg.Printf( _( "A new name is entered for this component\n\ msg.Printf( _( "A new name is entered for this component\n\
...@@ -249,7 +240,7 @@ An alias %s already exists!\nCannot update this component" ), ...@@ -249,7 +240,7 @@ An alias %s already exists!\nCannot update this component" ),
/* End unused code */ /* End unused code */
/* save old cmp in undo list */ /* save old cmp in undo list */
m_Parent->SaveCopyInUndoList( m_LibEntry, IS_CHANGED ); m_parent->SaveCopyInUndoList( m_libEntry, IS_CHANGED );
// delete any fields with no name or no value before we copy all of m_FieldsBuf // delete any fields with no name or no value before we copy all of m_FieldsBuf
// back into the component // back into the component
...@@ -274,12 +265,12 @@ An alias %s already exists!\nCannot update this component" ), ...@@ -274,12 +265,12 @@ An alias %s already exists!\nCannot update this component" ),
#endif #endif
// copy all the fields back, fully replacing any previous fields // copy all the fields back, fully replacing any previous fields
m_LibEntry->SetFields( m_FieldsBuf ); m_libEntry->SetFields( m_FieldsBuf );
// We need to keep the name and the value the same at the moment! // We need to keep the name and the value the same at the moment!
SetName( m_LibEntry->GetValueField().GetText() ); SetName( m_libEntry->GetValueField().GetText() );
m_Parent->OnModify(); m_parent->OnModify();
EndModal( 0 ); EndModal( 0 );
} }
...@@ -445,13 +436,11 @@ LIB_FIELD* DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::findField( const wxString& aField ...@@ -445,13 +436,11 @@ LIB_FIELD* DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::findField( const wxString& aField
} }
/***********************************************************/ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
/***********************************************************/
{ {
LIB_FIELDS cmpFields; LIB_FIELDS cmpFields;
m_LibEntry->GetFields( cmpFields ); m_libEntry->GetFields( cmpFields );
#if defined(DEBUG) #if defined(DEBUG)
for( unsigned i=0; i<cmpFields.size(); ++i ) for( unsigned i=0; i<cmpFields.size(); ++i )
...@@ -492,7 +481,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers() ...@@ -492,7 +481,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
// Now copy in the template fields, in the order that they are present in the // Now copy in the template fields, in the order that they are present in the
// template field editor UI. // template field editor UI.
const TEMPLATE_FIELDNAMES& tfnames = const TEMPLATE_FIELDNAMES& tfnames =
((SCH_EDIT_FRAME*)m_Parent->GetParent())->GetTemplateFieldNames(); ((SCH_EDIT_FRAME*)m_parent->GetParent())->GetTemplateFieldNames();
for( TEMPLATE_FIELDNAMES::const_iterator it = tfnames.begin(); it!=tfnames.end(); ++it ) for( TEMPLATE_FIELDNAMES::const_iterator it = tfnames.begin(); it!=tfnames.end(); ++it )
{ {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ #ifndef __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__
#define __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ #define __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/string.h> #include <wx/gdicmn.h>
#include <wx/gdicmn.h> #include <wx/font.h>
#include <wx/font.h> #include <wx/colour.h>
#include <wx/colour.h> #include <wx/settings.h>
#include <wx/settings.h> #include <wx/string.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/radiobox.h>
#include <wx/radiobox.h> #include <wx/checkbox.h>
#include <wx/checkbox.h> #include <wx/statbox.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/dialog.h> #include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog ///////////////////////////////////////////////////////////////////////////////
{ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog
private: {
private:
protected:
wxListCtrl* fieldListCtrl; protected:
wxButton* addFieldButton; wxListCtrl* fieldListCtrl;
wxButton* deleteFieldButton; wxButton* addFieldButton;
wxButton* moveUpButton; wxButton* deleteFieldButton;
wxRadioBox* m_FieldHJustifyCtrl; wxButton* moveUpButton;
wxRadioBox* m_FieldVJustifyCtrl; wxRadioBox* m_FieldHJustifyCtrl;
wxCheckBox* showCheckBox; wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* rotateCheckBox; wxCheckBox* showCheckBox;
wxRadioBox* m_StyleRadioBox; wxCheckBox* rotateCheckBox;
wxStaticText* fieldNameLabel; wxRadioBox* m_StyleRadioBox;
wxTextCtrl* fieldNameTextCtrl; wxStaticText* fieldNameLabel;
wxStaticText* fieldValueLabel; wxTextCtrl* fieldNameTextCtrl;
wxTextCtrl* fieldValueTextCtrl; wxStaticText* fieldValueLabel;
wxStaticText* textSizeLabel; wxTextCtrl* fieldValueTextCtrl;
wxTextCtrl* textSizeTextCtrl; wxStaticText* textSizeLabel;
wxStaticText* posXLabel; wxTextCtrl* textSizeTextCtrl;
wxTextCtrl* posXTextCtrl; wxStaticText* m_staticTextUnitSize;
wxStaticText* posYLabel; wxStaticText* posXLabel;
wxTextCtrl* posYTextCtrl; wxTextCtrl* posXTextCtrl;
wxStdDialogButtonSizer* stdDialogButtonSizer; wxStaticText* m_staticTextUnitPosX;
wxButton* stdDialogButtonSizerOK; wxStaticText* posYLabel;
wxButton* stdDialogButtonSizerCancel; wxTextCtrl* posYTextCtrl;
wxStaticText* m_staticTextUnitPosY;
// Virtual event handlers, overide them in your derived class wxStaticLine* m_staticline1;
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } wxStdDialogButtonSizer* stdDialogButtonSizer;
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } wxButton* stdDialogButtonSizerOK;
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); } wxButton* stdDialogButtonSizerCancel;
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } // Virtual event handlers, overide them in your derived class
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); } virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
public: virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 615,550 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
}; public:
#endif //__DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 615,456 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
};
#endif //__DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__
This diff is collapsed.
/******************************************************************************* /*******************************************************************************
* * * *
* Author : Angus Johnson * * Author : Angus Johnson *
* Version : 5.0.3 * * Version : 5.1.4 *
* Date : 12 January 2013 * * Date : 24 March 2013 *
* Website : http://www.angusj.com * * Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2013 * * Copyright : Angus Johnson 2010-2013 *
* * * *
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* Paper no. DETC2005-85513 pp. 565-575 * * Paper no. DETC2005-85513 pp. 565-575 *
* ASME 2005 International Design Engineering Technical Conferences * * ASME 2005 International Design Engineering Technical Conferences *
* and Computers and Information in Engineering Conference (IDETC/CIE2005) * * and Computers and Information in Engineering Conference (IDETC/CIE2005) *
* September 2428, 2005 , Long Beach, California, USA * * September 24-28, 2005 , Long Beach, California, USA *
* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * * http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf *
* * * *
*******************************************************************************/ *******************************************************************************/
...@@ -64,25 +64,59 @@ public: ...@@ -64,25 +64,59 @@ public:
typedef std::vector< IntPoint > Polygon; typedef std::vector< IntPoint > Polygon;
typedef std::vector< Polygon > Polygons; typedef std::vector< Polygon > Polygons;
std::ostream& operator <<(std::ostream &s, Polygon &p); std::ostream& operator <<(std::ostream &s, Polygon &p);
std::ostream& operator <<(std::ostream &s, Polygons &p); std::ostream& operator <<(std::ostream &s, Polygons &p);
struct ExPolygon { class PolyNode;
Polygon outer; typedef std::vector< PolyNode* > PolyNodes;
Polygons holes;
class PolyNode
{
public:
PolyNode();
Polygon Contour;
PolyNodes Childs;
PolyNode* Parent;
PolyNode* GetNext() const;
bool IsHole() const;
int ChildCount() const;
private:
PolyNode* GetNextSiblingUp() const;
unsigned Index; //node index in Parent.Childs
void AddChild(PolyNode& child);
friend class Clipper; //to access Index
}; };
typedef std::vector< ExPolygon > ExPolygons;
class PolyTree: public PolyNode
{
public:
~PolyTree(){Clear();};
PolyNode* GetFirst() const;
void Clear();
int Total() const;
private:
PolyNodes AllNodes;
friend class Clipper; //to access AllNodes
};
enum JoinType { jtSquare, jtRound, jtMiter }; enum JoinType { jtSquare, jtRound, jtMiter };
bool Orientation(const Polygon &poly); bool Orientation(const Polygon &poly);
double Area(const Polygon &poly); double Area(const Polygon &poly);
void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys, void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys,
double delta, JoinType jointype = jtSquare, double MiterLimit = 2, bool AutoFix = true); double delta, JoinType jointype = jtSquare, double limit = 0, bool autoFix = true);
void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillType fillType = pftEvenOdd);
void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFillType fillType = pftEvenOdd);
void SimplifyPolygons(Polygons &polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygons(Polygons &polys, PolyFillType fillType = pftEvenOdd);
void CleanPolygon(Polygon& in_poly, Polygon& out_poly, double distance = 1.415);
void CleanPolygons(Polygons& in_polys, Polygons& out_polys, double distance = 1.415);
void PolyTreeToPolygons(PolyTree& polytree, Polygons& polygons);
void ReversePolygon(Polygon& p); void ReversePolygon(Polygon& p);
void ReversePolygons(Polygons& p); void ReversePolygons(Polygons& p);
...@@ -100,7 +134,6 @@ struct TEdge { ...@@ -100,7 +134,6 @@ struct TEdge {
double dx; double dx;
long64 deltaX; long64 deltaX;
long64 deltaY; long64 deltaY;
long64 tmpX;
PolyType polyType; PolyType polyType;
EdgeSide side; EdgeSide side;
int windDelta; //1 or -1 depending on winding direction int windDelta; //1 or -1 depending on winding direction
...@@ -140,8 +173,8 @@ struct OutPt; //forward declaration ...@@ -140,8 +173,8 @@ struct OutPt; //forward declaration
struct OutRec { struct OutRec {
int idx; int idx;
bool isHole; bool isHole;
OutRec *FirstLeft; OutRec *FirstLeft; //see comments in clipper.pas
OutRec *AppendLink; PolyNode *polyNode;
OutPt *pts; OutPt *pts;
OutPt *bottomPt; OutPt *bottomPt;
}; };
...@@ -204,13 +237,13 @@ public: ...@@ -204,13 +237,13 @@ public:
Clipper(); Clipper();
~Clipper(); ~Clipper();
bool Execute(ClipType clipType, bool Execute(ClipType clipType,
Polygons &solution, Polygons &solution,
PolyFillType subjFillType = pftEvenOdd, PolyFillType subjFillType = pftEvenOdd,
PolyFillType clipFillType = pftEvenOdd); PolyFillType clipFillType = pftEvenOdd);
bool Execute(ClipType clipType, bool Execute(ClipType clipType,
ExPolygons &solution, PolyTree &polytree,
PolyFillType subjFillType = pftEvenOdd, PolyFillType subjFillType = pftEvenOdd,
PolyFillType clipFillType = pftEvenOdd); PolyFillType clipFillType = pftEvenOdd);
void Clear(); void Clear();
bool ReverseSolution() {return m_ReverseOutput;}; bool ReverseSolution() {return m_ReverseOutput;};
void ReverseSolution(bool value) {m_ReverseOutput = value;}; void ReverseSolution(bool value) {m_ReverseOutput = value;};
...@@ -225,12 +258,12 @@ private: ...@@ -225,12 +258,12 @@ private:
Scanbeam *m_Scanbeam; Scanbeam *m_Scanbeam;
TEdge *m_ActiveEdges; TEdge *m_ActiveEdges;
TEdge *m_SortedEdges; TEdge *m_SortedEdges;
IntersectNode *m_IntersectNodes; IntersectNode *m_IntersectNodes;
bool m_ExecuteLocked; bool m_ExecuteLocked;
PolyFillType m_ClipFillType; PolyFillType m_ClipFillType;
PolyFillType m_SubjFillType; PolyFillType m_SubjFillType;
bool m_ReverseOutput; bool m_ReverseOutput;
bool m_UsingExPolygons; bool m_UsingPolyTree;
void DisposeScanbeamList(); void DisposeScanbeamList();
void SetWindingCount(TEdge& edge); void SetWindingCount(TEdge& edge);
bool IsEvenOddFillType(const TEdge& edge) const; bool IsEvenOddFillType(const TEdge& edge) const;
...@@ -269,13 +302,13 @@ private: ...@@ -269,13 +302,13 @@ private:
void ProcessIntersectList(); void ProcessIntersectList();
void ProcessEdgesAtTopOfScanbeam(const long64 topY); void ProcessEdgesAtTopOfScanbeam(const long64 topY);
void BuildResult(Polygons& polys); void BuildResult(Polygons& polys);
void BuildResultEx(ExPolygons& polys); void BuildResult2(PolyTree& polytree);
void SetHoleState(TEdge *e, OutRec *OutRec); void SetHoleState(TEdge *e, OutRec *OutRec);
void DisposeIntersectNodes(); void DisposeIntersectNodes();
bool FixupIntersections(); bool FixupIntersectionOrder();
void FixupOutPolygon(OutRec &outRec); void FixupOutPolygon(OutRec &outRec);
bool IsHole(TEdge *e); bool IsHole(TEdge *e);
void FixHoleLinkage(OutRec *outRec); void FixHoleLinkage(OutRec &outRec);
void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1); void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1);
void ClearJoins(); void ClearJoins();
void AddHorzJoin(TEdge *e, int idx); void AddHorzJoin(TEdge *e, int idx);
...@@ -283,6 +316,8 @@ private: ...@@ -283,6 +316,8 @@ private:
bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2); bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2);
void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx); void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx);
void JoinCommonEdges(); void JoinCommonEdges();
void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec);
void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec);
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
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