20#include <wx/hyperlink.h>
42 std::vector<PCB_TABLECELL*> aCells ) :
64 m_cellText->SetWrapVisualFlags( wxSTC_WRAPVISUALFLAG_END );
65 m_cellText->SetWrapIndentMode( wxSTC_WRAPINDENT_INDENT );
71 m_cellText->SetTechnology( wxSTC_TECHNOLOGY_DIRECTWRITE );
77 [
this]( wxKeyEvent& aEvent )
79 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
82 [
this]( wxStyledTextEvent& aEvent )
86 [
this](
const wxString& xRef, wxArrayString* tokens )
128 m_bold->SetIsCheckButton();
168 if( !wxDialog::TransferDataToWindow() )
175 bool firstCell =
true;
178 int textThickness = 0;
179 int basePenWidth = 0;
181 for( PCB_TABLECELL* cell :
m_cells )
185 wxString
text = cell->GetText();
188 if(
BOARD* board = cell->GetBoard() )
189 text = board->ConvertKIIDsToCrossReferences(
text );
193 m_fontCtrl->SetFontSelection( cell->GetFont() );
196 textThickness = cell->GetTextThickness();
199 hAlign = cell->GetHorizJustify();
200 vAlign = cell->GetVertJustify();
207 m_bold->Check( cell->IsBold() );
210 m_italic->Check( cell->IsItalic() );
219 wxString
text = cell->GetText();
222 if(
BOARD* board = cell->GetBoard() )
223 text = board->ConvertKIIDsToCrossReferences(
text );
228 if( cell->GetFont() !=
m_fontCtrl->GetFontSelection( cell->IsBold(), cell->IsItalic() ) )
231 if( cell->GetTextWidth() !=
m_textWidth.GetValue() )
237 if( cell->GetTextThickness() != textThickness )
243 if( cell->IsBold() !=
m_bold->IsChecked() )
249 if( cell->IsItalic() !=
m_italic->IsChecked() )
255 if( cell->GetHorizJustify() != hAlign )
258 if( cell->GetVertJustify() != vAlign )
261 if( cell->GetMarginLeft() !=
m_marginLeft.GetIntValue() )
264 if( cell->GetMarginTop() !=
m_marginTop.GetIntValue() )
305 if( textThickness == 0 )
308 if( basePenWidth > 0 )
314 else if( textThickness > 0 )
333 if( aEvent.IsChecked() )
339 wxCommandEvent
dummy;
370 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
380 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
388 if( !wxDialog::TransferDataFromWindow() )
391 BOARD_COMMIT commit(
m_frame );
396 bool pushCommit = (
m_table->GetEditFlags() == 0 );
403 for( PCB_TABLECELL* cell :
m_cells )
410 if(
BOARD* board = cell->GetBoard() )
411 txt = board->ConvertCrossReferencesToKIIDs( txt );
416 txt.Replace(
"\r",
"\n" );
417#elif defined( __WINDOWS__ )
420 txt.Replace(
"\r",
"" );
423 cell->SetText( txt );
427 cell->SetBold(
m_bold->IsChecked() );
430 cell->SetItalic(
m_italic->IsChecked() );
433 cell->SetIsKnockout(
true );
434 else if(
m_cbKnockout->Get3StateValue() == wxCHK_UNCHECKED )
435 cell->SetIsKnockout(
false );
438 cell->SetFont(
m_fontCtrl->GetFontSelection( cell->IsBold(), cell->IsItalic() ) );
447 cell->SetAutoThickness(
true );
478 if( !commit.Empty() )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
virtual void OnCharHook(wxKeyEvent &aEvt)
BITMAP_BUTTON * m_vAlignTop
wxCheckBox * m_cbKnockout
BITMAP_BUTTON * m_vAlignCenter
BITMAP_BUTTON * m_hAlignRight
BITMAP_BUTTON * m_hAlignCenter
BITMAP_BUTTON * m_vAlignBottom
wxStyledTextCtrl * m_cellTextCtrl
wxStaticText * m_SizeXLabel
wxTextCtrl * m_marginTopCtrl
wxStaticText * m_ThicknessUnits
BITMAP_BUTTON * m_autoTextThickness
BITMAP_BUTTON * m_separator0
wxTextCtrl * m_ThicknessCtrl
wxTextCtrl * m_marginBottomCtrl
BITMAP_BUTTON * m_hAlignLeft
wxStaticText * m_SizeXUnits
wxTextCtrl * m_marginRightCtrl
wxStaticText * m_marginTopUnits
wxTextCtrl * m_marginLeftCtrl
wxStaticText * m_SizeYUnits
BITMAP_BUTTON * m_separator1
wxStaticText * m_ThicknessLabel
wxStaticText * m_SizeYLabel
DIALOG_TABLECELL_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Table Cell Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
bool m_mixedItalicSetting
UNIT_BINDER m_textThickness
bool TransferDataFromWindow() override
bool m_cellTextIsGenerated
Generated cell text, shown so the user can read it but not theirs to change.
std::vector< SCH_TABLECELL * > m_cells
HTML_MESSAGE_BOX * m_helpWindow
@ TABLECELL_PROPS_EDIT_TABLE
void onBold(wxCommandEvent &aEvent) override
void onTextSize(wxCommandEvent &aEvent) override
void onHAlignButton(wxCommandEvent &aEvent)
void onAutoTextThickness(wxCommandEvent &aEvent) override
void onEditTable(wxCommandEvent &aEvent) override
enum TABLECELL_PROPS_RETVALUE m_returnValue
wxStyledTextCtrl * m_cellText
SCINTILLA_TRICKS * m_scintillaTricks
DIALOG_TABLECELL_PROPERTIES(SCH_EDIT_FRAME *aParentFrame, std::vector< SCH_TABLECELL * > aCells)
void onItalic(wxCommandEvent &aEvent) override
UNIT_BINDER m_marginBottom
bool TransferDataToWindow() override
~DIALOG_TABLECELL_PROPERTIES()
UNIT_BINDER m_marginRight
void onSyntaxHelp(wxHyperlinkEvent &aEvent) override
void onVAlignButton(wxCommandEvent &aEvent)
Common, abstract interface for edit frames.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Display a syntax help window for text variables and expressions.
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
This file is part of the common library.
#define IN_EDIT
Item currently edited.
int GetPenSizeForNormal(int aTextSize)
#define SKIP_CONNECTIVITY
std::vector< FAB_LAYER_COLOR > dummy
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
@ GR_TEXT_H_ALIGN_INDETERMINATE
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
@ GR_TEXT_V_ALIGN_INDETERMINATE
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...