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#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 ),
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 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
100 m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
102 m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
103
105
107 m_alignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
109 m_alignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_align_center ) );
111 m_alignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
112
114
116 m_vAlignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
118 m_vAlignMiddle->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_center ) );
120 m_vAlignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
121
123
124 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
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
151{
152 delete m_scintillaTricks;
153}
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::MILLIMETRES );
177}
178
179
181{
183
184 // Set default parameters
186
190
195}
196
197
199{
201
202 // Import default parameters from widgets
203 if( validateMM( m_defaultLineWidth, 0.0, 10.0 ) )
205
208
211
212 if( validateMM( m_defaultTextThickness, 0.0, 5.0 ) )
214
215 // Get page margins values
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
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
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
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:
299
300 // Font Options
302
303 m_bold->Check( item->m_Bold );
304 m_italic->Check( item->m_Italic );
305
307
309 btn->Check( false );
310
311 switch( item->m_Hjustify )
312 {
313 case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->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;
328 }
329
330 // Text size
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
356 m_buttonHelp->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
357
359 || aItem->GetType() == DS_DATA_ITEM::DS_RECT );
360
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
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{
431 PL_SELECTION& selection = selTool->GetSelection();
432
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
456
457 // Rebuild the draw list with the new parameters
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 CallAfter(
481 [this]()
482 {
483 OnAcceptPrms();
484 } );
485 }
486}
487
488
489void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
490{
492
494 model.m_DefaultLineWidth = 0.15;
495 model.m_DefaultTextThickness = 0.15;
496
498
499 // Rebuild the draw list with the new parameters
502}
503
504
506{
507 if( aItem == nullptr )
508 return false;
509
510 wxString msg;
511
512 // Import common parameters:
513 aItem->m_Info = m_textCtrlComment->GetValue();
514
515 switch( m_choicePageOpt->GetSelection() )
516 {
517 default:
518 case 0: aItem->SetPage1Option( ALL_PAGES ); break;
519 case 1: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break;
520 case 2: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break;
521 }
522
523 // Import thickness
524 if( validateMM( m_lineWidth, 0.0, 10.0 ) )
526
527 // Import Start point
528 aItem->m_Pos.m_Pos.x = toMM( m_textPosX.GetIntValue() );
529 aItem->m_Pos.m_Pos.y = toMM( m_textPosY.GetIntValue() );
530
531 switch( m_comboBoxCornerPos->GetSelection() )
532 {
533 case 2: aItem->m_Pos.m_Anchor = RB_CORNER; break;
534 case 0: aItem->m_Pos.m_Anchor = RT_CORNER; break;
535 case 3: aItem->m_Pos.m_Anchor = LB_CORNER; break;
536 case 1: aItem->m_Pos.m_Anchor = LT_CORNER; break;
537 }
538
539 // Import End point
540 aItem->m_End.m_Pos.x = toMM( m_textEndX.GetIntValue() );
541 aItem->m_End.m_Pos.y = toMM( m_textEndY.GetIntValue() );
542
543 switch( m_comboBoxCornerEnd->GetSelection() )
544 {
545 case 2: aItem->m_End.m_Anchor = RB_CORNER; break;
546 case 0: aItem->m_End.m_Anchor = RT_CORNER; break;
547 case 3: aItem->m_End.m_Anchor = LB_CORNER; break;
548 case 1: aItem->m_End.m_Anchor = LT_CORNER; break;
549 }
550
551 // Import Repeat prms
552 long itmp;
553 msg = m_textCtrlRepeatCount->GetValue();
554 msg.ToLong( &itmp );
555
556 // Ensure m_RepeatCount is > 0. Otherwise it create issues because a repeat
557 // count < 1 make no sense
558 if( itmp < 1l )
559 {
560 itmp = 1;
561 msg.Printf( wxT( "%ld" ), itmp );
562 m_textCtrlRepeatCount->SetValue( msg );
563 }
564
565 aItem->m_RepeatCount = itmp;
566
569
570 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
571 {
572 DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
573
574 item->m_TextBase = m_stcText->GetValue();
575
576 msg = m_textCtrlTextIncrement->GetValue();
577 msg.ToLong( &itmp );
578 item->m_IncrementLabel = itmp;
579
580 item->m_Bold = m_bold->IsChecked();
581 item->m_Italic = m_italic->IsChecked();
583
584 if( m_alignLeft->IsChecked() )
586 else if( m_alignCenter->IsChecked() )
588 else if( m_alignRight->IsChecked() )
590
591 if( m_vAlignTop->IsChecked() )
593 else if( m_vAlignMiddle->IsChecked() )
595 else if( m_vAlignBottom->IsChecked() )
597
599 item->m_Font = m_fontCtrl->GetFontSelection( item->m_Bold, item->m_Italic, true );
600
601 msg = m_textCtrlRotation->GetValue();
603 EDA_UNITS::UNSCALED, msg );
604
605 // Import text size
608
611
612 // Import constraints:
615 }
616
617 if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
618 {
619 DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
620
621 msg = m_textCtrlRotation->GetValue();
622 item->m_Orient = m_parent->AngleValueFromString( msg );
623 }
624
625 if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
626 {
627 DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
628 long value;
629
630 msg = m_textCtrlBitmapDPI->GetValue();
631
632 if( msg.ToLong( &value ) )
633 item->SetPPI( (int)value );
634 }
635
636 return true;
637}
638
639
640void PROPERTIES_FRAME::onScintillaCharAdded( wxStyledTextEvent &aEvent )
641{
642 wxArrayString autocompleteTokens;
643 int pos = m_stcText->GetCurrentPos();
644 int start = m_stcText->WordStartPosition( pos, true );
645 wxString partial;
646
647 if( start >= 2
648 && m_stcText->GetCharAt( start-2 ) == '$'
649 && m_stcText->GetCharAt( start-1 ) == '{' )
650 {
651 DS_DRAW_ITEM_LIST::GetTextVars( &autocompleteTokens );
652
653 partial = m_stcText->GetTextRange( start, pos );
654
655 for( std::pair<wxString, wxString> entry : m_parent->Prj().GetTextVars() )
656 autocompleteTokens.push_back( entry.first );
657 }
658
659 m_scintillaTricks->DoAutocomplete( partial, autocompleteTokens );
660 m_stcText->SetFocus();
661}
662
663
664void PROPERTIES_FRAME::onScintillaFocusLost( wxFocusEvent& aEvent )
665{
666 m_stcText->AutoCompCancel();
667 m_propertiesDirty = true;
668 aEvent.Skip();
669}
670
671
672void PROPERTIES_FRAME::onHelp( wxCommandEvent& aEvent )
673{
674 // Show the system variables for worksheet text:
675 HTML_MESSAGE_BOX dlg( wxGetTopLevelParent( this ), _( "Predefined Keywords" ) );
676 wxString message;
677
678 message << _( "Texts can include keywords." ) << "<br>";
679 message << _( "Keyword notation is ${keyword}" ) << "<br>";
680 message << _( "Each keyword is replaced by its value" ) << "<br><br>";
681 message << _( "These build-in keywords are always available:" ) << "<br><br>";
682 dlg.AddHTML_Text( message );
683
684 message = "KICAD_VERSION\n";
685 message << "# " << _( "(sheet number)" ) << "\n";
686 message << "## " << _( "(sheet count)" ) << "\n";
687 message << "COMMENT1 thru COMMENT9\n";
688 message << "COMPANY\n";
689 message << "FILENAME\n";
690 message << "ISSUE_DATE\n";
691 message << "LAYER\n";
692 message << "PAPER " << _( "(paper size)" ) << "\n";
693 message << "REVISION\n";
694 message << "SHEETNAME\n";
695 message << "SHEETPATH\n";
696 message << "TITLE\n";
697
698 dlg.ListSet( message );
699 dlg.ShowModal();
700}
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.
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
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:113
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
KIFONT::FONT * GetFontSelection(bool aBold, bool aItalic, bool aForDrawingSheet=false) const
bool HaveFontSelection() const
Definition: font_choice.cpp:94
void SetFontSelection(KIFONT::FONT *aFont)
Definition: font_choice.cpp:73
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:1669
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
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)
void onHelp(wxCommandEvent &aEvent) override
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)
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.
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:129
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:510
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:576
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:154
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:690