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 (C) 2021-2024 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
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 ),
57 m_textSizeX( aParent, m_staticTextTsizeX, m_textCtrlTextSizeX, m_textSizeXUnits ),
58 m_textSizeY( aParent, m_staticTextTsizeY, m_textCtrlTextSizeY, m_textSizeYUnits ),
59 m_constraintX( aParent, m_constraintXLabel, m_constraintXCtrl, m_constraintXUnits ),
60 m_constraintY( aParent, m_constraintYLabel, m_constraintYCtrl, m_constraintYUnits ),
61 m_textPosX( aParent, m_staticTextPosX, m_textCtrlPosX, m_TextPosXUnits ),
62 m_textPosY( aParent, m_staticTextPosY, m_textCtrlPosY, m_TextPosYUnits ),
63 m_textEndX( aParent, m_staticTextEndX, m_textCtrlEndX, m_TextEndXUnits ),
64 m_textEndY( aParent, m_staticTextEndY, m_textCtrlEndY, m_TextEndYUnits ),
65 m_textStepX( aParent, m_staticTextStepX, m_textCtrlStepX, m_TextStepXUnits ),
66 m_textStepY( aParent, m_staticTextStepY, m_textCtrlStepY, m_TextStepYUnits ),
67 m_defaultTextSizeX( aParent, m_staticTextDefTsX, m_textCtrlDefaultTextSizeX,
68 m_defaultTextSizeXUnits ),
69 m_defaultTextSizeY( aParent, m_staticTextDefTsY, m_textCtrlDefaultTextSizeY,
70 m_defaultTextSizeYUnits ),
71 m_defaultLineWidth( aParent, m_defaultLineWidthLabel, m_defaultLineWidthCtrl,
72 m_defaultLineWidthUnits ),
73 m_defaultTextThickness( aParent, m_defaultTextThicknessLabel, m_defaultTextThicknessCtrl,
74 m_defaultTextThicknessUnits ),
75 m_textLeftMargin( aParent, m_leftMarginLabel, m_leftMarginCtrl, m_leftMarginUnits ),
76 m_textRightMargin( aParent, m_rightMarginLabel, m_rightMarginCtrl, m_rightMarginUnits ),
77 m_textTopMargin( aParent, m_topMarginLabel, m_topMarginCtrl, m_topMarginUnits ),
78 m_textBottomMargin( aParent, m_bottomMarginLabel, m_bottomMarginCtrl, m_bottomMarginUnits ),
79 m_lineWidth( aParent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits )
80{
81 m_parent = aParent;
82
83 m_stcText->SetUseVerticalScrollBar( false );
84 m_stcText->SetUseHorizontalScrollBar( false );
85 m_stcText->SetEOLMode( wxSTC_EOL_LF ); // Always use LF as eol char, regardless the platform
86
87#ifdef _WIN32
88 // Without this setting, on Windows, some esoteric unicode chars create display issue
89 // in a wxStyledTextCtrl.
90 // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
91 m_stcText->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
92#endif
93
94 m_scintillaTricks = new SCINTILLA_TRICKS( m_stcText, wxT( "{}" ), false );
95
96 m_staticTextSizeInfo->SetFont( KIUI::GetInfoFont( this ).Italic() );
97
99 m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
101 m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
102
104
106 m_alignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
108 m_alignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_align_center ) );
110 m_alignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
111
113
115 m_vAlignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
117 m_vAlignMiddle->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_center ) );
119 m_vAlignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
120
122
123 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
125
126 m_buttonOK->SetDefault();
127
128 // ensure sizers are up to date
129 // (fix an issue on GTK but should not create issues on other platforms):
130 m_swItemProperties->Fit();
131 m_swGeneralOpts->Fit();
132
133 m_stcText->Bind( wxEVT_STC_CHARADDED, &PROPERTIES_FRAME::onScintillaCharAdded, this );
134 m_stcText->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED, &PROPERTIES_FRAME::onScintillaCharAdded,
135 this );
136 m_alignLeft->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onHAlignButton, this );
137 m_alignCenter->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onHAlignButton, this );
138 m_alignRight->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onHAlignButton, this );
139 m_vAlignTop->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onVAlignButton, this );
140 m_vAlignMiddle->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onVAlignButton, this );
141 m_vAlignBottom->Bind( wxEVT_BUTTON, &PROPERTIES_FRAME::onVAlignButton, this );
142}
143
144
146{
147 delete m_scintillaTricks;
148}
149
150
151void PROPERTIES_FRAME::OnPageChanged( wxNotebookEvent& event )
152{
153 if( event.GetSelection() == 0 )
154 m_buttonOK->SetDefault();
155 else
156 m_buttonGeneralOptsOK->SetDefault();
157
158 event.Skip();
159}
160
161
163{
164 return FromDIP( wxSize( 150, -1 ) );
165}
166
167
168double fromMM( double aMMValue )
169{
171}
172
173
174double toMM( double aIUValue )
175{
177}
178
179
180bool validateMM( UNIT_BINDER& aUnitBinder, double aMin, double aMax )
181{
182 return aUnitBinder.Validate( aMin, aMax, EDA_UNITS::MILLIMETRES );
183}
184
185
187{
189
190 // Set default parameters
192
196
201}
202
203
205{
207
208 // Import default parameters from widgets
209 if( validateMM( m_defaultLineWidth, 0.0, 10.0 ) )
211
214
217
218 if( validateMM( m_defaultTextThickness, 0.0, 5.0 ) )
220
221 // Get page margins values
226
227 return true;
228}
229
230
232{
233 if( !aItem )
234 {
235 m_SizerItemProperties->Show( false );
236 return;
237 }
238
239 wxString msg;
240
241 // Set parameters common to all DS_DATA_ITEM types
242 m_staticTextType->SetLabel( aItem->GetClassName() );
243 m_textCtrlComment->SetValue( aItem->m_Info );
244
245 switch( aItem->GetPage1Option() )
246 {
247 default:
248 case ALL_PAGES: m_choicePageOpt->SetSelection( 0 ); break;
249 case FIRST_PAGE_ONLY: m_choicePageOpt->SetSelection( 1 ); break;
250 case SUBSEQUENT_PAGES: m_choicePageOpt->SetSelection( 2 ); break;
251 }
252
253 // Position/ start point
256
257 switch( aItem->m_Pos.m_Anchor )
258 {
259 case RB_CORNER: m_comboBoxCornerPos->SetSelection( 2 ); break;
260 case RT_CORNER: m_comboBoxCornerPos->SetSelection( 0 ); break;
261 case LB_CORNER: m_comboBoxCornerPos->SetSelection( 3 ); break;
262 case LT_CORNER: m_comboBoxCornerPos->SetSelection( 1 ); break;
263 }
264
265 // End point
268
269 switch( aItem->m_End.m_Anchor )
270 {
271 case RB_CORNER: m_comboBoxCornerEnd->SetSelection( 2 ); break;
272 case RT_CORNER: m_comboBoxCornerEnd->SetSelection( 0 ); break;
273 case LB_CORNER: m_comboBoxCornerEnd->SetSelection( 3 ); break;
274 case LT_CORNER: m_comboBoxCornerEnd->SetSelection( 1 ); break;
275 }
276
278
279 // Now, set prms more specific to DS_DATA_ITEM types
280 // For a given type, disable widgets which are not relevant,
281 // and be sure widgets which are relevant are enabled
282 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
283 {
284 DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
285 item->m_FullText = item->m_TextBase;
286
287 // Replace our '\' 'n' sequence by the EOL char
289 m_stcText->SetValue( item->m_FullText );
290 m_stcText->EmptyUndoBuffer();
291
292 msg.Printf( wxT( "%d" ), item->m_IncrementLabel );
293 m_textCtrlTextIncrement->SetValue( msg );
294
295 // Rotation (poly and text)
296 msg.Printf( wxT( "%.3f" ), item->m_Orient );
297 m_textCtrlRotation->SetValue( msg );
298
299 // Constraints:
302
303 // Font Options
305
306 m_bold->Check( item->m_Bold );
307 m_italic->Check( item->m_Italic );
308
310
312 btn->Check( false );
313
314 switch( item->m_Hjustify )
315 {
316 case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check(); break;
320 }
321
323 btn->Check( false );
324
325 switch( item->m_Vjustify )
326 {
327 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
331 }
332
333 // Text size
336 }
337
338 if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
339 {
340 DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
341
342 // Rotation (poly and text)
343 msg.Printf( wxT( "%.3f" ), item->m_Orient.AsDegrees() );
344 m_textCtrlRotation->SetValue( msg );
345 }
346
347 if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
348 {
349 DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
350
351 // select definition in PPI
352 msg.Printf( wxT( "%d" ), item->GetPPI() );
353 m_textCtrlBitmapDPI->SetValue( msg );
354 }
355
356 m_SizerItemProperties->Show( true );
357
359 m_buttonHelp->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
360
362 || aItem->GetType() == DS_DATA_ITEM::DS_RECT );
363
365
366 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT
368 {
369 m_staticTextRot->Show( true );
370 m_textCtrlRotation->Show( true );
371 }
372 else
373 {
374 m_staticTextRot->Show( false );
375 m_textCtrlRotation->Show( false );
376 }
377
380
383
384 // Repeat parameters
385 msg.Printf( wxT( "%d" ), aItem->m_RepeatCount );
386 m_textCtrlRepeatCount->SetValue( msg );
387
390
391 // The number of widgets was modified, so recalculate sizers
392 m_swItemProperties->Layout();
393
394#ifdef __WXGTK__
395 // This call is mandatory on wxGTK to initialize the right virtual size and therefore
396 // scrollbars, but for some reason, create issues on Windows (incorrect display
397 // until the frame is resized). Joys of multiplatform dev.
398 m_swItemProperties->Fit();
399#endif
400
401 // send a size event to be sure scrollbars will be added/removed as needed
402 m_swItemProperties->PostSizeEvent();
403 m_swItemProperties->Refresh();
404}
405
406
407void PROPERTIES_FRAME::onHAlignButton( wxCommandEvent& aEvent )
408{
410 {
411 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
412 btn->Check( false );
413 }
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
426
427void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
428{
430 PL_SELECTION& selection = selTool->GetSelection();
431
433
434 DS_DRAW_ITEM_BASE* drawItem = (DS_DRAW_ITEM_BASE*) selection.Front();
435
436 if( drawItem )
437 {
438 DS_DATA_ITEM* dataItem = drawItem->GetPeer();
439 CopyPrmsFromPanelToItem( dataItem );
440
441 // Be sure what is displayed is what is set for item
442 // (mainly, texts can be modified if they contain "\n")
443 CopyPrmsFromItemToPanel( dataItem );
444 m_parent->GetCanvas()->GetView()->Update( drawItem );
445 }
446
448
449 // Refresh values, exactly as they are converted, to avoid any mistake
451
453
454 // Rebuild the draw list with the new parameters
457}
458
459
460void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
461{
463
465 model.m_DefaultLineWidth = 0.15;
466 model.m_DefaultTextThickness = 0.15;
467
469
470 // Rebuild the draw list with the new parameters
473}
474
475
477{
478 if( aItem == nullptr )
479 return false;
480
481 wxString msg;
482
483 // Import common parameters:
484 aItem->m_Info = m_textCtrlComment->GetValue();
485
486 switch( m_choicePageOpt->GetSelection() )
487 {
488 default:
489 case 0: aItem->SetPage1Option( ALL_PAGES ); break;
490 case 1: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break;
491 case 2: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break;
492 }
493
494 // Import thickness
495 if( validateMM( m_lineWidth, 0.0, 10.0 ) )
497
498 // Import Start point
499 aItem->m_Pos.m_Pos.x = toMM( m_textPosX.GetIntValue() );
500 aItem->m_Pos.m_Pos.y = toMM( m_textPosY.GetIntValue() );
501
502 switch( m_comboBoxCornerPos->GetSelection() )
503 {
504 case 2: aItem->m_Pos.m_Anchor = RB_CORNER; break;
505 case 0: aItem->m_Pos.m_Anchor = RT_CORNER; break;
506 case 3: aItem->m_Pos.m_Anchor = LB_CORNER; break;
507 case 1: aItem->m_Pos.m_Anchor = LT_CORNER; break;
508 }
509
510 // Import End point
511 aItem->m_End.m_Pos.x = toMM( m_textEndX.GetIntValue() );
512 aItem->m_End.m_Pos.y = toMM( m_textEndY.GetIntValue() );
513
514 switch( m_comboBoxCornerEnd->GetSelection() )
515 {
516 case 2: aItem->m_End.m_Anchor = RB_CORNER; break;
517 case 0: aItem->m_End.m_Anchor = RT_CORNER; break;
518 case 3: aItem->m_End.m_Anchor = LB_CORNER; break;
519 case 1: aItem->m_End.m_Anchor = LT_CORNER; break;
520 }
521
522 // Import Repeat prms
523 long itmp;
524 msg = m_textCtrlRepeatCount->GetValue();
525 msg.ToLong( &itmp );
526
527 // Ensure m_RepeatCount is > 0. Otherwise it create issues because a repeat
528 // count < 1 make no sense
529 if( itmp < 1l )
530 {
531 itmp = 1;
532 msg.Printf( wxT( "%ld" ), itmp );
533 m_textCtrlRepeatCount->SetValue( msg );
534 }
535
536 aItem->m_RepeatCount = itmp;
537
540
541 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
542 {
543 DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
544
545 item->m_TextBase = m_stcText->GetValue();
546
547 msg = m_textCtrlTextIncrement->GetValue();
548 msg.ToLong( &itmp );
549 item->m_IncrementLabel = itmp;
550
551 item->m_Bold = m_bold->IsChecked();
552 item->m_Italic = m_italic->IsChecked();
554
555 if( m_alignLeft->IsChecked() )
557 else if( m_alignCenter->IsChecked() )
559 else if( m_alignRight->IsChecked() )
561
562 if( m_vAlignTop->IsChecked() )
564 else if( m_vAlignMiddle->IsChecked() )
566 else if( m_vAlignBottom->IsChecked() )
568
570 item->m_Font = m_fontCtrl->GetFontSelection( item->m_Bold, item->m_Italic );
571
572 msg = m_textCtrlRotation->GetValue();
574 EDA_UNITS::UNSCALED, msg );
575
576 // Import text size
579
582
583 // Import constraints:
586 }
587
588 if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
589 {
590 DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
591
592 msg = m_textCtrlRotation->GetValue();
593 item->m_Orient = m_parent->AngleValueFromString( msg );
594 }
595
596 if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
597 {
598 DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
599 long value;
600
601 msg = m_textCtrlBitmapDPI->GetValue();
602
603 if( msg.ToLong( &value ) )
604 item->SetPPI( (int)value );
605 }
606
607 return true;
608}
609
610
611void PROPERTIES_FRAME::onScintillaCharAdded( wxStyledTextEvent &aEvent )
612{
613 wxArrayString autocompleteTokens;
614 int pos = m_stcText->GetCurrentPos();
615 int start = m_stcText->WordStartPosition( pos, true );
616 wxString partial;
617
618 if( start >= 2
619 && m_stcText->GetCharAt( start-2 ) == '$'
620 && m_stcText->GetCharAt( start-1 ) == '{' )
621 {
622 DS_DRAW_ITEM_LIST::GetTextVars( &autocompleteTokens );
623
624 partial = m_stcText->GetTextRange( start, pos );
625
626 for( std::pair<wxString, wxString> entry : m_parent->Prj().GetTextVars() )
627 autocompleteTokens.push_back( entry.first );
628 }
629
630 m_scintillaTricks->DoAutocomplete( partial, autocompleteTokens );
631 m_stcText->SetFocus();
632}
633
634
635void PROPERTIES_FRAME::onScintillaFocusLost( wxFocusEvent& aEvent )
636{
637 m_stcText->AutoCompCancel();
638 aEvent.Skip();
639}
640
641
642void PROPERTIES_FRAME::onHelp( wxCommandEvent& aEvent )
643{
644 // Show the system variables for worksheet text:
645 HTML_MESSAGE_BOX dlg( wxGetTopLevelParent( this ), _( "Predefined Keywords" ) );
646 wxString message;
647
648 message << _( "Texts can include keywords." ) << "<br>";
649 message << _( "Keyword notation is ${keyword}" ) << "<br>";
650 message << _( "Each keyword is replaced by its value" ) << "<br><br>";
651 message << _( "These build-in keywords are always available:" ) << "<br><br>";
652 dlg.AddHTML_Text( message );
653
654 message = "KICAD_VERSION\n";
655 message << "# " << _( "(sheet number)" ) << "\n";
656 message << "## " << _( "(sheet count)" ) << "\n";
657 message << "COMMENT1 thru COMMENT9\n";
658 message << "COMPANY\n";
659 message << "FILENAME\n";
660 message << "ISSUE_DATE\n";
661 message << "LAYER\n";
662 message << "PAPER " << _( "(paper size)" ) << "\n";
663 message << "REVISION\n";
664 message << "SHEETNAME\n";
665 message << "SHEETPATH\n";
666 message << "TITLE\n";
667
668 dlg.ListSet( message );
669 dlg.ShowModal();
670}
constexpr EDA_IU_SCALE drawSheetIUScale
Definition: base_units.h:109
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Definition: bitmap_button.h:42
void SetIsRadioButton()
bool IsChecked() const
void Check(bool aCheck=true)
Check the control.
void SetIsSeparator()
Render button as a toolbar separator.
void SetIsCheckButton()
Setup the control as a two-state button (checked or unchecked).
void SetBitmap(const wxBitmapBundle &aBmp)
Set the bitmap shown when the button is enabled.
void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
KIGFX::COLOR4D GetSwatchColor() const
void SetDefaultColor(const KIGFX::COLOR4D &aColor)
Sets the color that will be chosen with the "Reset to Default" button in the chooser.
void SetSwatchBackground(const KIGFX::COLOR4D &aBackground)
Set the swatch background color.
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
Definition: ds_data_item.h:342
GR_TEXT_H_ALIGN_T m_Hjustify
Definition: ds_data_item.h:338
KIGFX::COLOR4D m_TextColor
Definition: ds_data_item.h:344
VECTOR2D m_BoundingBoxSize
Definition: ds_data_item.h:345
GR_TEXT_V_ALIGN_T m_Vjustify
Definition: ds_data_item.h:339
Drawing sheet structure type definitions.
Definition: ds_data_item.h:96
PAGE_OPTION GetPage1Option() const
Definition: ds_data_item.h:133
void SetPage1Option(PAGE_OPTION aChoice)
Definition: ds_data_item.h:134
DS_ITEM_TYPE GetType() const
Definition: ds_data_item.h:128
const wxString GetClassName() const
VECTOR2D m_IncrementVector
Definition: ds_data_item.h:204
POINT_COORD m_Pos
Definition: ds_data_item.h:200
wxString m_Info
Definition: ds_data_item.h:199
double m_LineWidth
Definition: ds_data_item.h:202
POINT_COORD m_End
Definition: ds_data_item.h:201
int m_IncrementLabel
Definition: ds_data_item.h:205
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:39
void SetBottomMargin(double aMargin)
Definition: ds_data_model.h:73
double GetRightMargin()
Definition: ds_data_model.h:66
VECTOR2D m_DefaultTextSize
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
double GetTopMargin()
Definition: ds_data_model.h:69
void SetRightMargin(double aMargin)
Definition: ds_data_model.h:67
double m_DefaultLineWidth
double GetBottomMargin()
Definition: ds_data_model.h:72
double GetLeftMargin()
Definition: ds_data_model.h:63
void SetLeftMargin(double aMargin)
Definition: ds_data_model.h:64
double m_DefaultTextThickness
void SetTopMargin(double aMargin)
Definition: ds_data_model.h:70
Base class to handle basic graphic items.
Definition: ds_draw_item.h:59
DS_DATA_ITEM * GetPeer() const
Definition: ds_draw_item.h:63
static void GetTextVars(wxArrayString *aVars)
Definition: ds_painter.cpp:97
double AsDegrees() const
Definition: eda_angle.h:155
virtual COLOR4D GetDrawBgColor() const
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
bool HaveFontSelection() const
Definition: font_choice.cpp:94
void SetFontSelection(KIFONT::FONT *aFont)
Definition: font_choice.cpp:73
KIFONT::FONT * GetFontSelection(bool aBold, bool aItalic) 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.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1639
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Class PANEL_PROPERTIES_BASE.
wxScrolledWindow * m_swItemProperties
wxStaticBoxSizer * m_sbSizerEndPosition
wxStyledTextCtrl * m_stcText
wxScrolledWindow * m_swGeneralOpts
wxStaticText * m_staticTextInclabel
wxStaticText * m_staticTextBitmapDPI
COLOR_SWATCH * m_textColorSwatch
BITMAP_BUTTON * m_vAlignMiddle
wxStaticText * m_staticTextSizeInfo
BITMAP_BUTTON * m_vAlignBottom
void DisplayDrawingSheet()
Build and update the list of WS_DRAW_ITEM_xxx showing the frame layout.
The main window used in the drawing sheet editor.
void OnModify() override
Must be called after a change in order to set the "modify" flag.
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PL_SELECTION & GetSelection()
Return the set of currently selected items.
VECTOR2D m_Pos
Definition: ds_data_item.h:80
virtual std::map< wxString, wxString > & GetTextVars() const
Definition: project.cpp:84
UNIT_BINDER m_defaultTextSizeX
void onScintillaFocusLost(wxFocusEvent &aEvent) override
UNIT_BINDER m_lineWidth
PROPERTIES_FRAME(PL_EDITOR_FRAME *aParent)
void OnAcceptPrms(wxCommandEvent &event) override
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)
void onHelp(wxCommandEvent &aEvent) override
UNIT_BINDER m_textEndX
void OnSetDefaultValues(wxCommandEvent &event) override
void CopyPrmsFromItemToPanel(DS_DATA_ITEM *aItem)
void onHAlignButton(wxCommandEvent &aEvent)
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
void OnPageChanged(wxNotebookEvent &event) override
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void DoAutocomplete(const wxString &aPartial, const wxArrayString &aTokens)
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
EDA_ANGLE AngleValueFromString(const wxString &aTextValue) const
int GetIntValue()
Definition: unit_binder.h:127
virtual void SetDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
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.
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
#define TB_DEFAULT_TEXTSIZE
Definition: ds_data_item.h:35
@ FIRST_PAGE_ONLY
Definition: ds_data_item.h:58
@ SUBSEQUENT_PAGES
Definition: ds_data_item.h:59
@ ALL_PAGES
Definition: ds_data_item.h:57
@ RB_CORNER
Definition: ds_data_item.h:49
@ RT_CORNER
Definition: ds_data_item.h:50
@ LT_CORNER
Definition: ds_data_item.h:52
@ LB_CORNER
Definition: ds_data_item.h:51
#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",...
Definition: eda_units.cpp:532
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
Definition: eda_units.cpp:598
KICOMMON_API double ToUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: eda_units.cpp:259
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:151
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:587