00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "a2dprec.h"
00014
00015 #ifdef __BORLANDC__
00016 #pragma hdrstop
00017 #endif
00018
00019 #ifndef WX_PRECOMP
00020 #include "wx/wx.h"
00021 #endif
00022
00023
00024
00025 #include "wx/canvas/canmod.h"
00026 #include "wx/editor/settingsdlg.h"
00027
00028
00029
00030
00031 #define ID_UNITS 10005
00032 #define ID_settings 10010
00033 #define ID_displaySettings 10013
00034 #define ID_display 10017
00035 #define ID_objectThreshold 10018
00036 #define ID_TEXTCTRL1 10019
00037 #define ID_CHECKBOX1 10020
00038 #define ID_TEXTCTRL8 10028
00039 #define ID_CHECKBOX4 10038
00040 #define ID_PANEL2 10023
00041 #define ID_TEXTCTRL2 10021
00042 #define ID_TEXTCTRL3 10022
00043 #define ID_TEXTCTRL4 10024
00044 #define ID_TEXTCTRL9 10029
00045 #define ID_TEXTCTRL5 10025
00046 #define ID_TEXTCTRL6 10026
00047 #define ID_TEXTCTRL7 10027
00048 #define ID_CHECKBOX2 10030
00049 #define ID_CHECKBOX3 10031
00050 #define ID_PANEL1 10032
00051 #define ID_TEXTCTRL10 10033
00052 #define ID_TEXTCTRL12 10035
00053 #define ID_TEXTCTRL11 10034
00054 #define ID_TEXTCTRL13 10036
00055 #define ID_BUTTON1 10037
00056 #define ID_SnapGrid_X 10038
00057 #define ID_SnapGrid_Y 10038
00058
00059
00060
00061
00062
00063 IMPLEMENT_DYNAMIC_CLASS( a2dSettings, wxDialog )
00064
00065
00066
00067
00068
00069
00070 BEGIN_EVENT_TABLE( a2dSettings, wxDialog )
00071 EVT_CLOSE( a2dSettings::OnCloseWindow )
00072 EVT_CHANGED_DOCUMENT( a2dSettings::OnChangedDocument )
00073 EVT_CHOICE( ID_UNITS, a2dSettings::OnUnitsSelected )
00074 END_EVENT_TABLE()
00075
00076
00077
00078
00079
00080 a2dSettings::a2dSettings()
00081 {
00082 a2dDocviewGlobals->GetEventDistributer()->Register( this );
00083 Init();
00084 }
00085
00086 a2dSettings::a2dSettings( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00087 {
00088 a2dDocviewGlobals->GetEventDistributer()->Register( this );
00089 Init();
00090 Create(parent, id, caption, pos, size, style);
00091 }
00092
00093
00094
00095
00096
00097
00098 bool a2dSettings::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00099 {
00100
00101 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
00102 wxDialog::Create( parent, id, caption, pos, size, style );
00103
00104 CreateControls();
00105 if (GetSizer())
00106 {
00107 GetSizer()->SetSizeHints(this);
00108 }
00109 Centre();
00110
00111
00112 return true;
00113 }
00114
00115 bool a2dSettings::Show( bool show )
00116 {
00117 if ( show )
00118 {
00119 UpdateEntries();
00120 }
00121 return wxDialog::Show( show );
00122 }
00123
00124
00125
00126
00127
00128 a2dSettings::~a2dSettings()
00129 {
00130 a2dDocviewGlobals->GetEventDistributer()->Unregister( this );
00131
00132
00133 }
00134
00135
00136
00137
00138
00139
00140 void a2dSettings::Init()
00141 {
00142 m_settingsTabs = NULL;
00143 m_displaySet = NULL;
00144 m_displayAberation = NULL;
00145 m_objectThreshold = NULL;
00146 m_primThreshold = NULL;
00147 m_drawRectangle = NULL;
00148 m_selectionDistance = NULL;
00149 m_booleanSet = NULL;
00150 m_snapfactor = NULL;
00151 m_offsetAber = NULL;
00152 m_roundFactor = NULL;
00153 m_offset = NULL;
00154 m_smoothAber = NULL;
00155 m_maxLineMerge = NULL;
00156 m_intersectionGrid = NULL;
00157 m_fillRuleWinding = NULL;
00158 m_linkHoles = NULL;
00159 m_arcpolySet = NULL;
00160 m_minRadius = NULL;
00161 m_maxRadius = NULL;
00162 m_poly2arcAber = NULL;
00163 m_arc2polyAber = NULL;
00164
00165 }
00166
00167 void a2dSettings::UpdateEntries()
00168 {
00169 wxString unitstr = a2dGetCmdh()->GetCanvasDocument()->GetUnits();
00170 double fromMeters;
00171 a2dDoMu::GetMultiplierFromString( unitstr, fromMeters );
00172 fromMeters = 1/fromMeters;
00173 a2dDoMu marge = a2dGetCmdh()->GetBooleanEngineMarge();
00174 m_snapfactor->SetValue( marge.GetValueString() );
00175
00176 m_smoothAber->SetValue( a2dGetCmdh()->GetBooleanEngineSmoothAber().GetValueString() );
00177 m_offsetAber->SetValue( a2dGetCmdh()->GetBooleanEngineCorrectionAber().GetValueString() );
00178 m_offset->SetValue( a2dGetCmdh()->GetBooleanEngineCorrectionFactor().GetValueString() );
00179 m_maxLineMerge->SetValue( a2dGetCmdh()->GetBooleanEngineMaxlinemerge().GetValueString() );
00180 m_poly2arcAber->SetValue( a2dGetCmdh()->GetAberPolyToArc().GetValueString() );
00181 m_arc2polyAber->SetValue( a2dGetCmdh()->GetAberArcToPoly().GetValueString() );
00182 m_maxRadius->SetValue( a2dGetCmdh()->GetRadiusMin().GetValueString() );
00183 m_minRadius->SetValue( a2dGetCmdh()->GetRadiusMax().GetValueString() );
00184
00185 m_fillRuleWinding->SetValue( a2dGetCmdh()->GetBooleanEngineWindingRule() );
00186 m_linkHoles->SetValue( a2dGetCmdh()->GetBooleanEngineLinkHoles() );
00187 wxString number;
00188 number.Printf( wxT("%lg"), a2dGetCmdh()->GetBooleanEngineRoundfactor() );
00189 m_roundFactor->SetValue( number );
00190 long i = a2dGetCmdh()->GetBooleanEngineGrid();
00191 number.Printf( wxT("%ld"), i );
00192 m_intersectionGrid->SetValue( number );
00193
00194 m_units->SetStringSelection( unitstr );
00195 }
00196
00197
00198
00199
00200
00201 void a2dSettings::CreateControls()
00202 {
00203
00204 a2dSettings* itemDialog1 = this;
00205
00206 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
00207 itemDialog1->SetSizer(itemBoxSizer2);
00208
00209 m_settingsTabs = new wxNotebook( itemDialog1, ID_settings, wxDefaultPosition, wxDefaultSize, wxBK_DEFAULT );
00210 m_settingsTabs->SetHelpText(_("settings"));
00211 if (a2dSettings::ShowToolTips())
00212 m_settingsTabs->SetToolTip(_("settings"));
00213 m_settingsTabs->SetName(_T("Settings"));
00214
00215 m_displaySet = new wxPanel( m_settingsTabs, ID_displaySettings, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
00216 m_displaySet->SetHelpText(_("displaySettings"));
00217 if (a2dSettings::ShowToolTips())
00218 m_displaySet->SetToolTip(_("displaySettings"));
00219 m_displaySet->SetName(_T("displaySettings"));
00220 wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
00221 m_displaySet->SetSizer(itemBoxSizer5);
00222
00223 m_unitsStrings.Add( wxT("non") );
00224 m_unitsStrings.Add( wxT("pm") );
00225 m_unitsStrings.Add( wxT("nm") );
00226 m_unitsStrings.Add( wxT("um") );
00227 m_unitsStrings.Add( wxT("mm") );
00228 m_unitsStrings.Add( wxT("cm") );
00229 m_unitsStrings.Add( wxT("dm") );
00230 m_unitsStrings.Add( wxT("m") );
00231 m_unitsStrings.Add( wxT("mil") );
00232 m_unitsStrings.Add( wxT("inch") );
00233 m_unitsStrings.Add( wxT("foot") );
00234
00235 m_units = new wxChoice( m_displaySet, ID_UNITS, wxDefaultPosition, wxSize(60, -1), m_unitsStrings, 0 );
00236 m_units->SetStringSelection(_("um"));
00237 m_units->SetHelpText(_("Units used in document"));
00238 if (a2dSettings::ShowToolTips())
00239 m_units->SetToolTip(_("Units used in document"));
00240 m_units->SetName(_T("Units"));
00241 itemBoxSizer5->Add(m_units, 0, wxALIGN_LEFT|wxALL, 5);
00242
00243 wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
00244 itemBoxSizer5->Add(itemBoxSizer20, 0, wxALIGN_LEFT|wxALL, 5);
00245 wxStaticText* itemStaticText21 = new wxStaticText( m_displaySet, wxID_STATIC, _("Grid X-Y"), wxDefaultPosition, wxDefaultSize, 0 );
00246 itemStaticText21->SetHelpText(_("Canvas grid distance in X and Y in meters, e.g. 100 um"));
00247 if (ShowToolTips())
00248 itemStaticText21->SetToolTip(_("Canvas grid distance in X and Y e.g. 100 um"));
00249 itemBoxSizer20->Add(itemStaticText21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00250 m_gridDistX = new wxTextCtrl( m_displaySet, ID_SnapGrid_X, _T(""), wxDefaultPosition, wxSize(60, -1), wxTE_PROCESS_ENTER );
00251 itemBoxSizer20->Add(m_gridDistX, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00252 m_gridDistY = new wxTextCtrl( m_displaySet, ID_SnapGrid_Y, _T(""), wxDefaultPosition, wxSize(60, -1), wxTE_PROCESS_ENTER );
00253 itemBoxSizer20->Add(m_gridDistY, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00254
00255 wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
00256 itemBoxSizer5->Add(itemBoxSizer6, 0, wxALIGN_LEFT|wxALL, 5);
00257 m_displayAberation = new wxTextCtrl( m_displaySet, ID_display, _("-1"), wxDefaultPosition, wxDefaultSize, 0 );
00258 m_displayAberation->SetName(_T("displayAberation"));
00259 itemBoxSizer6->Add(m_displayAberation, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00260 wxStaticText* itemStaticText8 = new wxStaticText( m_displaySet, wxID_STATIC, _("Display aberation"), wxDefaultPosition, wxDefaultSize, 0 );
00261 itemBoxSizer6->Add(itemStaticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00262
00263 wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
00264 itemBoxSizer5->Add(itemBoxSizer9, 0, wxALIGN_LEFT|wxALL, 5);
00265 m_objectThreshold = new wxTextCtrl( m_displaySet, ID_objectThreshold, _("-1"), wxDefaultPosition, wxDefaultSize, 0 );
00266 m_objectThreshold->SetName(_T("objectThreshold"));
00267 itemBoxSizer9->Add(m_objectThreshold, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00268
00269 wxStaticText* itemStaticText11 = new wxStaticText( m_displaySet, wxID_STATIC, _("Object Threshold"), wxDefaultPosition, wxDefaultSize, 0 );
00270 itemStaticText11->SetHelpText(_("Object Threshold below this number of pixels no display"));
00271 if (a2dSettings::ShowToolTips())
00272 itemStaticText11->SetToolTip(_("Object Threshold below this number of pixels no display"));
00273 itemBoxSizer9->Add(itemStaticText11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00274
00275 wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
00276 itemBoxSizer5->Add(itemBoxSizer12, 0, wxALIGN_LEFT|wxALL, 2);
00277 m_primThreshold = new wxTextCtrl( m_displaySet, ID_TEXTCTRL1, _("-1"), wxDefaultPosition, wxDefaultSize, 0 );
00278 m_primThreshold->SetName(_T("primThreshold"));
00279 itemBoxSizer12->Add(m_primThreshold, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00280
00281 wxStaticText* itemStaticText14 = new wxStaticText( m_displaySet, wxID_STATIC, _("Primitive Threshold"), wxDefaultPosition, wxDefaultSize, 0 );
00282 itemStaticText14->SetHelpText(_("Primitive Threshold below this number of pixels no display"));
00283 if (a2dSettings::ShowToolTips())
00284 itemStaticText14->SetToolTip(_("Primitive Threshold below this number of pixels no display"));
00285 itemBoxSizer12->Add(itemStaticText14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00286
00287 wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
00288 itemBoxSizer5->Add(itemBoxSizer15, 0, wxALIGN_LEFT|wxALL, 5);
00289 m_drawRectangle = new wxCheckBox( m_displaySet, ID_CHECKBOX1, _("Draw Rectangle"), wxDefaultPosition, wxDefaultSize, 0 );
00290 m_drawRectangle->SetValue(true);
00291 m_drawRectangle->SetHelpText(_("Draw Rectangle at threshold of object or primitive"));
00292 if (a2dSettings::ShowToolTips())
00293 m_drawRectangle->SetToolTip(_("Draw Rectangle at threshold of object or primitive"));
00294 m_drawRectangle->SetName(_T("drawRectangle"));
00295 itemBoxSizer15->Add(m_drawRectangle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00296
00297 wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxHORIZONTAL);
00298 itemBoxSizer5->Add(itemBoxSizer17, 0, wxALIGN_LEFT|wxALL, 2);
00299 m_selectionDistance = new wxTextCtrl( m_displaySet, ID_TEXTCTRL8, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
00300 m_selectionDistance->SetName(_T("selectionDistance"));
00301 itemBoxSizer17->Add(m_selectionDistance, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00302
00303 wxStaticText* itemStaticText19 = new wxStaticText( m_displaySet, wxID_STATIC, _("Selection distance"), wxDefaultPosition, wxDefaultSize, 0 );
00304 itemStaticText19->SetHelpText(_("Selection will hit if within this amount of pixels"));
00305 if (a2dSettings::ShowToolTips())
00306 itemStaticText19->SetToolTip(_("Selection will hit if within this amount of pixels"));
00307 itemBoxSizer17->Add(itemStaticText19, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00308
00309 m_drawOutline = new wxCheckBox( m_displaySet, ID_CHECKBOX4, _("Draw Only Outlines"), wxDefaultPosition, wxDefaultSize, 0 );
00310 m_drawOutline->SetValue(false);
00311 m_drawOutline->SetHelpText(_("Draw filled or outline"));
00312 if (a2dSettings::ShowToolTips())
00313 m_drawOutline->SetToolTip(_("Draw filled or outline"));
00314 m_drawOutline->SetName(_T("m_outline"));
00315 itemBoxSizer5->Add( m_drawOutline, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00316
00317 m_settingsTabs->AddPage(m_displaySet, _("Display"));
00318
00319 m_booleanSet = new wxPanel( m_settingsTabs, ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
00320 wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL);
00321 m_booleanSet->SetSizer(itemBoxSizer22);
00322
00323 wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL);
00324 itemBoxSizer22->Add(itemBoxSizer23, 0, wxALIGN_LEFT|wxALL, 5);
00325 m_snapfactor = new wxTextCtrl( m_booleanSet, ID_TEXTCTRL2, _("-1"), wxDefaultPosition, wxDefaultSize, 0 );
00326 itemBoxSizer23->Add(m_snapfactor, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00327
00328 wxStaticText* itemStaticText25 = new wxStaticText( m_booleanSet, wxID_STATIC, _("Snap Factor"), wxDefaultPosition, wxDefaultSize, 0 );
00329 itemStaticText25->SetHelpText(_("Point closer to Segments will be snapped to segment"));
00330 if (a2dSettings::ShowToolTips())
00331 itemStaticText25->SetToolTip(_("Point closer to Segments will be snapped to segment"));
00332 itemBoxSizer23->Add(itemStaticText25, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00333
00334 wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxHORIZONTAL);
00335 itemBoxSizer22->Add(itemBoxSizer26, 0, wxALIGN_LEFT|wxALL, 5);
00336 m_offsetAber = new wxTextCtrl( m_booleanSet, ID_TEXTCTRL3, _("-1"), wxDefaultPosition, wxDefaultSize, 0 );
00337 itemBoxSizer26->Add(m_offsetAber, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00338
00339 wxStaticText* itemStaticText28 = new wxStaticText( m_booleanSet, wxID_STATIC, _("Offset Aberation"), wxDefaultPosition, wxDefaultSize, 0 );
00340 itemStaticText28->SetHelpText(_("Correction/Offset arc segments, will deviate this maximal amount"));
00341 if (a2dSettings::ShowToolTips())
00342 itemStaticText28->SetToolTip(_("Correction/Offset arc segments, will deviate this maximal amount"));
00343 itemBoxSizer26->Add(itemStaticText28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00344
00345 wxBoxSizer* itemBoxSizer29 = new wxBoxSizer(wxHORIZONTAL);
00346 itemBoxSizer22->Add(itemBoxSizer29, 0, wxALIGN_LEFT|wxALL, 5);
00347 m_roundFactor = new wxTextCtrl( m_booleanSet, ID_TEXTCTRL4, _("1.5"), wxDefaultPosition, wxDefaultSize, 0 );
00348 itemBoxSizer29->Add(m_roundFactor, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00349
00350 wxStaticText* itemStaticText31 = new wxStaticText( m_booleanSet, wxID_STATIC, _("Rounding Factor"), wxDefaultPosition, wxDefaultSize, 0 );
00351 itemStaticText31->SetHelpText(_("Offset and path 2 polygon, will use this to define arc or angle at corners"));
00352 if (a2dSettings::ShowToolTips())
00353 itemStaticText31->SetToolTip(_("Offset and path 2 polygon, will use this to define arc or angle at corners"));
00354 itemBoxSizer29->Add(itemStaticText31, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00355
00356 wxBoxSizer* itemBoxSizer32 = new wxBoxSizer(wxHORIZONTAL);
00357 itemBoxSizer22->Add(itemBoxSizer32, 0, wxALIGN_LEFT|wxALL, 5);
00358 m_offset = new wxTextCtrl( m_booleanSet, ID_TEXTCTRL9, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
00359 itemBoxSizer32->Add(m_offset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00360
00361 wxStaticText* itemStaticText34 = new wxStaticText( m_booleanSet, wxID_STATIC, _("Offset Amount"), wxDefaultPosition, wxDefaultSize, 0 );
00362 itemStaticText34->SetHelpText(_("How far will the offset be from original (neg also possible)"));
00363 if (a2dSettings::ShowToolTips())
00364 itemStaticText34->SetToolTip(_("How far will the offset be from original (neg also possible)"));
00365 itemBoxSizer32->Add(itemStaticText34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00366
00367 wxBoxSizer* itemBoxSizer35 = new wxBoxSizer(wxHORIZONTAL);
00368 itemBoxSizer22->Add(itemBoxSizer35, 0, wxALIGN_LEFT|wxALL, 5);
00369 m_smoothAber = new wxTextCtrl( m_booleanSet, ID_TEXTCTRL5, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
00370 itemBoxSizer35->Add(m_smoothAber, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00371
00372 wxStaticText* itemStaticText37 = new wxStaticText( m_booleanSet, wxID_STATIC, _("Smoothing abberation"), wxDefaultPosition, wxDefaultSize, 0 );
00373 itemStaticText37->SetHelpText(_("when simplyfying polygons in boolean operation, this is maximal deviation"));
00374 if (a2dSettings::ShowToolTips())
00375 itemStaticText37->SetToolTip(_("when simplyfying polygons in boolean operation, this is maximal deviation"));
00376 itemBoxSizer35->Add(itemStaticText37, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00377
00378 wxBoxSizer* itemBoxSizer38 = new wxBoxSizer(wxHORIZONTAL);
00379 itemBoxSizer22->Add(itemBoxSizer38, 0, wxALIGN_LEFT|wxALL, 5);
00380 m_maxLineMerge = new wxTextCtrl( m_booleanSet, ID_TEXTCTRL6, _("-1"), wxDefaultPosition, wxDefaultSize, 0 );
00381 itemBoxSizer38->Add(m_maxLineMerge, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00382
00383 wxStaticText* itemStaticText40 = new wxStaticText( m_booleanSet, wxID_STATIC, _("Maximum Line Merge"), wxDefaultPosition, wxDefaultSize, 0 );
00384 itemStaticText40->SetHelpText(_("lines to a lenght of this can be combined with other lines"));
00385 if (a2dSettings::ShowToolTips())
00386 itemStaticText40->SetToolTip(_("lines to a lenght of this can be combined with other lines"));
00387 itemBoxSizer38->Add(itemStaticText40, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00388
00389 wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL);
00390 itemBoxSizer22->Add(itemBoxSizer41, 0, wxALIGN_LEFT|wxALL, 5);
00391 m_intersectionGrid = new wxTextCtrl( m_booleanSet, ID_TEXTCTRL7, _("100"), wxDefaultPosition, wxDefaultSize, 0 );
00392 itemBoxSizer41->Add(m_intersectionGrid, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00393
00394 wxStaticText* itemStaticText43 = new wxStaticText( m_booleanSet, wxID_STATIC, _("Grid for intersections"), wxDefaultPosition, wxDefaultSize, 0 );
00395 itemStaticText43->SetHelpText(_("How accurate will intersections in boolean algorithm be"));
00396 if (a2dSettings::ShowToolTips())
00397 itemStaticText43->SetToolTip(_("How accurate will intersections in boolean algorithm be"));
00398 itemBoxSizer41->Add(itemStaticText43, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00399
00400 wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL);
00401 itemBoxSizer22->Add(itemBoxSizer44, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00402 m_fillRuleWinding = new wxCheckBox( m_booleanSet, ID_CHECKBOX2, _("Winding Rule"), wxDefaultPosition, wxDefaultSize, 0 );
00403 m_fillRuleWinding->SetValue(false);
00404 m_fillRuleWinding->SetHelpText(_("Winding Rule if set else alternate filling"));
00405 if (a2dSettings::ShowToolTips())
00406 m_fillRuleWinding->SetToolTip(_("Winding Rule if set else alternate filling"));
00407 itemBoxSizer44->Add(m_fillRuleWinding, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00408
00409 m_linkHoles = new wxCheckBox( m_booleanSet, ID_CHECKBOX3, _("Link Holes"), wxDefaultPosition, wxDefaultSize, 0 );
00410 m_linkHoles->SetValue(false);
00411 m_linkHoles->SetHelpText(_("connect holes in polygons to outer contour, result is polygon.\nOr use vector path as output."));
00412 if (a2dSettings::ShowToolTips())
00413 m_linkHoles->SetToolTip(_("connect holes in polygons to outer contour, result is polygon.\nOr use vector path as output."));
00414 itemBoxSizer44->Add(m_linkHoles, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00415
00416 m_settingsTabs->AddPage(m_booleanSet, _("Boolean Operations"));
00417
00418 m_arcpolySet = new wxPanel( m_settingsTabs, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
00419 wxBoxSizer* itemBoxSizer48 = new wxBoxSizer(wxVERTICAL);
00420 m_arcpolySet->SetSizer(itemBoxSizer48);
00421
00422 wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxHORIZONTAL);
00423 itemBoxSizer48->Add(itemBoxSizer49, 0, wxALIGN_LEFT|wxALL, 5);
00424 m_minRadius = new wxTextCtrl( m_arcpolySet, ID_TEXTCTRL10, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
00425 itemBoxSizer49->Add(m_minRadius, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00426
00427 wxStaticText* itemStaticText51 = new wxStaticText( m_arcpolySet, wxID_STATIC, _("Minimum Radius"), wxDefaultPosition, wxDefaultSize, 0 );
00428 itemStaticText51->SetHelpText(_("found arc segments with a radius above this will be converted from polygon"));
00429 if (a2dSettings::ShowToolTips())
00430 itemStaticText51->SetToolTip(_("found arc segments with a radius above this will be converted from polygon"));
00431 itemBoxSizer49->Add(itemStaticText51, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00432
00433 wxBoxSizer* itemBoxSizer52 = new wxBoxSizer(wxHORIZONTAL);
00434 itemBoxSizer48->Add(itemBoxSizer52, 0, wxALIGN_LEFT|wxALL, 5);
00435 m_maxRadius = new wxTextCtrl( m_arcpolySet, ID_TEXTCTRL12, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
00436 itemBoxSizer52->Add(m_maxRadius, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00437
00438 wxStaticText* itemStaticText54 = new wxStaticText( m_arcpolySet, wxID_STATIC, _("Maximum Radius"), wxDefaultPosition, wxDefaultSize, 0 );
00439 itemStaticText54->SetHelpText(_("found arc segments with a radius below this will be converted from polygon"));
00440 if (a2dSettings::ShowToolTips())
00441 itemStaticText54->SetToolTip(_("found arc segments with a radius below this will be converted from polygon"));
00442 itemBoxSizer52->Add(itemStaticText54, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00443
00444 wxBoxSizer* itemBoxSizer55 = new wxBoxSizer(wxHORIZONTAL);
00445 itemBoxSizer48->Add(itemBoxSizer55, 0, wxALIGN_LEFT|wxALL, 5);
00446 m_poly2arcAber = new wxTextCtrl( m_arcpolySet, ID_TEXTCTRL11, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
00447 itemBoxSizer55->Add(m_poly2arcAber, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00448
00449 wxStaticText* itemStaticText57 = new wxStaticText( m_arcpolySet, wxID_STATIC, _("Conversion Aberration"), wxDefaultPosition, wxDefaultSize, 0 );
00450 itemStaticText57->SetHelpText(_("polygon segments must be this close to a perfect arc"));
00451 if (a2dSettings::ShowToolTips())
00452 itemStaticText57->SetToolTip(_("polygon segments must be this close to a perfect arc"));
00453 itemBoxSizer55->Add(itemStaticText57, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00454
00455 wxStaticLine* itemStaticLine58 = new wxStaticLine( m_arcpolySet, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
00456 itemBoxSizer48->Add(itemStaticLine58, 0, wxGROW|wxALL, 5);
00457
00458 wxBoxSizer* itemBoxSizer59 = new wxBoxSizer(wxHORIZONTAL);
00459 itemBoxSizer48->Add(itemBoxSizer59, 0, wxALIGN_LEFT|wxALL, 5);
00460 m_arc2polyAber = new wxTextCtrl( m_arcpolySet, ID_TEXTCTRL13, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
00461 itemBoxSizer59->Add(m_arc2polyAber, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00462
00463 wxStaticText* itemStaticText61 = new wxStaticText( m_arcpolySet, wxID_STATIC, _("Arc conversion aberration"), wxDefaultPosition, wxDefaultSize, 0 );
00464 itemStaticText61->SetHelpText(_("polygon segments will be this close to a perfect arc after conversion"));
00465 if (a2dSettings::ShowToolTips())
00466 itemStaticText61->SetToolTip(_("polygon segments will be this close to a perfect arc after conversion"));
00467 itemBoxSizer59->Add(itemStaticText61, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
00468
00469 m_settingsTabs->AddPage(m_arcpolySet, _("arc<=>polygon conversion"));
00470
00471 itemBoxSizer2->Add(m_settingsTabs, 1, wxGROW|wxALL, 5);
00472
00473 wxButton* itemButton62 = new wxButton( itemDialog1, ID_BUTTON1, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
00474 itemButton62->SetHelpText(_("Apply settings in current tab"));
00475 if (a2dSettings::ShowToolTips())
00476 itemButton62->SetToolTip(_("Apply settings in current tab"));
00477 itemBoxSizer2->Add(itemButton62, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
00478
00479
00480 itemButton62->Connect(ID_BUTTON1, wxEVT_LEFT_DOWN, wxMouseEventHandler(a2dSettings::OnLeftDown), NULL, this);
00481
00482 }
00483
00484
00485
00486
00487
00488
00489 bool a2dSettings::ShowToolTips()
00490 {
00491 return true;
00492 }
00493
00494
00495
00496
00497
00498 wxBitmap a2dSettings::GetBitmapResource( const wxString& name )
00499 {
00500
00501
00502 wxUnusedVar(name);
00503 return wxNullBitmap;
00504
00505 }
00506
00507
00508
00509
00510
00511 wxIcon a2dSettings::GetIconResource( const wxString& name )
00512 {
00513
00514
00515 wxUnusedVar(name);
00516 return wxNullIcon;
00517
00518 }
00519
00520 void a2dSettings::OnChangedDocument( a2dCommandEvent& event )
00521 {
00522 a2dCanvasDocument* doc = (a2dCanvasDocument*) event.GetDocument();
00523 if ( doc )
00524 {
00525 UpdateEntries();
00526 }
00527 }
00528
00529
00530
00531
00532
00533 void a2dSettings::OnLeftDown( wxMouseEvent& event )
00534 {
00535 wxString unitOfMeasure = m_unitsStrings[m_units->GetSelection()];
00536
00537 if ( a2dGetCmdh()->GetCanvasDocument() )
00538 a2dGetCmdh()->GetCanvasDocument()->SetUnits( unitOfMeasure );
00539
00540 a2dDoMu snapfactor;
00541 snapfactor.Eval( m_snapfactor->GetValue() );
00542 a2dGetCmdh()->SetBooleanEngineMarge( snapfactor );
00543
00544 a2dDoMu smoothAber;
00545 smoothAber.Eval( m_smoothAber->GetValue() );
00546 a2dGetCmdh()->SetBooleanEngineSmoothAber( smoothAber );
00547
00548 a2dGetCmdh()->SetBooleanEngineGrid( wxAtoi( m_intersectionGrid->GetValue() ) );
00549
00550 a2dDoMu offsetAber;
00551 offsetAber.Eval( m_offsetAber->GetValue() );
00552 a2dGetCmdh()->SetBooleanEngineCorrectionAber( offsetAber );
00553
00554 a2dDoMu offset;
00555 offset.Eval( m_offset->GetValue() );
00556 a2dGetCmdh()->SetBooleanEngineCorrectionFactor( offset );
00557
00558 a2dDoMu maxLineMerge;
00559 maxLineMerge.Eval( m_maxLineMerge->GetValue() );
00560 a2dGetCmdh()->SetBooleanEngineMaxlinemerge( maxLineMerge );
00561
00562 a2dDoMu minRadius;
00563 minRadius.Eval( m_minRadius->GetValue() );
00564 a2dGetCmdh()->SetRadiusMin( minRadius );
00565
00566 a2dDoMu maxRadius;
00567 maxRadius.Eval( m_maxRadius->GetValue() );
00568 a2dGetCmdh()->SetRadiusMax( maxRadius );
00569
00570 a2dDoMu aberPolyToArc;
00571 aberPolyToArc.Eval( m_poly2arcAber->GetValue() );
00572 a2dGetCmdh()->SetAberPolyToArc( aberPolyToArc );
00573
00574
00575 a2dDoMu aberArcToPoly;
00576 aberArcToPoly.Eval( m_arc2polyAber->GetValue() );
00577 a2dGetCmdh()->SetAberArcToPoly( aberArcToPoly );
00578
00579 a2dGetCmdh()->SetBooleanEngineWindingRule( m_fillRuleWinding->GetValue() );
00580
00581 a2dGetCmdh()->SetBooleanEngineLinkHoles( m_linkHoles->GetValue() );
00582 a2dGetCmdh()->SetBooleanEngineRoundfactor( wxAtoi( m_roundFactor->GetValue() ) );
00583 if ( m_drawOutline->GetValue() )
00584 a2dGetCmdh()->Submit( new a2dCommand_SetDrawWireFrame( RenderWIREFRAME_ZERO_WIDTH | RenderWIREFRAME_SELECT ), false );
00585 else
00586 a2dGetCmdh()->Submit( new a2dCommand_SetDrawWireFrame( RenderLAYERED | RenderWIREFRAME_SELECT ), false );
00587
00588 a2dDoMu gridX;
00589 gridX.Eval( m_gridDistX->GetValue() );
00590 a2dGetCmdh()->SetGridX( gridX );
00591 a2dDoMu gridY;
00592 gridY.Eval( m_gridDistY->GetValue() );
00593 a2dGetCmdh()->SetGridY( gridY );
00594 }
00595
00596 void a2dSettings::OnUnitsSelected( wxCommandEvent& event )
00597 {
00598 event.Skip();
00599 }
00600
00601
00602
00603
00604
00605 void a2dSettings::OnCloseWindow( wxCloseEvent& event )
00606 {
00607
00608
00609 event.Skip();
00610
00611 }
00612
00613
00614 #define ID_X 10001
00615 #define ID_Y 10002
00616 #define ID_UNITSDOC 10003
00617 #define ID_oke 10004
00618
00619 BEGIN_EVENT_TABLE( a2dNewDocumentSize, wxDialog )
00620 EVT_TEXT_ENTER( ID_X, a2dNewDocumentSize::OnXEnter )
00621 EVT_TEXT_ENTER( ID_Y, a2dNewDocumentSize::OnYEnter )
00622 EVT_CHOICE( ID_UNITS, a2dNewDocumentSize::OnUnitsSelected )
00623 EVT_BUTTON( ID_oke, a2dNewDocumentSize::OnOkeClick )
00624 END_EVENT_TABLE()
00625
00626 a2dNewDocumentSize::a2dNewDocumentSize()
00627 {
00628 Init();
00629 }
00630
00631 a2dNewDocumentSize::a2dNewDocumentSize( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00632 {
00633 Init();
00634 Create(parent, id, caption, pos, size, style);
00635 }
00636
00637 bool a2dNewDocumentSize::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00638 {
00639 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
00640 wxDialog::Create( parent, id, caption, pos, size, style );
00641
00642 CreateControls();
00643 if (GetSizer())
00644 {
00645 GetSizer()->SetSizeHints(this);
00646 }
00647 Centre();
00648 return true;
00649 }
00650
00651 a2dNewDocumentSize::~a2dNewDocumentSize()
00652 {
00653 }
00654
00655 void a2dNewDocumentSize::Init()
00656 {
00657 m_x = NULL;
00658 m_y = NULL;
00659 m_units = NULL;
00660 }
00661
00662 void a2dNewDocumentSize::CreateControls()
00663 {
00664 a2dNewDocumentSize* itemDialog1 = this;
00665
00666 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
00667 itemDialog1->SetSizer(itemBoxSizer2);
00668
00669 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
00670 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
00671
00672 wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Size in X"), wxDefaultPosition, wxDefaultSize, 0 );
00673 itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00674
00675 m_x = new wxTextCtrl( itemDialog1, ID_X, _("1000"), wxDefaultPosition, wxDefaultSize, 0 );
00676 m_x->SetHelpText(_("Document size in X"));
00677 if (a2dNewDocumentSize::ShowToolTips())
00678 m_x->SetToolTip(_("Document size in X"));
00679 itemBoxSizer3->Add(m_x, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00680
00681 wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
00682 itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_LEFT|wxALL, 5);
00683
00684 wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _("Size in Y"), wxDefaultPosition, wxDefaultSize, 0 );
00685 itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00686
00687 m_y = new wxTextCtrl( itemDialog1, ID_Y, _("1000"), wxDefaultPosition, wxDefaultSize, 0 );
00688 m_y->SetHelpText(_("Document size in Y"));
00689 if (a2dNewDocumentSize::ShowToolTips())
00690 m_y->SetToolTip(_("Document size in Y"));
00691 itemBoxSizer6->Add(m_y, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00692
00693 wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
00694 itemBoxSizer2->Add(itemBoxSizer9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00695
00696 wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Units"), wxDefaultPosition, wxDefaultSize, 0 );
00697 itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00698
00699 m_unitsStrings.Add( wxT("non") );
00700 m_unitsStrings.Add( wxT("pm") );
00701 m_unitsStrings.Add( wxT("nm") );
00702 m_unitsStrings.Add( wxT("um") );
00703 m_unitsStrings.Add( wxT("mm") );
00704 m_unitsStrings.Add( wxT("cm") );
00705 m_unitsStrings.Add( wxT("dm") );
00706 m_unitsStrings.Add( wxT("m") );
00707 m_unitsStrings.Add( wxT("mil") );
00708 m_unitsStrings.Add( wxT("inch") );
00709 m_unitsStrings.Add( wxT("foot") );
00710
00711 m_units = new wxChoice( itemDialog1, ID_UNITSDOC, wxDefaultPosition, wxDefaultSize, m_unitsStrings, 0 );
00712 m_units->SetStringSelection(_("um"));
00713 m_units->SetHelpText(_("Units used for document"));
00714 if (a2dNewDocumentSize::ShowToolTips())
00715 m_units->SetToolTip(_("Units used for document"));
00716 itemBoxSizer9->Add(m_units, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00717
00718 wxButton* itemButton12 = new wxButton( itemDialog1, ID_oke, _("Oke"), wxDefaultPosition, wxDefaultSize, 0 );
00719 itemBoxSizer2->Add(itemButton12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00720
00721 }
00722
00723 bool a2dNewDocumentSize::ShowToolTips()
00724 {
00725 return true;
00726 }
00727
00728 void a2dNewDocumentSize::OnXEnter( wxCommandEvent& event )
00729 {
00730 event.Skip();
00731 }
00732
00733 void a2dNewDocumentSize::OnYEnter( wxCommandEvent& event )
00734 {
00735 event.Skip();
00736 }
00737
00738 void a2dNewDocumentSize::OnUnitsSelected( wxCommandEvent& event )
00739 {
00740 event.Skip();
00741 }
00742
00743 void a2dNewDocumentSize::OnOkeClick( wxCommandEvent& event )
00744 {
00745 wxString unitOfMeasure = m_unitsStrings[m_units->GetSelection()];
00746
00747 EndModal( wxID_OK );
00748 }
00749
00750 double a2dNewDocumentSize::GetSizeX() const
00751 {
00752 a2dDoMu sizex;
00753 sizex.Eval( m_x->GetValue() );
00754 return sizex.GetNumber();
00755 }
00756
00757 double a2dNewDocumentSize::GetSizeY() const
00758 {
00759 a2dDoMu sizey;
00760 sizey.Eval( m_y->GetValue() );
00761 return sizey.GetNumber();
00762 }
00763
00764 wxString a2dNewDocumentSize::GetUnit() const
00765 {
00766 return m_unitsStrings[m_units->GetSelection()];
00767 }