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