28 #include <wx/gbsizer.h>
29 #include <wx/odcombo.h>
30 #include <wx/tglbtn.h>
32 #if defined(__WXMSW__) && defined(__MEMDEBUG__)
33 #include <wx/msw/msvcrt.h>
45 EVT_COMMAND_SCROLL( ID_SLIDER_RED,
a2dStyleDialog::OnSliderUpdate )
46 EVT_COMMAND_SCROLL( ID_SLIDER_GREEN,
a2dStyleDialog::OnSliderUpdate )
47 EVT_COMMAND_SCROLL( ID_SLIDER_BLUE,
a2dStyleDialog::OnSliderUpdate )
66 wxDialog( parent, -1, _T( "style dialog" ), wxDefaultPosition, wxDefaultSize, style, _T( "style dialog" ) )
73 m_fillpatternmono = *m_fillpatterns->GetPattern( 0 );
77 m_cdata =
new wxColourData();
78 m_cdata->SetChooseFull(
true );
80 m_cd =
new wxColourDialog(
this, m_cdata );
82 m_fillstippleb = wxBitmap( 34, 34, -1 );
85 m_colorFill1 = wxColour( 0, 255, 255 );
86 m_colorFill2 = wxColour( 0, 255, 0 );
87 m_colorStroke = wxColour( 0, 0, 255 );
90 m_color = &m_colorFill1;
94 m_PattFill =
a2dFill( m_fillpatternmono );
100 m_pattStroke =
a2dStroke( m_fillpatternmono );
103 m_fill = m_oneColFill;
104 m_stroke = m_oneColStroke;
106 wxBoxSizer* item0 =
new wxBoxSizer( wxVERTICAL );
108 wxBoxSizer* item4 =
new wxBoxSizer( wxVERTICAL );
110 wxBoxSizer* item5 =
new wxBoxSizer( wxHORIZONTAL );
112 wxBoxSizer* item6 =
new wxBoxSizer( wxVERTICAL );
114 wxBoxSizer* item7 =
new wxBoxSizer( wxHORIZONTAL );
116 SetEvtHandlerEnabled(
false );
117 m_spinred =
new wxSpinCtrl(
this, ID_RED, _T(
"125" ), wxDefaultPosition, wxSize( 50, -1 ), wxSP_ARROW_KEYS, 0, 255, 122 );
118 item7->Add( m_spinred, 0, wxALIGN_CENTRE | wxALL, 2 );
120 m_sliderred =
new wxSlider(
this, ID_SLIDER_RED, 125, 0, 255, wxDefaultPosition, wxSize( 120, -1 ), 0 );
122 item7->Add( m_sliderred, 0, wxALIGN_CENTRE | wxALL, 2 );
124 item6->Add( item7, 0, wxALIGN_CENTER, 2 );
126 wxBoxSizer* item10 =
new wxBoxSizer( wxHORIZONTAL );
128 m_spingreen =
new wxSpinCtrl(
this, ID_GREEN, _T(
"125" ), wxDefaultPosition, wxSize( 50, -1 ), wxSP_ARROW_KEYS, 0, 255, 122 );
129 item10->Add( m_spingreen, 0, wxALIGN_CENTRE | wxALL, 2 );
131 m_slidergreen =
new wxSlider(
this, ID_SLIDER_GREEN, 125, 0, 255, wxDefaultPosition, wxSize( 120, -1 ), 0 );
132 item10->Add( m_slidergreen, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT | wxBOTTOM, 2 );
134 item6->Add( item10, 0, wxALIGN_CENTRE, 2 );
136 wxBoxSizer* item13 =
new wxBoxSizer( wxHORIZONTAL );
138 m_spinblue =
new wxSpinCtrl(
this, ID_BLUE, _T(
"125" ), wxDefaultPosition, wxSize( 50, -1 ), wxSP_ARROW_KEYS, 0, 255, 122 );
139 item13->Add( m_spinblue, 0, wxALIGN_CENTRE | wxALL, 2 );
141 m_sliderblue =
new wxSlider(
this, ID_SLIDER_BLUE, 125, 0, 255, wxDefaultPosition, wxSize( 120, -1 ), 0 );
142 item13->Add( m_sliderblue, 0, wxALIGN_CENTRE | wxALL, 2 );
144 item6->Add( item13, 0, wxALIGN_CENTRE, 2 );
146 wxBoxSizer* item63 =
new wxBoxSizer( wxHORIZONTAL );
153 wxRadioBox* item18 =
new wxRadioBox(
this, ID_COLOURS, _T(
"Colours" ), wxDefaultPosition, wxDefaultSize, 3, strs18, 1, wxRA_SPECIFY_ROWS );
154 item18->SetSelection( 1 );
155 item63->Add( item18, 0, wxALIGN_CENTRE );
156 item6->Add( item63, 0, wxALIGN_CENTRE, 2 );
158 wxBoxSizer* item32 =
new wxBoxSizer( wxHORIZONTAL );
160 wxStaticText* item33 =
new wxStaticText(
this, -1, _T(
"stipple bitmap" ), wxDefaultPosition, wxSize( 60, -1 ), 0 );
161 item33->SetForegroundColour( *wxRED );
162 item33->SetBackgroundColour( *wxLIGHT_GREY );
163 item32->Add( item33, 0, wxALIGN_CENTRE | wxALL, 2 );
164 m_fillstipple =
new wxBitmapButton(
this, ID_STIPPLEBITMAP, m_fillstippleb, wxDefaultPosition, wxSize( 34, 34 ) );
165 item32->Add( m_fillstipple, 0, wxALIGN_CENTRE | wxALL, 2 );
166 item6->Add( item32, 0, wxALIGN_LEFT, 2 );
168 item5->Add( item6, 1, wxGROW | wxALIGN_CENTER_HORIZONTAL, 2 );
170 m_colourfillshow =
new wxBitmapButton(
this, ID_FILLCOLOR, wxBitmap( 100, 150 ), wxDefaultPosition, wxDefaultSize );
171 item5->Add( m_colourfillshow, 0, wxALIGN_RIGHT | wxGROW, 1 );
173 m_colourstrokeshow =
new wxBitmapButton(
this, ID_STROKECOLOR, wxBitmap( 10, 150 ), wxDefaultPosition, wxDefaultSize );
174 item5->Add( m_colourstrokeshow, 0, wxALIGN_RIGHT | wxGROW, 1 );
176 item4->Add( item5, 0, wxEXPAND | wxALIGN_RIGHT, 2 );
178 item0->Add( item4, 0, wxALIGN_CENTER_VERTICAL, 2 );
182 wxBoxSizer* item21 =
new wxBoxSizer( wxVERTICAL );
184 wxBoxSizer* item22 =
new wxBoxSizer( wxHORIZONTAL );
186 wxStaticText* item23 =
new wxStaticText(
this, ID_TEXT, _T(
"Fill Style" ), wxDefaultPosition, wxSize( 60, -1 ), wxST_NO_AUTORESIZE );
187 item23->SetForegroundColour( *wxRED );
188 item23->SetBackgroundColour( *wxLIGHT_GREY );
189 item22->Add( item23, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxLEFT, 1 );
191 wxString fillstyles[] =
193 _T(
"Transparent (no fill)" ),
195 _T(
"Backward diagonal hatch" ),
196 _T(
"Cross-diagonal hatch" ),
197 _T(
"Forward diagonal hatch" ),
199 _T(
"Horizontal hatch" ),
200 _T(
"Vertical hatch" ),
201 _T(
"Two Colour Backward diagonal hatch" ),
202 _T(
"Two Colour Cross-diagonal hatch" ),
203 _T(
"Two Colour Forward diagonal hatch" ),
204 _T(
"Two Colour Cross hatch" ),
205 _T(
"Two Colour Horizontal hatch" ),
206 _T(
"Two Colour Vertical hatch" ),
208 _T(
"wxSTIPPLE_MASK_OPAQUE" ),
209 _T(
"wxSTIPPLE_MASK_OPAQUE_TRANSPARENT" ),
210 _T(
"wxGRADIENT_FILL_XY_LINEAR" ),
211 _T(
"wxGRADIENT_FILL_XY_RADIAL" ),
212 _T(
"wxGRADIENT_FILL_XY_DROP" ),
217 m_fillstyles =
new wxChoice(
this, ID_FILLSTYLE, wxDefaultPosition, wxSize( 70, -1 ), 22, fillstyles, 0 );
218 item22->Add( m_fillstyles, 1, wxALIGN_CENTER_VERTICAL | wxALL, 2 );
220 item21->Add( item22, 0, wxEXPAND );
222 wxBoxSizer* item25 =
new wxBoxSizer( wxHORIZONTAL );
224 wxStaticText* item26 =
new wxStaticText(
this, ID_TEXT, _T(
"stroke width" ), wxDefaultPosition, wxSize( 60, -1 ), wxST_NO_AUTORESIZE );
225 item26->SetForegroundColour( *wxRED );
226 item26->SetBackgroundColour( *wxLIGHT_GREY );
227 item25->Add( item26, 0, wxALIGN_LEFT | wxLEFT, 1 );
229 m_pixelwidth =
new wxSpinCtrl(
this, ID_PIXELWIDTH, _T(
"0" ), wxDefaultPosition, wxSize( 60, -1 ), wxSP_ARROW_KEYS, 0, 1000, 0 );
230 item25->Add( m_pixelwidth, 0, wxEXPAND );
232 m_pixelstroke =
new wxCheckBox(
this, ID_PIXELSTROKE, _T(
"Pixel stroke" ), wxDefaultPosition, wxDefaultSize, 0 );
233 item25->Add( m_pixelstroke, 0, wxALIGN_RIGHT | wxALL, 1 );
235 item21->Add( item25, 0, wxEXPAND );
237 item0->Add( item21, 0, wxEXPAND );
239 wxBoxSizer* item29 =
new wxBoxSizer( wxHORIZONTAL );
241 wxStaticText* item30 =
new wxStaticText(
this, ID_TEXT, _T(
"StrokeStyle" ), wxDefaultPosition, wxSize( 60, -1 ), wxST_NO_AUTORESIZE );
242 item30->SetForegroundColour( *wxRED );
243 item30->SetBackgroundColour( *wxLIGHT_GREY );
244 item29->Add( item30, 0, wxALIGN_LEFT | wxLEFT, 1 );
246 wxString strokestyles[] =
250 _T(
"Dotted style" ),
251 _T(
"Long dashed style" ),
252 _T(
"Short dashed style" ),
253 _T(
"Dot and dash style" ),
254 _T(
"User defined dash style" ),
255 _T(
"Backward diagonal hatch" ),
256 _T(
"Cross-diagonal hatch" ),
257 _T(
"Forward diagonal hatch" ),
259 _T(
"Horizontal hatch" ),
260 _T(
"Vertical hatch" ),
262 _T(
"wxSTIPPLE_MASK_OPAQUE" ),
264 _T(
"wxSTIPPLE_MASK_OPAQUE_TRANSPARENT" ),
265 _T(
"a2dSTROKE_OBJECTS" ),
270 m_strokestyles =
new wxChoice(
this, ID_STROKESTYLE, wxDefaultPosition, wxSize( 70, -1 ), 19, strokestyles, 0 );
271 item29->Add( m_strokestyles, 1, wxALIGN_CENTER_VERTICAL | wxALL, 2 );
273 item0->Add( item29, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL, 2 );
277 item0->Add(
new wxButton(
this, ID_MODEL_BUTTON_OK, _T(
"Ok" ), wxDefaultPosition, wxSize( 55, 20 ) ) );
285 SetEvtHandlerEnabled(
true );
286 SetAutoLayout(
true );
289 item0->SetSizeHints(
this );
291 m_skipspinevent =
false;
292 m_doSentCommand =
true;
294 m_needsUpdate =
true;
295 m_fillCommand =
false;
296 m_strokeCommand =
false;
297 m_setCentralStyle = setCentralStyle;
301 a2dStyleDialog::~a2dStyleDialog()
304 delete m_fillpatterns;
309 void a2dStyleDialog::SetColor( wxSpinEvent& spinevent )
311 unsigned char m_colorR =
m_color->Red();
312 unsigned char m_colorG =
m_color->Green();
313 unsigned char m_colorB =
m_color->Blue();
315 switch ( spinevent.GetId() )
319 m_color->Set( spinevent.GetPosition(), m_colorG, m_colorB );
324 m_color->Set( m_colorR, spinevent.GetPosition(), m_colorB );
329 m_color->Set( m_colorR, m_colorG, spinevent.GetPosition() );
336 m_needsUpdate =
true;
338 if (
m_color == &m_colorStroke )
339 SentStyle(
false,
true );
341 SentStyle(
true,
false );
344 void a2dStyleDialog::OnPixelWidth( wxCommandEvent& WXUNUSED( event ) )
346 m_stroke.
SetWidth( m_pixelwidth->GetValue() );
347 SentStyle(
false,
true );
350 void a2dStyleDialog::OnPixelWidthSpin( wxSpinEvent& WXUNUSED( event ) )
352 m_stroke.
SetWidth( m_pixelwidth->GetValue() );
353 SentStyle(
false,
true );
356 void a2dStyleDialog::OnPixelStroke( wxCommandEvent& WXUNUSED( event ) )
359 SentStyle(
false,
true );
363 void a2dStyleDialog::OnSpinCtrlText( wxCommandEvent& event )
365 if ( m_skipspinevent ==
true )
367 m_skipspinevent =
false;
371 unsigned char m_colorR =
m_color->Red();
372 unsigned char m_colorG =
m_color->Green();
373 unsigned char m_colorB =
m_color->Blue();
375 switch ( event.GetId() )
379 m_color->Set( m_spinred->GetValue(), m_colorG, m_colorB );
384 m_color->Set( m_colorR, m_spingreen->GetValue(), m_colorB );
389 m_color->Set( m_colorR, m_colorG, m_spinblue->GetValue() );
396 m_needsUpdate =
true;
398 if (
m_color == &m_colorStroke )
399 SentStyle(
false,
true );
401 SentStyle(
true,
false );
404 void a2dStyleDialog::OnSliderUpdate( wxScrollEvent& event )
406 unsigned char m_colorR =
m_color->Red();
407 unsigned char m_colorG =
m_color->Green();
408 unsigned char m_colorB =
m_color->Blue();
410 switch ( event.GetId() )
414 m_color->Set( m_sliderred->GetValue(), m_colorG, m_colorB );
417 case ID_SLIDER_GREEN:
419 m_color->Set( m_colorR, m_slidergreen->GetValue(), m_colorB );
424 m_color->Set( m_colorR, m_colorG, m_sliderblue->GetValue() );
431 m_needsUpdate =
true;
433 if ( event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE )
435 if (
m_color == &m_colorStroke )
436 SentStyle(
false,
true );
438 SentStyle(
true,
false );
443 void a2dStyleDialog::ColorSelect( wxCommandEvent& event )
446 switch ( event.GetInt() )
467 m_needsUpdate =
true;
469 if (
m_color == &m_colorStroke )
470 SentStyle(
false,
true );
472 SentStyle(
true,
false );
476 void a2dStyleDialog::OnColourBitmap( wxCommandEvent& event )
478 if (
m_cd->ShowModal() == wxID_OK )
481 if ( event.GetId() == ID_STROKECOLOR )
482 m_colorStroke =
m_cdata->GetColour();
483 else if ( event.GetId() == ID_FILLCOLOR )
487 m_needsUpdate =
true;
489 if (
m_color == &m_colorStroke )
490 SentStyle(
false,
true );
492 SentStyle(
true,
false );
496 void a2dStyleDialog::OnStippleBitmap( wxCommandEvent& WXUNUSED( event ) )
498 PatternDialog pattern(
this, m_fillpatterns, _T(
"Patterns" ), ( wxDEFAULT_DIALOG_STYLE ) );
499 int choosen = pattern.ShowModal();
501 m_fillpatternmono = *m_fillpatterns->GetPattern( choosen );
503 m_needsUpdate =
true;
504 SentStyle(
true,
false );
507 void a2dStyleDialog::OnStrokeStyle( wxCommandEvent& event )
511 switch( event.GetInt() )
555 if ( strokestyle != m_stroke.GetStyle() )
568 m_stroke = m_pattStroke;
573 m_stroke = m_pattStroke;
578 m_stroke = m_pattStroke;
581 m_stroke.SetStyle( strokestyle );
584 m_needsUpdate =
true;
585 SentStyle(
false,
true );
588 void a2dStyleDialog::OnFillStyle( wxCommandEvent& event )
592 switch( event.GetInt() )
645 if ( fillstyle != m_fill.GetStyle() )
682 else if ( fillstyle >= a2dFIRST_TWOCOL_HATCH && fillstyle <= a2dLAST_TWOCOL_HATCH )
684 m_hatchTwoColFill.SetStyle( fillstyle );
685 m_fill = m_hatchTwoColFill;
687 else if ( fillstyle >= a2dFIRST_HATCH && fillstyle <= a2dLAST_HATCH )
689 m_oneColFill.SetStyle( fillstyle );
690 m_fill = m_oneColFill;
694 m_oneColFill.SetStyle( fillstyle );
695 m_fill = m_oneColFill;
699 m_needsUpdate =
true;
700 SentStyle(
true,
false );
710 SetReturnCode( wxID_OK );
715 void a2dStyleDialog::OnIdle( wxIdleEvent& WXUNUSED( idleEvent ) )
719 m_needsUpdate =
false;
721 unsigned char m_colorR =
m_color->Red();
722 unsigned char m_colorG =
m_color->Green();
723 unsigned char m_colorB =
m_color->Blue();
725 m_sliderred->SetValue( m_colorR );
726 m_slidergreen->SetValue( m_colorG );
727 m_sliderblue->SetValue( m_colorB );
731 m_skipspinevent =
true;
732 m_spinred->SetValue( m_colorR );
733 m_skipspinevent =
true;
734 m_spingreen->SetValue( m_colorG );
735 m_skipspinevent =
true;
736 m_spinblue->SetValue( m_colorB );
738 m_pixelwidth->SetValue( (
int ) m_stroke.
GetWidth() );
751 m_oneColStroke.
SetColour( m_colorStroke );
753 m_hatchTwoColFill.
SetColour( m_colorFill1 );
756 m_fillstipple->Enable(
false );
758 int curstyle = m_fill.GetStyle();
790 m_fillstipple->Enable(
true );
793 m_fillstipple->Enable(
true );
796 m_fillstipple->Enable(
true );
810 m_fillstyles->SetSelection( style );
813 switch( m_stroke.GetStyle() )
853 default: strokestyle = 0;
856 m_strokestyles->SetSelection( strokestyle );
859 wxMemoryDC dcmemtemp;
860 dcmemtemp.SelectObject( m_fillstippleb );
862 brush.SetColour( *wxBLACK );
863 dcmemtemp.SetBackground( brush );
865 dcmemtemp.SetPen( *wxTRANSPARENT_PEN );
867 dcmemtemp.SetTextBackground( m_PattFill.
GetColour2() );
868 dcmemtemp.SetTextForeground( m_PattFill.
GetColour() );
869 wxBrush brushbitm( m_fillpatternmono );
870 dcmemtemp.SetBrush( brushbitm );
872 dcmemtemp.DrawRectangle( 0, 0, 32, 32 );
873 dcmemtemp.SelectObject( wxNullBitmap );
874 m_fillstipple->SetBitmapLabel( m_fillstippleb );
875 m_fillstipple->Refresh(
true );
886 m_PattFill.SetStipple( m_fillpatternmono );
892 m_PattFill.SetStipple( m_fillpatternmono );
900 wxBitmap fillpattern = wxBitmap( 32, 32, -1 );
902 wxMemoryDC dcmemtemp2;
903 dcmemtemp2.SelectObject( fillpattern );
906 brush.SetColour( *wxBLACK );
907 dcmemtemp2.SetBackground( brush );
909 dcmemtemp2.SetPen( *wxTRANSPARENT_PEN );
911 dcmemtemp2.SetTextBackground( m_PattFill.
GetColour2() );
912 dcmemtemp2.SetTextForeground( m_PattFill.
GetColour() );
913 wxBrush brushbitm( m_fillpatternmono );
914 dcmemtemp2.SetBrush( brushbitm );
916 dcmemtemp2.DrawRectangle( 0, 0, 32, 32 );
917 dcmemtemp2.SelectObject( wxNullBitmap );
918 m_PattFill.SetStipple( fillpattern );
927 m_fill = m_hatchTwoColFill;
943 int w = m_colourfillshow->GetBitmapLabel().GetWidth();
944 int h = m_colourfillshow->GetBitmapLabel().GetHeight();
950 m_colourfillshow->SetBitmapLabel( drawer->
GetBuffer() );
951 m_colourfillshow->Refresh(
true );
956 int w = m_colourstrokeshow->GetBitmapLabel().GetWidth();
957 int h = m_colourstrokeshow->GetBitmapLabel().GetHeight();
962 drawer2->
DrawLine( w / 2, 0, w / 2, h );
964 m_colourstrokeshow->SetBitmapLabel( drawer2->
GetBuffer() );
965 m_colourstrokeshow->Refresh(
true );
971 m_fillCommand =
false;
974 if ( m_strokeCommand )
976 m_strokeCommand =
false;
981 void a2dStyleDialog::SentStyle(
bool fill,
bool stroke )
990 if ( !m_setCentralStyle )
993 m_fillCommand = fill;
994 m_strokeCommand = stroke;
997 void a2dStyleDialog::OnComEvent(
a2dComEvent& event )
999 a2dSignal comId =
event.GetId();
1015 a2dObject*
object =
property->GetRefObjectNA();
1020 SetStroke( stroke );
1033 comId == a2dHabitat::sig_changedStroke ||
1034 comId == a2dHabitat::sig_changedLayer
1038 if ( ! GetFill().IsSameAs( f ) )
1041 if ( ! GetStroke().IsSameAs( s ) )
1067 void a2dStyleDialog::OnSize( wxSizeEvent& WXUNUSED( event ) )
1072 void a2dStyleDialog::CmOk( wxCommandEvent& WXUNUSED( event ) )
1075 EndModal( wxID_OK );
1078 SetReturnCode( wxID_OK );
1083 void a2dStyleDialog::SetFill(
const a2dFill& fill )
1089 m_needsUpdate =
true;
1092 void a2dStyleDialog::SetStroke(
const a2dStroke& stroke )
1097 m_needsUpdate =
true;
1107 a2dCustomColors::a2dCustomColors()
1112 void a2dCustomColors::Init()
1114 for(
int i=0; i < wxColourData::NUM_CUSTOM; i++)
1116 m_Color[i] = *wxWHITE;
1120 void a2dCustomColors::Set(
const wxColourData &colData)
1122 for(
int i=0; i < wxColourData::NUM_CUSTOM; i++)
1124 m_Color[i] = colData.GetCustomColour(i);
1128 void a2dCustomColors::Get(wxColourData *pColData)
const
1130 for(
int i=0; i < wxColourData::NUM_CUSTOM; i++)
1132 pColData->SetCustomColour(i, m_Color[i]);
1136 void a2dCustomColors::Set(
int i,
const wxColour &color)
1138 wxASSERT(i < wxColourData::NUM_CUSTOM);
1142 wxColour a2dCustomColors::Get(
int i)
const
1144 wxASSERT(i < wxColourData::NUM_CUSTOM);
1150 for(
int i=0; i < wxColourData::NUM_CUSTOM; i++)
1152 if(m_Color[i] != rhs.m_Color[i])
return false;
1159 return !(*
this==rhs);
1165 #include "../../art/resources/JoinMiter.xpm"
1166 #include "../../art/resources/JoinBevel.xpm"
1167 #include "../../art/resources/JoinRound.xpm"
1168 #include "../../art/resources/JoinMiterPressed.xpm"
1169 #include "../../art/resources/JoinBevelPressed.xpm"
1170 #include "../../art/resources/JoinRoundPressed.xpm"
1171 #include "../../art/resources/JoinMiterDisabled.xpm"
1172 #include "../../art/resources/JoinBevelDisabled.xpm"
1173 #include "../../art/resources/JoinRoundDisabled.xpm"
1174 #include "../../art/resources/CapButt.xpm"
1175 #include "../../art/resources/CapProjecting.xpm"
1176 #include "../../art/resources/CapRound.xpm"
1177 #include "../../art/resources/CapButtPressed.xpm"
1178 #include "../../art/resources/CapProjectingPressed.xpm"
1179 #include "../../art/resources/CapRoundPressed.xpm"
1180 #include "../../art/resources/CapButtDisabled.xpm"
1181 #include "../../art/resources/CapProjectingDisabled.xpm"
1182 #include "../../art/resources/CapRoundDisabled.xpm"
1188 const wxArrayString a2dColorComboBox::TChoices(
bool bAllowTransparent)
1190 if(bAllowTransparent)
1192 const int TNumChoices = 2;
1193 const wxString TChoices[TNumChoices] = { _(
"Transparent"), _(
"Select Color...") };
1194 return wxArrayString(TNumChoices, TChoices);
1198 const int TNumChoices = 1;
1199 const wxString TChoices[TNumChoices] = { _(
"Select Color...") };
1200 return wxArrayString(TNumChoices, TChoices);
1213 : wxOwnerDrawnComboBox(parent,
id, wxEmptyString, wxDefaultPosition, size, TChoices(bAllowTransparent), wxCB_READONLY), m_bAllowTransparent(bAllowTransparent), m_pCustomColors(pCustCol), m_Color(*wxBLACK)
1218 void a2dColorComboBox::SetColor(
const wxColour &color)
1221 if(m_bAllowTransparent)
1222 SetSelection((m_Color == wxTransparentColour) ? 0 : 1);
1224 SetSelection((m_Color == wxTransparentColour) ? -1 : 0);
1227 void a2dColorComboBox::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const
1229 if( !(flags & wxODCB_PAINTING_CONTROL) )
1231 dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1235 if ( m_Color == wxTransparentColour )
1236 dc.DrawLabel(GetString(0), rect, wxALIGN_CENTER);
1239 dc.SetPen(*wxBLACK_PEN);
1240 dc.SetBrush(wxBrush(m_Color));
1241 dc.DrawRectangle(rect.x+3, rect.y+3, rect.width-6, rect.height-6);
1246 wxCoord a2dColorComboBox::OnMeasureItem(
size_t item)
const
1248 return wxOwnerDrawnComboBox::GetClientSize().GetHeight();
1251 void a2dColorComboBox::OnSelected(wxCommandEvent& event)
1253 switch(event.GetSelection())
1255 case 0:
if(m_bAllowTransparent) m_Color = wxTransparentColour;
1259 case 1: SelectColor();
1266 void a2dColorComboBox::SelectColor()
1269 cData.SetChooseFull(
true);
1270 if(m_pCustomColors) m_pCustomColors->Get(&cData);
1271 cData.SetColour(m_Color);
1272 wxColourDialog cDlg(
this, &cData);
1274 if(cDlg.ShowModal() == wxID_OK)
1276 cData = cDlg.GetColourData();
1277 if(m_pCustomColors) m_pCustomColors->Set(cData);
1278 m_Color = cData.GetColour();
1286 const wxArrayString a2dStrokeStyleComboBox::TChoices(
bool bAllowLayerStyle)
1288 const int TNumChoices = 5;
1289 const wxString TChoices[TNumChoices] = { wxT(
"Solid"), wxT(
"Dot"), wxT(
"Long Dash"), wxT(
"Dot Dash"), _(
"No Line") };
1290 wxArrayString choices(TNumChoices, TChoices);
1292 if(bAllowLayerStyle) choices.Add(_(
"Layer"));
1306 : wxOwnerDrawnComboBox(parent,
id, wxEmptyString, wxDefaultPosition, size, TChoices(bAllowLayerStyle), wxCB_READONLY),
1312 void a2dStrokeStyleComboBox::SetStyle(
const a2dStrokeStyle &style)
1335 void a2dStrokeStyleComboBox::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const
1337 wxPenStyle penStyle = wxPENSTYLE_INVALID;
1340 case 0: penStyle = wxPENSTYLE_SOLID;
1342 case 1: penStyle = wxPENSTYLE_DOT;
1344 case 2: penStyle = wxPENSTYLE_LONG_DASH;
1346 case 3: penStyle = wxPENSTYLE_DOT_DASH;
1348 case 4: dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1350 case 5: dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1353 wxPen pen(dc.GetTextForeground(), 3, penStyle);
1354 pen.SetCap(wxCAP_BUTT);
1356 dc.DrawLine(rect.x+5, rect.y+rect.height/2, rect.x+rect.width-5, rect.y+rect.height/2);
1359 wxCoord a2dStrokeStyleComboBox::OnMeasureItem(
size_t item)
const
1361 return wxOwnerDrawnComboBox::GetClientSize().GetHeight();
1364 void a2dStrokeStyleComboBox::OnSelected(wxCommandEvent& event)
1366 switch(event.GetSelection())
1389 const wxArrayString a2dFillComboBox::TChoices(
bool bAllowLayerStyle)
1391 const int TNumChoices = 2;
1392 const wxString TChoices[TNumChoices] = { _(
"Transparent"), _(
"Select Color...") };
1393 wxArrayString choices(TNumChoices, TChoices);
1395 if(bAllowLayerStyle) choices.Add(_(
"Layer"));
1409 : wxOwnerDrawnComboBox(parent,
id, wxEmptyString, wxDefaultPosition, size, TChoices(bAllowLayerStyle), wxCB_READONLY),
1410 m_bAllowLayerStyle(bAllowLayerStyle), m_pCustomColors(pCustCol), m_Fill()
1415 void a2dFillComboBox::SetFill(
const a2dFill &fill)
1419 switch(m_Fill.GetStyle())
1432 void a2dFillComboBox::OnDrawItem(wxDC& dc,
const wxRect& rect,
int item,
int flags)
const
1434 if( !(flags & wxODCB_PAINTING_CONTROL) )
1436 dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1442 case 0: dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1445 case 1: dc.SetPen(*wxBLACK_PEN);
1446 dc.SetBrush(wxBrush(m_Fill.
GetColour()));
1447 dc.DrawRectangle(rect.x+3, rect.y+3, rect.width-6, rect.height-6);
1450 case 2: dc.DrawLabel(GetString(item), rect, wxALIGN_CENTER);
1456 wxCoord a2dFillComboBox::OnMeasureItem(
size_t item)
const
1458 return wxOwnerDrawnComboBox::GetClientSize().GetHeight();
1461 void a2dFillComboBox::OnSelected(wxCommandEvent& event)
1463 switch(event.GetSelection())
1468 case 1: SelectColor();
1478 void a2dFillComboBox::SelectColor()
1481 cData.SetChooseFull(
true);
1482 if(m_pCustomColors) m_pCustomColors->Get(&cData);
1484 wxColourDialog cDlg(
this, &cData);
1486 if(cDlg.ShowModal() == wxID_OK)
1488 cData = cDlg.GetColourData();
1489 if(m_pCustomColors) m_pCustomColors->Set(cData);
1502 ID_STROKESTYLE_BOX = wxID_HIGHEST + 1,
1508 ID_CAPPROJECTING_BT,
1510 ID_STROKEWIDTH_CTRL,
1531 : m_bFill(bFill), m_UnitsScale(1), m_CustomColors(), m_ExtStroke(), m_ExtFill()
1533 wxString DlgTitel = (bGlobal) ? _(
"Global Line and Filling") : _(
"Line and Filling");
1534 wxDialog::Create(parent, wxID_ANY, DlgTitel, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
1535 CreateControls(bAllowLayerStyle);
1536 if(GetSizer()) GetSizer()->SetSizeHints(
this);
1540 void a2dDialogStyle::CreateControls(
bool bAllowLayerStyle)
1542 wxBoxSizer* pTopSizer =
new wxBoxSizer(wxVERTICAL);
1543 this->SetSizer(pTopSizer);
1548 wxStaticBox* pStaticBoxLine =
new wxStaticBox(
this, wxID_ANY, _(
"Line"));
1549 wxStaticBoxSizer* pStaticBoxSizerLine =
new wxStaticBoxSizer(pStaticBoxLine, wxVERTICAL);
1550 pTopSizer->Add(pStaticBoxSizerLine, 0, wxGROW|wxALL, 5);
1552 wxGridBagSizer* pGridBagSizerLine =
new wxGridBagSizer(0, 0);
1553 pGridBagSizerLine->SetEmptyCellSize(wxSize(10, 10));
1554 pStaticBoxSizerLine->Add(pGridBagSizerLine, 0, wxALIGN_LEFT|wxALL, 5);
1556 wxStaticText* pStrokeStyleTxt =
new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _(
"Style:"), wxDefaultPosition, wxDefaultSize, 0);
1557 pGridBagSizerLine->Add(pStrokeStyleTxt, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1559 m_pSrokeStyleBox =
new a2dStrokeStyleComboBox(pStaticBoxSizerLine->GetStaticBox(), ID_STROKESTYLE_BOX, bAllowLayerStyle);
1560 pGridBagSizerLine->Add(m_pSrokeStyleBox, wxGBPosition(0, 1), wxGBSpan(1, 1), wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1562 wxStaticText* pStrokeJoinTxt =
new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _(
"Corners:"), wxDefaultPosition, wxDefaultSize, 0);
1563 pGridBagSizerLine->Add(pStrokeJoinTxt, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1565 wxBoxSizer* pStrokeJoinSizer =
new wxBoxSizer(wxHORIZONTAL);
1566 pGridBagSizerLine->Add(pStrokeJoinSizer, wxGBPosition(0, 3), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
1568 m_pJoinMiterBt =
new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_JOINMITER_BT, wxBitmap(JoinMiter_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1569 m_pJoinMiterBt->SetBitmapDisabled(wxBitmap(JoinMiterDisabled_xpm));
1570 pStrokeJoinSizer->Add(m_pJoinMiterBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1572 m_pJoinBevelBt =
new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_JOINBEVEL_BT, wxBitmap(JoinBevel_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1573 m_pJoinBevelBt->SetBitmapDisabled(wxBitmap(JoinBevelDisabled_xpm));
1574 pStrokeJoinSizer->Add(m_pJoinBevelBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1576 m_pJoinRoundBt =
new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_JOINROUND_BT, wxBitmap(JoinRound_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1577 m_pJoinRoundBt->SetBitmapDisabled(wxBitmap(JoinRoundDisabled_xpm));
1578 pStrokeJoinSizer->Add(m_pJoinRoundBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1580 wxStaticText* pStrokeColorTxt =
new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _(
"Color:"), wxDefaultPosition, wxDefaultSize, 0);
1581 pGridBagSizerLine->Add(pStrokeColorTxt, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1583 m_pStrokeColorBox =
new a2dColorComboBox(pStaticBoxSizerLine->GetStaticBox(), ID_STROKECOLOR_BOX,
false, &m_CustomColors);
1584 pGridBagSizerLine->Add(m_pStrokeColorBox, wxGBPosition(1, 1), wxGBSpan(1, 1), wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1586 wxStaticText* pStrokeCapTxt =
new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _(
"Caps:"), wxDefaultPosition, wxDefaultSize, 0);
1587 pGridBagSizerLine->Add(pStrokeCapTxt, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
1589 wxBoxSizer* pStrokeCapSizer =
new wxBoxSizer(wxHORIZONTAL);
1590 pGridBagSizerLine->Add(pStrokeCapSizer, wxGBPosition(1, 3), wxGBSpan(1, 1), wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
1592 m_pCapButtBt =
new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_CAPBUTT_BT, wxBitmap(CapButt_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1593 m_pCapButtBt->SetBitmapDisabled(wxBitmap(CapButtDisabled_xpm));
1594 pStrokeCapSizer->Add(m_pCapButtBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1596 m_pCapProjectingBt =
new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_CAPPROJECTING_BT, wxBitmap(CapProjecting_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1597 m_pCapProjectingBt->SetBitmapDisabled(wxBitmap(CapProjectingDisabled_xpm));
1598 pStrokeCapSizer->Add(m_pCapProjectingBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1600 m_pCapRoundBt =
new wxBitmapToggleButton(pStaticBoxSizerLine->GetStaticBox(), ID_CAPROUND_BT, wxBitmap(CapRound_xpm), wxDefaultPosition, wxSize(24, 24), 0);
1601 m_pCapRoundBt->SetBitmapDisabled(wxBitmap(CapRoundDisabled_xpm));
1602 pStrokeCapSizer->Add(m_pCapRoundBt, 0, wxALIGN_CENTER_VERTICAL, 5);
1604 wxBoxSizer* pStrokeWidthSizer =
new wxBoxSizer(wxHORIZONTAL);
1605 pGridBagSizerLine->Add(pStrokeWidthSizer, wxGBPosition(2, 0), wxGBSpan(1, 2), wxGROW|wxALIGN_CENTER_VERTICAL, 5);
1607 wxStaticText* pStrokeWidthTxt =
new wxStaticText(pStaticBoxSizerLine->GetStaticBox(), wxID_STATIC, _(
"Line width (mm):"), wxDefaultPosition, wxDefaultSize, 0);
1608 pStrokeWidthSizer->Add(pStrokeWidthTxt, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1610 m_pStrokeWidthCtrl =
new wxSpinCtrlDouble(pStaticBoxSizerLine->GetStaticBox(), ID_STROKEWIDTH_CTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0.1, 5.0, 0.2, 0.1);
1611 m_pStrokeWidthCtrl->SetDigits(1);
1612 m_pStrokeWidthCtrl->SetValue(wxT(
""));
1613 pStrokeWidthSizer->Add(m_pStrokeWidthCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1615 pStaticBoxSizerLine->Layout();
1620 wxStaticBox* pStaticBoxFill =
new wxStaticBox(
this, wxID_ANY, _(
"Filling"));
1621 wxStaticBoxSizer* pStaticBoxSizerFill =
new wxStaticBoxSizer(pStaticBoxFill, wxVERTICAL);
1622 pTopSizer->Add(pStaticBoxSizerFill, 0, wxGROW|wxALL, 5);
1624 wxBoxSizer* pFillColorSizer =
new wxBoxSizer(wxHORIZONTAL);
1625 pFillColorSizer->SetMinSize( pStrokeWidthSizer->GetSize() );
1626 pStaticBoxSizerFill->Add(pFillColorSizer, 0, wxALIGN_LEFT|wxALL, 5);
1628 wxStaticText* pFillColorTxt =
new wxStaticText( pStaticBoxSizerFill->GetStaticBox(), wxID_STATIC, _(
"Color:"), wxDefaultPosition, wxDefaultSize, 0 );
1629 pFillColorSizer->Add(pFillColorTxt, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1631 m_pFillBox =
new a2dFillComboBox(pStaticBoxSizerFill->GetStaticBox(), ID_FILL_BOX, bAllowLayerStyle, &m_CustomColors);
1632 if(!m_bFill) m_pFillBox->Disable();
1633 pFillColorSizer->Add(m_pFillBox, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1638 wxStdDialogButtonSizer* pStdDlgBtSizer =
new wxStdDialogButtonSizer;
1640 pTopSizer->Add(pStdDlgBtSizer, 0, wxGROW|wxALL, 5);
1641 wxButton* pOkButton =
new wxButton(
this, wxID_OK, _(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
1642 pOkButton->SetDefault();
1643 pStdDlgBtSizer->AddButton(pOkButton);
1645 wxButton* pCancelButton =
new wxButton(
this, wxID_CANCEL, _(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
1646 pStdDlgBtSizer->AddButton(pCancelButton);
1648 pStdDlgBtSizer->Realize();
1651 void a2dDialogStyle::OnInitDialog(wxInitDialogEvent& event)
1655 defaultStroke.SetJoin(wxJOIN_MITER);
1656 defaultStroke.SetCap(wxCAP_BUTT);
1657 m_ExtStroke.SetDefault(defaultStroke);
1660 UpdateStrokeData(
false);
1662 if(m_bFill && m_ExtFill.IsValid())
1663 m_pFillBox->SetFill(m_ExtFill.Get());
1666 void a2dDialogStyle::UpdateStrokeData(
bool bGetFromDlg)
1670 if(m_pSrokeStyleBox->IsStyleSelected())
1671 m_ExtStroke.SetStyle(m_pSrokeStyleBox->GetStyle());
1673 if(m_pStrokeColorBox->IsColorSelected())
1674 m_ExtStroke.SetColor(m_pStrokeColorBox->GetColor());
1676 #if defined(__WXMSW__)
1677 if(!m_pStrokeWidthCtrl->GetText()->GetValue().IsEmpty())
1679 if( m_pStrokeWidthCtrl->GetValue() )
1681 m_ExtStroke.SetWidth(m_pStrokeWidthCtrl->GetValue() / m_UnitsScale);
1683 if(m_pJoinMiterBt->GetValue()) m_ExtStroke.SetJoin(wxJOIN_MITER);
1684 else if(m_pJoinBevelBt->GetValue()) m_ExtStroke.SetJoin(wxJOIN_BEVEL);
1685 else if(m_pJoinRoundBt->GetValue()) m_ExtStroke.SetJoin(wxJOIN_ROUND);
1687 if(m_pCapButtBt->GetValue()) m_ExtStroke.SetCap(wxCAP_BUTT);
1688 else if(m_pCapProjectingBt->GetValue()) m_ExtStroke.SetCap(wxCAP_PROJECTING);
1689 else if(m_pCapRoundBt->GetValue()) m_ExtStroke.SetCap(wxCAP_ROUND);
1693 if(m_ExtStroke.IsStyleValid())
1694 m_pSrokeStyleBox->SetStyle(m_ExtStroke.GetStyle());
1696 if(m_ExtStroke.HasEditableStyle())
1698 m_pStrokeColorBox->Enable();
1699 if(m_ExtStroke.IsColorValid())
1700 m_pStrokeColorBox->SetColor(m_ExtStroke.GetColor());
1702 m_pStrokeWidthCtrl->Enable();
1703 if(m_ExtStroke.IsWidthValid())
1704 m_pStrokeWidthCtrl->SetValue(m_ExtStroke.GetWidth() * m_UnitsScale);
1706 m_pJoinMiterBt->Enable();
1707 m_pJoinBevelBt->Enable();
1708 m_pJoinRoundBt->Enable();
1709 if(m_ExtStroke.IsJoinValid())
1710 SetJoin(m_ExtStroke.GetJoin());
1712 m_pCapButtBt->Enable();
1713 m_pCapProjectingBt->Enable();
1714 m_pCapRoundBt->Enable();
1715 if(m_ExtStroke.IsCapValid())
1716 SetCap(m_ExtStroke.GetCap());
1720 m_pStrokeColorBox->Disable();
1721 m_pStrokeColorBox->SetSelection(-1);
1723 m_pStrokeWidthCtrl->Disable();
1724 m_pStrokeWidthCtrl->SetValue(wxT(
""));
1726 m_pJoinMiterBt->Disable();
1727 m_pJoinMiterBt->SetValue(
false);
1728 m_pJoinBevelBt->Disable();
1729 m_pJoinBevelBt->SetValue(
false);
1730 m_pJoinRoundBt->Disable();
1731 m_pJoinRoundBt->SetValue(
false);
1733 m_pCapButtBt->Disable();
1734 m_pCapButtBt->SetValue(
false);
1735 m_pCapProjectingBt->Disable();
1736 m_pCapProjectingBt->SetValue(
false);
1737 m_pCapRoundBt->Disable();
1738 m_pCapRoundBt->SetValue(
false);
1743 void a2dDialogStyle::OnStrokeStyle(wxCommandEvent& event)
1745 UpdateStrokeData(
true);
1747 if( m_ExtStroke.HasEditableStyle() && !m_ExtStroke.IsInitialised() )
1749 a2dStroke defaultStroke = m_ExtStroke.GetDefault();
1750 defaultStroke.SetStyle(m_ExtStroke.GetStyle());
1751 m_ExtStroke.Set(defaultStroke);
1754 UpdateStrokeData(
false);
1757 void a2dDialogStyle::OnJoin(wxCommandEvent& event)
1759 switch(event.GetId())
1761 case ID_JOINMITER_BT: SetJoin(wxJOIN_MITER);
1763 case ID_JOINBEVEL_BT: SetJoin(wxJOIN_BEVEL);
1765 case ID_JOINROUND_BT: SetJoin(wxJOIN_ROUND);
1770 void a2dDialogStyle::SetJoin(wxPenJoin join)
1775 m_pJoinMiterBt->SetBitmap(wxBitmap(JoinMiterPressed_xpm));
1776 m_pJoinMiterBt->SetValue(
true);
1777 m_pJoinBevelBt->SetBitmap(wxBitmap(JoinBevel_xpm));
1778 m_pJoinBevelBt->SetValue(
false);
1779 m_pJoinRoundBt->SetBitmap(wxBitmap(JoinRound_xpm));
1780 m_pJoinRoundBt->SetValue(
false);
1784 m_pJoinMiterBt->SetBitmap(wxBitmap(JoinMiter_xpm));
1785 m_pJoinMiterBt->SetValue(
false);
1786 m_pJoinBevelBt->SetBitmap(wxBitmap(JoinBevelPressed_xpm));
1787 m_pJoinBevelBt->SetValue(
true);
1788 m_pJoinRoundBt->SetBitmap(wxBitmap(JoinRound_xpm));
1789 m_pJoinRoundBt->SetValue(
false);
1793 m_pJoinMiterBt->SetBitmap(wxBitmap(JoinMiter_xpm));
1794 m_pJoinMiterBt->SetValue(
false);
1795 m_pJoinBevelBt->SetBitmap(wxBitmap(JoinBevel_xpm));
1796 m_pJoinBevelBt->SetValue(
false);
1797 m_pJoinRoundBt->SetBitmap(wxBitmap(JoinRoundPressed_xpm));
1798 m_pJoinRoundBt->SetValue(
true);
1802 m_pJoinMiterBt->SetBitmap(wxBitmap(JoinMiter_xpm));
1803 m_pJoinMiterBt->SetValue(
false);
1804 m_pJoinBevelBt->SetBitmap(wxBitmap(JoinBevel_xpm));
1805 m_pJoinBevelBt->SetValue(
false);
1806 m_pJoinRoundBt->SetBitmap(wxBitmap(JoinRound_xpm));
1807 m_pJoinRoundBt->SetValue(
false);
1812 void a2dDialogStyle::OnCap(wxCommandEvent& event)
1814 switch(event.GetId())
1816 case ID_CAPBUTT_BT: SetCap(wxCAP_BUTT);
1818 case ID_CAPPROJECTING_BT: SetCap(wxCAP_PROJECTING);
1820 case ID_CAPROUND_BT: SetCap(wxCAP_ROUND);
1825 void a2dDialogStyle::SetCap(wxPenCap cap)
1830 m_pCapButtBt->SetBitmap(wxBitmap(CapButtPressed_xpm));
1831 m_pCapButtBt->SetValue(
true);
1832 m_pCapProjectingBt->SetBitmap(wxBitmap(CapProjecting_xpm));
1833 m_pCapProjectingBt->SetValue(
false);
1834 m_pCapRoundBt->SetBitmap(wxBitmap(CapRound_xpm));
1835 m_pCapRoundBt->SetValue(
false);
1838 case wxCAP_PROJECTING:
1839 m_pCapButtBt->SetBitmap(wxBitmap(CapButt_xpm));
1840 m_pCapButtBt->SetValue(
false);
1841 m_pCapProjectingBt->SetBitmap(wxBitmap(CapProjectingPressed_xpm));
1842 m_pCapProjectingBt->SetValue(
true);
1843 m_pCapRoundBt->SetBitmap(wxBitmap(CapRound_xpm));
1844 m_pCapRoundBt->SetValue(
false);
1848 m_pCapButtBt->SetBitmap(wxBitmap(CapButt_xpm));
1849 m_pCapButtBt->SetValue(
false);
1850 m_pCapProjectingBt->SetBitmap(wxBitmap(CapProjecting_xpm));
1851 m_pCapProjectingBt->SetValue(
false);
1852 m_pCapRoundBt->SetBitmap(wxBitmap(CapRoundPressed_xpm));
1853 m_pCapRoundBt->SetValue(
true);
1857 m_pCapButtBt->SetBitmap(wxBitmap(CapButt_xpm));
1858 m_pCapButtBt->SetValue(
false);
1859 m_pCapProjectingBt->SetBitmap(wxBitmap(CapProjecting_xpm));
1860 m_pCapProjectingBt->SetValue(
false);
1861 m_pCapRoundBt->SetBitmap(wxBitmap(CapRound_xpm));
1862 m_pCapRoundBt->SetValue(
false);
1867 void a2dDialogStyle::OnOk(wxCommandEvent& event)
1871 #if defined(__WXMSW__)
1872 m_pStrokeWidthCtrl->OnTextLostFocus(evt);
1875 UpdateStrokeData(
true);
1877 if(m_bFill && m_pFillBox->IsFillSelected())
1878 m_ExtFill.Set(m_pFillBox->GetFill());
1901 obj->SetBin2(
true );
1903 a2dFill fill = obj->GetFill();
1905 fill = layersetup->GetFill( obj->
GetLayer() );
1909 returned.Set( fill );
1911 returned.Mix( fill );
1939 obj->SetBin2(
true );
1943 stroke = layersetup->GetStroke( obj->
GetLayer() );
1946 returned.Set( stroke );
1948 returned.Mix( stroke );
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
(In) Visible property that can be added to Docview Objects.
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Base class for all types of strokes, understood by a2dDrawer2D classes.
static const a2dSignal sig_changedFill
when active drawing is set, this signal is send to the drawing.
static const a2dSignal sm_changedProperty
void DrawLine(double x1, double y1, double x2, double y2)
Draw line in world coordinates.
const a2dFill * a2dINHERIT_FILL
global a2dFill stock object for INHERTED from parent object filling
wxColour GetColour2() const
return colour 2
dialog for defining style on an a2dCanvasObject
void SetPixelStroke(bool pixelstroke)
set pixelstoke flag, stroke width is defined in pixels else in worldcoordinates
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
void ConnectEvent(wxEventType type, wxEvtHandler *eventSink)
void SetDrawerStroke(const a2dStroke &stroke)
Used to set the current stroke.
void SetStroke(const a2dStroke &stroke)
used for new objects etc. to set the stroke
bool GetPixelStroke() const
if the width is pixels or not.
This class implements drawing functions for wxDC based drawing.
a2dCanvasObject is the base class for Canvas Objects.
wxColour GetColour() const
return colour 1
wxBitmap GetBuffer() const
return buffer as a bitmap
void OnCloseWindow(wxCloseEvent &event)
Close window.
void SetFill(const a2dFill &fill)
used for new objects etc. to set the fill
bool m_doSentCommand
When canvas event, this is set to prevent sending commands.
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
void SetDrawerFill(const a2dFill &fill)
Used to set the current fill.
a2dFillStyle
Filling styles for a2dFill.
general style dialog to edit a2dCanvasObject style
void SetWidth(float width)
Set width of stroke in world coordinates.
wxColourDialog * m_cd
color dialog for color bitmap button sample
void SetColour(const wxColour &col)
set colour used for gradient and wxSTROKE_MASK_OPAQUE filling.
#define forEachIn(listtype, list)
easy iteration for a2dlist
static const a2dSignal sig_changedActiveDrawing
when active drawing is set, this signal is send to the drawing.
const a2dStroke & GetStroke() const
get the current stroke
polyline defined with list of points.
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
Contains graphical drawing context specific classes. a2dDcDrawer and derived classes are used for dra...
wxUint16 GetLayer() const
Returns the layer index where this object is drawn upon.
void SetColour(const wxColour &col)
set colour used for gradient and wxSTIPPLE_MASK_OPAQUE filling.
const a2dStroke * a2dINHERIT_STROKE
global a2dStroke stock object for INHERTED from parent object stroking
bool CheckMask(a2dCanvasObjectFlagsMask mask) const
Compares all flags in object to the given mask and return true is the same.
const a2dFill * a2dNullFILL
global a2dFill stock object for defining NO filling
defines common settinsg for a habitat for a set of a2dCameleons.
const a2dStroke * a2dNullSTROKE
global a2dStroke stock object for NO stroking
bool GetFixedStyle() const
Get object fixed style setting.
const a2dFill & GetFill() const
get the current fill
virtual void BeginDraw()
start to draw on this context (used to initialize a specific drawer)
wxColourData * m_cdata
colour data for colour dialog
property to hold a a2dStroke type variable to be associated with a a2dObject
bool GetRelease() const
get release flag
editing tool for a2dCanvasObject's
wxColour * m_color
the color that is under modification
wxColour GetColour() const
return colour
Event sent to a2dCommandProcessor.
all polygon and polyline a2dCanvasObject are here.
void DrawRoundedRectangle(double x, double y, double width, double height, double radius, bool pixelsize=false)
Draw RoundedRectangle in world coordinates.
a2dDrawing * GetDrawing() const
get drawing via top object
the a2dDrawingPart is a a2dView specially designed for displaying parts of a a2dDrawing. It uses a a2dDrawer2D to actually redraw things from the document, by giving that a2dDrawer2D as drawing context to the document, and telling the document to redraw a certain rectangular area. At that last is what this class is for. It optimizes the areas to be redrawn after object in the document were changed. To do that it combines redraw areas to a minimal set of redrawing areas. All the administration for this and the way things will be redrawn is from this view.
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
#define EVT_UNDO(func)
event sent from a2DocumentCommandProcessor when a command is undone
a2dStrokeStyle
stroke styles for a2dStroke
property to hold a a2dFill type variable to be associated with a a2dObject
void SetColour2(const wxColour &col)
set colour 2 used for gradient and wxSTIPPLE_MASK_OPAQUE filling.
bool DisconnectEvent(wxEventType type, wxEvtHandler *eventSink)
virtual void EndDraw()
end drawing on this context (used to reset a specific drawer)
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling