27 #include <wx/tglbtn.h>
28 #include <wx/valnum.h>
33 #include "../../art/resources/AlignTR.xpm"
34 #include "../../art/resources/AlignTRPressed.xpm"
35 #include "../../art/resources/AlignT.xpm"
36 #include "../../art/resources/AlignTPressed.xpm"
37 #include "../../art/resources/AlignTL.xpm"
38 #include "../../art/resources/AlignTLPressed.xpm"
39 #include "../../art/resources/AlignR.xpm"
40 #include "../../art/resources/AlignRPressed.xpm"
41 #include "../../art/resources/AlignC.xpm"
42 #include "../../art/resources/AlignCPressed.xpm"
43 #include "../../art/resources/AlignL.xpm"
44 #include "../../art/resources/AlignLPressed.xpm"
45 #include "../../art/resources/AlignBR.xpm"
46 #include "../../art/resources/AlignBRPressed.xpm"
47 #include "../../art/resources/AlignB.xpm"
48 #include "../../art/resources/AlignBPressed.xpm"
49 #include "../../art/resources/AlignBL.xpm"
50 #include "../../art/resources/AlignBLPressed.xpm"
59 ID_STROKECOLOR_BOX = wxID_HIGHEST + 1,
68 wxID_ALIGN_TL, wxID_ALIGN_T, wxID_ALIGN_TR,
69 wxID_ALIGN_L, wxID_ALIGN_C, wxID_ALIGN_R,
70 wxID_ALIGN_BL, wxID_ALIGN_B, wxID_ALIGN_BR,
76 #define a2dSHOW_ALL_SETTINGS
112 : wxDialog( parent, -1, (bGlobal) ? _("Global Font") : _("Font"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE ), m_bFill(bFill), m_UnitsScale(1), m_CustomColors(), m_ExtStroke(), m_ExtFill(), m_ExtFont()
118 m_styles[ wxT(
"Medium" ) ] = _(
"Medium" );
119 m_styles[ wxT(
"Medium Italic" ) ] = _(
"Medium Italic" );
120 m_styles[ wxT(
"Regular" ) ] = _(
"Regular" );
121 m_styles[ wxT(
"Italic" ) ] = _(
"Italic" );
122 m_styles[ wxT(
"Bold" ) ] = _(
"Bold" );
123 m_styles[ wxT(
"Bold Oblique" ) ] = _(
"Bold Oblique" );
124 m_styles[ wxT(
"Bold Italic" ) ] = _(
"Bold Italic" );
125 m_styles[ wxT(
"Light" ) ] = _(
"Light" );
126 m_styles[ wxT(
"Light Italic" ) ] = _(
"Light Italic" );
127 m_styles[ wxT(
"Black" ) ] = _(
"Black" );
128 m_styles[ wxT(
"Black Italic" ) ] = _(
"Black Italic" );
129 m_styles[ wxT(
"Narrow" ) ] = _(
"Narrow" );
130 m_styles[ wxT(
"Roman" ) ] = _(
"Roman" );
131 m_styles[ wxT(
"Condensed" ) ] = _(
"Condensed" );
132 m_styles[ wxT(
"Condensed Italic" ) ] = _(
"Condensed Italic" );
133 m_styles[ wxT(
"Condensed Bold" ) ] = _(
"Condensed Bold" );
134 m_styles[ wxT(
"Condensed Oblique" ) ] = _(
"Condensed Oblique" );
135 m_styles[ wxT(
"Condensed Bold Italic" ) ] = _(
"Condensed Bold Italic" );
136 m_styles[ wxT(
"Condensed Bold Oblique" ) ] = _(
"Condensed Bold Oblique" );
137 m_styles[ wxT(
"Poster Compressed" ) ] = _(
"Poster Compressed" );
138 m_styles[ wxT(
"ExtraLight" ) ] = _(
"ExtraLight" );
139 m_styles[ wxT(
"Oblique" ) ] = _(
"Oblique" );
140 m_styles[ wxT(
"Book" ) ] = _(
"Book" );
141 m_styles[ wxT(
"Demi" ) ] = _(
"Demi" );
142 m_styles[ wxT(
"Demi Oblique" ) ] = _(
"Demi Oblique" );
143 m_styles[ wxT(
"Demibold" ) ] = _(
"Demibold" );
144 m_styles[ wxT(
"Demibold Italic" ) ] = _(
"Demibold Italic" );
145 m_styles[ wxT(
"Demibold Roman" ) ] = _(
"Demibold Roman" );
146 m_styles[ wxT(
"Semilight" ) ] = _(
"Semilight" );
147 m_styles[ wxT(
"Semibold" ) ] = _(
"Semibold" );
148 m_styles[ wxT(
"Pixel Pen" ) ] = _(
"Pixel Pen" );
149 m_styles[ wxT(
"Normalized Pen" ) ] = _(
"Normalized Pen" );
150 m_styles[ wxT(
" 2% of height" ) ] = _(
" 2% of height" );
151 m_styles[ wxT(
" 5% of height" ) ] = _(
" 5% of height" );
152 m_styles[ wxT(
" 7% of height" ) ] = _(
" 7% of height" );
153 m_styles[ wxT(
"10% of height" ) ] = _(
"10% of height" );
154 m_styles[ wxT(
"15% of height" ) ] = _(
"15% of height" );
155 m_styles[ wxT(
"20% of height" ) ] = _(
"20% of height" );
157 CreateControls(bAllowLayerStyle);
160 void a2dTextPropDlgExt::CreateControls(
bool bAllowLayerStyle)
162 m_pTopSizer =
new wxBoxSizer(wxVERTICAL);
163 this->SetSizer(m_pTopSizer);
171 wxBoxSizer* propsizer =
new wxBoxSizer( wxHORIZONTAL );
172 wxBoxSizer* sizesizer =
new wxBoxSizer( wxVERTICAL );
175 wxBoxSizer* getwidthsizer_l;
176 getwidthsizer_l =
new wxBoxSizer( wxHORIZONTAL );
179 wxBoxSizer* typesizer =
new wxBoxSizer( wxVERTICAL );
180 wxStaticText* typetext =
new wxStaticText(
this, -1, _(
"Type:" ) );
181 typesizer->Add( typetext , 0, wxLEFT | wxRIGHT | wxTOP, 5 );
183 types.Add( _(
"* (All types)" ) );
184 for (
size_t i = 0; i < m_fonts->GetCount(); i++ )
186 wxString type = m_fonts->Item( i )->GetData()->GetType();
188 for ( j = 0; j < types.GetCount(); j++ )
190 if ( types.Item( j ) == type )
193 if ( j == types.GetCount() )
196 m_typelist =
new wxListBox(
this, wxID_FONTTYPE_LIST, wxDefaultPosition, wxDefaultSize, types, wxLB_SORT | wxLB_ALWAYS_SB );
197 typesizer->Add( m_typelist, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5 );
198 getwidthsizer_l->Add( typesizer, 0, wxALL | wxEXPAND, 5 );
199 #ifndef a2dSHOW_ALL_SETTINGS
202 #endif // a2dSHOW_ALL_SETTINGS
205 wxBoxSizer* fontsizer =
new wxBoxSizer( wxVERTICAL );
206 fontsizer->Add(
new wxStaticText(
this, -1, _(
"Font:" ) ), 0, wxLEFT | wxRIGHT | wxTOP, 5 );
207 wxArrayString fonts = GetFontList( a2dDEFAULT_FONTTYPE );
208 m_fontlist =
new wxListBox(
this, wxID_FONTNAME_LIST, wxDefaultPosition, wxDefaultSize, fonts, wxLB_SORT | wxLB_ALWAYS_SB );
209 m_fontlist->SetMinSize( m_fontlist->GetSize() );
210 fontsizer->Add( m_fontlist, 1, wxLEFT | wxRIGHT | wxBOTTOM| wxEXPAND , 5 );
211 getwidthsizer_l->Add( fontsizer, 0, wxALL | wxEXPAND, 5 );
213 propsizer->Add( getwidthsizer_l, 0, wxEXPAND, 0 );
216 wxBoxSizer* getwidthsizer_r;
217 getwidthsizer_r =
new wxBoxSizer( wxHORIZONTAL );
220 wxBoxSizer* stylesizer =
new wxBoxSizer( wxVERTICAL );
221 stylesizer->Add(
new wxStaticText(
this, -1, _(
"Style:" ) ), 0, wxLEFT | wxRIGHT | wxTOP, 5 );
222 wxString longeststyle = GetLongestStyle();
223 wxArrayString styles;
224 styles.Add( longeststyle );
225 m_stylelist =
new wxListBox(
this, wxID_FONTSTYLE_LIST, wxDefaultPosition, wxSize( -1,-1 ), styles, wxLB_SORT | wxLB_ALWAYS_SB );
226 m_stylelist->SetMinSize( m_stylelist->GetSize() );
227 stylesizer->Add( m_stylelist, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5 );
228 getwidthsizer_r->Add( stylesizer, 0, wxALL | wxEXPAND, 5 );
231 wxFloatingPointValidator<float> val( 1, NULL, wxNUM_VAL_DEFAULT );
232 val.SetRange( 1, MAXSIZE );
234 sizesizer->Add(
new wxStaticText(
this, -1, _(
"Size:" ) ), 0, wxLEFT | wxRIGHT | wxTOP, 5 );
236 for(
float i=5 ; i<=12 ; i++)
237 sizes.Add( wxString::Format(
"%.0f", i) );
238 for(
float i=14 ; i<=28 ; i=i+2)
239 sizes.Add( wxString::Format(
"%.0f", i) );
240 sizes.Add( wxString::Format(
"%.0f", 36.0) );
241 sizes.Add( wxString::Format(
"%.0f", 48.0) );
242 sizes.Add( wxString::Format(
"%.0f", 72.0) );
243 m_sizelist =
new wxListBox(
this, wxID_FONTSIZE_LIST, wxDefaultPosition, wxDefaultSize, sizes, wxLB_ALWAYS_SB );
244 m_sizeedit =
new wxTextCtrl(
this, wxID_FONTSIZE_EDIT, wxT(
"" ), wxDefaultPosition, wxDefaultSize, 0, val );
245 m_sizeedit->SetMinSize( wxSize(70, -1) );
246 sizesizer->Add( m_sizeedit, 0, wxLEFT | wxRIGHT | wxEXPAND, 5 );
247 sizesizer->Add( m_sizelist, 1, wxLEFT | wxRIGHT | wxBOTTOM| wxEXPAND , 5 );
248 getwidthsizer_r->Add( sizesizer, 0, wxALL | wxEXPAND, 5 );
250 propsizer->Add( getwidthsizer_r, 0, wxEXPAND, 0 );
252 m_pTopSizer->Add( propsizer, 1, wxALL | wxEXPAND, 5 );
253 getwidthsizer_r->Layout();
254 getwidthsizer_l->Layout();
256 wxBoxSizer* bottomsizer =
new wxBoxSizer( wxHORIZONTAL );
261 wxStaticBoxSizer* pStaticBoxSizerAlignment =
new wxStaticBoxSizer(
new wxStaticBox(
this, wxID_ANY, wxT(
"Alignment:") ), wxVERTICAL );
262 wxGridSizer* alignsizer2 =
new wxGridSizer( 3 );
263 m_pAlignTL_Bt =
new wxBitmapToggleButton(
this, wxID_ALIGN_TL, wxBitmap(AlignTL_xpm), wxDefaultPosition, wxSize(24, 24), wxBU_EXACTFIT);
264 alignsizer2->Add( m_pAlignTL_Bt, 0, 0, 0 );
265 m_pAlignT_Bt =
new wxBitmapToggleButton(
this, wxID_ALIGN_T, wxBitmap(AlignT_xpm), wxDefaultPosition, wxSize(24, 24), wxBU_EXACTFIT);
266 alignsizer2->Add( m_pAlignT_Bt, 0, 0, 0 );
267 m_pAlignTR_Bt =
new wxBitmapToggleButton(
this, wxID_ALIGN_TR, wxBitmap(AlignTR_xpm), wxDefaultPosition, wxSize(24, 24), wxBU_EXACTFIT);
268 alignsizer2->Add( m_pAlignTR_Bt, 0, 0, 0 );
269 m_pAlignL_Bt =
new wxBitmapToggleButton(
this, wxID_ALIGN_L, wxBitmap(AlignL_xpm), wxDefaultPosition, wxSize(24, 24), wxBU_EXACTFIT);
270 alignsizer2->Add( m_pAlignL_Bt, 0, 0, 0 );
271 m_pAlignC_Bt =
new wxBitmapToggleButton(
this, wxID_ALIGN_C, wxBitmap(AlignC_xpm), wxDefaultPosition, wxSize(24, 24), wxBU_EXACTFIT);
272 alignsizer2->Add( m_pAlignC_Bt, 0, 0, 0 );
273 m_pAlignR_Bt =
new wxBitmapToggleButton(
this, wxID_ALIGN_R, wxBitmap(AlignR_xpm), wxDefaultPosition, wxSize(24, 24), wxBU_EXACTFIT);
274 alignsizer2->Add( m_pAlignR_Bt, 0, 0, 0 );
275 m_pAlignBL_Bt =
new wxBitmapToggleButton(
this, wxID_ALIGN_BL, wxBitmap(AlignBL_xpm), wxDefaultPosition, wxSize(24, 24), wxBU_EXACTFIT);
276 alignsizer2->Add( m_pAlignBL_Bt, 0, 0, 0 );
277 m_pAlignB_Bt =
new wxBitmapToggleButton(
this, wxID_ALIGN_B, wxBitmap(AlignB_xpm), wxDefaultPosition, wxSize(24, 24), wxBU_EXACTFIT);
278 alignsizer2->Add( m_pAlignB_Bt, 0, 0, 0 );
279 m_pAlignBR_Bt =
new wxBitmapToggleButton(
this, wxID_ALIGN_BR, wxBitmap(AlignBR_xpm), wxDefaultPosition, wxSize(24, 24), wxBU_EXACTFIT);
280 alignsizer2->Add( m_pAlignBR_Bt, 0, 0, 0 );
283 pStaticBoxSizerAlignment->Add( alignsizer2, 0, wxALL | wxEXPAND, 5 );
284 m_aligncheck =
new wxCheckBox(
this, wxID_CHECK_ALIGN, _(
"Align on bbox" ) );
285 pStaticBoxSizerAlignment->Add( m_aligncheck, 0, 0 );
286 bottomsizer->Add( pStaticBoxSizerAlignment, 0, wxALL | wxEXPAND, 5 );
287 #ifndef a2dSHOW_ALL_SETTINGS
288 m_aligncheck->Hide();
289 #endif // a2dSHOW_ALL_SETTINGS
293 wxStaticBoxSizer* pStaticBoxSizerPreview =
new wxStaticBoxSizer(
new wxStaticBox(
this, wxID_ANY, wxT(
"Sample:") ), wxVERTICAL );
294 m_canvas =
new a2dCanvas(
this, -1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER );
298 m_canvastext =
new a2dText( _T(
"AaBbCc12" ) );
302 root->
Append( m_canvastext );
303 m_canvasline1 =
new a2dSLine( 0.0, 0.0, 1.0, 0.0 );
304 m_canvasline1->
SetStroke( wxColour( 0xc0, 0xc0, 0xc0 ), 1 );
305 root->
Append( m_canvasline1 );
306 m_canvasline2 =
new a2dSLine( 0.0, 0.0, 0.0, 1.0 );
307 m_canvasline2->
SetStroke( wxColour( 0xc0, 0xc0, 0xc0 ), 1 );
308 root->
Append( m_canvasline2 );
309 pStaticBoxSizerPreview->Add( m_canvas, 1, wxALL | wxEXPAND, 5 );
310 bottomsizer->Add(pStaticBoxSizerPreview, 1, wxALL | wxEXPAND, 5 );
312 m_pTopSizer->Add( bottomsizer, 0, wxALL | wxEXPAND, 5 );
318 wxBoxSizer* coloursizer;
319 coloursizer =
new wxBoxSizer( wxHORIZONTAL );
324 wxBoxSizer* textcoloursizer;
325 textcoloursizer =
new wxBoxSizer( wxVERTICAL );
326 wxStaticText* pStrokeColorTxt =
new wxStaticText(
this, wxID_ANY, wxT(
"Textcolour:"), wxDefaultPosition, wxDefaultSize, 0 );
327 textcoloursizer->Add( pStrokeColorTxt, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
328 m_pStrokeColorBox =
new a2dColorComboBox(
this, ID_STROKECOLOR_BOX,
false, &m_CustomColors);
329 m_pStrokeColorBox->SetMinSize( wxSize( getwidthsizer_l->GetMinSize().GetWidth()-spacerwidth*2, -1) );
330 textcoloursizer->Add( m_pStrokeColorBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
333 m_textframe =
new wxCheckBox(
this, wxID_CHECK_FRAME, _(
"Frame around text" ) );
334 textcoloursizer->Add( m_textframe, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
335 #ifndef a2dSHOW_ALL_SETTINGS
337 #endif // a2dSHOW_ALL_SETTINGS
339 coloursizer->Add( textcoloursizer, 0, 0, 0 );
341 coloursizer->Add( spacerwidth, 0, 0, 0, 5 );
344 wxBoxSizer* backgroundcoloursizer;
345 backgroundcoloursizer =
new wxBoxSizer( wxVERTICAL );
346 wxStaticText* pFillColorTxt =
new wxStaticText(
this, wxID_ANY, wxT(
"Backgroundcolour:"), wxDefaultPosition, wxDefaultSize, 0 );
347 backgroundcoloursizer->Add( pFillColorTxt, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
348 m_pFillBox =
new a2dFillComboBox(
this, ID_FILL_BOX, bAllowLayerStyle, &m_CustomColors);
349 m_pFillBox->SetMinSize( wxSize( getwidthsizer_r->GetMinSize().GetWidth()-spacerwidth*2, -1) );
350 if(!m_bFill) m_pFillBox->Disable();
351 backgroundcoloursizer->Add( m_pFillBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
354 m_textbackground =
new wxCheckBox(
this, wxID_CHECK_BACKGROUND, _(
"Fill text background" ) );
355 backgroundcoloursizer->Add( m_textbackground, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
356 #ifndef a2dSHOW_ALL_SETTINGS
357 m_textbackground->Hide();
358 #endif // a2dSHOW_ALL_SETTINGS
360 coloursizer->Add( backgroundcoloursizer, 0, 0, 0 );
362 m_pTopSizer->Add( coloursizer, 0, wxALL, 10 );
364 wxBoxSizer* buttonsizer =
new wxBoxSizer( wxHORIZONTAL );
365 #ifdef a2dSHOW_ALL_SETTINGS
366 buttonsizer->Add(
new wxButton(
this, wxID_FONT_SEARCHPATH, _(
"Search Path" ) ), 0, wxALL, 5 );
367 #endif // a2dSHOW_ALL_SETTINGS
368 buttonsizer->Add(
new wxButton(
this, wxID_OK, _(
"OK" ) ), 0, wxALL, 5 );
369 buttonsizer->Add(
new wxButton(
this, wxID_CANCEL, _(
"Cancel" ) ), 0, wxALL, 5 );
370 m_pTopSizer->Add( buttonsizer, 0, wxALL|wxALIGN_RIGHT, 5 );
373 void a2dTextPropDlgExt::OnInitDialog(wxInitDialogEvent& event)
377 defaultStroke.SetJoin(wxJOIN_MITER);
378 defaultStroke.SetCap(wxCAP_BUTT);
379 m_ExtStroke.SetDefault(defaultStroke);
383 UpdateStrokeData(
false);
385 if(m_bFill && m_ExtFill.IsValid())
386 m_pFillBox->SetFill(m_ExtFill.Get());
391 GetSizer()->SetSizeHints(
this);
396 void a2dTextPropDlgExt::UpdateStrokeData(
bool bGetFromDlg)
400 if(m_pStrokeColorBox->IsColorSelected())
401 m_ExtStroke.SetColor(m_pStrokeColorBox->GetColor());
405 if(m_ExtStroke.HasEditableStyle())
407 m_pStrokeColorBox->Enable();
408 if(m_ExtStroke.IsColorValid())
409 m_pStrokeColorBox->SetColor(m_ExtStroke.GetColor());
413 m_pStrokeColorBox->Disable();
414 m_pStrokeColorBox->SetSelection(-1);
419 void a2dTextPropDlgExt::UpdateFontData()
422 if(m_ExtFont.IsSizeValid())
425 double size = ( ( m_ExtFont.GetFont().
GetFontInfo().
GetSize() * m_UnitsScale ) / 25.4 ) * 72;
426 int remainder = int( ( size+0.05 ) *10 ) % 10;
428 sizetext.Printf( wxT(
"%.1f" ), size );
430 sizetext.Printf( wxT(
"%.0f" ), size );
432 m_sizeedit->SetValue( sizetext );
433 int itemnr = m_sizelist->FindString( sizetext );
434 m_sizelist->SetSelection( itemnr );
436 m_sizelist->SetFirstItem( itemnr );
440 if(m_ExtFont.IsTypeValid())
442 if ( m_typelist->GetCount() )
446 if ( idx == wxNOT_FOUND )
448 m_typelist->SetSelection( idx );
452 if(m_ExtFont.IsAlignmentValid())
455 SetAlignment( m_ExtFont.GetAlignment() );
458 m_aligncheck->SetValue( ( m_ExtFont.GetAlignment() & wxBASELINE ) > 0 );
461 if(m_ExtFont.IsTextflagsValid())
470 if(m_ExtFont.IsNameValid())
473 wxString oldname = m_fontlist->GetStringSelection();
475 if ( m_fontlist->GetCount() )
480 idx = m_fontlist->FindString( oldname );
481 if ( idx == wxNOT_FOUND )
483 m_fontlist->SetSelection( idx );
485 m_fontlist->SetFirstItem( idx );
490 wxCommandEvent dummy;
497 void a2dTextPropDlgExt::OnOk(wxCommandEvent& event)
499 if(m_FontFound ==
false)
502 wxString type = m_typelist->GetStringSelection();
503 wxString name = m_fontlist->GetStringSelection();
505 wxStringToStringHashMap::const_iterator it;
506 for( it = m_styles.begin(); it != m_styles.end(); ++it )
508 if( it->second == m_stylelist->GetStringSelection() )
515 for (
size_t i = 0; i < m_fonts->GetCount(); i++ )
517 wxString fonttype = m_fonts->Item( i )->GetData()->GetType();
518 wxString fontname = m_fonts->Item( i )->GetData()->GetName();
519 wxString fontstyle = m_fonts->Item( i )->GetData()->GetStyle();
520 if ( ( fonttype == type || type == _(
"* (All types)" ) )
521 && fontname == name )
524 m_sizeedit->GetValue().ToDouble( &size );
525 a2dFontInfo fontinfo = *m_fonts->Item( i )->GetData();
527 if( size < 1 || size > MAXSIZE )
528 size = ( ( m_ExtFont.GetFont().
GetFontInfo().
GetSize() * m_UnitsScale ) / 25.4 ) * 72;
530 int round = float ( ( ( ( ( size ) / 72 ) * 25.4 ) / m_UnitsScale ) + 0.5 );
533 m_ExtFont.SetStyleValidity(
false );
539 UpdateStrokeData(
true);
541 if(m_bFill && m_pFillBox->IsFillSelected())
542 m_ExtFill.Set(m_pFillBox->GetFill());
549 wxString type = m_typelist->GetStringSelection();
550 wxString oldname = m_fontlist->GetStringSelection();
552 while ( m_fontlist->GetCount() )
553 m_fontlist->Delete( 0 );
555 m_fontlist->Append( GetFontList( type ) );
557 if ( m_fontlist->GetCount() )
562 idx = m_fontlist->FindString( oldname );
563 if ( idx == wxNOT_FOUND )
565 m_fontlist->SetSelection( idx );
573 wxString type = m_typelist->GetStringSelection();
574 wxString name = m_fontlist->GetStringSelection();
576 wxStringToStringHashMap::const_iterator it;
577 for( it = m_styles.begin(); it != m_styles.end(); ++it )
579 if( it->second == m_stylelist->GetStringSelection() )
581 oldstyle = it->first;
586 while ( m_stylelist->GetCount() )
587 m_stylelist->Delete( 0 );
593 for (
size_t i = 0; i < m_fonts->GetCount(); i++ )
595 wxString fontname = m_fonts->Item( i )->GetData()->GetName();
596 wxString fonttype = m_fonts->Item( i )->GetData()->GetType();
597 wxString fontstyle = m_fonts->Item( i )->GetData()->GetStyle();
599 if ( ( fonttype == type || type == _(
"* (All types)" ) )
600 && fontname == name )
603 wxStringToStringHashMap::const_iterator it = m_styles.find( fontstyle );
604 if( it != m_styles.end())
606 for ( j = 0; j < fonts.GetCount(); j++ )
608 if ( fonts.Item( j ) == it->second )
611 if ( j == fonts.GetCount() )
613 fonts.Add( it->second );
617 wxFAIL_MSG( wxString::Format(
"Fontstyle \"%s\" is unknown.", fontstyle) );
621 m_stylelist->Append( fonts );
625 wxArrayString mapped_styles, common_styles = m_ExtFont.GetCommonStyle();
627 for(
int i=0; i < common_styles.GetCount(); i++ )
629 wxStringToStringHashMap::const_iterator it = m_styles.find( common_styles[i] );
630 if( it != m_styles.end())
632 mapped_styles.Add( it->second );
635 m_stylelist->Append( mapped_styles );
639 if ( m_stylelist->GetCount() )
641 if( m_ExtFont.IsStyleValid() )
645 wxStringToStringHashMap::const_iterator it = m_styles.find( m_ExtFont.GetFont().
GetFontInfo().
GetStyle() );
646 if( it != m_styles.end())
647 idx = m_stylelist->FindString( it->second );
650 wxFAIL_MSG( wxString::Format(
"Fontstyle \"%s\" is unknown.", m_ExtFont.GetFont().
GetFontInfo().
GetStyle()) );
654 if( idx != wxNOT_FOUND )
656 m_stylelist->SetSelection( idx );
666 wxStringToStringHashMap::const_iterator it;
667 for( it = m_styles.begin(); it != m_styles.end(); ++it )
669 if( it->second == m_stylelist->GetStringSelection() )
681 m_sizelist->SetSelection( wxNOT_FOUND );
687 int idx = m_sizelist->GetSelection();
688 m_sizeedit->SetValue( m_sizelist->GetStringSelection() );
689 m_sizelist->SetSelection( idx );
692 m_sizelist->GetStringSelection().ToDouble( &size );
693 int round = float ( ( ( ( ( size ) / 72 ) * 25.4 ) / m_UnitsScale ) + 0.5 );
700 wxString type = m_typelist->GetStringSelection();
701 wxString name = m_fontlist->GetStringSelection();
703 wxStringToStringHashMap::const_iterator it;
704 for( it = m_styles.begin(); it != m_styles.end(); ++it )
706 if( it->second == m_stylelist->GetStringSelection() )
716 bool use_temp_font =
false;
718 for (
size_t i = 0; i < m_fonts->GetCount(); i++ )
720 wxString fonttype = m_fonts->Item( i )->GetData()->GetType();
721 wxString fontname = m_fonts->Item( i )->GetData()->GetName();
722 wxString fontstyle = m_fonts->Item( i )->GetData()->GetStyle();
723 if ( ( fonttype == type || type == _(
"* (All types)" ) )
724 && fontname == name && fontstyle == style )
726 valid_font = *m_fonts->Item( i )->GetData();
731 if ( ( fonttype == type || type == _(
"* (All types)" ) )
732 && fontname == name && style == wxT(
"") )
734 if ( !use_temp_font || fontstyle == wxT(
"Regular"))
736 use_temp_font =
true;
737 temp_font = *m_fonts->Item( i )->GetData();
745 m_sizeedit->GetValue().ToDouble( &size );
746 if( size < 1 || size > MAXSIZE )
747 size = ( ( m_ExtFont.GetFont().
GetFontInfo().
GetSize() * m_UnitsScale ) / 25.4 ) * 72;
752 int round = float ( ( ( ( ( size ) / 72 ) * 25.4 ) / m_UnitsScale ) + 0.5 );
756 m_canvastext->
SetFont( m_ExtFont.GetFont() );
762 int round = float ( ( ( ( ( size ) / 72 ) * 25.4 ) / m_UnitsScale ) + 0.5 );
763 temp_font.
SetSize( ( ( ( size ) / 72 ) * 25.4 ) / round );
773 if( m_ExtFont.IsAlignmentValid() )
780 m_canvastext->
SetAlignment( wxMAXY | wxMINX | wxBASELINE_CONTRA );
785 if( m_pStrokeColorBox->IsColorSelected() )
786 m_canvastext->
SetStroke( m_pStrokeColorBox->GetColor() );
788 m_canvastext->
SetStroke( wxColour( *wxBLACK ) );
799 if ( dlg.ShowModal() == wxID_OK )
804 wxString oldtype = m_typelist->GetStringSelection();
806 while ( m_typelist->GetCount() )
807 m_typelist->Delete( 0 );
809 types.Add( _(
"* (All types)" ) );
810 for (
size_t i = 0; i < m_fonts->GetCount(); i++ )
812 wxString type = m_fonts->Item( i )->GetData()->GetType();
814 for ( j = 0; j < types.GetCount(); j++ )
816 if ( types.Item( j ) == type )
819 if ( j == types.GetCount() )
822 m_typelist->Append( types );
824 if ( m_typelist->GetCount() )
826 int idx = m_typelist->FindString( oldtype );
827 if ( idx == wxNOT_FOUND )
829 m_typelist->SetSelection( idx );
837 switch( event.GetId() )
839 case wxID_ALIGN_TL: m_ExtFont.
SetAlignment( wxMAXY | wxMINX );
break;
840 case wxID_ALIGN_T: m_ExtFont.
SetAlignment( wxMAXY );
break;
841 case wxID_ALIGN_TR: m_ExtFont.
SetAlignment( wxMAXY | wxMAXX );
break;
842 case wxID_ALIGN_L: m_ExtFont.
SetAlignment( wxMINX );
break;
843 case wxID_ALIGN_C: m_ExtFont.
SetAlignment( wxMIDX | wxMIDY );
break;
844 case wxID_ALIGN_R: m_ExtFont.
SetAlignment( wxMAXX );
break;
845 case wxID_ALIGN_BL: m_ExtFont.
SetAlignment( wxMINY | wxMINX );
break;
846 case wxID_ALIGN_B: m_ExtFont.
SetAlignment( wxMINY );
break;
847 case wxID_ALIGN_BR: m_ExtFont.
SetAlignment( wxMINY | wxMAXX );
break;
851 if ( m_aligncheck->IsChecked() )
853 m_ExtFont.
SetAlignment( m_ExtFont.GetAlignment() | wxBASELINE );
854 m_ExtFont.
SetAlignment( m_ExtFont.GetAlignment() & ~wxBASELINE_CONTRA );
858 m_ExtFont.
SetAlignment( m_ExtFont.GetAlignment() | wxBASELINE_CONTRA );
859 m_ExtFont.
SetAlignment( m_ExtFont.GetAlignment() & ~wxBASELINE );
862 SetAlignment( m_ExtFont.GetAlignment() );
869 if ( m_textframe->IsChecked() )
874 if ( m_textbackground->IsChecked() )
894 wxArrayString a2dTextPropDlgExt::GetFontList(wxString type)
897 for (
size_t i = 0; i < m_fonts->GetCount(); i++ )
899 wxString fonttype = m_fonts->Item( i )->GetData()->GetType();
900 if ( fonttype == type || type == _(
"* (All types)" ) )
902 wxString fontname = m_fonts->Item( i )->GetData()->GetName();
904 for ( j = 0; j < fonts.GetCount(); j++ )
906 if ( fonts.Item( j ) == fontname )
909 if ( j == fonts.GetCount() )
910 fonts.Add( fontname );
917 wxString a2dTextPropDlgExt::GetLongestStyle()
919 wxString longeststyle =
"";
920 for (
size_t i = 0; i < m_fonts->GetCount(); i++ )
922 wxString fontname = m_fonts->Item( i )->GetData()->GetName();
923 wxString fonttype = m_fonts->Item( i )->GetData()->GetType();
924 wxString fontstyle = m_fonts->Item( i )->GetData()->GetStyle();
926 wxStringToStringHashMap::const_iterator it = m_styles.find( fontstyle );
927 if( it != m_styles.end())
929 if( it->second.Length() > longeststyle.Length() )
930 longeststyle = it->second;
936 void a2dTextPropDlgExt::RepaintSample()
946 if ( m_ExtFont.GetAlignment() & wxMINX )
948 if ( m_ExtFont.GetAlignment() & wxMAXX )
951 if ( m_ExtFont.GetAlignment() & wxMINY )
953 if ( m_ExtFont.GetAlignment() & wxMAXY )
956 if( m_pFillBox->GetFill().
IsNoFill() )
960 if ( m_ExtFont.GetAlignment() & wxBASELINE )
961 m_canvastext->
SetFill( m_pFillBox->GetFill() );
962 if ( m_ExtFont.GetAlignment() & wxBASELINE_CONTRA )
963 m_canvastext->
SetFill( m_pFillBox->GetFill() );
974 void a2dTextPropDlgExt::SetAlignment(
int align)
978 case wxMAXY | wxMINX:
979 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTLPressed_xpm));
980 m_pAlignTL_Bt->SetValue(
true);
981 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignT_xpm));
982 m_pAlignT_Bt->SetValue(
false);
983 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTR_xpm));
984 m_pAlignTR_Bt->SetValue(
false);
985 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignL_xpm));
986 m_pAlignL_Bt->SetValue(
false);
987 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignC_xpm));
988 m_pAlignC_Bt->SetValue(
false);
989 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignR_xpm));
990 m_pAlignR_Bt->SetValue(
false);
991 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBL_xpm));
992 m_pAlignBL_Bt->SetValue(
false);
993 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignB_xpm));
994 m_pAlignB_Bt->SetValue(
false);
995 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBR_xpm));
996 m_pAlignBR_Bt->SetValue(
false);
999 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTL_xpm));
1000 m_pAlignTL_Bt->SetValue(
false);
1001 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignTPressed_xpm));
1002 m_pAlignT_Bt->SetValue(
true);
1003 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTR_xpm));
1004 m_pAlignTR_Bt->SetValue(
false);
1005 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignL_xpm));
1006 m_pAlignL_Bt->SetValue(
false);
1007 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignC_xpm));
1008 m_pAlignC_Bt->SetValue(
false);
1009 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignR_xpm));
1010 m_pAlignR_Bt->SetValue(
false);
1011 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBL_xpm));
1012 m_pAlignBL_Bt->SetValue(
false);
1013 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignB_xpm));
1014 m_pAlignB_Bt->SetValue(
false);
1015 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBR_xpm));
1016 m_pAlignBR_Bt->SetValue(
false);
1018 case wxMAXY | wxMAXX:
1019 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTL_xpm));
1020 m_pAlignTL_Bt->SetValue(
false);
1021 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignT_xpm));
1022 m_pAlignT_Bt->SetValue(
false);
1023 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTRPressed_xpm));
1024 m_pAlignTR_Bt->SetValue(
true);
1025 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignL_xpm));
1026 m_pAlignL_Bt->SetValue(
false);
1027 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignC_xpm));
1028 m_pAlignC_Bt->SetValue(
false);
1029 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignR_xpm));
1030 m_pAlignR_Bt->SetValue(
false);
1031 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBL_xpm));
1032 m_pAlignBL_Bt->SetValue(
false);
1033 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignB_xpm));
1034 m_pAlignB_Bt->SetValue(
false);
1035 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBR_xpm));
1036 m_pAlignBR_Bt->SetValue(
false);
1039 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTL_xpm));
1040 m_pAlignTL_Bt->SetValue(
false);
1041 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignT_xpm));
1042 m_pAlignT_Bt->SetValue(
false);
1043 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTR_xpm));
1044 m_pAlignTR_Bt->SetValue(
false);
1045 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignLPressed_xpm));
1046 m_pAlignL_Bt->SetValue(
true);
1047 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignC_xpm));
1048 m_pAlignC_Bt->SetValue(
false);
1049 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignR_xpm));
1050 m_pAlignR_Bt->SetValue(
false);
1051 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBL_xpm));
1052 m_pAlignBL_Bt->SetValue(
false);
1053 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignB_xpm));
1054 m_pAlignB_Bt->SetValue(
false);
1055 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBR_xpm));
1056 m_pAlignBR_Bt->SetValue(
false);
1058 case wxMIDX | wxMIDY:
1059 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTL_xpm));
1060 m_pAlignTL_Bt->SetValue(
false);
1061 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignT_xpm));
1062 m_pAlignT_Bt->SetValue(
false);
1063 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTR_xpm));
1064 m_pAlignTR_Bt->SetValue(
false);
1065 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignL_xpm));
1066 m_pAlignL_Bt->SetValue(
false);
1067 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignCPressed_xpm));
1068 m_pAlignC_Bt->SetValue(
true);
1069 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignR_xpm));
1070 m_pAlignR_Bt->SetValue(
false);
1071 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBL_xpm));
1072 m_pAlignBL_Bt->SetValue(
false);
1073 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignB_xpm));
1074 m_pAlignB_Bt->SetValue(
false);
1075 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBR_xpm));
1076 m_pAlignBR_Bt->SetValue(
false);
1079 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTL_xpm));
1080 m_pAlignTL_Bt->SetValue(
false);
1081 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignT_xpm));
1082 m_pAlignT_Bt->SetValue(
false);
1083 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTR_xpm));
1084 m_pAlignTR_Bt->SetValue(
false);
1085 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignL_xpm));
1086 m_pAlignL_Bt->SetValue(
false);
1087 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignC_xpm));
1088 m_pAlignC_Bt->SetValue(
false);
1089 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignRPressed_xpm));
1090 m_pAlignR_Bt->SetValue(
true);
1091 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBL_xpm));
1092 m_pAlignBL_Bt->SetValue(
false);
1093 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignB_xpm));
1094 m_pAlignB_Bt->SetValue(
false);
1095 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBR_xpm));
1096 m_pAlignBR_Bt->SetValue(
false);
1098 case wxMINY | wxMINX:
1099 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTL_xpm));
1100 m_pAlignTL_Bt->SetValue(
false);
1101 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignT_xpm));
1102 m_pAlignT_Bt->SetValue(
false);
1103 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTR_xpm));
1104 m_pAlignTR_Bt->SetValue(
false);
1105 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignL_xpm));
1106 m_pAlignL_Bt->SetValue(
false);
1107 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignC_xpm));
1108 m_pAlignC_Bt->SetValue(
false);
1109 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignR_xpm));
1110 m_pAlignR_Bt->SetValue(
false);
1111 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBLPressed_xpm));
1112 m_pAlignBL_Bt->SetValue(
true);
1113 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignB_xpm));
1114 m_pAlignB_Bt->SetValue(
false);
1115 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBR_xpm));
1116 m_pAlignBR_Bt->SetValue(
false);
1119 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTL_xpm));
1120 m_pAlignTL_Bt->SetValue(
false);
1121 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignT_xpm));
1122 m_pAlignT_Bt->SetValue(
false);
1123 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTR_xpm));
1124 m_pAlignTR_Bt->SetValue(
false);
1125 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignL_xpm));
1126 m_pAlignL_Bt->SetValue(
false);
1127 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignC_xpm));
1128 m_pAlignC_Bt->SetValue(
false);
1129 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignR_xpm));
1130 m_pAlignR_Bt->SetValue(
false);
1131 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBL_xpm));
1132 m_pAlignBL_Bt->SetValue(
false);
1133 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignBPressed_xpm));
1134 m_pAlignB_Bt->SetValue(
true);
1135 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBR_xpm));
1136 m_pAlignBR_Bt->SetValue(
false);
1138 case wxMINY | wxMAXX:
1139 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTL_xpm));
1140 m_pAlignTL_Bt->SetValue(
false);
1141 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignT_xpm));
1142 m_pAlignT_Bt->SetValue(
false);
1143 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTR_xpm));
1144 m_pAlignTR_Bt->SetValue(
false);
1145 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignL_xpm));
1146 m_pAlignL_Bt->SetValue(
false);
1147 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignC_xpm));
1148 m_pAlignC_Bt->SetValue(
false);
1149 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignR_xpm));
1150 m_pAlignR_Bt->SetValue(
false);
1151 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBL_xpm));
1152 m_pAlignBL_Bt->SetValue(
false);
1153 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignB_xpm));
1154 m_pAlignB_Bt->SetValue(
false);
1155 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBRPressed_xpm));
1156 m_pAlignBR_Bt->SetValue(
true);
1159 m_pAlignTL_Bt->SetBitmap(wxBitmap(AlignTL_xpm));
1160 m_pAlignTL_Bt->SetValue(
false);
1161 m_pAlignT_Bt->SetBitmap(wxBitmap(AlignT_xpm));
1162 m_pAlignT_Bt->SetValue(
false);
1163 m_pAlignTR_Bt->SetBitmap(wxBitmap(AlignTR_xpm));
1164 m_pAlignTR_Bt->SetValue(
false);
1165 m_pAlignL_Bt->SetBitmap(wxBitmap(AlignL_xpm));
1166 m_pAlignL_Bt->SetValue(
false);
1167 m_pAlignC_Bt->SetBitmap(wxBitmap(AlignC_xpm));
1168 m_pAlignC_Bt->SetValue(
false);
1169 m_pAlignR_Bt->SetBitmap(wxBitmap(AlignR_xpm));
1170 m_pAlignR_Bt->SetValue(
false);
1171 m_pAlignBL_Bt->SetBitmap(wxBitmap(AlignBL_xpm));
1172 m_pAlignBL_Bt->SetValue(
false);
1173 m_pAlignB_Bt->SetBitmap(wxBitmap(AlignB_xpm));
1174 m_pAlignB_Bt->SetValue(
false);
1175 m_pAlignBR_Bt->SetBitmap(wxBitmap(AlignBR_xpm));
1176 m_pAlignBR_Bt->SetValue(
false);
1193 obj->SetBin2(
true );
1207 returned.SetNameValidity(
false );
1208 returned.SetStyleValidity(
false );
double GetHeight() const
returns height of the boundingbox
all basic primitives derived from a2dCanvasObject
#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.
void OnChangeFontSize(wxCommandEvent &event)
User interface event handler.
const wxString & GetName() const
Get name of font, e.g. Arial.
bool GetWrongLoad() const
Get flag if text couldn't be loadad from file.
void SetAlignment(int alignment)
Set the position of the anchor point w.r.t the text.
Font info class, used as a single element for enumerating fonts.
disable background drawing
void SetPosXY12(double x1, double y1, double x2, double y2, bool afterinversion=true)
sets both positions of line
void OnChangeFontSizeList(wxCommandEvent &event)
User interface event handler.
void OnSearchPath(wxCommandEvent &event)
User interface event handler.
void OnColourChange(wxCommandEvent &event)
User interface event handler.
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
double GetSize() const
Get size of the font.
allow draw a frame rect around a text
void Enlarge(const double Marge)
enlarge with the given amount
void OnChangeFont()
User interface event handler.
void OnAlignment(wxCommandEvent &event)
User interface event handler.
a2dBoundingBox GetCalculatedBoundingBox(int nChildLevels)
Like GetBbox, but it always calculcates the bounding box from scratch.
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
virtual void SetPending(bool pending)
set this object pending for update
void SetSize(double size)
Set the size.
void SetYaxis(bool up)
set if the Yaxis goes up or down
a2dCanvasObject is the base class for Canvas Objects.
a2dCanvas uses a2dCanvasView for displaying a view on a a2dCanvasDocument.
a2dFont GetFont() const
get font for text
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
a2dText is an abstract base class.
const wxString & GetType() const
Get type of font, e.g. Freetype or Stroke.
const a2dBoundingBox & Translate(a2dPoint2D &)
translate with given vector
void SetName(wxString name)
Set the font name.
double GetMinX() const
get minimum X of the boundingbox
void OnTextflags(wxCommandEvent &event)
User interface event handler.
void SetMappingWidthHeight(double vx1, double vy1, double width, double height, bool scrollbars)
Give the virtual size to be displayed, the mappingmatrix will be calculated.
void SetFont(const a2dFont &font, double lineSpaceFactor=0.1)
set font for text
#define forEachIn(listtype, list)
easy iteration for a2dlist
static void GetInfoList(a2dFontInfoList &list)
Append fonts of this type to the list.
void OnChangeFontName(wxCommandEvent &event)
User interface event handler.
void SetStyle(wxString style)
Set the font style.
static a2dFont CreateFont(const a2dFontInfo &info, bool force=false)
Create the font from a fontinfo description.
bool CheckMask(a2dCanvasObjectFlagsMask mask) const
Compares all flags in object to the given mask and return true is the same.
void SetScaleOnResize(bool val)
set if the drawing should be resclaed on a window resize
defines common settinsg for a habitat for a set of a2dCameleons.
unsigned int GetTextFlags() const
Get the text flags.
Display a dialog to edit the font search path.
a2dCanvas is used to display one of the a2dCanvasObjects which are part of a a2dCanvasDocument object...
bool GetFixedStyle() const
Get object fixed style setting.
Contains graphical drawing context specific classes. a2dDrawer2D and derived classes are used for dra...
void SetSize(double size)
Set size of the font.
void SetStroke(const wxColour &strokecolor, double width=0, a2dStrokeStyle style=a2dSTROKE_SOLID)
Set a stroke for the object which will be used instead of the layer stroke.
void SetTextFlags(unsigned int textflags)
Set the text flags.
bool GetRelease() const
get release flag
void SetTextFlags(unsigned int textflags)
Set the text flags.
dialog for choosing fonts
double GetWidth() const
returns width of the boundingbox
const wxString & GetStyle() const
Get style of font, e.g. Bold.
void SetPosXY(double x, double y, bool restrict=false)
set position to x,y
A list used for enumerating fonts.
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
all polygon and polyline a2dCanvasObject are here.
double GetMinY() const
get minimum Y of the boundingbox
int GetAlignment() const
Get the position of the anchor point w.r.t the text.
const a2dFontInfo & GetFontInfo() const
Get fontinfo of the font.
void OnSize(wxSizeEvent &event)
User interface event handler.
void SetAlignment(int alignment)
Set the position of the anchor point w.r.t the text.
void Append(a2dCanvasObject *obj)
append a a2dCanvasObject to the childobjects
a2dText * GetTextTemplateObject()
set template for line object
void OnChangeFontType(wxCommandEvent &event)
User interface event handler.
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
Refresh window.
void OnChangeFontStyle(wxCommandEvent &event)
User interface event handler.
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling
general canvas module declarations and classes