KiCad PCB EDA Suite
Loading...
Searching...
No Matches
properties_frame.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2013 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <project.h>
27#include <scintilla_tricks.h>
29#include <widgets/font_choice.h>
31#include <tool/tool_manager.h>
35#include <view/view.h>
36#include <bitmaps.h>
37
38#include "properties_frame.h"
39#include "pl_editor_frame.h"
41
43#include <wx/wupdlock.h>
44
50#define DLG_MIN_TEXTSIZE 0.01
51#define DLG_MAX_TEXTSIZE 100.0
52
53
55 PANEL_PROPERTIES_BASE( aParent ),
56 m_scintillaTricks( nullptr ),
80 m_propertiesDirty( false )
81{
82 m_parent = aParent;
83
84 m_stcText->SetUseVerticalScrollBar( false );
85 m_stcText->SetUseHorizontalScrollBar( false );
86 m_stcText->SetEOLMode( wxSTC_EOL_LF ); // Always use LF as eol char, regardless the platform
87
88#ifdef _WIN32
89 // Without this setting, on Windows, some esoteric unicode chars create display issue
90 // in a wxStyledTextCtrl.
91 // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
92 m_stcText->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
93#endif
94
95 m_scintillaTricks = new SCINTILLA_TRICKS( m_stcText, wxT( "{}" ), false );
96
97 m_staticTextSizeInfo->SetFont( KIUI::GetInfoFont( this ).Italic() );
98
99 m_bold->SetIsCheckButton();
101 m_italic->SetIsCheckButton();
103
104 m_separator2->SetIsSeparator();
105
106 m_alignLeft->SetIsRadioButton();
108 m_alignCenter->SetIsRadioButton();
110 m_alignRight->SetIsRadioButton();
112
113 m_separator3->SetIsSeparator();
114
115 m_vAlignTop->SetIsRadioButton();
117 m_vAlignMiddle->SetIsRadioButton();
119 m_vAlignBottom->SetIsRadioButton();
121
122 m_separator4->SetIsSeparator();
123
124 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
125 m_textColorSwatch->SetSwatchBackground( aParent->GetDrawBgColor() );
126
127 m_textColorSwatch->Bind( COLOR_SWATCH_CHANGED,
128 [this]( wxCommandEvent& event )
129 {
130 m_propertiesDirty = true;
131 } );
132
133 // ensure sizers are up to date
134 // (fix an issue on GTK but should not create issues on other platforms):
135 m_swItemProperties->Fit();
136 m_swGeneralOpts->Fit();
137
138 m_stcText->Bind( wxEVT_STC_CHARADDED, &PROPERTIES_FRAME::onScintillaCharAdded, this );
139 m_stcText->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED, &PROPERTIES_FRAME::onScintillaCharAdded,
140 this );
141 m_alignLeft->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onHAlignButton, this );
142 m_alignCenter->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onHAlignButton, this );
143 m_alignRight->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onHAlignButton, this );
144 m_vAlignTop->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onVAlignButton, this );
145 m_vAlignMiddle->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onVAlignButton, this );
146 m_vAlignBottom->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onVAlignButton, this );
147}
148
149
155
156
158{
159 return FromDIP( wxSize( 150, -1 ) );
160}
161
162
163double fromMM( double aMMValue )
164{
166}
167
168
169double toMM( double aIUValue )
170{
172}
173
174
175bool validateMM( UNIT_BINDER& aUnitBinder, double aMin, double aMax )
176{
177 return aUnitBinder.Validate( aMin, aMax, EDA_UNITS::MM );
178}
179
180
182{
184
185 // Set default parameters
186 m_defaultLineWidth.SetDoubleValue( fromMM( model.m_DefaultLineWidth ) );
187
188 m_defaultTextSizeX.SetDoubleValue( fromMM( model.m_DefaultTextSize.x ) );
189 m_defaultTextSizeY.SetDoubleValue( fromMM( model.m_DefaultTextSize.y ) );
190 m_defaultTextThickness.SetDoubleValue( fromMM( model.m_DefaultTextThickness ) );
191
192 m_textLeftMargin.SetDoubleValue( fromMM( model.GetLeftMargin() ) );
193 m_textRightMargin.SetDoubleValue( fromMM( model.GetRightMargin() ) );
194 m_textTopMargin.SetDoubleValue( fromMM( model.GetTopMargin() ) );
195 m_textBottomMargin.SetDoubleValue( fromMM( model.GetBottomMargin() ) );
196}
197
198
200{
202
203 // Import default parameters from widgets
204 if( validateMM( m_defaultLineWidth, 0.0, 10.0 ) )
205 model.m_DefaultLineWidth = toMM( m_defaultLineWidth.GetIntValue() );
206
208 model.m_DefaultTextSize.x = toMM( m_defaultTextSizeX.GetIntValue() );
209
211 model.m_DefaultTextSize.y = toMM( m_defaultTextSizeY.GetIntValue() );
212
213 if( validateMM( m_defaultTextThickness, 0.0, 5.0 ) )
214 model.m_DefaultTextThickness = toMM( m_defaultTextThickness.GetIntValue() );
215
216 // Get page margins values
217 model.SetRightMargin( toMM( m_textRightMargin.GetIntValue() ) );
218 model.SetBottomMargin( toMM( m_textBottomMargin.GetIntValue() ) );
219 model.SetLeftMargin( toMM( m_textLeftMargin.GetIntValue() ) );
220 model.SetTopMargin( toMM( m_textTopMargin.GetIntValue() ) );
221
222 return true;
223}
224
225
227{
228 if( !aItem )
229 {
230 m_SizerItemProperties->Show( false );
231 m_propertiesDirty = false;
232 return;
233 }
234
235 // No not update display during rebuild:
236 wxWindowUpdateLocker noUpdates( this );
237
238 wxString msg;
239
240 // Set parameters common to all DS_DATA_ITEM types
241 m_staticTextType->SetLabel( aItem->GetClassName() );
242 m_textCtrlComment->SetValue( aItem->m_Info );
243
244 switch( aItem->GetPage1Option() )
245 {
246 default:
247 case ALL_PAGES: m_choicePageOpt->SetSelection( 0 ); break;
248 case FIRST_PAGE_ONLY: m_choicePageOpt->SetSelection( 1 ); break;
249 case SUBSEQUENT_PAGES: m_choicePageOpt->SetSelection( 2 ); break;
250 }
251
252 // Position/ start point
253 m_textPosX.SetDoubleValue( fromMM( aItem->m_Pos.m_Pos.x ) );
254 m_textPosY.SetDoubleValue( fromMM( aItem->m_Pos.m_Pos.y ) );
255
256 switch( aItem->m_Pos.m_Anchor )
257 {
258 case RB_CORNER: m_comboBoxCornerPos->SetSelection( 2 ); break;
259 case RT_CORNER: m_comboBoxCornerPos->SetSelection( 0 ); break;
260 case LB_CORNER: m_comboBoxCornerPos->SetSelection( 3 ); break;
261 case LT_CORNER: m_comboBoxCornerPos->SetSelection( 1 ); break;
262 }
263
264 // End point
265 m_textEndX.SetDoubleValue( fromMM( aItem->m_End.m_Pos.x ) );
266 m_textEndY.SetDoubleValue( fromMM( aItem->m_End.m_Pos.y ) );
267
268 switch( aItem->m_End.m_Anchor )
269 {
270 case RB_CORNER: m_comboBoxCornerEnd->SetSelection( 2 ); break;
271 case RT_CORNER: m_comboBoxCornerEnd->SetSelection( 0 ); break;
272 case LB_CORNER: m_comboBoxCornerEnd->SetSelection( 3 ); break;
273 case LT_CORNER: m_comboBoxCornerEnd->SetSelection( 1 ); break;
274 }
275
276 m_lineWidth.SetDoubleValue( fromMM( aItem->m_LineWidth ) );
277
278 // Now, set prms more specific to DS_DATA_ITEM types
279 // For a given type, disable widgets which are not relevant,
280 // and be sure widgets which are relevant are enabled
281 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
282 {
283 DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
284 item->m_FullText = item->m_TextBase;
285
286 // Replace our '\' 'n' sequence by the EOL char
288 m_stcText->SetValue( item->m_FullText );
289 m_stcText->EmptyUndoBuffer();
290
291 msg.Printf( wxT( "%d" ), item->m_IncrementLabel );
292 m_textCtrlTextIncrement->SetValue( msg );
293
294 // Rotation (poly and text)
295 msg.Printf( wxT( "%.3f" ), item->m_Orient );
296 m_textCtrlRotation->SetValue( msg );
297
298 // Constraints:
299 m_constraintX.SetDoubleValue( fromMM( item->m_BoundingBoxSize.x ) );
300 m_constraintY.SetDoubleValue( fromMM( item->m_BoundingBoxSize.y ) );
301
302 // Font Options
303 m_fontCtrl->SetFontSelection( item->m_Font, true /*silent mode */ );
304
305 m_bold->Check( item->m_Bold );
306 m_italic->Check( item->m_Italic );
307
308 m_textColorSwatch->SetSwatchColor( item->m_TextColor, false );
309
311 btn->Check( false );
312
313 switch( item->m_Hjustify )
314 {
315 case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check(); break;
316 case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check(); break;
317 case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check(); break;
319 }
320
322 btn->Check( false );
323
324 switch( item->m_Vjustify )
325 {
326 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
327 case GR_TEXT_V_ALIGN_CENTER: m_vAlignMiddle->Check(); break;
328 case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
330 }
331
332 // Text size
333 m_textSizeX.SetDoubleValue( fromMM( item->m_TextSize.x ) );
334 m_textSizeY.SetDoubleValue( fromMM( item->m_TextSize.y ) );
335 }
336
337 if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
338 {
339 DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
340
341 // Rotation (poly and text)
342 msg.Printf( wxT( "%.3f" ), item->m_Orient.AsDegrees() );
343 m_textCtrlRotation->SetValue( msg );
344 }
345
346 if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
347 {
348 DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
349
350 // select definition in PPI
351 msg.Printf( wxT( "%d" ), item->GetPPI() );
352 m_textCtrlBitmapDPI->SetValue( msg );
353 }
354
355 m_SizerItemProperties->Show( true );
356
359
361 || aItem->GetType() == DS_DATA_ITEM::DS_RECT );
362
363 m_lineWidth.Show( aItem->GetType() != DS_DATA_ITEM::DS_BITMAP );
364
365 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT
367 {
368 m_staticTextRot->Show( true );
369 m_textCtrlRotation->Show( true );
370 }
371 else
372 {
373 m_staticTextRot->Show( false );
374 m_textCtrlRotation->Show( false );
375 }
376
379
382
383 // Repeat parameters
384 msg.Printf( wxT( "%d" ), aItem->m_RepeatCount );
385 m_textCtrlRepeatCount->SetValue( msg );
386
387 m_textStepX.SetDoubleValue( fromMM( aItem->m_IncrementVector.x ) );
388 m_textStepY.SetDoubleValue( fromMM( aItem->m_IncrementVector.y ) );
389
390 // The number of widgets was modified, so recalculate sizers
391 m_swItemProperties->Layout();
392
393#ifdef __WXGTK__
394 // This call is mandatory on wxGTK to initialize the right virtual size and therefore
395 // scrollbars, but for some reason, create issues on Windows (incorrect display
396 // until the frame is resized). Joys of multiplatform dev.
397 m_swItemProperties->Fit();
398#endif
399
400 // send a size event to be sure scrollbars will be added/removed as needed
401 m_swItemProperties->PostSizeEvent();
402 m_swItemProperties->Refresh();
403}
404
405
406void PROPERTIES_FRAME::onHAlignButton( wxCommandEvent& aEvent )
407{
409 {
410 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
411 btn->Check( false );
412 }
413
414 m_propertiesDirty = true;
415}
416
417
418void PROPERTIES_FRAME::onVAlignButton( wxCommandEvent& aEvent )
419{
421 {
422 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
423 btn->Check( false );
424 }
425
426 m_propertiesDirty = true;
427}
428
429
431{
432 PL_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PL_SELECTION_TOOL>();
433 PL_SELECTION& selection = selTool->GetSelection();
434
435 m_parent->SaveCopyInUndoList();
436
437 DS_DRAW_ITEM_BASE* drawItem = (DS_DRAW_ITEM_BASE*) selection.Front();
438
439 if( drawItem )
440 {
441 DS_DATA_ITEM* dataItem = drawItem->GetPeer();
442 CopyPrmsFromPanelToItem( dataItem );
443
444 // Be sure what is displayed is what is set for item
445 // (mainly, texts can be modified if they contain "\n")
446 CopyPrmsFromItemToPanel( dataItem );
447 m_parent->GetCanvas()->GetView()->Update( drawItem );
448 }
449
451
452 // Refresh values, exactly as they are converted, to avoid any mistake
454
455 m_propertiesDirty = false;
456
457 m_parent->OnModify();
458
459 // Rebuild the draw list with the new parameters
460 m_parent->GetCanvas()->DisplayDrawingSheet();
461 m_parent->GetCanvas()->Refresh();
462}
463
464
465void PROPERTIES_FRAME::onModify( wxCommandEvent& aEvent )
466{
467 m_propertiesDirty = true;
468}
469
470
471void PROPERTIES_FRAME::onTextFocusLost( wxFocusEvent& aEvent )
472{
473 m_propertiesDirty = true;
474 aEvent.Skip(); // Mandatory in wxFocusEvent
475}
476
477
478void PROPERTIES_FRAME::OnUpdateUI( wxUpdateUIEvent& aEvent )
479{
481 {
482 // Clear m_propertiesDirty now. Otherwise OnAcceptPrms() is called multiple
483 // times (probably by each updated widget)
484 m_propertiesDirty = false;
485 CallAfter(
486 [this]()
487 {
488 OnAcceptPrms();
489 } );
490 }
491}
492
493
494void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
495{
497
499 model.m_DefaultLineWidth = 0.15;
500 model.m_DefaultTextThickness = 0.15;
501
503
504 // Rebuild the draw list with the new parameters
505 m_parent->GetCanvas()->DisplayDrawingSheet();
506 m_parent->GetCanvas()->Refresh();
507}
508
509
511{
512 if( aItem == nullptr )
513 return false;
514
515 wxString msg;
516
517 // Import common parameters:
518 aItem->m_Info = m_textCtrlComment->GetValue();
519
520 switch( m_choicePageOpt->GetSelection() )
521 {
522 default:
523 case 0: aItem->SetPage1Option( ALL_PAGES ); break;
524 case 1: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break;
525 case 2: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break;
526 }
527
528 // Import thickness
529 if( validateMM( m_lineWidth, 0.0, 10.0 ) )
530 aItem->m_LineWidth = toMM( m_lineWidth.GetIntValue() );
531
532 // Import Start point
533 aItem->m_Pos.m_Pos.x = toMM( m_textPosX.GetIntValue() );
534 aItem->m_Pos.m_Pos.y = toMM( m_textPosY.GetIntValue() );
535
536 switch( m_comboBoxCornerPos->GetSelection() )
537 {
538 case 2: aItem->m_Pos.m_Anchor = RB_CORNER; break;
539 case 0: aItem->m_Pos.m_Anchor = RT_CORNER; break;
540 case 3: aItem->m_Pos.m_Anchor = LB_CORNER; break;
541 case 1: aItem->m_Pos.m_Anchor = LT_CORNER; break;
542 }
543
544 // Import End point
545 aItem->m_End.m_Pos.x = toMM( m_textEndX.GetIntValue() );
546 aItem->m_End.m_Pos.y = toMM( m_textEndY.GetIntValue() );
547
548 switch( m_comboBoxCornerEnd->GetSelection() )
549 {
550 case 2: aItem->m_End.m_Anchor = RB_CORNER; break;
551 case 0: aItem->m_End.m_Anchor = RT_CORNER; break;
552 case 3: aItem->m_End.m_Anchor = LB_CORNER; break;
553 case 1: aItem->m_End.m_Anchor = LT_CORNER; break;
554 }
555
556 // Import Repeat prms
557 long itmp;
558 msg = m_textCtrlRepeatCount->GetValue();
559 msg.ToLong( &itmp );
560
561 // Ensure m_RepeatCount is > 0. Otherwise it create issues because a repeat
562 // count < 1 make no sense
563 if( itmp < 1l )
564 {
565 itmp = 1;
566 msg.Printf( wxT( "%ld" ), itmp );
567 m_textCtrlRepeatCount->SetValue( msg );
568 }
569
570 aItem->m_RepeatCount = itmp;
571
572 aItem->m_IncrementVector.x = toMM( m_textStepX.GetIntValue() );
573 aItem->m_IncrementVector.y = toMM( m_textStepY.GetIntValue() );
574
575 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
576 {
577 DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
578
579 item->m_TextBase = m_stcText->GetValue();
580
581 msg = m_textCtrlTextIncrement->GetValue();
582 msg.ToLong( &itmp );
583 item->m_IncrementLabel = itmp;
584
585 item->m_Bold = m_bold->IsChecked();
586 item->m_Italic = m_italic->IsChecked();
587 item->m_TextColor = m_textColorSwatch->GetSwatchColor();
588
589 if( m_alignLeft->IsChecked() )
591 else if( m_alignCenter->IsChecked() )
593 else if( m_alignRight->IsChecked() )
595
596 if( m_vAlignTop->IsChecked() )
598 else if( m_vAlignMiddle->IsChecked() )
600 else if( m_vAlignBottom->IsChecked() )
602
603 if( m_fontCtrl->HaveFontSelection() )
604 item->m_Font = m_fontCtrl->GetFontSelection( item->m_Bold, item->m_Italic, true );
605
606 msg = m_textCtrlRotation->GetValue();
608 EDA_UNITS::UNSCALED, msg );
609
610 // Import text size
612 item->m_TextSize.x = toMM( m_textSizeX.GetIntValue() );
613
615 item->m_TextSize.y = toMM( m_textSizeY.GetIntValue() );
616
617 // Import constraints:
618 item->m_BoundingBoxSize.x = toMM( m_constraintX.GetIntValue() );
619 item->m_BoundingBoxSize.y = toMM( m_constraintY.GetIntValue() );
620 }
621
622 if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
623 {
624 DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
625
626 msg = m_textCtrlRotation->GetValue();
627 item->m_Orient = m_parent->AngleValueFromString( msg );
628 }
629
630 if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
631 {
632 DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
633 long value;
634
635 msg = m_textCtrlBitmapDPI->GetValue();
636
637 if( msg.ToLong( &value ) )
638 item->SetPPI( (int)value );
639 }
640
641 return true;
642}
643
644
645void PROPERTIES_FRAME::onScintillaCharAdded( wxStyledTextEvent &aEvent )
646{
647 wxArrayString autocompleteTokens;
648 int pos = m_stcText->GetCurrentPos();
649 int start = m_stcText->WordStartPosition( pos, true );
650 wxString partial;
651
652 if( start >= 2
653 && m_stcText->GetCharAt( start-2 ) == '$'
654 && m_stcText->GetCharAt( start-1 ) == '{' )
655 {
656 DS_DRAW_ITEM_LIST::GetTextVars( &autocompleteTokens );
657
658 partial = m_stcText->GetTextRange( start, pos );
659
660 for( std::pair<wxString, wxString> entry : m_parent->Prj().GetTextVars() )
661 autocompleteTokens.push_back( entry.first );
662 }
663
664 m_scintillaTricks->DoAutocomplete( partial, autocompleteTokens );
665 m_stcText->SetFocus();
666}
667
668
669void PROPERTIES_FRAME::onScintillaFocusLost( wxFocusEvent& aEvent )
670{
671 m_stcText->AutoCompCancel();
672 m_propertiesDirty = true;
673 aEvent.Skip();
674}
675
676
677void PROPERTIES_FRAME::onHelp( wxHyperlinkEvent& aEvent )
678{
679 // Show the system variables for worksheet text:
680 HTML_MESSAGE_BOX dlg( wxGetTopLevelParent( this ), _( "Predefined Keywords" ) );
681 wxString message;
682
683 message << _( "Texts can include keywords." ) << "<br>";
684 message << _( "Keyword notation is ${keyword}" ) << "<br>";
685 message << _( "Each keyword is replaced by its value" ) << "<br><br>";
686 message << _( "These build-in keywords are always available:" ) << "<br><br>";
687 dlg.AddHTML_Text( message );
688
689 message = "KICAD_VERSION\n";
690 message << "# " << _( "(sheet number)" ) << "\n";
691 message << "## " << _( "(sheet count)" ) << "\n";
692 message << "COMMENT1 thru COMMENT9\n";
693 message << "COMPANY\n";
694 message << "FILENAME\n";
695 message << "ISSUE_DATE\n";
696 message << "LAYER\n";
697 message << "PAPER " << _( "(paper size)" ) << "\n";
698 message << "REVISION\n";
699 message << "SHEETNAME\n";
700 message << "SHEETPATH\n";
701 message << "TITLE\n";
702
703 dlg.ListSet( message );
704 dlg.ShowModal();
705}
constexpr EDA_IU_SCALE drawSheetIUScale
Definition base_units.h:113
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
@ text_align_right
@ text_valign_top
@ text_align_left
@ text_valign_center
@ text_align_center
@ text_valign_bottom
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:402
int ShowModal() override
void SetPPI(int aBitmapPPI)
bool ReplaceAntiSlashSequence()
Replace the '\''n' sequence by EOL and the sequence '\''\' by only one '\' inside m_FullText.
KIFONT::FONT * m_Font
GR_TEXT_H_ALIGN_T m_Hjustify
KIGFX::COLOR4D m_TextColor
VECTOR2D m_BoundingBoxSize
GR_TEXT_V_ALIGN_T m_Vjustify
Drawing sheet structure type definitions.
PAGE_OPTION GetPage1Option() const
void SetPage1Option(PAGE_OPTION aChoice)
DS_ITEM_TYPE GetType() const
const wxString GetClassName() const
VECTOR2D m_IncrementVector
POINT_COORD m_Pos
wxString m_Info
double m_LineWidth
POINT_COORD m_End
Handle the graphic items list to draw/plot the frame and title block.
static DS_DATA_MODEL & GetTheInstance()
Return the instance of DS_DATA_MODEL used in the application.
Base class to handle basic graphic items.
DS_DATA_ITEM * GetPeer() const
static void GetTextVars(wxArrayString *aVars)
double AsDegrees() const
Definition eda_angle.h:116
virtual COLOR4D GetDrawBgColor() const
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
void ListSet(const wxString &aList)
Add a list of items.
wxScrolledWindow * m_swItemProperties
wxStaticBoxSizer * m_sbSizerEndPosition
wxStyledTextCtrl * m_stcText
wxScrolledWindow * m_swGeneralOpts
wxStaticText * m_defaultLineWidthUnits
PANEL_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
wxStaticText * m_defaultTextSizeXUnits
wxStaticText * m_staticTextSizeInfo
wxStaticText * m_defaultLineWidthLabel
wxStaticText * m_defaultTextThicknessLabel
wxHyperlinkCtrl * m_syntaxHelpLink
wxStaticText * m_defaultTextThicknessUnits
wxStaticText * m_defaultTextSizeYUnits
The main window used in the drawing sheet editor.
PL_SELECTION & GetSelection()
Return the set of currently selected items.
VECTOR2D m_Pos
void onModify(wxCommandEvent &aEvent) override
UNIT_BINDER m_defaultTextSizeX
void onScintillaFocusLost(wxFocusEvent &aEvent) override
UNIT_BINDER m_lineWidth
PROPERTIES_FRAME(PL_EDITOR_FRAME *aParent)
UNIT_BINDER m_constraintX
UNIT_BINDER m_defaultLineWidth
UNIT_BINDER m_textBottomMargin
PL_EDITOR_FRAME * m_parent
UNIT_BINDER m_textSizeY
UNIT_BINDER m_textLeftMargin
UNIT_BINDER m_defaultTextThickness
void onScintillaCharAdded(wxStyledTextEvent &aEvent)
UNIT_BINDER m_textEndX
void OnSetDefaultValues(wxCommandEvent &event) override
void onTextFocusLost(wxFocusEvent &aEvent) override
void CopyPrmsFromItemToPanel(DS_DATA_ITEM *aItem)
void OnUpdateUI(wxUpdateUIEvent &aEvent) override
void onHAlignButton(wxCommandEvent &aEvent)
void onHelp(wxHyperlinkEvent &aEvent) override
bool CopyPrmsFromPanelToItem(DS_DATA_ITEM *aItem)
UNIT_BINDER m_textEndY
wxSize GetMinSize() const override
UNIT_BINDER m_textSizeX
void onVAlignButton(wxCommandEvent &aEvent)
UNIT_BINDER m_constraintY
UNIT_BINDER m_defaultTextSizeY
UNIT_BINDER m_textPosX
UNIT_BINDER m_textStepY
UNIT_BINDER m_textTopMargin
UNIT_BINDER m_textRightMargin
UNIT_BINDER m_textPosY
UNIT_BINDER m_textStepX
SCINTILLA_TRICKS * m_scintillaTricks
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
#define TB_DEFAULT_TEXTSIZE
@ FIRST_PAGE_ONLY
@ SUBSEQUENT_PAGES
@ ALL_PAGES
@ RB_CORNER
@ RT_CORNER
@ LT_CORNER
@ LB_CORNER
#define _(s)
KICOMMON_API double FromUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Return in internal units the value aValue given in a real unit such as "in", "mm",...
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Convert aTextValue to a double.
KICOMMON_API double ToUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Convert aValue in internal units to the appropriate user units defined by aUnit.
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
double fromMM(double aMMValue)
double toMM(double aIUValue)
#define DLG_MIN_TEXTSIZE
Minimum drawing sheet text default size in millmeters from PROPERTIES_FRAME.
bool validateMM(UNIT_BINDER &aUnitBinder, double aMin, double aMax)
#define DLG_MAX_TEXTSIZE
Maximum drawing sheet text size in mm from PROPERTIES_FRAME.
KIBIS_MODEL * model
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
VECTOR2< double > VECTOR2D
Definition vector2d.h:694