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
154
155
157{
158 return FromDIP( wxSize( 150, -1 ) );
159}
160
161
162double fromMM( double aMMValue )
163{
165}
166
167
168double toMM( double aIUValue )
169{
171}
172
173
174bool validateMM( UNIT_BINDER& aUnitBinder, double aMin, double aMax )
175{
176 return aUnitBinder.Validate( aMin, aMax, EDA_UNITS::MM );
177}
178
179
181{
183
184 // Set default parameters
185 m_defaultLineWidth.SetDoubleValue( fromMM( model.m_DefaultLineWidth ) );
186
187 m_defaultTextSizeX.SetDoubleValue( fromMM( model.m_DefaultTextSize.x ) );
188 m_defaultTextSizeY.SetDoubleValue( fromMM( model.m_DefaultTextSize.y ) );
189 m_defaultTextThickness.SetDoubleValue( fromMM( model.m_DefaultTextThickness ) );
190
191 m_textLeftMargin.SetDoubleValue( fromMM( model.GetLeftMargin() ) );
192 m_textRightMargin.SetDoubleValue( fromMM( model.GetRightMargin() ) );
193 m_textTopMargin.SetDoubleValue( fromMM( model.GetTopMargin() ) );
194 m_textBottomMargin.SetDoubleValue( fromMM( model.GetBottomMargin() ) );
195}
196
197
199{
201
202 // Import default parameters from widgets
203 if( validateMM( m_defaultLineWidth, 0.0, 10.0 ) )
204 model.m_DefaultLineWidth = toMM( m_defaultLineWidth.GetIntValue() );
205
207 model.m_DefaultTextSize.x = toMM( m_defaultTextSizeX.GetIntValue() );
208
210 model.m_DefaultTextSize.y = toMM( m_defaultTextSizeY.GetIntValue() );
211
212 if( validateMM( m_defaultTextThickness, 0.0, 5.0 ) )
213 model.m_DefaultTextThickness = toMM( m_defaultTextThickness.GetIntValue() );
214
215 // Get page margins values
216 model.SetRightMargin( toMM( m_textRightMargin.GetIntValue() ) );
217 model.SetBottomMargin( toMM( m_textBottomMargin.GetIntValue() ) );
218 model.SetLeftMargin( toMM( m_textLeftMargin.GetIntValue() ) );
219 model.SetTopMargin( toMM( m_textTopMargin.GetIntValue() ) );
220
221 return true;
222}
223
224
226{
227 if( !aItem )
228 {
229 m_SizerItemProperties->Show( false );
230 m_propertiesDirty = false;
231 return;
232 }
233
234 // No not update display during rebuild:
235 wxWindowUpdateLocker noUpdates( this );
236
237 wxString msg;
238
239 // Set parameters common to all DS_DATA_ITEM types
240 m_staticTextType->SetLabel( aItem->GetClassName() );
241 m_textCtrlComment->SetValue( aItem->m_Info );
242
243 switch( aItem->GetPage1Option() )
244 {
245 default:
246 case ALL_PAGES: m_choicePageOpt->SetSelection( 0 ); break;
247 case FIRST_PAGE_ONLY: m_choicePageOpt->SetSelection( 1 ); break;
248 case SUBSEQUENT_PAGES: m_choicePageOpt->SetSelection( 2 ); break;
249 }
250
251 // Position/ start point
252 m_textPosX.SetDoubleValue( fromMM( aItem->m_Pos.m_Pos.x ) );
253 m_textPosY.SetDoubleValue( fromMM( aItem->m_Pos.m_Pos.y ) );
254
255 switch( aItem->m_Pos.m_Anchor )
256 {
257 case RB_CORNER: m_comboBoxCornerPos->SetSelection( 2 ); break;
258 case RT_CORNER: m_comboBoxCornerPos->SetSelection( 0 ); break;
259 case LB_CORNER: m_comboBoxCornerPos->SetSelection( 3 ); break;
260 case LT_CORNER: m_comboBoxCornerPos->SetSelection( 1 ); break;
261 }
262
263 // End point
264 m_textEndX.SetDoubleValue( fromMM( aItem->m_End.m_Pos.x ) );
265 m_textEndY.SetDoubleValue( fromMM( aItem->m_End.m_Pos.y ) );
266
267 switch( aItem->m_End.m_Anchor )
268 {
269 case RB_CORNER: m_comboBoxCornerEnd->SetSelection( 2 ); break;
270 case RT_CORNER: m_comboBoxCornerEnd->SetSelection( 0 ); break;
271 case LB_CORNER: m_comboBoxCornerEnd->SetSelection( 3 ); break;
272 case LT_CORNER: m_comboBoxCornerEnd->SetSelection( 1 ); break;
273 }
274
275 m_lineWidth.SetDoubleValue( fromMM( aItem->m_LineWidth ) );
276
277 // Now, set prms more specific to DS_DATA_ITEM types
278 // For a given type, disable widgets which are not relevant,
279 // and be sure widgets which are relevant are enabled
280 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
281 {
282 DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
283 item->m_FullText = item->m_TextBase;
284
285 // Replace our '\' 'n' sequence by the EOL char
287 m_stcText->SetValue( item->m_FullText );
288 m_stcText->EmptyUndoBuffer();
289
290 msg.Printf( wxT( "%d" ), item->m_IncrementLabel );
291 m_textCtrlTextIncrement->SetValue( msg );
292
293 // Rotation (poly and text)
294 msg.Printf( wxT( "%.3f" ), item->m_Orient );
295 m_textCtrlRotation->SetValue( msg );
296
297 // Constraints:
298 m_constraintX.SetDoubleValue( fromMM( item->m_BoundingBoxSize.x ) );
299 m_constraintY.SetDoubleValue( fromMM( item->m_BoundingBoxSize.y ) );
300
301 // Font Options
302 m_fontCtrl->SetFontSelection( item->m_Font, true /*silent mode */ );
303
304 m_bold->Check( item->m_Bold );
305 m_italic->Check( item->m_Italic );
306
307 m_textColorSwatch->SetSwatchColor( item->m_TextColor, false );
308
310 btn->Check( false );
311
312 switch( item->m_Hjustify )
313 {
314 case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check(); break;
315 case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check(); break;
316 case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check(); break;
318 }
319
321 btn->Check( false );
322
323 switch( item->m_Vjustify )
324 {
325 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
326 case GR_TEXT_V_ALIGN_CENTER: m_vAlignMiddle->Check(); break;
327 case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
329 }
330
331 // Text size
332 m_textSizeX.SetDoubleValue( fromMM( item->m_TextSize.x ) );
333 m_textSizeY.SetDoubleValue( fromMM( item->m_TextSize.y ) );
334 }
335
336 if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
337 {
338 DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
339
340 // Rotation (poly and text)
341 msg.Printf( wxT( "%.3f" ), item->m_Orient.AsDegrees() );
342 m_textCtrlRotation->SetValue( msg );
343 }
344
345 if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
346 {
347 DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
348
349 // select definition in PPI
350 msg.Printf( wxT( "%d" ), item->GetPPI() );
351 m_textCtrlBitmapDPI->SetValue( msg );
352 }
353
354 m_SizerItemProperties->Show( true );
355
358
360 || aItem->GetType() == DS_DATA_ITEM::DS_RECT );
361
362 m_lineWidth.Show( aItem->GetType() != DS_DATA_ITEM::DS_BITMAP );
363
364 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT
366 {
367 m_staticTextRot->Show( true );
368 m_textCtrlRotation->Show( true );
369 }
370 else
371 {
372 m_staticTextRot->Show( false );
373 m_textCtrlRotation->Show( false );
374 }
375
378
381
382 // Repeat parameters
383 msg.Printf( wxT( "%d" ), aItem->m_RepeatCount );
384 m_textCtrlRepeatCount->SetValue( msg );
385
386 m_textStepX.SetDoubleValue( fromMM( aItem->m_IncrementVector.x ) );
387 m_textStepY.SetDoubleValue( fromMM( aItem->m_IncrementVector.y ) );
388
389 // The number of widgets was modified, so recalculate sizers
390 m_swItemProperties->Layout();
391
392#ifdef __WXGTK__
393 // This call is mandatory on wxGTK to initialize the right virtual size and therefore
394 // scrollbars, but for some reason, create issues on Windows (incorrect display
395 // until the frame is resized). Joys of multiplatform dev.
396 m_swItemProperties->Fit();
397#endif
398
399 // send a size event to be sure scrollbars will be added/removed as needed
400 m_swItemProperties->PostSizeEvent();
401 m_swItemProperties->Refresh();
402}
403
404
405void PROPERTIES_FRAME::onHAlignButton( wxCommandEvent& aEvent )
406{
408 {
409 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
410 btn->Check( false );
411 }
412
413 m_propertiesDirty = true;
414}
415
416
417void PROPERTIES_FRAME::onVAlignButton( wxCommandEvent& aEvent )
418{
420 {
421 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
422 btn->Check( false );
423 }
424
425 m_propertiesDirty = true;
426}
427
428
430{
431 PL_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PL_SELECTION_TOOL>();
432 PL_SELECTION& selection = selTool->GetSelection();
433
434 m_parent->SaveCopyInUndoList();
435
436 DS_DRAW_ITEM_BASE* drawItem = (DS_DRAW_ITEM_BASE*) selection.Front();
437
438 if( drawItem )
439 {
440 DS_DATA_ITEM* dataItem = drawItem->GetPeer();
441 CopyPrmsFromPanelToItem( dataItem );
442
443 // Be sure what is displayed is what is set for item
444 // (mainly, texts can be modified if they contain "\n")
445 CopyPrmsFromItemToPanel( dataItem );
446 m_parent->GetCanvas()->GetView()->Update( drawItem );
447 }
448
450
451 // Refresh values, exactly as they are converted, to avoid any mistake
453
454 m_propertiesDirty = false;
455
456 m_parent->OnModify();
457
458 // Rebuild the draw list with the new parameters
459 m_parent->GetCanvas()->DisplayDrawingSheet();
460 m_parent->GetCanvas()->Refresh();
461}
462
463
464void PROPERTIES_FRAME::onModify( wxCommandEvent& aEvent )
465{
466 m_propertiesDirty = true;
467}
468
469
470void PROPERTIES_FRAME::onTextFocusLost( wxFocusEvent& aEvent )
471{
472 m_propertiesDirty = true;
473 aEvent.Skip(); // Mandatory in wxFocusEvent
474}
475
476
477void PROPERTIES_FRAME::OnUpdateUI( wxUpdateUIEvent& aEvent )
478{
480 {
481 // Clear m_propertiesDirty now. Otherwise OnAcceptPrms() is called multiple
482 // times (probably by each updated widget)
483 m_propertiesDirty = false;
484 CallAfter(
485 [this]()
486 {
487 OnAcceptPrms();
488 } );
489 }
490}
491
492
493void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
494{
496
498 model.m_DefaultLineWidth = 0.15;
499 model.m_DefaultTextThickness = 0.15;
500
502
503 // Rebuild the draw list with the new parameters
504 m_parent->GetCanvas()->DisplayDrawingSheet();
505 m_parent->GetCanvas()->Refresh();
506}
507
508
510{
511 if( aItem == nullptr )
512 return false;
513
514 wxString msg;
515
516 // Import common parameters:
517 aItem->m_Info = m_textCtrlComment->GetValue();
518
519 switch( m_choicePageOpt->GetSelection() )
520 {
521 default:
522 case 0: aItem->SetPage1Option( ALL_PAGES ); break;
523 case 1: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break;
524 case 2: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break;
525 }
526
527 // Import thickness
528 if( validateMM( m_lineWidth, 0.0, 10.0 ) )
529 aItem->m_LineWidth = toMM( m_lineWidth.GetIntValue() );
530
531 // Import Start point
532 aItem->m_Pos.m_Pos.x = toMM( m_textPosX.GetIntValue() );
533 aItem->m_Pos.m_Pos.y = toMM( m_textPosY.GetIntValue() );
534
535 switch( m_comboBoxCornerPos->GetSelection() )
536 {
537 case 2: aItem->m_Pos.m_Anchor = RB_CORNER; break;
538 case 0: aItem->m_Pos.m_Anchor = RT_CORNER; break;
539 case 3: aItem->m_Pos.m_Anchor = LB_CORNER; break;
540 case 1: aItem->m_Pos.m_Anchor = LT_CORNER; break;
541 }
542
543 // Import End point
544 aItem->m_End.m_Pos.x = toMM( m_textEndX.GetIntValue() );
545 aItem->m_End.m_Pos.y = toMM( m_textEndY.GetIntValue() );
546
547 switch( m_comboBoxCornerEnd->GetSelection() )
548 {
549 case 2: aItem->m_End.m_Anchor = RB_CORNER; break;
550 case 0: aItem->m_End.m_Anchor = RT_CORNER; break;
551 case 3: aItem->m_End.m_Anchor = LB_CORNER; break;
552 case 1: aItem->m_End.m_Anchor = LT_CORNER; break;
553 }
554
555 // Import Repeat prms
556 long itmp;
557 msg = m_textCtrlRepeatCount->GetValue();
558 msg.ToLong( &itmp );
559
560 // Ensure m_RepeatCount is > 0. Otherwise it create issues because a repeat
561 // count < 1 make no sense
562 if( itmp < 1l )
563 {
564 itmp = 1;
565 msg.Printf( wxT( "%ld" ), itmp );
566 m_textCtrlRepeatCount->SetValue( msg );
567 }
568
569 aItem->m_RepeatCount = itmp;
570
571 aItem->m_IncrementVector.x = toMM( m_textStepX.GetIntValue() );
572 aItem->m_IncrementVector.y = toMM( m_textStepY.GetIntValue() );
573
574 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
575 {
576 DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
577
578 item->m_TextBase = m_stcText->GetValue();
579
580 msg = m_textCtrlTextIncrement->GetValue();
581 msg.ToLong( &itmp );
582 item->m_IncrementLabel = itmp;
583
584 item->m_Bold = m_bold->IsChecked();
585 item->m_Italic = m_italic->IsChecked();
586 item->m_TextColor = m_textColorSwatch->GetSwatchColor();
587
588 if( m_alignLeft->IsChecked() )
590 else if( m_alignCenter->IsChecked() )
592 else if( m_alignRight->IsChecked() )
594
595 if( m_vAlignTop->IsChecked() )
597 else if( m_vAlignMiddle->IsChecked() )
599 else if( m_vAlignBottom->IsChecked() )
601
602 if( m_fontCtrl->HaveFontSelection() )
603 item->m_Font = m_fontCtrl->GetFontSelection( item->m_Bold, item->m_Italic, true );
604
605 msg = m_textCtrlRotation->GetValue();
607 EDA_UNITS::UNSCALED, msg );
608
609 // Import text size
611 item->m_TextSize.x = toMM( m_textSizeX.GetIntValue() );
612
614 item->m_TextSize.y = toMM( m_textSizeY.GetIntValue() );
615
616 // Import constraints:
617 item->m_BoundingBoxSize.x = toMM( m_constraintX.GetIntValue() );
618 item->m_BoundingBoxSize.y = toMM( m_constraintY.GetIntValue() );
619 }
620
621 if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
622 {
623 DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
624
625 msg = m_textCtrlRotation->GetValue();
626 item->m_Orient = m_parent->AngleValueFromString( msg );
627 }
628
629 if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
630 {
631 DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
632 long value;
633
634 msg = m_textCtrlBitmapDPI->GetValue();
635
636 if( msg.ToLong( &value ) )
637 item->SetPPI( (int)value );
638 }
639
640 return true;
641}
642
643
644void PROPERTIES_FRAME::onScintillaCharAdded( wxStyledTextEvent &aEvent )
645{
646 wxArrayString autocompleteTokens;
647 int pos = m_stcText->GetCurrentPos();
648 int start = m_stcText->WordStartPosition( pos, true );
649 wxString partial;
650
651 if( start >= 2
652 && m_stcText->GetCharAt( start-2 ) == '$'
653 && m_stcText->GetCharAt( start-1 ) == '{' )
654 {
655 DS_DRAW_ITEM_LIST::GetTextVars( &autocompleteTokens );
656
657 partial = m_stcText->GetTextRange( start, pos );
658
659 for( std::pair<wxString, wxString> entry : m_parent->Prj().GetTextVars() )
660 autocompleteTokens.push_back( entry.first );
661 }
662
663 m_scintillaTricks->DoAutocomplete( partial, autocompleteTokens );
664 m_stcText->SetFocus();
665}
666
667
668void PROPERTIES_FRAME::onScintillaFocusLost( wxFocusEvent& aEvent )
669{
670 m_stcText->AutoCompCancel();
671 m_propertiesDirty = true;
672 aEvent.Skip();
673}
674
675
676void PROPERTIES_FRAME::onHelp( wxHyperlinkEvent& aEvent )
677{
678 // Show the system variables for worksheet text:
679 HTML_MESSAGE_BOX dlg( wxGetTopLevelParent( this ), _( "Predefined Keywords" ) );
680 wxString message;
681
682 message << _( "Texts can include keywords." ) << "<br>";
683 message << _( "Keyword notation is ${keyword}" ) << "<br>";
684 message << _( "Each keyword is replaced by its value" ) << "<br><br>";
685 message << _( "These build-in keywords are always available:" ) << "<br><br>";
686 dlg.AddHTML_Text( message );
687
688 message = "KICAD_VERSION\n";
689 message << "# " << _( "(sheet number)" ) << "\n";
690 message << "## " << _( "(sheet count)" ) << "\n";
691 message << "COMMENT1 thru COMMENT9\n";
692 message << "COMPANY\n";
693 message << "FILENAME\n";
694 message << "ISSUE_DATE\n";
695 message << "LAYER\n";
696 message << "PAPER " << _( "(paper size)" ) << "\n";
697 message << "REVISION\n";
698 message << "SHEETNAME\n";
699 message << "SHEETPATH\n";
700 message << "TITLE\n";
701
702 dlg.ListSet( message );
703 dlg.ShowModal();
704}
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:399
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