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/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -20,18 +20,17 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
upperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* optionsSizer;
optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Component") ), wxVERTICAL );
wxStaticBoxSizer* unitSizer;
unitSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Unit") ), wxVERTICAL );
m_staticTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnit->Wrap( -1 );
optionsSizer->Add( m_staticTextUnit, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString unitChoiceChoices[] = { _("1"), _("2"), _("3"), _("4"), _("5"), _("6"), _("7"), _("8"), _("9"), _("10"), _("11"), _("12"), _("13"), _("14"), _("15"), _("16"), _("17"), _("18"), _("19"), _("20"), _("21"), _("22"), _("23"), _("24"), _("25"), _("26") };
int unitChoiceNChoices = sizeof( unitChoiceChoices ) / sizeof( wxString );
unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceNChoices, unitChoiceChoices, 0 );
unitChoice->SetSelection( 0 );
unitSizer->Add( unitChoice, 0, wxALL|wxEXPAND, 5 );
optionsSizer->Add( unitSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
optionsSizer->Add( unitChoice, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* orientationSizer;
orientationSizer = new wxBoxSizer( wxHORIZONTAL );
......@@ -44,6 +43,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
orientationSizer->Add( orientationRadioBox, 1, wxALL|wxEXPAND, 8 );
optionsSizer->Add( orientationSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 );
wxBoxSizer* mirrorSizer;
......@@ -57,18 +57,18 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
mirrorSizer->Add( mirrorRadioBox, 1, wxALL, 8 );
optionsSizer->Add( mirrorSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 );
wxStaticBoxSizer* chipnameSizer;
chipnameSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Chip Name") ), wxHORIZONTAL );
m_staticTextChipname = new wxStaticText( this, wxID_ANY, _("Chip Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextChipname->Wrap( -1 );
optionsSizer->Add( m_staticTextChipname, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
chipnameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
chipnameTextCtrl->SetMaxLength( 32 );
chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") );
chipnameSizer->Add( chipnameTextCtrl, 1, wxALL|wxEXPAND, 5 );
optionsSizer->Add( chipnameSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 );
optionsSizer->Add( chipnameTextCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Convert"), wxDefaultPosition, wxDefaultSize, 0 );
convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") );
......@@ -84,6 +84,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
optionsSizer->Add( defaultsButton, 0, wxALL|wxEXPAND, 5 );
upperSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* fieldsSizer;
......@@ -112,45 +113,48 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
fieldsSizer->Add( gridStaticBoxSizer, 3, wxEXPAND|wxRIGHT|wxLEFT, 8 );
wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerOptions;
sbSizerOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Text Justification:") ), wxHORIZONTAL );
wxBoxSizer* bSizerJustification;
bSizerJustification = new wxBoxSizer( wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 0 );
sbSizerOptions->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 2 );
sbSizerOptions->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( sbSizerOptions, 0, wxEXPAND, 5 );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL );
fieldEditBoxSizer->Add( bSizerJustification, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerStyle;
bSizerStyle = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bShowRotateSizer;
bShowRotateSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 );
visibilitySizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 );
visibilitySizer->Add( rotateCheckBox, 0, wxALL, 5 );
visibilitySizer->Add( bShowRotateSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
bSizerStyle->Add( visibilitySizer, 1, wxEXPAND|wxALL, 5 );
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
......@@ -158,89 +162,101 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
m_StyleRadioBox->SetSelection( 3 );
m_StyleRadioBox->SetToolTip( _("The style of the currently selected field's text in the schemati") );
visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerStyle->Add( m_StyleRadioBox, 1, wxEXPAND|wxALL, 5 );
fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND|wxTOP, 5 );
fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 );
fieldNameLabel->Wrap( -1 );
fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 );
fieldNameBoxSizer->Add( fieldNameLabel, 0, wxTOP, 5 );
fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldNameTextCtrl->SetMaxLength( 0 );
fieldNameTextCtrl->SetToolTip( _("The name of the currently selected field\nSome fixed fields names are not editable") );
fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxEXPAND, 5 );
wxBoxSizer* fieldTextBoxSizer;
fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 );
fieldValueLabel->Wrap( -1 );
fieldTextBoxSizer->Add( fieldValueLabel, 0, 0, 5 );
fieldTextBoxSizer->Add( fieldValueLabel, 0, wxTOP, 5 );
fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldValueTextCtrl->SetMaxLength( 0 );
fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* textSizeBoxSizer;
textSizeBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxEXPAND, 5 );
wxFlexGridSizer* fgSizerPosSize;
fgSizerPosSize = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizerPosSize->AddGrowableCol( 1 );
fgSizerPosSize->SetFlexibleDirection( wxBOTH );
fgSizerPosSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size(\")"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel->Wrap( -1 );
textSizeBoxSizer->Add( textSizeLabel, 0, 0, 5 );
fgSizerPosSize->Add( textSizeLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
textSizeTextCtrl->SetMaxLength( 0 );
textSizeTextCtrl->SetToolTip( _("The size of the currently selected field's text in the schematic") );
textSizeBoxSizer->Add( textSizeTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( textSizeBoxSizer, 0, wxALL|wxEXPAND, 5 );
fgSizerPosSize->Add( textSizeTextCtrl, 0, wxEXPAND|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* positionBoxSizer;
positionBoxSizer = new wxBoxSizer( wxHORIZONTAL );
m_staticTextUnitSize = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitSize->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* posXBoxSizer;
posXBoxSizer = new wxBoxSizer( wxVERTICAL );
posXLabel = new wxStaticText( this, wxID_ANY, _("PosX(\")"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel = new wxStaticText( this, wxID_ANY, _("PosX"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel->Wrap( -1 );
posXBoxSizer->Add( posXLabel, 0, 0, 5 );
fgSizerPosSize->Add( posXLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posXTextCtrl->SetMaxLength( 0 );
posXTextCtrl->SetToolTip( _("The X coordinate of the text relative to the component") );
posXBoxSizer->Add( posXTextCtrl, 0, wxEXPAND, 5 );
positionBoxSizer->Add( posXBoxSizer, 1, wxALL|wxEXPAND, 5 );
fgSizerPosSize->Add( posXTextCtrl, 0, wxEXPAND|wxTOP|wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* posYBoxSizer;
posYBoxSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextUnitPosX = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosX->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
posYLabel = new wxStaticText( this, wxID_ANY, _("PosY(\")"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel = new wxStaticText( this, wxID_ANY, _("PosY"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel->Wrap( -1 );
posYBoxSizer->Add( posYLabel, 0, 0, 5 );
fgSizerPosSize->Add( posYLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posYTextCtrl->SetMaxLength( 0 );
posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") );
posYBoxSizer->Add( posYTextCtrl, 0, wxEXPAND, 5 );
fgSizerPosSize->Add( posYTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextUnitPosY = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosY->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
positionBoxSizer->Add( posYBoxSizer, 1, wxALL|wxEXPAND, 5 );
fieldEditBoxSizer->Add( positionBoxSizer, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP, 5 );
fieldsSizer->Add( fieldEditBoxSizer, 2, wxEXPAND, 5 );
upperSizer->Add( fieldsSizer, 1, wxALL|wxEXPAND, 5 );
mainSizer->Add( upperSizer, 1, wxEXPAND, 5 );
stdDialogButtonSizer = new wxStdDialogButtonSizer();
......@@ -249,8 +265,10 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel );
stdDialogButtonSizer->Realize();
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 );
this->SetSizer( mainSizer );
this->Layout();
......
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/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -12,18 +12,18 @@
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/choice.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/radiobox.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/listctrl.h>
#include <wx/dialog.h>
......@@ -38,9 +38,11 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
private:
protected:
wxStaticText* m_staticTextUnit;
wxChoice* unitChoice;
wxRadioBox* orientationRadioBox;
wxRadioBox* mirrorRadioBox;
wxStaticText* m_staticTextChipname;
wxTextCtrl* chipnameTextCtrl;
wxCheckBox* convertCheckBox;
wxStaticText* partsAreLockedLabel;
......@@ -60,10 +62,13 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
wxTextCtrl* fieldValueTextCtrl;
wxStaticText* textSizeLabel;
wxTextCtrl* textSizeTextCtrl;
wxStaticText* m_staticTextUnitSize;
wxStaticText* posXLabel;
wxTextCtrl* posXTextCtrl;
wxStaticText* m_staticTextUnitPosX;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStaticText* m_staticTextUnitPosY;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
......@@ -81,7 +86,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
public:
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 );
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();
};
......
......@@ -34,8 +34,8 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB : public DIALOG_EDIT_LIBENTRY_FIELDS_IN
/*****************************************************************************************/
{
private:
LIB_EDIT_FRAME* m_Parent;
LIB_COMPONENT* m_LibEntry;
LIB_EDIT_FRAME* m_parent;
LIB_COMPONENT* m_libEntry;
bool m_skipCopyFromPanel;
/// a copy of the edited component's LIB_FIELDs
......@@ -64,10 +64,10 @@ private:
int getSelectedFieldNdx();
/**
* Function InitBuffers
* Function initBuffers
* sets up to edit the given component.
*/
void InitBuffers();
void initBuffers();
/**
* Function findField
......@@ -133,8 +133,8 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( aParent )
/***********************************************************************/
{
m_Parent = aParent;
m_LibEntry = aLibEntry;
m_parent = aParent;
m_libEntry = aLibEntry;
GetSizer()->SetSizeHints( this );
Centre();
......@@ -163,20 +163,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event
columnLabel.SetText( _( "Value" ) );
fieldListCtrl->InsertColumn( COLUMN_TEXT, columnLabel );
wxString label = _( "Size" ) + ReturnUnitSymbol( g_UserUnit );
textSizeLabel->SetLabel( label );
m_staticTextUnitSize->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_staticTextUnitPosX->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_staticTextUnitPosY->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
label = _( "Pos " );
label += _( "X" );
label += ReturnUnitSymbol( g_UserUnit );
posXLabel->SetLabel( label );
label = _( "Pos " );
label += _( "Y" );
label += ReturnUnitSymbol( g_UserUnit );
posYLabel->SetLabel( label );
InitBuffers();
initBuffers();
copySelectedFieldToPanel();
stdDialogButtonSizerOK->SetDefault();
......@@ -237,7 +228,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
* or root alias of the component */
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;
msg.Printf( _( "A new name is entered for this component\n\
......@@ -249,7 +240,7 @@ An alias %s already exists!\nCannot update this component" ),
/* End unused code */
/* 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
// back into the component
......@@ -274,12 +265,12 @@ An alias %s already exists!\nCannot update this component" ),
#endif
// 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!
SetName( m_LibEntry->GetValueField().GetText() );
SetName( m_libEntry->GetValueField().GetText() );
m_Parent->OnModify();
m_parent->OnModify();
EndModal( 0 );
}
......@@ -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;
m_LibEntry->GetFields( cmpFields );
m_libEntry->GetFields( cmpFields );
#if defined(DEBUG)
for( unsigned i=0; i<cmpFields.size(); ++i )
......@@ -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
// template field editor UI.
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 )
{
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -16,39 +16,40 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* fieldsSizer;
fieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxHORIZONTAL );
wxBoxSizer* bSizerFieldsSetup;
bSizerFieldsSetup = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* gridStaticBoxSizer;
gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
wxBoxSizer* bSizerFiledsList;
bSizerFiledsList = new wxBoxSizer( wxVERTICAL );
fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
fieldListCtrl->SetMinSize( wxSize( 220,-1 ) );
gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 );
bSizerFiledsList->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 );
addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 );
addFieldButton->SetToolTip( _("Add a new custom field") );
gridStaticBoxSizer->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 );
bSizerFiledsList->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 );
deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 );
deleteFieldButton->SetToolTip( _("Delete one of the optional fields") );
gridStaticBoxSizer->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 );
bSizerFiledsList->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 );
moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
moveUpButton->SetToolTip( _("Move the selected optional fields up one position") );
gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
bSizerFiledsList->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
fieldsSizer->Add( gridStaticBoxSizer, 5, wxEXPAND|wxRIGHT, 8 );
bSizerFieldsSetup->Add( bSizerFiledsList, 1, wxEXPAND, 5 );
wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* optionsSizer;
optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Text Justification:") ), wxHORIZONTAL );
wxBoxSizer* bSizerJustify;
bSizerJustify = new wxBoxSizer( wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
......@@ -56,7 +57,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
m_FieldHJustifyCtrl->SetSelection( 1 );
m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") );
optionsSizer->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 8 );
bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
......@@ -64,35 +65,38 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
m_FieldVJustifyCtrl->SetSelection( 0 );
m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
optionsSizer->Add( m_FieldVJustifyCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 8 );
bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fieldEditBoxSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxEXPAND|wxBOTTOM, 5 );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL );
fieldEditBoxSizer->Add( bSizerJustify, 0, wxEXPAND, 5 );
wxBoxSizer* bShowRotateSizer;
bShowRotateSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerAspect;
bSizerAspect = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 );
visibilitySizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 );
visibilitySizer->Add( rotateCheckBox, 0, wxALL, 5 );
visibilitySizer->Add( bShowRotateSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
bSizerAspect->Add( visibilitySizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 1 );
visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_StyleRadioBox->SetSelection( 0 );
bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( bSizerAspect, 0, wxEXPAND, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
......@@ -102,10 +106,12 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 );
fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldNameTextCtrl->SetMaxLength( 0 );
fieldNameTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* fieldTextBoxSizer;
......@@ -116,60 +122,71 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
fieldTextBoxSizer->Add( fieldValueLabel, 0, 0, 5 );
fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldValueTextCtrl->SetMaxLength( 0 );
fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* textSizeBoxSizer;
textSizeBoxSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizerPosSize;
fgSizerPosSize = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizerPosSize->AddGrowableCol( 1 );
fgSizerPosSize->SetFlexibleDirection( wxBOTH );
fgSizerPosSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size(\")"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel->Wrap( -1 );
textSizeBoxSizer->Add( textSizeLabel, 0, 0, 5 );
fgSizerPosSize->Add( textSizeLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
textSizeTextCtrl->SetMaxLength( 0 );
textSizeTextCtrl->SetToolTip( _("The vertical height of the currently selected field's text in the schematic") );
textSizeBoxSizer->Add( textSizeTextCtrl, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( textSizeBoxSizer, 0, wxALL|wxEXPAND, 5 );
fgSizerPosSize->Add( textSizeTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
wxBoxSizer* positionBoxSizer;
positionBoxSizer = new wxBoxSizer( wxHORIZONTAL );
m_staticTextUnitSize = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitSize->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* posXBoxSizer;
posXBoxSizer = new wxBoxSizer( wxVERTICAL );
posXLabel = new wxStaticText( this, wxID_ANY, _("PosX(\")"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel = new wxStaticText( this, wxID_ANY, _("PosX"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel->Wrap( -1 );
posXBoxSizer->Add( posXLabel, 0, 0, 5 );
fgSizerPosSize->Add( posXLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posXBoxSizer->Add( posXTextCtrl, 0, wxEXPAND, 5 );
positionBoxSizer->Add( posXBoxSizer, 1, wxALL|wxEXPAND, 5 );
posXTextCtrl->SetMaxLength( 0 );
fgSizerPosSize->Add( posXTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
wxBoxSizer* posYBoxSizer;
posYBoxSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextUnitPosX = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosX->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
posYLabel = new wxStaticText( this, wxID_ANY, _("PosY(\")"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel = new wxStaticText( this, wxID_ANY, _("PosY"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel->Wrap( -1 );
posYBoxSizer->Add( posYLabel, 0, 0, 5 );
fgSizerPosSize->Add( posYLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posYTextCtrl->SetMaxLength( 0 );
posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") );
posYBoxSizer->Add( posYTextCtrl, 0, wxEXPAND, 5 );
fgSizerPosSize->Add( posYTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextUnitPosY = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosY->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
positionBoxSizer->Add( posYBoxSizer, 1, wxALL|wxEXPAND, 5 );
fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
fieldEditBoxSizer->Add( positionBoxSizer, 1, wxEXPAND, 5 );
fieldsSizer->Add( fieldEditBoxSizer, 3, wxEXPAND, 5 );
bSizerFieldsSetup->Add( fieldEditBoxSizer, 0, wxEXPAND, 5 );
mainSizer->Add( fieldsSizer, 1, wxEXPAND|wxALL, 5 );
mainSizer->Add( bSizerFieldsSetup, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
stdDialogButtonSizer = new wxStdDialogButtonSizer();
stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
......@@ -177,8 +194,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel );
stdDialogButtonSizer->Realize();
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 );
this->SetSizer( mainSizer );
this->Layout();
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<FileVersion major="1" minor="11" />
<object class="Project" expanded="1">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">ANSI</property>
......@@ -19,66 +20,33 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_managed">0</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center"></property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">615,550</property>
<property name="size">615,456</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass"></property>
<property name="title">Fields Properties</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -125,28 +93,22 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Fields</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">fieldsSizer</property>
<property name="name">bSizerFieldsSetup</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">8</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">5</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label"></property>
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">gridStaticBoxSizer</property>
<property name="name">bSizerFiledsList</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">8</property>
<property name="flag">wxALL|wxEXPAND</property>
......@@ -156,7 +118,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -176,7 +141,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -191,9 +155,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES</property>
......@@ -261,7 +223,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -283,7 +248,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add Field</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -298,9 +262,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -349,7 +311,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -371,7 +336,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Delete Field</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -386,9 +350,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -437,7 +399,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -459,7 +424,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Move Up</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -474,9 +438,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -521,7 +483,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">3</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">fieldEditBoxSizer</property>
......@@ -529,18 +491,15 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_TOP|wxEXPAND|wxBOTTOM</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Text Justification:</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">optionsSizer</property>
<property name="name">bSizerJustify</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">8</property>
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
......@@ -548,7 +507,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -570,7 +532,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Horiz. Justify</property>
<property name="layer"></property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
......@@ -586,9 +547,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="selection">1</property>
<property name="show">1</property>
<property name="size"></property>
......@@ -630,15 +589,18 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">8</property>
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -660,7 +622,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Vert. Justify</property>
<property name="layer"></property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
......@@ -676,9 +637,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
......@@ -725,23 +684,23 @@
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Visibility</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">visibilitySizer</property>
<property name="name">bSizerAspect</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Visibility</property>
<property name="minimum_size"></property>
<property name="name">bShowRotateSizer</property>
<property name="name">visibilitySizer</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</property>
......@@ -751,7 +710,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -773,7 +735,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -788,9 +749,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -839,7 +798,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -861,7 +823,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Rotate</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -876,9 +837,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -929,7 +888,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -951,7 +913,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Style:</property>
<property name="layer"></property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
......@@ -967,10 +928,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="selection">1</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
......@@ -1030,7 +989,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1051,7 +1013,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Field Name</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1066,19 +1027,13 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -1117,7 +1072,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1137,7 +1095,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1153,9 +1110,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1219,7 +1174,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1240,7 +1198,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Field Value</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1255,19 +1212,13 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -1306,7 +1257,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1326,7 +1280,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1342,9 +1295,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1392,23 +1343,33 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">textSizeBoxSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="name">fgSizerPosSize</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">3</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1428,8 +1389,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Size(&quot;)</property>
<property name="layer"></property>
<property name="label">Size</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1444,19 +1404,13 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -1488,14 +1442,17 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1515,7 +1472,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1531,9 +1487,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1577,36 +1531,102 @@
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">positionBoxSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">unit</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="name">posXBoxSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<property name="moveable">1</property>
<property name="name">m_staticTextUnitSize</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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"></property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1626,8 +1646,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">PosX(&quot;)</property>
<property name="layer"></property>
<property name="label">PosX</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1642,19 +1661,13 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -1686,14 +1699,17 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1713,7 +1729,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1729,9 +1744,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1775,27 +1788,102 @@
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">unit</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="name">posYBoxSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<property name="moveable">1</property>
<property name="name">m_staticTextUnitPosX</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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"></property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1815,8 +1903,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">PosY(&quot;)</property>
<property name="layer"></property>
<property name="label">PosY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1831,19 +1918,13 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -1875,14 +1956,17 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
......@@ -1902,7 +1986,6 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1918,9 +2001,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -1964,12 +2045,174 @@
<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="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">unit</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextUnitPosY</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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="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">
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -12,18 +12,19 @@
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/listctrl.h>
#include <wx/string.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
......@@ -52,10 +53,14 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog
wxTextCtrl* fieldValueTextCtrl;
wxStaticText* textSizeLabel;
wxTextCtrl* textSizeTextCtrl;
wxStaticText* m_staticTextUnitSize;
wxStaticText* posXLabel;
wxTextCtrl* posXTextCtrl;
wxStaticText* m_staticTextUnitPosX;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStaticText* m_staticTextUnitPosY;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
......@@ -73,7 +78,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog
public:
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 );
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();
};
......
/*******************************************************************************
* *
* Author : Angus Johnson *
* Version : 5.0.3 *
* Date : 12 January 2013 *
* Version : 5.1.4 *
* Date : 24 March 2013 *
* Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2013 *
* *
......@@ -26,7 +26,7 @@
* Paper no. DETC2005-85513 pp. 565-575 *
* ASME 2005 International Design Engineering Technical Conferences *
* 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 *
* *
*******************************************************************************/
......@@ -63,8 +63,90 @@ inline long64 Abs(long64 val)
{
return val < 0 ? -val : val;
}
//------------------------------------------------------------------------------
// PolyTree methods ...
//------------------------------------------------------------------------------
void PolyTree::Clear()
{
for (PolyNodes::size_type i = 0; i < AllNodes.size(); ++i)
delete AllNodes[i];
AllNodes.resize(0);
Childs.resize(0);
}
//------------------------------------------------------------------------------
PolyNode* PolyTree::GetFirst() const
{
if (Childs.size() > 0)
return Childs[0];
else
return 0;
}
//------------------------------------------------------------------------------
int PolyTree::Total() const
{
return AllNodes.size();
}
//------------------------------------------------------------------------------
// PolyNode methods ...
//------------------------------------------------------------------------------
PolyNode::PolyNode(): Childs(), Parent(0), Index(0)
{
}
//------------------------------------------------------------------------------
int PolyNode::ChildCount() const
{
return Childs.size();
}
//------------------------------------------------------------------------------
void PolyNode::AddChild(PolyNode& child)
{
unsigned cnt = Childs.size();
Childs.push_back(&child);
child.Parent = this;
child.Index = cnt;
}
//------------------------------------------------------------------------------
PolyNode* PolyNode::GetNext() const
{
if (Childs.size() > 0)
return Childs[0];
else
return GetNextSiblingUp();
}
//------------------------------------------------------------------------------
PolyNode* PolyNode::GetNextSiblingUp() const
{
if (!Parent) //protects against PolyTree.GetNextSiblingUp()
return 0;
else if (Index == Parent->Childs.size() - 1)
return Parent->GetNextSiblingUp();
else
return Parent->Childs[Index + 1];
}
//------------------------------------------------------------------------------
bool PolyNode::IsHole() const
{
bool result = true;
PolyNode* node = Parent;
while (node)
{
result = !result;
node = node->Parent;
}
return result;
}
//------------------------------------------------------------------------------
// Int128 class (enables safe math on signed 64bit integers)
// eg Int128 val1((long64)9223372036854775807); //ie 2^63 -1
......@@ -77,8 +159,8 @@ class Int128
{
public:
long64 hi;
ulong64 lo;
long64 hi;
Int128(long64 _lo = 0)
{
......@@ -86,9 +168,10 @@ class Int128
if (_lo < 0) hi = -1; else hi = 0;
}
Int128(const Int128 &val): hi(val.hi), lo(val.lo){}
Int128(const long64& _hi, const ulong64& _lo): hi(_hi), lo(_lo){}
Int128(const Int128 &val): lo(val.lo), hi(val.hi){}
Int128(const long64& _hi, const ulong64& _lo): lo(_lo), hi(_hi){}
long64 operator = (const long64 &val)
{
......@@ -423,7 +506,7 @@ void SetDx(TEdge &e)
e.deltaY = (e.ytop - e.ybot);
if (e.deltaY == 0) e.dx = HORIZONTAL;
else e.dx = (double)(e.deltaX) / (e.deltaY);
else e.dx = (double)(e.deltaX) / e.deltaY;
}
//---------------------------------------------------------------------------
......@@ -460,14 +543,18 @@ bool IntersectPoint(TEdge &edge1, TEdge &edge2,
IntPoint &ip, bool UseFullInt64Range)
{
double b1, b2;
if (SlopesEqual(edge1, edge2, UseFullInt64Range)) return false;
if (SlopesEqual(edge1, edge2, UseFullInt64Range))
{
if (edge2.ybot > edge1.ybot) ip.Y = edge2.ybot;
else ip.Y = edge1.ybot;
return false;
}
else if (NEAR_ZERO(edge1.dx))
{
ip.X = edge1.xbot;
if (NEAR_EQUAL(edge2.dx, HORIZONTAL))
{
ip.Y = edge2.ybot;
} else
else
{
b2 = edge2.ybot - (edge2.xbot / edge2.dx);
ip.Y = Round(ip.X / edge2.dx + b2);
......@@ -477,14 +564,14 @@ bool IntersectPoint(TEdge &edge1, TEdge &edge2,
{
ip.X = edge2.xbot;
if (NEAR_EQUAL(edge1.dx, HORIZONTAL))
{
ip.Y = edge1.ybot;
} else
else
{
b1 = edge1.ybot - (edge1.xbot / edge1.dx);
ip.Y = Round(ip.X / edge1.dx + b1);
}
} else
}
else
{
b1 = edge1.xbot - edge1.ybot * edge1.dx;
b2 = edge2.xbot - edge2.ybot * edge2.dx;
......@@ -503,7 +590,8 @@ bool IntersectPoint(TEdge &edge1, TEdge &edge2,
ip.X = edge1.xtop;
ip.Y = edge1.ytop;
return TopX(edge2, edge1.ytop) < edge1.xtop;
} else
}
else
{
ip.X = edge2.xtop;
ip.Y = edge2.ytop;
......@@ -670,7 +758,8 @@ OutPt* GetBottomPt(OutPt *pp)
}
//------------------------------------------------------------------------------
bool FindSegment(OutPt* &pp, IntPoint &pt1, IntPoint &pt2)
bool FindSegment(OutPt* &pp, bool UseFullInt64Range,
IntPoint &pt1, IntPoint &pt2)
{
//outPt1 & outPt2 => the overlap segment (if the function returns true)
if (!pp) return false;
......@@ -678,8 +767,8 @@ bool FindSegment(OutPt* &pp, IntPoint &pt1, IntPoint &pt2)
IntPoint pt1a = pt1, pt2a = pt2;
do
{
if (SlopesEqual(pt1a, pt2a, pp->pt, pp->prev->pt, true) &&
SlopesEqual(pt1a, pt2a, pp->pt, true) &&
if (SlopesEqual(pt1a, pt2a, pp->pt, pp->prev->pt, UseFullInt64Range) &&
SlopesEqual(pt1a, pt2a, pp->pt, UseFullInt64Range) &&
GetOverlapSegment(pt1a, pt2a, pp->pt, pp->prev->pt, pt1, pt2))
return true;
pp = pp->next;
......@@ -1081,7 +1170,7 @@ bool Clipper::Execute(ClipType clipType, Polygons &solution,
m_SubjFillType = subjFillType;
m_ClipFillType = clipFillType;
m_ClipType = clipType;
m_UsingExPolygons = false;
m_UsingPolyTree = false;
bool succeeded = ExecuteInternal();
if (succeeded) BuildResult(solution);
m_ExecuteLocked = false;
......@@ -1089,79 +1178,34 @@ bool Clipper::Execute(ClipType clipType, Polygons &solution,
}
//------------------------------------------------------------------------------
bool Clipper::Execute(ClipType clipType, ExPolygons &solution,
bool Clipper::Execute(ClipType clipType, PolyTree& polytree,
PolyFillType subjFillType, PolyFillType clipFillType)
{
if( m_ExecuteLocked ) return false;
m_ExecuteLocked = true;
solution.resize(0);
m_SubjFillType = subjFillType;
m_ClipFillType = clipFillType;
m_ClipType = clipType;
m_UsingExPolygons = true;
m_UsingPolyTree = true;
bool succeeded = ExecuteInternal();
if (succeeded) BuildResultEx(solution);
if (succeeded) BuildResult2(polytree);
m_ExecuteLocked = false;
return succeeded;
}
//------------------------------------------------------------------------------
bool PolySort(OutRec *or1, OutRec *or2)
{
if (or1 == or2) return false;
if (!or1->pts || !or2->pts)
{
if (or1->pts != or2->pts)
{
return or1->pts ? true : false;
}
else return false;
}
int i1, i2;
if (or1->isHole)
i1 = or1->FirstLeft->idx; else
i1 = or1->idx;
if (or2->isHole)
i2 = or2->FirstLeft->idx; else
i2 = or2->idx;
int result = i1 - i2;
if (result == 0 && (or1->isHole != or2->isHole))
{
return or1->isHole ? false : true;
}
else return result < 0;
}
//------------------------------------------------------------------------------
OutRec* FindAppendLinkEnd(OutRec *outRec)
{
while (outRec->AppendLink) outRec = outRec->AppendLink;
return outRec;
}
//------------------------------------------------------------------------------
void Clipper::FixHoleLinkage(OutRec *outRec)
void Clipper::FixHoleLinkage(OutRec &outRec)
{
OutRec *tmp;
if (outRec->bottomPt)
tmp = m_PolyOuts[outRec->bottomPt->idx]->FirstLeft;
else
tmp = outRec->FirstLeft;
if (outRec == tmp) throw clipperException("HoleLinkage error");
//skip OutRecs that (a) contain outermost polygons or
//(b) already have the correct owner/child linkage ...
if (!outRec.FirstLeft ||
(outRec.isHole != outRec.FirstLeft->isHole &&
outRec.FirstLeft->pts)) return;
if (tmp)
{
if (tmp->AppendLink) tmp = FindAppendLinkEnd(tmp);
if (tmp == outRec) tmp = 0;
else if (tmp->isHole)
{
FixHoleLinkage(tmp);
tmp = tmp->FirstLeft;
}
}
outRec->FirstLeft = tmp;
if (!tmp) outRec->isHole = false;
outRec->AppendLink = 0;
OutRec* orfl = outRec.FirstLeft;
while (orfl && ((orfl->isHole == outRec.isHole) || !orfl->pts))
orfl = orfl->FirstLeft;
outRec.FirstLeft = orfl;
}
//------------------------------------------------------------------------------
......@@ -1196,15 +1240,12 @@ bool Clipper::ExecuteInternal()
if (!outRec->pts) continue;
FixupOutPolygon(*outRec);
if (!outRec->pts) continue;
if (outRec->isHole && m_UsingExPolygons) FixHoleLinkage(outRec);
if ((outRec->isHole ^ m_ReverseOutput) == (Area(*outRec, m_UseFullRange) > 0))
ReversePolyPtLinks(outRec->pts);
}
if (m_Joins.size() > 0) JoinCommonEdges();
if (m_UsingExPolygons)
std::sort(m_PolyOuts.begin(), m_PolyOuts.end(), PolySort);
}
ClearJoins();
......@@ -1493,14 +1534,10 @@ void Clipper::CopyAELToSEL()
{
TEdge* e = m_ActiveEdges;
m_SortedEdges = e;
if (!m_ActiveEdges) return;
m_SortedEdges->prevInSEL = 0;
e = e->nextInAEL;
while ( e )
{
e->prevInSEL = e->prevInAEL;
e->prevInSEL->nextInSEL = e;
e->nextInSEL = 0;
e->nextInSEL = e->nextInAEL;
e = e->nextInAEL;
}
}
......@@ -1585,9 +1622,7 @@ void Clipper::InsertLocalMinimaIntoAEL(const long64 botY)
AddLocalMinPoly( lb, rb, IntPoint(lb->xcurr, m_CurrentLM->Y) );
//if any output polygons share an edge, they'll need joining later ...
if (rb->outIdx >= 0)
{
if (NEAR_EQUAL(rb->dx, HORIZONTAL))
if (rb->outIdx >= 0 && NEAR_EQUAL(rb->dx, HORIZONTAL))
{
for (HorzJoinList::size_type i = 0; i < m_HorizJoins.size(); ++i)
{
......@@ -1601,7 +1636,6 @@ void Clipper::InsertLocalMinimaIntoAEL(const long64 botY)
AddJoin(hj->edge, rb, hj->savedIdx);
}
}
}
if( lb->nextInAEL != rb )
{
......@@ -1732,17 +1766,11 @@ void Clipper::IntersectEdges(TEdge *e1, TEdge *e2,
}
else if ( e1Contributing )
{
if ((e2Wc == 0 || e2Wc == 1) &&
(m_ClipType != ctIntersection ||
e2->polyType == ptSubject || (e2->windCnt2 != 0)))
DoEdge1(e1, e2, pt);
if (e2Wc == 0 || e2Wc == 1) DoEdge1(e1, e2, pt);
}
else if ( e2contributing )
{
if ((e1Wc == 0 || e1Wc == 1) &&
(m_ClipType != ctIntersection ||
e1->polyType == ptSubject || (e1->windCnt2 != 0)))
DoEdge2(e1, e2, pt);
if (e1Wc == 0 || e1Wc == 1) DoEdge2(e1, e2, pt);
}
else if ( (e1Wc == 0 || e1Wc == 1) &&
(e2Wc == 0 || e2Wc == 1) && !e1stops && !e2stops )
......@@ -1918,7 +1946,9 @@ void Clipper::AppendPolygon(TEdge *e1, TEdge *e2)
}
outRec2->pts = 0;
outRec2->bottomPt = 0;
outRec2->AppendLink = outRec1;
outRec2->FirstLeft = outRec1;
int OKIdx = e1->outIdx;
int ObsoleteIdx = e2->outIdx;
......@@ -1957,9 +1987,9 @@ OutRec* Clipper::CreateOutRec()
OutRec* result = new OutRec;
result->isHole = false;
result->FirstLeft = 0;
result->AppendLink = 0;
result->pts = 0;
result->bottomPt = 0;
result->polyNode = 0;
return result;
}
//------------------------------------------------------------------------------
......@@ -2056,9 +2086,6 @@ TEdge *GetMaximaPair(TEdge *e)
void Clipper::SwapPositionsInAEL(TEdge *edge1, TEdge *edge2)
{
if( !edge1->nextInAEL && !edge1->prevInAEL ) return;
if( !edge2->nextInAEL && !edge2->prevInAEL ) return;
if( edge1->nextInAEL == edge2 )
{
TEdge* next = edge2->nextInAEL;
......@@ -2176,13 +2203,6 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
TEdge* e = GetNextInAEL( horzEdge , dir );
while( e )
{
TEdge* eNext = GetNextInAEL( e, dir );
if (eMaxPair ||
((dir == dLeftToRight) && (e->xcurr <= horzRight)) ||
((dir == dRightToLeft) && (e->xcurr >= horzLeft)))
{
//ok, so far it looks like we're still in range of the horizontal edge
if ( e->xcurr == horzEdge->xtop && !eMaxPair )
{
if (SlopesEqual(*e, *horzEdge->nextInLML, m_UseFullRange))
......@@ -2198,6 +2218,13 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
break;
}
TEdge* eNext = GetNextInAEL( e, dir );
if (eMaxPair ||
((dir == dLeftToRight) && (e->xcurr < horzRight)) ||
((dir == dRightToLeft) && (e->xcurr > horzLeft)))
{
//so far we're still in range of the horizontal edge
if( e == eMaxPair )
{
//horzEdge is evidently a maxima horizontal and we've arrived at its end.
......@@ -2233,8 +2260,8 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
}
SwapPositionsInAEL( horzEdge, e );
}
else if( (dir == dLeftToRight && e->xcurr > horzRight && m_SortedEdges) ||
(dir == dRightToLeft && e->xcurr < horzLeft && m_SortedEdges) ) break;
else if( (dir == dLeftToRight && e->xcurr >= horzRight) ||
(dir == dRightToLeft && e->xcurr <= horzLeft) ) break;
e = eNext;
} //end while
......@@ -2283,7 +2310,7 @@ bool Clipper::ProcessIntersections(const long64 botY, const long64 topY)
try {
BuildIntersectList(botY, topY);
if ( !m_IntersectNodes) return true;
if ( FixupIntersections() ) ProcessIntersectList();
if ( FixupIntersectionOrder() ) ProcessIntersectList();
else return false;
}
catch(...) {
......@@ -2312,16 +2339,12 @@ void Clipper::BuildIntersectList(const long64 botY, const long64 topY)
//prepare for sorting ...
TEdge* e = m_ActiveEdges;
e->tmpX = TopX( *e, topY );
m_SortedEdges = e;
m_SortedEdges->prevInSEL = 0;
e = e->nextInAEL;
while( e )
{
e->prevInSEL = e->prevInAEL;
e->prevInSEL->nextInSEL = e;
e->nextInSEL = 0;
e->tmpX = TopX( *e, topY );
e->nextInSEL = e->nextInAEL;
e->xcurr = TopX( *e, topY );
e = e->nextInAEL;
}
......@@ -2335,9 +2358,10 @@ void Clipper::BuildIntersectList(const long64 botY, const long64 topY)
{
TEdge *eNext = e->nextInSEL;
IntPoint pt;
if(e->tmpX > eNext->tmpX &&
IntersectPoint(*e, *eNext, pt, m_UseFullRange))
if(e->xcurr > eNext->xcurr)
{
if (!IntersectPoint(*e, *eNext, pt, m_UseFullRange) && e->xcurr > eNext->xcurr +1)
throw clipperException("Intersection error");
if (pt.Y > botY)
{
pt.Y = botY;
......@@ -2427,7 +2451,8 @@ void Clipper::DoMaxima(TEdge *e, long64 topY)
{
if (!eNext) throw clipperException("DoMaxima error");
IntersectEdges( e, eNext, IntPoint(X, topY), ipBoth );
eNext = eNext->nextInAEL;
SwapPositionsInAEL(e, eNext);
eNext = e->nextInAEL;
}
if( e->outIdx < 0 && eMaxPair->outIdx < 0 )
{
......@@ -2575,61 +2600,77 @@ void Clipper::FixupOutPolygon(OutRec &outRec)
void Clipper::BuildResult(Polygons &polys)
{
int k = 0;
polys.resize(m_PolyOuts.size());
polys.reserve(m_PolyOuts.size());
for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
{
if (m_PolyOuts[i]->pts)
{
Polygon* pg = &polys[k];
pg->clear();
Polygon pg;
OutPt* p = m_PolyOuts[i]->pts;
do
{
pg->push_back(p->pt);
pg.push_back(p->pt);
p = p->prev;
} while (p != m_PolyOuts[i]->pts);
//make sure each polygon has at least 3 vertices ...
if (pg->size() < 3) pg->clear(); else k++;
if (pg.size() > 2)
polys.push_back(pg);
}
}
polys.resize(k);
}
//------------------------------------------------------------------------------
void Clipper::BuildResultEx(ExPolygons &polys)
int PointCount(OutPt *pts)
{
PolyOutList::size_type i = 0;
int k = 0;
polys.resize(0);
polys.reserve(m_PolyOuts.size());
while (i < m_PolyOuts.size() && m_PolyOuts[i]->pts)
if (!pts) return 0;
int result = 0;
OutPt* p = pts;
do
{
ExPolygon epg;
OutPt* p = m_PolyOuts[i]->pts;
do {
epg.outer.push_back(p->pt);
p = p->prev;
} while (p != m_PolyOuts[i]->pts);
i++;
//make sure polygons have at least 3 vertices ...
if (epg.outer.size() < 3) continue;
while (i < m_PolyOuts.size()
&& m_PolyOuts[i]->pts && m_PolyOuts[i]->isHole)
result++;
p = p->next;
}
while (p != pts);
return result;
}
//------------------------------------------------------------------------------
void Clipper::BuildResult2(PolyTree& polytree)
{
polytree.Clear();
polytree.AllNodes.reserve(m_PolyOuts.size());
//add each output polygon/contour to polytree ...
for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++)
{
Polygon pg;
p = m_PolyOuts[i]->pts;
do {
pg.push_back(p->pt);
p = p->prev;
} while (p != m_PolyOuts[i]->pts);
epg.holes.push_back(pg);
i++;
OutRec* outRec = m_PolyOuts[i];
int cnt = PointCount(outRec->pts);
if (cnt < 3) continue;
FixHoleLinkage(*outRec);
PolyNode* pn = new PolyNode();
//nb: polytree takes ownership of all the PolyNodes
polytree.AllNodes.push_back(pn);
outRec->polyNode = pn;
pn->Parent = 0;
pn->Index = 0;
pn->Contour.reserve(cnt);
OutPt *op = outRec->pts;
for (int j = 0; j < cnt; j++)
{
pn->Contour.push_back(op->pt);
op = op->prev;
}
polys.push_back(epg);
k++;
}
polys.resize(k);
//fixup PolyNode links etc ...
polytree.Childs.reserve(m_PolyOuts.size());
for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++)
{
OutRec* outRec = m_PolyOuts[i];
if (!outRec->polyNode) continue;
if (outRec->FirstLeft)
outRec->FirstLeft->polyNode->AddChild(*outRec->polyNode);
else
polytree.AddChild(*outRec->polyNode);
}
}
//------------------------------------------------------------------------------
......@@ -2649,7 +2690,7 @@ void SwapIntersectNodes(IntersectNode &int1, IntersectNode &int2)
}
//------------------------------------------------------------------------------
bool Clipper::FixupIntersections()
bool Clipper::FixupIntersectionOrder()
{
if ( !m_IntersectNodes->next ) return true;
......@@ -2664,8 +2705,8 @@ bool Clipper::FixupIntersections()
else if (e1->nextInSEL == int1->edge2) e2 = e1->nextInSEL;
else
{
//The current intersection is out of order, so try and swap it with
//a subsequent intersection ...
//The current intersection (Int1) is out of order (since it doesn't
//contain adjacent edges), so swap it with a subsequent intersection ...
while (int2)
{
if (int2->edge1->nextInSEL == int2->edge2 ||
......@@ -2674,7 +2715,8 @@ bool Clipper::FixupIntersections()
}
if ( !int2 ) return false; //oops!!!
//found an intersect node that can be swapped ...
//found an intersect node (Int2) that does contain adjacent edges,
//so prepare to process it before Int1 ...
SwapIntersectNodes(*int1, *int2);
e1 = int1->edge1;
e2 = int1->edge2;
......@@ -2758,15 +2800,16 @@ bool Clipper::JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2)
OutPt *pp2a = outRec2->pts;
IntPoint pt1 = j->pt2a, pt2 = j->pt2b;
IntPoint pt3 = j->pt1a, pt4 = j->pt1b;
if (!FindSegment(pp1a, pt1, pt2)) return false;
if (!FindSegment(pp1a, m_UseFullRange, pt1, pt2)) return false;
if (outRec1 == outRec2)
{
//we're searching the same polygon for overlapping segments so
//segment 2 mustn't be the same as segment 1 ...
pp2a = pp1a->next;
if (!FindSegment(pp2a, pt3, pt4) || (pp2a == pp1a)) return false;
if (!FindSegment(pp2a, m_UseFullRange, pt3, pt4) || (pp2a == pp1a))
return false;
}
else if (!FindSegment(pp2a, pt3, pt4)) return false;
else if (!FindSegment(pp2a, m_UseFullRange, pt3, pt4)) return false;
if (!GetOverlapSegment(pt1, pt2, pt3, pt4, pt1, pt2)) return false;
......@@ -2833,17 +2876,76 @@ void Clipper::FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx)
}
//----------------------------------------------------------------------
bool Poly2ContainsPoly1(OutPt* outPt1, OutPt* outPt2, bool UseFullInt64Range)
{
//find the first pt in outPt1 that isn't also a vertex of outPt2 ...
OutPt* outPt = outPt1;
do
{
if (!PointIsVertex(outPt->pt, outPt2)) break;
outPt = outPt->next;
}
while (outPt != outPt1);
bool result;
//sometimes a point on one polygon can be touching the other polygon
//so to be totally confident outPt1 is inside outPt2 repeat ...
do
{
result = PointInPolygon(outPt->pt, outPt2, UseFullInt64Range);
outPt = outPt->next;
}
while (result && outPt != outPt1);
return result;
}
//----------------------------------------------------------------------
void Clipper::FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec)
{
for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
{
OutRec* outRec = m_PolyOuts[i];
if (outRec->pts && outRec->FirstLeft == OldOutRec)
{
if (Poly2ContainsPoly1(outRec->pts, NewOutRec->pts, m_UseFullRange))
outRec->FirstLeft = NewOutRec;
}
}
}
//----------------------------------------------------------------------
void Clipper::FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec)
{
for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
{
OutRec* outRec = m_PolyOuts[i];
if (outRec->FirstLeft == OldOutRec) outRec->FirstLeft = NewOutRec;
}
}
//----------------------------------------------------------------------
void Clipper::JoinCommonEdges()
{
for (JoinList::size_type i = 0; i < m_Joins.size(); i++)
{
JoinRec* j = m_Joins[i];
OutPt *p1, *p2;
if (!JoinPoints(j, p1, p2)) continue;
OutRec *outRec1 = m_PolyOuts[j->poly1Idx];
OutRec *outRec2 = m_PolyOuts[j->poly2Idx];
if (!outRec1->pts || !outRec2->pts) continue;
//get the polygon fragment with the correct hole state (FirstLeft)
//before calling JoinPoints() ...
OutRec *holeStateRec;
if (outRec1 == outRec2) holeStateRec = outRec1;
else if (Param1RightOfParam2(outRec1, outRec2)) holeStateRec = outRec2;
else if (Param1RightOfParam2(outRec2, outRec1)) holeStateRec = outRec1;
else holeStateRec = GetLowermostRec(outRec1, outRec2);
OutPt *p1, *p2;
if (!JoinPoints(j, p1, p2)) continue;
if (outRec1 == outRec2)
{
//instead of joining two polygons, we've just created a new one by
......@@ -2859,13 +2961,17 @@ void Clipper::JoinCommonEdges()
outRec2->bottomPt = outRec2->pts;
outRec2->bottomPt->idx = outRec2->idx;
if (PointInPolygon(outRec2->pts->pt, outRec1->pts, m_UseFullRange))
if (Poly2ContainsPoly1(outRec2->pts, outRec1->pts, m_UseFullRange))
{
//outRec2 is contained by outRec1 ...
outRec2->isHole = !outRec1->isHole;
outRec2->FirstLeft = outRec1;
FixupJoinRecs(j, p2, i+1);
//fixup FirstLeft pointers that may need reassigning to OutRec1
if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1);
FixupOutPolygon(*outRec1); //nb: do this BEFORE testing orientation
FixupOutPolygon(*outRec2); // but AFTER calling FixupJoinRecs()
......@@ -2873,7 +2979,7 @@ void Clipper::JoinCommonEdges()
if ((outRec2->isHole ^ m_ReverseOutput) == (Area(*outRec2, m_UseFullRange) > 0))
ReversePolyPtLinks(outRec2->pts);
} else if (PointInPolygon(outRec1->pts->pt, outRec2->pts, m_UseFullRange))
} else if (Poly2ContainsPoly1(outRec1->pts, outRec2->pts, m_UseFullRange))
{
//outRec1 is contained by outRec2 ...
outRec2->isHole = outRec1->isHole;
......@@ -2882,19 +2988,15 @@ void Clipper::JoinCommonEdges()
outRec1->FirstLeft = outRec2;
FixupJoinRecs(j, p2, i+1);
//fixup FirstLeft pointers that may need reassigning to OutRec1
if (m_UsingPolyTree) FixupFirstLefts2(outRec1, outRec2);
FixupOutPolygon(*outRec1); //nb: do this BEFORE testing orientation
FixupOutPolygon(*outRec2); // but AFTER calling FixupJoinRecs()
if ((outRec1->isHole ^ m_ReverseOutput) == (Area(*outRec1, m_UseFullRange) > 0))
ReversePolyPtLinks(outRec1->pts);
//make sure any contained holes now link to the correct polygon ...
if (m_UsingExPolygons && outRec1->isHole)
for (PolyOutList::size_type k = 0; k < m_PolyOuts.size(); ++k)
{
OutRec *orec = m_PolyOuts[k];
if (orec->isHole && orec->bottomPt && orec->FirstLeft == outRec1)
orec->FirstLeft = outRec2;
}
}
else
{
......@@ -2903,47 +3005,31 @@ void Clipper::JoinCommonEdges()
outRec2->FirstLeft = outRec1->FirstLeft;
FixupJoinRecs(j, p2, i+1);
//fixup FirstLeft pointers that may need reassigning to OutRec2
if (m_UsingPolyTree) FixupFirstLefts1(outRec1, outRec2);
FixupOutPolygon(*outRec1); //nb: do this BEFORE testing orientation
FixupOutPolygon(*outRec2); // but AFTER calling FixupJoinRecs()
if (m_UsingExPolygons && outRec2->pts)
for (PolyOutList::size_type k = 0; k < m_PolyOuts.size(); ++k)
{
OutRec *orec = m_PolyOuts[k];
if (orec->isHole && orec->bottomPt && orec->FirstLeft == outRec1 &&
PointInPolygon(orec->bottomPt->pt, outRec2->pts, m_UseFullRange))
orec->FirstLeft = outRec2;
}
}
} else
{
//joined 2 polygons together ...
//make sure any holes contained by outRec2 now link to outRec1 ...
if (m_UsingExPolygons)
for (PolyOutList::size_type k = 0; k < m_PolyOuts.size(); ++k)
if (m_PolyOuts[k]->isHole && m_PolyOuts[k]->bottomPt &&
m_PolyOuts[k]->FirstLeft == outRec2)
m_PolyOuts[k]->FirstLeft = outRec1;
//and cleanup redundant edges too ...
//cleanup redundant edges ...
FixupOutPolygon(*outRec1);
if (outRec1->pts)
{
outRec1->isHole = Area(*outRec1, m_UseFullRange) < 0;
if (outRec1->isHole && !outRec1->FirstLeft)
outRec1->FirstLeft = outRec2->FirstLeft;
}
//delete the obsolete pointer ...
int OKIdx = outRec1->idx;
int ObsoleteIdx = outRec2->idx;
outRec2->pts = 0;
outRec2->bottomPt = 0;
outRec2->AppendLink = outRec1;
outRec1->isHole = holeStateRec->isHole;
if (holeStateRec == outRec2)
outRec1->FirstLeft = outRec2->FirstLeft;
outRec2->FirstLeft = outRec1;
//now fixup any subsequent Joins that match this polygon
for (JoinList::size_type k = i+1; k < m_Joins.size(); k++)
......@@ -2952,6 +3038,9 @@ void Clipper::JoinCommonEdges()
if (j2->poly1Idx == ObsoleteIdx) j2->poly1Idx = OKIdx;
if (j2->poly2Idx == ObsoleteIdx) j2->poly2Idx = OKIdx;
}
//fixup FirstLeft pointers that may need reassigning to OutRec1
if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1);
}
}
}
......@@ -2982,19 +3071,26 @@ struct DoublePoint
//------------------------------------------------------------------------------
Polygon BuildArc(const IntPoint &pt,
const double a1, const double a2, const double r)
{
long64 steps = std::max(6, int(std::sqrt(std::fabs(r)) * std::fabs(a2 - a1)));
if (steps > 0x100) steps = 0x100;
int n = (unsigned)steps;
Polygon result(n);
double da = (a2 - a1) / (n -1);
double a = a1;
for (int i = 0; i < n; ++i)
{
result[i].X = pt.X + Round(std::cos(a)*r);
result[i].Y = pt.Y + Round(std::sin(a)*r);
a += da;
const double a1, const double a2, const double r, double limit)
{
//see notes in clipper.pas regarding steps
double arcFrac = std::fabs(a2 - a1) / (2 * pi);
int steps = (int)(arcFrac * pi / std::acos(1 - limit / std::fabs(r)));
if (steps < 2) steps = 2;
else if (steps > (int)(222.0 * arcFrac)) steps = (int)(222.0 * arcFrac);
double x = std::cos(a1);
double y = std::sin(a1);
double c = std::cos((a2 - a1) / steps);
double s = std::sin((a2 - a1) / steps);
Polygon result(steps +1);
for (int i = 0; i <= steps; ++i)
{
result[i].X = pt.X + Round(x * r);
result[i].Y = pt.Y + Round(y * r);
double x2 = x;
x = x * c - s * y; //cross product
y = x2 * s + y * c; //dot product
}
return result;
}
......@@ -3030,7 +3126,7 @@ private:
public:
PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys,
double delta, JoinType jointype, double MiterLimit, bool AutoFix)
double delta, JoinType jointype, double limit, bool autoFix)
{
//nb precondition - out_polys != ptsin_polys
if (NEAR_ZERO(delta))
......@@ -3046,7 +3142,7 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys,
//ChecksInput - fixes polygon orientation if necessary and removes
//duplicate vertices. Can be set false when you're sure that polygon
//orientation is correct and that there are no duplicate vertices.
if (AutoFix)
if (autoFix)
{
size_t Len = m_p.size(), botI = 0;
while (botI < Len && m_p[botI].size() == 0) botI++;
......@@ -3077,8 +3173,19 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys,
ReversePolygons(m_p);
}
if (MiterLimit <= 1) MiterLimit = 1;
m_RMin = 2.0/(MiterLimit*MiterLimit);
switch (jointype)
{
case jtRound:
if (limit <= 0) limit = 0.25;
else if (limit > std::fabs(delta)) limit = std::fabs(delta);
break;
case jtMiter:
if (limit < 2) limit = 2;
break;
default: //unused
limit = 1;
}
m_RMin = 2.0/(limit*limit);
double deltaSq = delta*delta;
out_polys.clear();
......@@ -3101,7 +3208,7 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys,
else if (len == 1)
{
Polygon arc;
arc = BuildArc(m_p[m_i][len-1], 0, 2 * pi, delta);
arc = BuildArc(m_p[m_i][len-1], 0, 2 * pi, delta, limit);
out_polys[m_i] = arc;
continue;
}
......@@ -3122,11 +3229,11 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys,
{
m_R = 1 + (normals[m_j].X*normals[m_k].X +
normals[m_j].Y*normals[m_k].Y);
if (m_R >= m_RMin) DoMiter(); else DoSquare(MiterLimit);
if (m_R >= m_RMin) DoMiter(); else DoSquare(limit);
break;
}
case jtSquare: DoSquare(); break;
case jtRound: DoRound(); break;
case jtSquare: DoSquare(1.0); break;
case jtRound: DoRound(limit); break;
}
m_k = m_j;
}
......@@ -3165,14 +3272,13 @@ private:
void AddPoint(const IntPoint& pt)
{
Polygon::size_type len = m_curr_poly->size();
if (len == m_curr_poly->capacity())
m_curr_poly->reserve(len + buffLength);
if (m_curr_poly->size() == m_curr_poly->capacity())
m_curr_poly->reserve(m_curr_poly->capacity() + buffLength);
m_curr_poly->push_back(pt);
}
//------------------------------------------------------------------------------
void DoSquare(double mul = 1.0)
void DoSquare(double mul)
{
IntPoint pt1 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_k].X * m_delta),
(long64)Round(m_p[m_i][m_j].Y + normals[m_k].Y * m_delta));
......@@ -3223,7 +3329,7 @@ void DoMiter()
}
//------------------------------------------------------------------------------
void DoRound()
void DoRound(double limit)
{
IntPoint pt1 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_k].X * m_delta),
(long64)Round(m_p[m_i][m_j].Y + normals[m_k].Y * m_delta));
......@@ -3239,7 +3345,7 @@ void DoRound()
double a2 = std::atan2(normals[m_j].Y, normals[m_j].X);
if (m_delta > 0 && a2 < a1) a2 += pi *2;
else if (m_delta < 0 && a2 > a1) a2 -= pi *2;
Polygon arc = BuildArc(m_p[m_i][m_j], a1, a2, m_delta);
Polygon arc = BuildArc(m_p[m_i][m_j], a1, a2, m_delta, limit);
for (Polygon::size_type m = 0; m < arc.size(); m++)
AddPoint(arc[m]);
}
......@@ -3267,14 +3373,14 @@ bool UpdateBotPt(const IntPoint &pt, IntPoint &botPt)
//------------------------------------------------------------------------------
void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys,
double delta, JoinType jointype, double MiterLimit, bool AutoFix)
double delta, JoinType jointype, double limit, bool autoFix)
{
if (&out_polys == &in_polys)
{
Polygons poly2(in_polys);
PolyOffsetBuilder(poly2, out_polys, delta, jointype, MiterLimit, AutoFix);
PolyOffsetBuilder(poly2, out_polys, delta, jointype, limit, autoFix);
}
else PolyOffsetBuilder(in_polys, out_polys, delta, jointype, MiterLimit, AutoFix);
else PolyOffsetBuilder(in_polys, out_polys, delta, jointype, limit, autoFix);
}
//------------------------------------------------------------------------------
......@@ -3300,6 +3406,86 @@ void SimplifyPolygons(Polygons &polys, PolyFillType fillType)
}
//------------------------------------------------------------------------------
bool PointsAreClose(IntPoint pt1, IntPoint pt2, long64 distSqrd)
{
long64 dx = pt1.X - pt2.X;
long64 dy = pt1.Y - pt2.Y;
return ((dx * dx) + (dy * dy) <= distSqrd);
}
//------------------------------------------------------------------------------
void CleanPolygon(Polygon& in_poly, Polygon& out_poly, double distance)
{
//distance = proximity in units/pixels below which vertices
//will be stripped. Default ~= sqrt(2).
int highI = in_poly.size() -1;
long64 d = (int)(distance * distance);
while (highI > 0 && PointsAreClose(in_poly[highI], in_poly[0], d)) highI--;
if (highI < 2)
{
out_poly.clear();
return;
}
out_poly.resize(highI + 1);
bool UseFullRange = FullRangeNeeded(in_poly);
IntPoint pt = in_poly[highI];
int i = 0;
int k = 0;
for (;;)
{
if (i >= highI) break;
int j = i + 1;
if (PointsAreClose(pt, in_poly[j], d))
{
i = j + 1;
while (i <= highI && PointsAreClose(pt, in_poly[i], d)) i++;
continue;
}
if (PointsAreClose(in_poly[i], in_poly[j], d) ||
SlopesEqual(pt, in_poly[i], in_poly[j], UseFullRange))
{
i = j;
continue;
}
pt = in_poly[i++];
out_poly[k++] = pt;
}
if (i <= highI) out_poly[k++] = in_poly[i];
if (k > 2 && SlopesEqual(out_poly[k -2], out_poly[k -1], out_poly[0], UseFullRange))
k--;
if (k < 3) out_poly.clear();
else if (k <= highI) out_poly.resize(k);
}
//------------------------------------------------------------------------------
void CleanPolygons(Polygons& in_polys, Polygons& out_polys, double distance)
{
for (Polygons::size_type i = 0; i < in_polys.size(); ++i)
CleanPolygon(in_polys[i], out_polys[i], distance);
}
//------------------------------------------------------------------------------
void AddPolyNodeToPolygons(PolyNode& polynode, Polygons& polygons)
{
if (polynode.Contour.size() > 0)
polygons.push_back(polynode.Contour);
for (int i = 0; i < polynode.ChildCount(); ++i)
AddPolyNodeToPolygons(*polynode.Childs[i], polygons);
}
//------------------------------------------------------------------------------
void PolyTreeToPolygons(PolyTree& polytree, Polygons& polygons)
{
polygons.resize(0);
polygons.reserve(polytree.Total());
AddPolyNodeToPolygons(polytree, polygons);
}
//------------------------------------------------------------------------------
std::ostream& operator <<(std::ostream &s, IntPoint& p)
{
s << p.X << ' ' << p.Y << "\n";
......
/*******************************************************************************
* *
* Author : Angus Johnson *
* Version : 5.0.3 *
* Date : 12 January 2013 *
* Version : 5.1.4 *
* Date : 24 March 2013 *
* Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2013 *
* *
......@@ -26,7 +26,7 @@
* Paper no. DETC2005-85513 pp. 565-575 *
* ASME 2005 International Design Engineering Technical Conferences *
* 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 *
* *
*******************************************************************************/
......@@ -64,25 +64,59 @@ public:
typedef std::vector< IntPoint > Polygon;
typedef std::vector< Polygon > Polygons;
std::ostream& operator <<(std::ostream &s, Polygon &p);
std::ostream& operator <<(std::ostream &s, Polygons &p);
struct ExPolygon {
Polygon outer;
Polygons holes;
class PolyNode;
typedef std::vector< PolyNode* > PolyNodes;
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
};
class PolyTree: public PolyNode
{
public:
~PolyTree(){Clear();};
PolyNode* GetFirst() const;
void Clear();
int Total() const;
private:
PolyNodes AllNodes;
friend class Clipper; //to access AllNodes
};
typedef std::vector< ExPolygon > ExPolygons;
enum JoinType { jtSquare, jtRound, jtMiter };
bool Orientation(const Polygon &poly);
double Area(const Polygon &poly);
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 SimplifyPolygons(const Polygons &in_polys, Polygons &out_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 ReversePolygons(Polygons& p);
......@@ -100,7 +134,6 @@ struct TEdge {
double dx;
long64 deltaX;
long64 deltaY;
long64 tmpX;
PolyType polyType;
EdgeSide side;
int windDelta; //1 or -1 depending on winding direction
......@@ -140,8 +173,8 @@ struct OutPt; //forward declaration
struct OutRec {
int idx;
bool isHole;
OutRec *FirstLeft;
OutRec *AppendLink;
OutRec *FirstLeft; //see comments in clipper.pas
PolyNode *polyNode;
OutPt *pts;
OutPt *bottomPt;
};
......@@ -208,7 +241,7 @@ public:
PolyFillType subjFillType = pftEvenOdd,
PolyFillType clipFillType = pftEvenOdd);
bool Execute(ClipType clipType,
ExPolygons &solution,
PolyTree &polytree,
PolyFillType subjFillType = pftEvenOdd,
PolyFillType clipFillType = pftEvenOdd);
void Clear();
......@@ -230,7 +263,7 @@ private:
PolyFillType m_ClipFillType;
PolyFillType m_SubjFillType;
bool m_ReverseOutput;
bool m_UsingExPolygons;
bool m_UsingPolyTree;
void DisposeScanbeamList();
void SetWindingCount(TEdge& edge);
bool IsEvenOddFillType(const TEdge& edge) const;
......@@ -269,13 +302,13 @@ private:
void ProcessIntersectList();
void ProcessEdgesAtTopOfScanbeam(const long64 topY);
void BuildResult(Polygons& polys);
void BuildResultEx(ExPolygons& polys);
void BuildResult2(PolyTree& polytree);
void SetHoleState(TEdge *e, OutRec *OutRec);
void DisposeIntersectNodes();
bool FixupIntersections();
bool FixupIntersectionOrder();
void FixupOutPolygon(OutRec &outRec);
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 ClearJoins();
void AddHorzJoin(TEdge *e, int idx);
......@@ -283,6 +316,8 @@ private:
bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2);
void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx);
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