Split out table editing and table cell editing.

This commit is contained in:
Jeff Young 2024-02-03 13:43:41 +00:00
parent 3282e4bb66
commit fa0ead98d8
69 changed files with 9704 additions and 8493 deletions

View File

@ -387,6 +387,13 @@ TOOL_ACTION ACTIONS::unmergeCells( TOOL_ACTION_ARGS()
.Tooltip( _( "Turn merged table cells back into separate cells." ) )
.Icon( BITMAPS::spreadsheet ) ); // JEY TODO: need icon
TOOL_ACTION ACTIONS::editTable( TOOL_ACTION_ARGS()
.Name( "pcbnew.TableEditor.editTable" )
.Scope( AS_GLOBAL )
.DefaultHotkey( MD_CTRL + 'E' )
.FriendlyName( _( "Edit Table" ) )
.Icon( BITMAPS::spreadsheet ) ); // JEY TODO: need icon
TOOL_ACTION ACTIONS::activatePointEditor( TOOL_ACTION_ARGS()
.Name( "common.Control.activatePointEditor" )
.Scope( AS_GLOBAL ) );

View File

@ -159,6 +159,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_symbol_properties_base.cpp
dialogs/dialog_symbol_remap.cpp
dialogs/dialog_symbol_remap_base.cpp
dialogs/dialog_table_properties.cpp
dialogs/dialog_table_properties_base.cpp
dialogs/dialog_tablecell_properties.cpp
dialogs/dialog_tablecell_properties_base.cpp
dialogs/dialog_text_properties.cpp

View File

@ -326,16 +326,18 @@ bool DIALOG_FIELD_PROPERTIES::TransferDataToWindow()
switch ( m_horizontalJustification )
{
case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check( true ); break;
case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check( true ); break;
case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check( true ); break;
case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check( true ); break;
case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check( true ); break;
case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check( true ); break;
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
switch ( m_verticalJustification )
{
case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check( true ); break;
case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check( true ); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check( true ); break;
case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check( true ); break;
case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check( true ); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check( true ); break;
case GR_TEXT_V_ALIGN_INDETERMINATE: break;
}
m_visible->SetValue( m_isVisible );

View File

@ -599,7 +599,7 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
m_currentLabel->AutoAutoplaceFields( m_Parent->GetScreen() );
if( !commit.Empty() )
commit.Push( _( "Edit Label" ), SKIP_CONNECTIVITY );
commit.Push( _( "Edit Label Properties" ), SKIP_CONNECTIVITY );
return true;
}

View File

@ -176,7 +176,7 @@ bool DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow()
else if( m_passive->GetValue() ) m_sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
if( !commit.Empty() )
commit.Push( _( "Edit Sheet Pin" ) );
commit.Push( _( "Edit Sheet Pin Properties" ) );
return true;
}

View File

@ -0,0 +1,417 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <kiplatform/ui.h>
#include <ee_actions.h>
#include <sch_edit_frame.h>
#include <widgets/color_swatch.h>
#include <widgets/grid_color_swatch_helpers.h>
#include <widgets/wx_grid.h>
#include <widgets/grid_text_helpers.h>
#include <grid_tricks.h>
#include <settings/color_settings.h>
#include <sch_table.h>
#include <sch_commit.h>
#include <tool/tool_manager.h>
#include <dialog_table_properties.h>
DIALOG_TABLE_PROPERTIES::DIALOG_TABLE_PROPERTIES( SCH_EDIT_FRAME* aFrame, SCH_TABLE* aTable ) :
DIALOG_TABLE_PROPERTIES_BASE( aFrame ),
m_frame( aFrame ),
m_table( aTable ),
m_borderWidth( aFrame, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
m_separatorsWidth( aFrame, m_separatorsWidthLabel, m_separatorsWidthCtrl, m_separatorsWidthUnits )
{
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_grid->CreateGrid( m_table->GetRowCount(), m_table->GetColCount() );
m_grid->EnableEditing( true );
m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false );
m_grid->SetMargins( 0, 0 );
m_grid->SetCellHighlightROPenWidth( 0 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( false );
m_grid->SetColLabelSize( 0 );
m_grid->EnableDragRowMove( false );
m_grid->EnableDragRowSize( false );
m_grid->SetRowLabelSize( 0 );
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_gridSizer->Add( m_grid, 1, wxEXPAND, 5 );
m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) );
wxColor coveredColor = wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT );
for( int row = 0; row < m_table->GetRowCount(); ++row )
{
for( int col = 0; col < m_table->GetColCount(); ++col )
{
const SCH_TABLECELL* cell = m_table->GetCell( row, col );
wxGridCellAttr* attr = new wxGridCellAttr;
if( cell->GetColSpan() == 0 || cell->GetRowSpan() == 0 )
{
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( this ) );
attr->SetReadOnly();
}
else
{
attr->SetEditor( new GRID_CELL_STC_EDITOR( true,
[this]( wxStyledTextEvent& aEvent, SCINTILLA_TRICKS* aScintillaTricks )
{
aScintillaTricks->DoTextVarAutocomplete(
[this]( const wxString& crossRef, wxArrayString* tokens )
{
getContextualTextVars( crossRef, tokens );
} );
} ) );
}
m_grid->SetAttr( row, col, attr );
}
}
for( const auto& [lineStyle, lineStyleDesc] : lineTypeNames )
{
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_separatorsStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
}
m_borderStyleCombo->Append( DEFAULT_STYLE );
m_separatorsStyleCombo->Append( DEFAULT_STYLE );
if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
SetupStandardButtons();
Layout();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
DIALOG_TABLE_PROPERTIES::~DIALOG_TABLE_PROPERTIES()
{
// Delete the GRID_TRICKS.
m_grid->PopEventHandler( true );
}
bool DIALOG_TABLE_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
//
// Cell Contents
//
wxColour coveredColor = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
if( KIPLATFORM::UI::IsDarkTheme() )
coveredColor = coveredColor.ChangeLightness( 140 );
else
coveredColor = coveredColor.ChangeLightness( 100 );
for( int row = 0; row < m_table->GetRowCount(); ++row )
{
for( int col = 0; col < m_table->GetColCount(); ++col )
{
SCH_TABLECELL* tableCell = m_table->GetCell( row, col );
if( tableCell->GetColSpan() == 0 || tableCell->GetRowSpan() == 0 )
m_grid->SetCellValue( row, col, coveredColor.GetAsString() );
else
m_grid->SetCellValue( row, col, tableCell->GetText() );
}
}
CallAfter( [this]()
{
for( int row = 0; row < m_table->GetRowCount(); ++row )
{
for( int col = 0; col < m_table->GetColCount(); ++col )
{
SCH_TABLECELL* tableCell = m_table->GetCell( row, col );
if( tableCell->IsSelected() )
{
m_grid->SetGridCursor( row, col );
m_grid->EnableCellEditControl();
m_grid->ShowCellEditControl();
return;
}
}
}
} );
sizeGridToTable();
//
// Table Properties
//
m_borderCheckbox->SetValue( m_table->StrokeExternal() );
m_headerBorder->SetValue( m_table->StrokeHeader() );
if( m_table->GetBorderStroke().GetWidth() >= 0 )
m_borderWidth.SetValue( m_table->GetBorderStroke().GetWidth() );
m_borderColorSwatch->SetSwatchColor( m_table->GetBorderStroke().GetColor(), false );
int style = static_cast<int>( m_table->GetBorderStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_borderStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_borderWidth.Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderColorLabel->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderColorSwatch->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderStyleLabel->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderStyleCombo->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
bool rows = m_table->StrokeRows() && m_table->GetSeparatorsStroke().GetWidth() >= 0;
bool cols = m_table->StrokeColumns() && m_table->GetSeparatorsStroke().GetWidth() >= 0;
m_rowSeparators->SetValue( rows );
m_colSeparators->SetValue( cols );
if( m_table->GetSeparatorsStroke().GetWidth() >= 0 )
m_separatorsWidth.SetValue( m_table->GetSeparatorsStroke().GetWidth() );
m_separatorsColorSwatch->SetSwatchColor( m_table->GetSeparatorsStroke().GetColor(), false );
style = static_cast<int>( m_table->GetSeparatorsStroke().GetLineStyle() );
if( style == -1 )
m_separatorsStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_separatorsStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_separatorsWidth.Enable( rows || cols );
m_separatorsColorLabel->Enable( rows || cols );
m_separatorsColorSwatch->Enable( rows || cols );
m_separatorsStyleLabel->Enable( rows || cols );
m_separatorsStyleCombo->Enable( rows || cols );
return true;
}
void DIALOG_TABLE_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
wxArrayString* aTokens )
{
if( !aCrossRef.IsEmpty() )
{
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
SCH_REFERENCE_LIST refs;
SCH_SYMBOL* refSymbol = nullptr;
sheets.GetSymbols( refs );
for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
{
SCH_REFERENCE& ref = refs[jj];
if( ref.GetSymbol()->GetRef( &ref.GetSheetPath(), true ) == aCrossRef )
{
refSymbol = ref.GetSymbol();
break;
}
}
if( refSymbol )
refSymbol->GetContextualTextVars( aTokens );
}
else
{
SCHEMATIC* schematic = m_table->Schematic();
if( schematic && schematic->CurrentSheet().Last() )
{
schematic->CurrentSheet().Last()->GetContextualTextVars( aTokens );
}
else
{
for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
aTokens->push_back( entry.first );
}
}
}
void DIALOG_TABLE_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
{
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( m_frame->eeconfig()->m_Drawing.default_line_thickness );
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );
m_borderColorSwatch->Enable( border );
m_borderStyleLabel->Enable( border );
m_borderStyleCombo->Enable( border );
bool row = m_rowSeparators->GetValue();
bool col = m_colSeparators->GetValue();
if( ( row || col ) && m_separatorsWidth.GetValue() < 0 )
m_separatorsWidth.SetValue( m_frame->eeconfig()->m_Drawing.default_line_thickness );
m_separatorsWidth.Enable( row || col );
m_separatorsColorLabel->Enable( row || col );
m_separatorsColorSwatch->Enable( row || col );
m_separatorsStyleLabel->Enable( row || col );
m_separatorsStyleCombo->Enable( row || col );
}
bool DIALOG_TABLE_PROPERTIES::TransferDataFromWindow()
{
if( !m_grid->CommitPendingChanges() )
return false;
if( !wxDialog::TransferDataFromWindow() )
return false;
SCH_COMMIT commit( m_frame );
/* save table in undo list if not already in edit */
if( m_table->GetEditFlags() == 0 )
commit.Modify( m_table, m_frame->GetScreen() );
for( int row = 0; row < m_table->GetRowCount(); ++row )
{
for( int col = 0; col < m_table->GetColCount(); ++col )
{
SCH_TABLECELL* tableCell = m_table->GetCell( row, col );
wxString txt = m_grid->GetCellValue( row, col );
#ifdef __WXMAC__
// On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting.
// Replace it now.
txt.Replace( "\r", "\n" );
#elif defined( __WINDOWS__ )
// On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
// drawing routines so strip the \r char.
txt.Replace( "\r", "" );
#endif
tableCell->SetText( txt );
}
}
m_table->SetStrokeExternal( m_borderCheckbox->GetValue() );
m_table->SetStrokeHeader( m_headerBorder->GetValue() );
{
STROKE_PARAMS stroke = m_table->GetBorderStroke();
if( m_borderCheckbox->GetValue() )
stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
else
stroke.SetWidth( -1 );
auto it = lineTypeNames.begin();
std::advance( it, m_borderStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
m_table->SetBorderStroke( stroke );
}
m_table->SetStrokeRows( m_rowSeparators->GetValue() );
m_table->SetStrokeColumns( m_colSeparators->GetValue() );
{
STROKE_PARAMS stroke = m_table->GetSeparatorsStroke();
if( m_rowSeparators->GetValue() || m_colSeparators->GetValue() )
stroke.SetWidth( std::max( 0, m_separatorsWidth.GetIntValue() ) );
else
stroke.SetWidth( -1 );
auto it = lineTypeNames.begin();
std::advance( it, m_separatorsStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
stroke.SetColor( m_separatorsColorSwatch->GetSwatchColor() );
m_table->SetSeparatorsStroke( stroke );
}
if( !commit.Empty() )
commit.Push( _( "Edit Table" ), SKIP_CONNECTIVITY );
return true;
}
void DIALOG_TABLE_PROPERTIES::sizeGridToTable()
{
Layout(); // Make sure we get the current client size for the grid
wxSize availableGridSize = m_grid->GetClientSize();
if( availableGridSize.x == 0 || availableGridSize.y == 0 )
return;
BOX2I tableBBox = m_table->GetBoundingBox();
double scalerX = static_cast<double>( availableGridSize.x ) / tableBBox.GetWidth();
double scalerY = static_cast<double>( availableGridSize.y ) / tableBBox.GetHeight();
for( int row = 0; row < m_table->GetRowCount(); ++row )
m_grid->SetRowSize( row, std::floor( m_table->GetRowHeight( row ) * scalerY ) );
for( int col = 0; col < m_table->GetColCount(); ++col )
m_grid->SetColSize( col, std::floor( m_table->GetColWidth( col ) * scalerX ) );
}
void DIALOG_TABLE_PROPERTIES::onSize( wxSizeEvent& aEvent )
{
if( m_table )
sizeGridToTable();
aEvent.Skip();
}

View File

@ -0,0 +1,64 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_TABLE_PROPERTIES_H
#define DIALOG_TABLE_PROPERTIES_H
#include <widgets/unit_binder.h>
#include <dialogs/dialog_table_properties_base.h>
class SCH_EDIT_FRAME;
class SCH_TABLE;
class WX_GRID;
class DIALOG_TABLE_PROPERTIES : public DIALOG_TABLE_PROPERTIES_BASE
{
public:
DIALOG_TABLE_PROPERTIES( SCH_EDIT_FRAME* aParentFrame, SCH_TABLE* aTable );
~DIALOG_TABLE_PROPERTIES();
private:
void sizeGridToTable();
void getContextualTextVars( const wxString& aCrossRef, wxArrayString* aTokens );
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void onBorderChecked( wxCommandEvent& aEvent ) override;
void onSize( wxSizeEvent& aEvent ) override;
private:
SCH_EDIT_FRAME* m_frame;
SCH_TABLE* m_table;
WX_GRID* m_grid;
UNIT_BINDER m_borderWidth;
UNIT_BINDER m_separatorsWidth;
};
#endif // DIALOG_TABLE_PROPERTIES_H

View File

@ -0,0 +1,211 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/color_swatch.h"
#include "widgets/wx_infobar.h"
#include "dialog_table_properties_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_TABLE_PROPERTIES_BASE::DIALOG_TABLE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_infoBar = new WX_INFOBAR( this );
m_infoBar->SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE );
m_infoBar->SetEffectDuration( 500 );
m_infoBar->Hide();
bMainSizer->Add( m_infoBar, 0, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bColumns;
bColumns = new wxBoxSizer( wxHORIZONTAL );
m_gridSizer = new wxBoxSizer( wxVERTICAL );
m_gridSizer->SetMinSize( wxSize( 600,400 ) );
wxStaticText* cellContentsLabel;
cellContentsLabel = new wxStaticText( this, wxID_ANY, _("Cell contents:"), wxDefaultPosition, wxDefaultSize, 0 );
cellContentsLabel->Wrap( -1 );
m_gridSizer->Add( cellContentsLabel, 0, wxTOP|wxBOTTOM, 3 );
bColumns->Add( m_gridSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bColumns->Add( 10, 0, 0, wxEXPAND, 15 );
wxBoxSizer* bPropertiesMargins;
bPropertiesMargins = new wxBoxSizer( wxVERTICAL );
wxGridBagSizer* bPropertiesSizer;
bPropertiesSizer = new wxGridBagSizer( 3, 3 );
bPropertiesSizer->SetFlexibleDirection( wxBOTH );
bPropertiesSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
bPropertiesSizer->SetEmptyCellSize( wxSize( 0,2 ) );
m_borderCheckbox = new wxCheckBox( this, wxID_ANY, _("External border"), wxDefaultPosition, wxDefaultSize, 0 );
bPropertiesSizer->Add( m_borderCheckbox, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 );
m_headerBorder = new wxCheckBox( this, wxID_ANY, _("Header border"), wxDefaultPosition, wxDefaultSize, 0 );
bPropertiesSizer->Add( m_headerBorder, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxLEFT, 20 );
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
bPropertiesSizer->Add( m_borderWidthLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
m_borderWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer7->Add( m_borderWidthCtrl, 0, wxEXPAND, 5 );
m_borderWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthUnits->Wrap( -1 );
bSizer7->Add( m_borderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel->Wrap( -1 );
bSizer7->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizer7->Add( 5, 0, 0, 0, 5 );
m_panelBorderColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_borderColorSwatch = new COLOR_SWATCH( m_panelBorderColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_borderColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelBorderColor->SetSizer( bSizer2 );
m_panelBorderColor->Layout();
bSizer2->Fit( m_panelBorderColor );
bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
bPropertiesSizer->Add( bSizer7, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderStyleLabel->Wrap( -1 );
bPropertiesSizer->Add( m_borderStyleLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_borderStyleCombo->SetMinSize( wxSize( 200,-1 ) );
bPropertiesSizer->Add( m_borderStyleCombo, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
bPropertiesSizer->Add( 0, 20, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_rowSeparators = new wxCheckBox( this, wxID_ANY, _("Row lines"), wxDefaultPosition, wxDefaultSize, 0 );
bPropertiesSizer->Add( m_rowSeparators, wxGBPosition( 5, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 15 );
m_colSeparators = new wxCheckBox( this, wxID_ANY, _("Column lines"), wxDefaultPosition, wxDefaultSize, 0 );
bPropertiesSizer->Add( m_colSeparators, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 20 );
m_separatorsWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsWidthLabel->Wrap( -1 );
bPropertiesSizer->Add( m_separatorsWidthLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer71;
bSizer71 = new wxBoxSizer( wxHORIZONTAL );
m_separatorsWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer71->Add( m_separatorsWidthCtrl, 0, wxEXPAND, 5 );
m_separatorsWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsWidthUnits->Wrap( -1 );
bSizer71->Add( m_separatorsWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_separatorsColorLabel = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsColorLabel->Wrap( -1 );
bSizer71->Add( m_separatorsColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizer71->Add( 5, 0, 0, 0, 5 );
m_panelSeparatorsColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
m_separatorsColorSwatch = new COLOR_SWATCH( m_panelSeparatorsColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer21->Add( m_separatorsColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelSeparatorsColor->SetSizer( bSizer21 );
m_panelSeparatorsColor->Layout();
bSizer21->Fit( m_panelSeparatorsColor );
bSizer71->Add( m_panelSeparatorsColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
bPropertiesSizer->Add( bSizer71, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_separatorsStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsStyleLabel->Wrap( -1 );
bPropertiesSizer->Add( m_separatorsStyleLabel, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_separatorsStyleCombo = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_separatorsStyleCombo->SetMinSize( wxSize( 200,-1 ) );
bPropertiesSizer->Add( m_separatorsStyleCombo, wxGBPosition( 8, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
bPropertiesSizer->AddGrowableCol( 1 );
bPropertiesMargins->Add( bPropertiesSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bColumns->Add( bPropertiesMargins, 0, wxEXPAND|wxTOP, 5 );
bMainSizer->Add( bColumns, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
wxBoxSizer* bButtons;
bButtons = new wxBoxSizer( wxHORIZONTAL );
bButtons->Add( 0, 0, 1, wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bButtons->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 );
bMainSizer->Add( bButtons, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onSize ) );
m_borderCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_rowSeparators->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_colSeparators->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
}
DIALOG_TABLE_PROPERTIES_BASE::~DIALOG_TABLE_PROPERTIES_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onSize ) );
m_borderCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_rowSeparators->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_colSeparators->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class COLOR_SWATCH;
class WX_INFOBAR;
#include "dialog_shim.h"
#include <wx/infobar.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
#include <wx/bmpcbox.h>
#include <wx/gbsizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_TABLE_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_TABLE_PROPERTIES_BASE : public DIALOG_SHIM
{
private:
protected:
WX_INFOBAR* m_infoBar;
wxBoxSizer* m_gridSizer;
wxCheckBox* m_borderCheckbox;
wxCheckBox* m_headerBorder;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
wxStaticText* m_borderWidthUnits;
wxStaticText* m_borderColorLabel;
wxPanel* m_panelBorderColor;
COLOR_SWATCH* m_borderColorSwatch;
wxStaticText* m_borderStyleLabel;
wxBitmapComboBox* m_borderStyleCombo;
wxCheckBox* m_rowSeparators;
wxCheckBox* m_colSeparators;
wxStaticText* m_separatorsWidthLabel;
wxTextCtrl* m_separatorsWidthCtrl;
wxStaticText* m_separatorsWidthUnits;
wxStaticText* m_separatorsColorLabel;
wxPanel* m_panelSeparatorsColor;
COLOR_SWATCH* m_separatorsColorSwatch;
wxStaticText* m_separatorsStyleLabel;
wxBitmapComboBox* m_separatorsStyleCombo;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, override them in your derived class
virtual void onSize( wxSizeEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_TABLE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Table Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_TABLE_PROPERTIES_BASE();
};

View File

@ -34,95 +34,26 @@
#include <dialog_tablecell_properties.h>
class TABLECELL_SCINTILLA_TRICKS : public SCINTILLA_TRICKS
{
public:
TABLECELL_SCINTILLA_TRICKS( wxStyledTextCtrl* aScintilla,
std::function<void( wxKeyEvent& )> onAcceptHandler,
std::function<void()> onNextHandler ) :
SCINTILLA_TRICKS( aScintilla, wxT( "{}" ), false, std::move( onAcceptHandler ) ),
m_onNextHandler( std::move( onNextHandler ) )
{ }
protected:
void onCharHook( wxKeyEvent& aEvent ) override
{
if( aEvent.GetKeyCode() == WXK_TAB && aEvent.AltDown() && !aEvent.ControlDown() )
m_onNextHandler();
else
SCINTILLA_TRICKS::onCharHook( aEvent );
}
private:
std::function<void()> m_onNextHandler;
};
DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( SCH_EDIT_FRAME* aFrame,
SCH_TABLECELL* aCell ) :
std::vector<SCH_TABLECELL*> aCells ) :
DIALOG_TABLECELL_PROPERTIES_BASE( aFrame ),
m_frame( aFrame ),
m_table( nullptr ),
m_cell( aCell ),
m_borderWidth( aFrame, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
m_separatorsWidth( aFrame, m_separatorsWidthLabel, m_separatorsWidthCtrl, m_separatorsWidthUnits ),
m_cells( std::move( aCells ) ),
m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
m_marginLeft( aFrame, nullptr, m_marginLeftCtrl, nullptr ),
m_marginTop( aFrame, nullptr, m_marginTopCtrl, m_marginTopUnits ),
m_marginRight( aFrame, nullptr, m_marginRightCtrl, nullptr ),
m_marginBottom( aFrame, nullptr, m_marginBottomCtrl, nullptr ),
m_scintillaTricks( nullptr )
m_returnValue( TABLECELL_PROPS_CANCEL )
{
m_table = static_cast<SCH_TABLE*>( m_cell->GetParent() );
wxASSERT( m_cells.size() > 0 && m_cells[0] );
#ifdef _WIN32
// Without this setting, on Windows, some esoteric unicode chars create display issue
// in a wxStyledTextCtrl.
// for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
m_textCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
#endif
m_scintillaTricks = new TABLECELL_SCINTILLA_TRICKS( m_textCtrl,
// onAccept handler
[this]( wxKeyEvent& aEvent )
{
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
},
// onNext handler
[this]()
{
wxCommandEvent dummy;
OnApply( dummy );
} );
// A hack which causes Scintilla to auto-size the text editor canvas
// See: https://github.com/jacobslusser/ScintillaNET/issues/216
m_textCtrl->SetScrollWidth( 1 );
m_textCtrl->SetScrollWidthTracking( true );
SetInitialFocus( m_textCtrl );
for( const auto& [lineStyle, lineStyleDesc] : lineTypeNames )
{
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_separatorsStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
}
m_borderStyleCombo->Append( DEFAULT_STYLE );
m_separatorsStyleCombo->Append( DEFAULT_STYLE );
m_table = static_cast<SCH_TABLE*>( m_cells[0]->GetParent() );
if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
m_separator1->SetIsSeparator();
m_bold->SetIsCheckButton();
m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
m_italic->SetIsCheckButton();
m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
m_separator2->SetIsSeparator();
m_hAlignLeft->SetIsRadioButton();
m_hAlignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
m_hAlignCenter->SetIsRadioButton();
@ -130,8 +61,6 @@ DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( SCH_EDIT_FRAME* aFrame
m_hAlignRight->SetIsRadioButton();
m_hAlignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
m_separator3->SetIsSeparator();
m_vAlignTop->SetIsRadioButton();
m_vAlignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
m_vAlignCenter->SetIsRadioButton();
@ -139,13 +68,6 @@ DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( SCH_EDIT_FRAME* aFrame
m_vAlignBottom->SetIsRadioButton();
m_vAlignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
m_separator4->SetIsSeparator();
m_hotkeyHint->SetFont( KIUI::GetInfoFont( this ) );
m_hotkeyHint->SetLabel( wxString::Format( wxT( "(%s+%s)" ),
KeyNameFromKeyCode( WXK_ALT ),
KeyNameFromKeyCode( WXK_TAB ) ) );
SetupStandardButtons();
Layout();
@ -161,99 +83,116 @@ DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( SCH_EDIT_FRAME* aFrame
}
DIALOG_TABLECELL_PROPERTIES::~DIALOG_TABLECELL_PROPERTIES()
{
delete m_scintillaTricks;
}
bool DIALOG_TABLECELL_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
m_borderCheckbox->SetValue( m_table->StrokeExternal() );
m_headerBorder->SetValue( m_table->StrokeHeader() );
bool firstCell = true;
GR_TEXT_H_ALIGN_T hAlign;
GR_TEXT_V_ALIGN_T vAlign;
if( m_table->GetBorderStroke().GetWidth() >= 0 )
m_borderWidth.SetValue( m_table->GetBorderStroke().GetWidth() );
m_borderColorSwatch->SetSwatchColor( m_table->GetBorderStroke().GetColor(), false );
int style = static_cast<int>( m_table->GetBorderStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_borderStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_borderWidth.Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderColorLabel->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderColorSwatch->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderStyleLabel->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderStyleCombo->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
bool rows = m_table->StrokeRows() && m_table->GetSeparatorsStroke().GetWidth() >= 0;
bool cols = m_table->StrokeColumns() && m_table->GetSeparatorsStroke().GetWidth() >= 0;
m_rowSeparators->SetValue( rows );
m_colSeparators->SetValue( cols );
if( m_table->GetSeparatorsStroke().GetWidth() >= 0 )
m_separatorsWidth.SetValue( m_table->GetSeparatorsStroke().GetWidth() );
m_separatorsColorSwatch->SetSwatchColor( m_table->GetSeparatorsStroke().GetColor(), false );
style = static_cast<int>( m_table->GetSeparatorsStroke().GetLineStyle() );
if( style == -1 )
m_separatorsStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_separatorsStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_separatorsWidth.Enable( rows || cols );
m_separatorsColorLabel->Enable( rows || cols );
m_separatorsColorSwatch->Enable( rows || cols );
m_separatorsStyleLabel->Enable( rows || cols );
m_separatorsStyleCombo->Enable( rows || cols );
m_textCtrl->SetValue( m_cell->GetText() );
m_fontCtrl->SetFontSelection( m_cell->GetFont() );
m_textSize.SetValue( m_cell->GetTextWidth() );
m_bold->Check( m_cell->IsBold() );
m_italic->Check( m_cell->IsItalic() );
switch( m_cell->GetHorizJustify() )
for( SCH_TABLECELL* cell : m_cells )
{
case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break;
if( firstCell )
{
m_fontCtrl->SetFontSelection( cell->GetFont() );
m_textSize.SetValue( cell->GetTextWidth() );
m_bold->Set3StateValue( cell->IsBold() ? wxCHK_CHECKED : wxCHK_UNCHECKED );
m_italic->Set3StateValue( cell->IsItalic() ? wxCHK_CHECKED : wxCHK_UNCHECKED );
hAlign = cell->GetHorizJustify();
vAlign = cell->GetVertJustify();
m_textColorBook->SetSelection( 1 );
m_textColorSwatch->SetSwatchColor( cell->GetTextColor(), false );
m_fillColorBook->SetSelection( 1 );
if( cell->IsFilled() )
m_fillColorSwatch->SetSwatchColor( cell->GetFillColor(), false );
else
m_fillColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
m_marginLeft.SetValue( cell->GetMarginLeft() );
m_marginTop.SetValue( cell->GetMarginTop() );
m_marginRight.SetValue( cell->GetMarginRight() );
m_marginBottom.SetValue( cell->GetMarginBottom() );
firstCell = false;
}
else
{
if( cell->GetFont() != m_fontCtrl->GetFontSelection( cell->IsBold(), cell->IsItalic() ) )
m_fontCtrl->SetSelection( -1 );
if( cell->GetTextWidth() != m_textSize.GetValue() )
m_textSize.SetValue( INDETERMINATE_STATE );
wxCheckBoxState bold = cell->IsBold() ? wxCHK_CHECKED : wxCHK_UNCHECKED;
if( bold != m_bold->Get3StateValue() )
m_bold->Set3StateValue( wxCHK_UNDETERMINED );
wxCheckBoxState italic = cell->IsItalic() ? wxCHK_CHECKED : wxCHK_UNCHECKED;
if( italic != m_italic->Get3StateValue() )
m_italic->Set3StateValue( wxCHK_UNDETERMINED );
if( cell->GetHorizJustify() != hAlign )
hAlign = GR_TEXT_H_ALIGN_INDETERMINATE;
if( cell->GetVertJustify() != vAlign )
vAlign = GR_TEXT_V_ALIGN_INDETERMINATE;
if( cell->GetTextColor() != m_textColorSwatch->GetSwatchColor() )
{
m_textColorBook->SetSelection( 0 );
m_textColorPopup->SetSelection( 0 );
}
COLOR4D fillColor = cell->IsFilled() ? cell->GetFillColor() : COLOR4D::UNSPECIFIED;
if( fillColor != m_fillColorSwatch->GetSwatchColor() )
{
m_fillColorBook->SetSelection( 0 );
m_fillColorPopup->SetSelection( 0 );
}
if( fillColor != m_fillColorSwatch->GetSwatchColor() )
fillColor = COLOR4D::UNSPECIFIED;
if( cell->GetMarginLeft() != m_marginLeft.GetIntValue() )
m_marginLeft.SetValue( INDETERMINATE_STATE );
if( cell->GetMarginTop() != m_marginTop.GetIntValue() )
m_marginTop.SetValue( INDETERMINATE_STATE );
if( cell->GetMarginRight() != m_marginRight.GetIntValue() )
m_marginRight.SetValue( INDETERMINATE_STATE );
if( cell->GetMarginBottom() != m_marginBottom.GetIntValue() )
m_marginBottom.SetValue( INDETERMINATE_STATE );
}
switch( hAlign )
{
case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break;
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
switch( vAlign )
{
case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
case GR_TEXT_V_ALIGN_INDETERMINATE: break;
}
}
switch( m_cell->GetVertJustify() )
{
case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
}
m_textColorSwatch->SetSwatchColor( m_cell->GetTextColor(), false );
if( m_cell->IsFilled() )
m_fillColorSwatch->SetSwatchColor( m_cell->GetFillColor(), false );
else
m_fillColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
m_marginLeft.SetValue( m_cell->GetMarginLeft() );
m_marginTop.SetValue( m_cell->GetMarginTop() );
m_marginRight.SetValue( m_cell->GetMarginRight() );
m_marginBottom.SetValue( m_cell->GetMarginBottom() );
return true;
}
@ -278,70 +217,23 @@ void DIALOG_TABLECELL_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
}
void DIALOG_TABLECELL_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
void DIALOG_TABLECELL_PROPERTIES::onTextColorPopup( wxCommandEvent& aEvent )
{
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( m_frame->eeconfig()->m_Drawing.default_line_thickness );
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );
m_borderColorSwatch->Enable( border );
m_borderStyleLabel->Enable( border );
m_borderStyleCombo->Enable( border );
bool row = m_rowSeparators->GetValue();
bool col = m_colSeparators->GetValue();
if( ( row || col ) && m_separatorsWidth.GetValue() < 0 )
m_separatorsWidth.SetValue( m_frame->eeconfig()->m_Drawing.default_line_thickness );
m_separatorsWidth.Enable( row || col );
m_separatorsColorLabel->Enable( row || col );
m_separatorsColorSwatch->Enable( row || col );
m_separatorsStyleLabel->Enable( row || col );
m_separatorsStyleCombo->Enable( row || col );
}
void DIALOG_TABLECELL_PROPERTIES::OnCharHook( wxKeyEvent& aEvt )
{
if( aEvt.GetKeyCode() == WXK_TAB && aEvt.AltDown() && !aEvt.ControlDown() )
if( aEvent.GetSelection() == 1 )
{
wxCommandEvent dummy;
OnApply( dummy );
}
else
{
DIALOG_SHIM::OnCharHook( aEvt );
m_textColorBook->SetSelection( 1 );
m_textColorSwatch->GetNewSwatchColor();
}
}
void DIALOG_TABLECELL_PROPERTIES::OnApply( wxCommandEvent& aEvent )
void DIALOG_TABLECELL_PROPERTIES::onFillColorPopup( wxCommandEvent& aEvent )
{
TransferDataFromWindow();
for( size_t ii = 0; ii < m_table->GetCells().size(); ++ii )
if( aEvent.GetSelection() == 1 )
{
if( m_table->GetCells()[ii] == m_cell )
{
ii++;
if( ii >= m_table->GetCells().size() )
ii = 0;
m_cell = m_table->GetCells()[ii];
m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_frame->GetToolManager()->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, m_cell );
break;
}
m_fillColorBook->SetSelection( 1 );
m_fillColorSwatch->GetNewSwatchColor();
}
TransferDataToWindow();
m_textCtrl->SelectAll();
}
@ -356,124 +248,82 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataFromWindow()
if( m_table->GetEditFlags() == 0 )
commit.Modify( m_table, m_frame->GetScreen() );
m_table->SetStrokeExternal( m_borderCheckbox->GetValue() );
m_table->SetStrokeHeader( m_headerBorder->GetValue() );
for( SCH_TABLECELL* cell : m_cells )
{
STROKE_PARAMS stroke = m_table->GetBorderStroke();
if( m_bold->Get3StateValue() == wxCHK_CHECKED )
cell->SetBold( true );
else if( m_bold->Get3StateValue() == wxCHK_UNCHECKED )
cell->SetBold( false );
if( m_borderCheckbox->GetValue() )
stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
else
stroke.SetWidth( -1 );
if( m_italic->Get3StateValue() == wxCHK_CHECKED )
cell->SetItalic( true );
else if( m_italic->Get3StateValue() == wxCHK_UNCHECKED )
cell->SetItalic( false );
auto it = lineTypeNames.begin();
std::advance( it, m_borderStyleCombo->GetSelection() );
if( m_fontCtrl->HaveFontSelection() )
cell->SetFont( m_fontCtrl->GetFontSelection( cell->IsBold(), cell->IsItalic() ) );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
if( !m_textSize.IsIndeterminate() )
cell->SetTextSize( VECTOR2I( m_textSize.GetIntValue(), m_textSize.GetIntValue() ) );
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
if( m_hAlignLeft->IsChecked() )
cell->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
else if( m_hAlignRight->IsChecked() )
cell->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else if( m_hAlignCenter->IsChecked() )
cell->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
m_table->SetBorderStroke( stroke );
}
if( m_vAlignTop->IsChecked() )
cell->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
else if( m_vAlignBottom->IsChecked() )
cell->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
else if( m_vAlignCenter->IsChecked() )
cell->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
m_table->SetStrokeRows( m_rowSeparators->GetValue() );
m_table->SetStrokeColumns( m_colSeparators->GetValue() );
{
STROKE_PARAMS stroke = m_table->GetSeparatorsStroke();
if( m_textColorBook->GetSelection() == 1 )
cell->SetTextColor( m_textColorSwatch->GetSwatchColor() );
if( m_rowSeparators->GetValue() || m_colSeparators->GetValue() )
stroke.SetWidth( std::max( 0, m_separatorsWidth.GetIntValue() ) );
else
stroke.SetWidth( -1 );
auto it = lineTypeNames.begin();
std::advance( it, m_separatorsStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
stroke.SetColor( m_separatorsColorSwatch->GetSwatchColor() );
m_table->SetSeparatorsStroke( stroke );
}
wxString txt = m_textCtrl->GetValue();
#ifdef __WXMAC__
// On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting.
// Replace it now.
txt.Replace( "\r", "\n" );
#elif defined( __WINDOWS__ )
// On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
// drawing routines so strip the \r char.
txt.Replace( "\r", "" );
#endif
m_cell->SetText( txt );
if( m_fontCtrl->HaveFontSelection() )
{
m_cell->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(),
m_italic->IsChecked() ) );
}
if( m_cell->GetTextWidth() != m_textSize.GetValue() )
m_cell->SetTextSize( VECTOR2I( m_textSize.GetValue(), m_textSize.GetValue() ) );
m_cell->SetTextColor( m_textColorSwatch->GetSwatchColor() );
if( m_bold->IsChecked() != m_cell->IsBold() )
{
if( m_bold->IsChecked() )
if( m_fillColorBook->GetSelection() == 1 )
{
m_cell->SetBold( true );
m_cell->SetTextThickness( GetPenSizeForBold( m_cell->GetTextWidth() ) );
}
else
{
m_cell->SetBold( false );
m_cell->SetTextThickness( 0 ); // Use default pen width
COLOR4D fillColor = m_fillColorSwatch->GetSwatchColor();
if( fillColor == COLOR4D::UNSPECIFIED )
{
cell->SetFillMode( FILL_T::NO_FILL );
}
else
{
cell->SetFillMode( FILL_T::FILLED_WITH_COLOR );
cell->SetFillColor( fillColor );
}
}
if( !m_marginLeft.IsIndeterminate() )
cell->SetMarginLeft( m_marginLeft.GetIntValue() );
if( !m_marginTop.IsIndeterminate() )
cell->SetMarginTop( m_marginTop.GetIntValue() );
if( !m_marginRight.IsIndeterminate() )
cell->SetMarginRight( m_marginRight.GetIntValue() );
if( !m_marginBottom.IsIndeterminate() )
cell->SetMarginBottom( m_marginBottom.GetIntValue() );
}
if( m_hAlignRight->IsChecked() )
m_cell->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else if( m_hAlignCenter->IsChecked() )
m_cell->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
else
m_cell->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
if( m_vAlignBottom->IsChecked() )
m_cell->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
else if( m_vAlignCenter->IsChecked() )
m_cell->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
else
m_cell->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
COLOR4D fillColor = m_fillColorSwatch->GetSwatchColor();
if( fillColor == COLOR4D::UNSPECIFIED )
{
m_cell->SetFillMode( FILL_T::NO_FILL );
}
else
{
m_cell->SetFillMode( FILL_T::FILLED_WITH_COLOR );
m_cell->SetFillColor( fillColor );
}
m_cell->SetMarginLeft( m_marginLeft.GetIntValue() );
m_cell->SetMarginTop( m_marginTop.GetIntValue() );
m_cell->SetMarginRight( m_marginRight.GetIntValue() );
m_cell->SetMarginBottom( m_marginBottom.GetIntValue() );
if( !commit.Empty() )
commit.Push( _( "Edit Table Cell" ), SKIP_CONNECTIVITY );
commit.Push( _( "Edit Table Cell Properties" ), SKIP_CONNECTIVITY );
m_returnValue = TABLECELL_PROPS_OK;
return true;
}
void DIALOG_TABLECELL_PROPERTIES::onEditTable( wxCommandEvent& aEvent )
{
if( TransferDataFromWindow() )
{
m_returnValue = TABLECELL_PROPS_EDIT_TABLE;
Close();
}
}

View File

@ -30,16 +30,24 @@
class SCH_EDIT_FRAME;
class SCH_TABLE;
class SCH_TABLECELL;
class DIALOG_TABLECELL_PROPERTIES : public DIALOG_TABLECELL_PROPERTIES_BASE
{
public:
DIALOG_TABLECELL_PROPERTIES( SCH_EDIT_FRAME* aParentFrame, SCH_TABLECELL* aCell );
~DIALOG_TABLECELL_PROPERTIES();
// The dialog can be closed for several reasons.
enum TABLECELL_PROPS_RETVALUE
{
TABLECELL_PROPS_CANCEL,
TABLECELL_PROPS_OK,
TABLECELL_PROPS_EDIT_TABLE
};
protected:
void OnCharHook( wxKeyEvent& aEvt ) override;
DIALOG_TABLECELL_PROPERTIES( SCH_EDIT_FRAME* aParentFrame, std::vector<SCH_TABLECELL*> aCells );
///< @return the value depending on the way the dialog was closed.
enum TABLECELL_PROPS_RETVALUE GetReturnValue() { return m_returnValue; }
private:
bool TransferDataToWindow() override;
@ -47,23 +55,23 @@ private:
void onHAlignButton( wxCommandEvent &aEvent );
void onVAlignButton( wxCommandEvent &aEvent );
void onBorderChecked( wxCommandEvent& aEvent ) override;
void OnApply( wxCommandEvent& aEvent ) override;
void onTextColorPopup( wxCommandEvent &aEvent ) override;
void onFillColorPopup( wxCommandEvent &aEvent ) override;
void onEditTable( wxCommandEvent& aEvent ) override;
private:
SCH_EDIT_FRAME* m_frame;
SCH_TABLE* m_table;
SCH_TABLECELL* m_cell;
SCH_EDIT_FRAME* m_frame;
SCH_TABLE* m_table;
std::vector<SCH_TABLECELL*> m_cells;
UNIT_BINDER m_borderWidth;
UNIT_BINDER m_separatorsWidth;
UNIT_BINDER m_textSize;
UNIT_BINDER m_marginLeft;
UNIT_BINDER m_marginTop;
UNIT_BINDER m_marginRight;
UNIT_BINDER m_marginBottom;
UNIT_BINDER m_textSize;
UNIT_BINDER m_marginLeft;
UNIT_BINDER m_marginTop;
UNIT_BINDER m_marginRight;
UNIT_BINDER m_marginBottom;
SCINTILLA_TRICKS* m_scintillaTricks;
enum TABLECELL_PROPS_RETVALUE m_returnValue; // the option that closed the dialog
};

View File

@ -28,300 +28,163 @@ DIALOG_TABLECELL_PROPERTIES_BASE::DIALOG_TABLECELL_PROPERTIES_BASE( wxWindow* pa
bMainSizer->Add( m_infoBar, 0, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bColumns;
bColumns = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bCellContentMargins;
bCellContentMargins = new wxBoxSizer( wxVERTICAL );
m_textCtrl = new wxStyledTextCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN, wxEmptyString );
m_textCtrl->SetUseTabs( true );
m_textCtrl->SetTabWidth( 4 );
m_textCtrl->SetIndent( 4 );
m_textCtrl->SetTabIndents( false );
m_textCtrl->SetBackSpaceUnIndents( false );
m_textCtrl->SetViewEOL( false );
m_textCtrl->SetViewWhiteSpace( false );
m_textCtrl->SetMarginWidth( 2, 0 );
m_textCtrl->SetIndentationGuides( false );
m_textCtrl->SetReadOnly( false );
m_textCtrl->SetMarginWidth( 1, 0 );
m_textCtrl->SetMarginWidth( 0, 0 );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY );
m_textCtrl->SetSelBackground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
m_textCtrl->SetSelForeground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
m_textCtrl->SetMinSize( wxSize( 500,-1 ) );
bCellContentMargins->Add( m_textCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM, 1 );
bColumns->Add( bCellContentMargins, 1, wxEXPAND|wxTOP, 6 );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_tablePage = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer16;
bSizer16 = new wxBoxSizer( wxVERTICAL );
m_textEntrySizer = new wxGridBagSizer( 3, 3 );
m_textEntrySizer->SetFlexibleDirection( wxBOTH );
m_textEntrySizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_textEntrySizer->SetEmptyCellSize( wxSize( 0,2 ) );
m_borderCheckbox = new wxCheckBox( m_tablePage, wxID_ANY, _("External border"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 );
m_headerBorder = new wxCheckBox( m_tablePage, wxID_ANY, _("Header border"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_headerBorder, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxLEFT, 20 );
m_borderWidthLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
m_borderWidthCtrl = new wxTextCtrl( m_tablePage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer7->Add( m_borderWidthCtrl, 0, wxEXPAND, 5 );
m_borderWidthUnits = new wxStaticText( m_tablePage, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthUnits->Wrap( -1 );
bSizer7->Add( m_borderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_borderColorLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel->Wrap( -1 );
bSizer7->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizer7->Add( 5, 0, 0, 0, 5 );
m_panelBorderColor = new wxPanel( m_tablePage, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_borderColorSwatch = new COLOR_SWATCH( m_panelBorderColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_borderColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelBorderColor->SetSizer( bSizer2 );
m_panelBorderColor->Layout();
bSizer2->Fit( m_panelBorderColor );
bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer7, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderStyleLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_borderStyleCombo = new wxBitmapComboBox( m_tablePage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_borderStyleCombo->SetMinSize( wxSize( 200,-1 ) );
m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_textEntrySizer->Add( 0, 20, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_rowSeparators = new wxCheckBox( m_tablePage, wxID_ANY, _("Row lines"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_rowSeparators, wxGBPosition( 5, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 15 );
m_colSeparators = new wxCheckBox( m_tablePage, wxID_ANY, _("Column lines"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_colSeparators, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 20 );
m_separatorsWidthLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsWidthLabel->Wrap( -1 );
m_textEntrySizer->Add( m_separatorsWidthLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer71;
bSizer71 = new wxBoxSizer( wxHORIZONTAL );
m_separatorsWidthCtrl = new wxTextCtrl( m_tablePage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer71->Add( m_separatorsWidthCtrl, 0, wxEXPAND, 5 );
m_separatorsWidthUnits = new wxStaticText( m_tablePage, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsWidthUnits->Wrap( -1 );
bSizer71->Add( m_separatorsWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_separatorsColorLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsColorLabel->Wrap( -1 );
bSizer71->Add( m_separatorsColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizer71->Add( 5, 0, 0, 0, 5 );
m_panelSeparatorsColor = new wxPanel( m_tablePage, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
m_separatorsColorSwatch = new COLOR_SWATCH( m_panelSeparatorsColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer21->Add( m_separatorsColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelSeparatorsColor->SetSizer( bSizer21 );
m_panelSeparatorsColor->Layout();
bSizer21->Fit( m_panelSeparatorsColor );
bSizer71->Add( m_panelSeparatorsColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer71, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_separatorsStyleLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsStyleLabel->Wrap( -1 );
m_textEntrySizer->Add( m_separatorsStyleLabel, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_separatorsStyleCombo = new wxBitmapComboBox( m_tablePage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_separatorsStyleCombo->SetMinSize( wxSize( 200,-1 ) );
m_textEntrySizer->Add( m_separatorsStyleCombo, wxGBPosition( 8, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_textEntrySizer->AddGrowableCol( 1 );
bSizer16->Add( m_textEntrySizer, 1, wxEXPAND|wxALL, 5 );
m_tablePage->SetSizer( bSizer16 );
m_tablePage->Layout();
bSizer16->Fit( m_tablePage );
m_notebook->AddPage( m_tablePage, _("Table"), false );
m_cellPage = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bMargins;
bMargins = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizeCtrlSizer;
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* fgTextStyleSizer;
fgTextStyleSizer = new wxFlexGridSizer( 0, 2, 5, 5 );
fgTextStyleSizer->SetFlexibleDirection( wxBOTH );
fgTextStyleSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_separator1 = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator1->Enable( false );
wxStaticText* hAlignLabel;
hAlignLabel = new wxStaticText( this, wxID_ANY, _("Horizontal alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
hAlignLabel->Wrap( -1 );
hAlignLabel->SetToolTip( _("Horizontal alignment") );
bSizeCtrlSizer->Add( m_separator1, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgTextStyleSizer->Add( hAlignLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_bold = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_bold->SetToolTip( _("Bold") );
wxBoxSizer* hAlignButtons;
hAlignButtons = new wxBoxSizer( wxHORIZONTAL );
bSizeCtrlSizer->Add( m_bold, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_italic = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_italic->SetToolTip( _("Italic") );
bSizeCtrlSizer->Add( m_italic, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator2 = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator2->Enable( false );
bSizeCtrlSizer->Add( m_separator2, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hAlignLeft = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignLeft = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignLeft->SetToolTip( _("Align left") );
bSizeCtrlSizer->Add( m_hAlignLeft, 0, wxALIGN_CENTER_VERTICAL, 5 );
hAlignButtons->Add( m_hAlignLeft, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hAlignCenter = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignCenter->SetToolTip( _("Align horizontal center") );
bSizeCtrlSizer->Add( m_hAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
hAlignButtons->Add( m_hAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hAlignRight = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignRight = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignRight->SetToolTip( _("Align right") );
bSizeCtrlSizer->Add( m_hAlignRight, 0, wxALIGN_CENTER_VERTICAL, 5 );
hAlignButtons->Add( m_hAlignRight, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator3 = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator3->Enable( false );
bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgTextStyleSizer->Add( hAlignButtons, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_vAlignTop = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
vAlignLabel = new wxStaticText( this, wxID_ANY, _("Vertical alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
vAlignLabel->Wrap( -1 );
vAlignLabel->SetToolTip( _("Vertical alignment") );
fgTextStyleSizer->Add( vAlignLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* vAlignButtons;
vAlignButtons = new wxBoxSizer( wxHORIZONTAL );
m_vAlignTop = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignTop->SetToolTip( _("Align top") );
bSizeCtrlSizer->Add( m_vAlignTop, 0, wxALIGN_CENTER_VERTICAL, 5 );
vAlignButtons->Add( m_vAlignTop, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_vAlignCenter = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignCenter->SetToolTip( _("Align vertical center") );
bSizeCtrlSizer->Add( m_vAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
vAlignButtons->Add( m_vAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_vAlignBottom = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignBottom = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignBottom->SetToolTip( _("Align bottom") );
bSizeCtrlSizer->Add( m_vAlignBottom, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator4 = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator4->Enable( false );
bSizeCtrlSizer->Add( m_separator4, 0, wxALIGN_CENTER_VERTICAL, 5 );
vAlignButtons->Add( m_vAlignBottom, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMargins->Add( bSizeCtrlSizer, 0, wxBOTTOM, 5 );
fgTextStyleSizer->Add( vAlignButtons, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
wxGridBagSizer* gbSizer2;
gbSizer2 = new wxGridBagSizer( 4, 5 );
gbSizer2->SetFlexibleDirection( wxBOTH );
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer2->SetEmptyCellSize( wxSize( -1,5 ) );
m_fontLabel = new wxStaticText( m_cellPage, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
bMargins->Add( fgTextStyleSizer, 0, wxEXPAND|wxBOTTOM, 6 );
bMargins->Add( 0, 10, 0, wxEXPAND, 5 );
wxGridBagSizer* gbFontSizer;
gbFontSizer = new wxGridBagSizer( 6, 5 );
gbFontSizer->SetFlexibleDirection( wxBOTH );
gbFontSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbFontSizer->SetEmptyCellSize( wxSize( -1,5 ) );
m_styleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_styleLabel->Wrap( -1 );
gbFontSizer->Add( m_styleLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer14;
bSizer14 = new wxBoxSizer( wxHORIZONTAL );
m_bold = new wxCheckBox( this, wxID_ANY, _("Bold"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
bSizer14->Add( m_bold, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_italic = new wxCheckBox( this, wxID_ANY, _("Italic"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
bSizer14->Add( m_italic, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 45 );
gbFontSizer->Add( bSizer14, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_fontLabel = new wxStaticText( this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fontLabel->Wrap( -1 );
gbSizer2->Add( m_fontLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 1 );
gbFontSizer->Add( m_fontLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 1 );
wxString m_fontCtrlChoices[] = { _("Default Font"), _("KiCad Font") };
int m_fontCtrlNChoices = sizeof( m_fontCtrlChoices ) / sizeof( wxString );
m_fontCtrl = new FONT_CHOICE( m_cellPage, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 );
m_fontCtrl = new FONT_CHOICE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 );
m_fontCtrl->SetSelection( 0 );
gbSizer2->Add( m_fontCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
gbFontSizer->Add( m_fontCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_textSizeLabel = new wxStaticText( m_cellPage, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel->Wrap( -1 );
gbSizer2->Add( m_textSizeLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
gbFontSizer->Add( m_textSizeLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer15;
bSizer15 = new wxBoxSizer( wxHORIZONTAL );
m_textSizeCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_textSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer15->Add( m_textSizeCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textSizeUnits = new wxStaticText( m_cellPage, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeUnits->Wrap( -1 );
bSizer15->Add( m_textSizeUnits, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 3 );
gbSizer2->Add( bSizer15, wxGBPosition( 1, 1 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL, 5 );
gbFontSizer->Add( bSizer15, wxGBPosition( 1, 1 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL, 5 );
gbSizer2->AddGrowableCol( 1 );
gbFontSizer->AddGrowableCol( 1 );
bMargins->Add( gbSizer2, 0, wxEXPAND|wxBOTTOM, 5 );
bMargins->Add( gbFontSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxFlexGridSizer* fgColorSizer;
fgColorSizer = new wxFlexGridSizer( 0, 2, 4, 5 );
fgColorSizer->SetFlexibleDirection( wxBOTH );
fgColorSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
bMargins->Add( 0, 5, 0, wxEXPAND, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 2, 6, 5 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_textColorLabel = new wxStaticText( m_cellPage, wxID_ANY, _("Text color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textColorLabel = new wxStaticText( this, wxID_ANY, _("Text color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textColorLabel->Wrap( -1 );
fgSizer1->Add( m_textColorLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgColorSizer->Add( m_textColorLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_panelTextColor = new wxPanel( m_cellPage, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
m_textColorBook = new wxSimplebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
wxPanel* textColorPopupPanel;
textColorPopupPanel = new wxPanel( m_textColorBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer20;
bSizer20 = new wxBoxSizer( wxVERTICAL );
wxString m_textColorPopupChoices[] = { _("-- mixed values --"), _("Set Color...") };
int m_textColorPopupNChoices = sizeof( m_textColorPopupChoices ) / sizeof( wxString );
m_textColorPopup = new wxChoice( textColorPopupPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_textColorPopupNChoices, m_textColorPopupChoices, 0 );
m_textColorPopup->SetSelection( 0 );
bSizer20->Add( m_textColorPopup, 0, 0, 5 );
textColorPopupPanel->SetSizer( bSizer20 );
textColorPopupPanel->Layout();
bSizer20->Fit( textColorPopupPanel );
m_textColorBook->AddPage( textColorPopupPanel, _("a page"), false );
textColorSwatchPanel = new wxPanel( m_textColorBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer222;
bSizer222 = new wxBoxSizer( wxHORIZONTAL );
m_panelTextColor = new wxPanel( textColorSwatchPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer221;
bSizer221 = new wxBoxSizer( wxVERTICAL );
@ -332,13 +195,42 @@ DIALOG_TABLECELL_PROPERTIES_BASE::DIALOG_TABLECELL_PROPERTIES_BASE( wxWindow* pa
m_panelTextColor->SetSizer( bSizer221 );
m_panelTextColor->Layout();
bSizer221->Fit( m_panelTextColor );
fgSizer1->Add( m_panelTextColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizer222->Add( m_panelTextColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_fillColorLabel = new wxStaticText( m_cellPage, wxID_ANY, _("Background fill:"), wxDefaultPosition, wxDefaultSize, 0 );
textColorSwatchPanel->SetSizer( bSizer222 );
textColorSwatchPanel->Layout();
bSizer222->Fit( textColorSwatchPanel );
m_textColorBook->AddPage( textColorSwatchPanel, _("a page"), false );
fgColorSizer->Add( m_textColorBook, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_fillColorLabel = new wxStaticText( this, wxID_ANY, _("Background fill:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fillColorLabel->Wrap( -1 );
fgSizer1->Add( m_fillColorLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgColorSizer->Add( m_fillColorLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_panelFillColor = new wxPanel( m_cellPage, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
m_fillColorBook = new wxSimplebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
wxPanel* fillColorPopupPanel;
fillColorPopupPanel = new wxPanel( m_fillColorBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer211;
bSizer211 = new wxBoxSizer( wxVERTICAL );
wxString m_fillColorPopupChoices[] = { _("-- mixed values --"), _("Set Color...") };
int m_fillColorPopupNChoices = sizeof( m_fillColorPopupChoices ) / sizeof( wxString );
m_fillColorPopup = new wxChoice( fillColorPopupPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fillColorPopupNChoices, m_fillColorPopupChoices, 0 );
m_fillColorPopup->SetSelection( 0 );
bSizer211->Add( m_fillColorPopup, 0, 0, 5 );
fillColorPopupPanel->SetSizer( bSizer211 );
fillColorPopupPanel->Layout();
bSizer211->Fit( fillColorPopupPanel );
m_fillColorBook->AddPage( fillColorPopupPanel, _("a page"), false );
fillColorSwatchPanel = new wxPanel( m_fillColorBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer23;
bSizer23 = new wxBoxSizer( wxHORIZONTAL );
m_panelFillColor = new wxPanel( fillColorSwatchPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer22;
bSizer22 = new wxBoxSizer( wxVERTICAL );
@ -349,93 +241,75 @@ DIALOG_TABLECELL_PROPERTIES_BASE::DIALOG_TABLECELL_PROPERTIES_BASE( wxWindow* pa
m_panelFillColor->SetSizer( bSizer22 );
m_panelFillColor->Layout();
bSizer22->Fit( m_panelFillColor );
fgSizer1->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizer23->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMargins->Add( fgSizer1, 0, wxEXPAND|wxTOP, 5 );
fillColorSwatchPanel->SetSizer( bSizer23 );
fillColorSwatchPanel->Layout();
bSizer23->Fit( fillColorSwatchPanel );
m_fillColorBook->AddPage( fillColorSwatchPanel, _("a page"), false );
fgColorSizer->Add( m_fillColorBook, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMargins->Add( 0, 10, 0, wxEXPAND, 5 );
bMargins->Add( fgColorSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 20 );
wxGridBagSizer* gbSizer3;
gbSizer3 = new wxGridBagSizer( 1, 0 );
gbSizer3->SetFlexibleDirection( wxBOTH );
gbSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_marginsLable = new wxStaticText( m_cellPage, wxID_ANY, _("Margins:"), wxDefaultPosition, wxDefaultSize, 0 );
m_marginsLable->Wrap( -1 );
gbSizer3->Add( m_marginsLable, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 35 );
bMargins->Add( 0, 5, 0, wxEXPAND, 5 );
wxBoxSizer* marginTopSizer;
marginTopSizer = new wxBoxSizer( wxHORIZONTAL );
wxGridSizer* gMarginsSizer;
gMarginsSizer = new wxGridSizer( 0, 3, 4, 2 );
m_marginTopCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
marginTopSizer->Add( m_marginTopCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxStaticText* marginsLabel;
marginsLabel = new wxStaticText( this, wxID_ANY, _("Cell margins:"), wxDefaultPosition, wxDefaultSize, 0 );
marginsLabel->Wrap( -1 );
gMarginsSizer->Add( marginsLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_marginTopUnits = new wxStaticText( m_cellPage, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_marginTopCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gMarginsSizer->Add( m_marginTopCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_marginTopUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_marginTopUnits->Wrap( -1 );
marginTopSizer->Add( m_marginTopUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
gMarginsSizer->Add( m_marginTopUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 2 );
m_marginLeftCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gMarginsSizer->Add( m_marginLeftCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer3->Add( marginTopSizer, wxGBPosition( 0, 2 ), wxGBSpan( 1, 4 ), wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
gMarginsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
wxBoxSizer* marginLeftSizer;
marginLeftSizer = new wxBoxSizer( wxHORIZONTAL );
m_marginLeftCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
marginLeftSizer->Add( m_marginLeftCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_marginRightCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gMarginsSizer->Add( m_marginRightCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer3->Add( marginLeftSizer, wxGBPosition( 1, 0 ), wxGBSpan( 1, 3 ), wxEXPAND|wxRIGHT|wxLEFT, 25 );
gMarginsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
wxBoxSizer* marginRightSizer;
marginRightSizer = new wxBoxSizer( wxHORIZONTAL );
m_marginRightCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
marginRightSizer->Add( m_marginRightCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_marginBottomCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gMarginsSizer->Add( m_marginBottomCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer3->Add( marginRightSizer, wxGBPosition( 1, 3 ), wxGBSpan( 1, 3 ), wxEXPAND, 5 );
wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxHORIZONTAL );
m_marginBottomCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer19->Add( m_marginBottomCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer3->Add( bSizer19, wxGBPosition( 2, 2 ), wxGBSpan( 1, 4 ), wxEXPAND, 5 );
bMargins->Add( gbSizer3, 1, wxEXPAND|wxTOP, 5 );
bMargins->Add( gMarginsSizer, 0, wxEXPAND, 5 );
bSizer13->Add( bMargins, 1, wxEXPAND|wxALL, 5 );
m_cellPage->SetSizer( bSizer13 );
m_cellPage->Layout();
bSizer13->Fit( m_cellPage );
m_notebook->AddPage( m_cellPage, _("Cell"), true );
bMainSizer->Add( bSizer13, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bColumns->Add( m_notebook, 0, wxEXPAND|wxBOTTOM|wxLEFT, 10 );
bMainSizer->Add( bColumns, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bButtons;
bButtons = new wxBoxSizer( wxHORIZONTAL );
m_editTable = new wxButton( this, wxID_ANY, _("Edit Table..."), wxDefaultPosition, wxDefaultSize, 0 );
m_editTable->SetToolTip( _("Edit table properties and cell contents") );
bButtons->Add( m_editTable, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
bButtons->Add( 0, 0, 1, wxEXPAND, 5 );
m_applyButton = new wxButton( this, wxID_ANY, _("Apply && Go to Next Cell"), wxDefaultPosition, wxDefaultSize, 0 );
bButtons->Add( m_applyButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_hotkeyHint = new wxStaticText( this, wxID_ANY, _("(Option+Tab)"), wxDefaultPosition, wxDefaultSize, 0 );
m_hotkeyHint->Wrap( -1 );
bButtons->Add( m_hotkeyHint, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 10 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
@ -454,20 +328,16 @@ DIALOG_TABLECELL_PROPERTIES_BASE::DIALOG_TABLECELL_PROPERTIES_BASE( wxWindow* pa
bMainSizer->Fit( this );
// Connect Events
m_textCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_borderCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_rowSeparators->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_colSeparators->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_applyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnApply ), NULL, this );
m_textColorPopup->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onTextColorPopup ), NULL, this );
m_fillColorPopup->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onFillColorPopup ), NULL, this );
m_editTable->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onEditTable ), NULL, this );
}
DIALOG_TABLECELL_PROPERTIES_BASE::~DIALOG_TABLECELL_PROPERTIES_BASE()
{
// Disconnect Events
m_textCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_borderCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_rowSeparators->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_colSeparators->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_applyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnApply ), NULL, this );
m_textColorPopup->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onTextColorPopup ), NULL, this );
m_fillColorPopup->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onFillColorPopup ), NULL, this );
m_editTable->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onEditTable ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -22,21 +22,20 @@ class WX_INFOBAR;
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/stc/stc.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
#include <wx/bmpcbox.h>
#include <wx/gbsizer.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/notebook.h>
#include <wx/textctrl.h>
#include <wx/gbsizer.h>
#include <wx/panel.h>
#include <wx/simplebook.h>
#include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -50,70 +49,48 @@ class DIALOG_TABLECELL_PROPERTIES_BASE : public DIALOG_SHIM
protected:
WX_INFOBAR* m_infoBar;
wxStyledTextCtrl* m_textCtrl;
wxNotebook* m_notebook;
wxPanel* m_tablePage;
wxGridBagSizer* m_textEntrySizer;
wxCheckBox* m_borderCheckbox;
wxCheckBox* m_headerBorder;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
wxStaticText* m_borderWidthUnits;
wxStaticText* m_borderColorLabel;
wxPanel* m_panelBorderColor;
COLOR_SWATCH* m_borderColorSwatch;
wxStaticText* m_borderStyleLabel;
wxBitmapComboBox* m_borderStyleCombo;
wxCheckBox* m_rowSeparators;
wxCheckBox* m_colSeparators;
wxStaticText* m_separatorsWidthLabel;
wxTextCtrl* m_separatorsWidthCtrl;
wxStaticText* m_separatorsWidthUnits;
wxStaticText* m_separatorsColorLabel;
wxPanel* m_panelSeparatorsColor;
COLOR_SWATCH* m_separatorsColorSwatch;
wxStaticText* m_separatorsStyleLabel;
wxBitmapComboBox* m_separatorsStyleCombo;
wxPanel* m_cellPage;
BITMAP_BUTTON* m_separator1;
BITMAP_BUTTON* m_bold;
BITMAP_BUTTON* m_italic;
BITMAP_BUTTON* m_separator2;
BITMAP_BUTTON* m_hAlignLeft;
BITMAP_BUTTON* m_hAlignCenter;
BITMAP_BUTTON* m_hAlignRight;
BITMAP_BUTTON* m_separator3;
wxStaticText* vAlignLabel;
BITMAP_BUTTON* m_vAlignTop;
BITMAP_BUTTON* m_vAlignCenter;
BITMAP_BUTTON* m_vAlignBottom;
BITMAP_BUTTON* m_separator4;
wxStaticText* m_styleLabel;
wxCheckBox* m_bold;
wxCheckBox* m_italic;
wxStaticText* m_fontLabel;
FONT_CHOICE* m_fontCtrl;
wxStaticText* m_textSizeLabel;
wxTextCtrl* m_textSizeCtrl;
wxStaticText* m_textSizeUnits;
wxStaticText* m_textColorLabel;
wxSimplebook* m_textColorBook;
wxChoice* m_textColorPopup;
wxPanel* textColorSwatchPanel;
wxPanel* m_panelTextColor;
COLOR_SWATCH* m_textColorSwatch;
wxStaticText* m_fillColorLabel;
wxSimplebook* m_fillColorBook;
wxChoice* m_fillColorPopup;
wxPanel* fillColorSwatchPanel;
wxPanel* m_panelFillColor;
COLOR_SWATCH* m_fillColorSwatch;
wxStaticText* m_marginsLable;
wxTextCtrl* m_marginTopCtrl;
wxStaticText* m_marginTopUnits;
wxTextCtrl* m_marginLeftCtrl;
wxTextCtrl* m_marginRightCtrl;
wxTextCtrl* m_marginBottomCtrl;
wxButton* m_applyButton;
wxStaticText* m_hotkeyHint;
wxStaticLine* m_staticline1;
wxButton* m_editTable;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, override them in your derived class
virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnApply( wxCommandEvent& event ) { event.Skip(); }
virtual void onTextColorPopup( wxCommandEvent& event ) { event.Skip(); }
virtual void onFillColorPopup( wxCommandEvent& event ) { event.Skip(); }
virtual void onEditTable( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -262,16 +262,18 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
switch( m_currentText->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break;
case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break;
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
switch( m_currentText->GetVertJustify() )
{
case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
case GR_TEXT_V_ALIGN_INDETERMINATE: break;
}
if( m_currentText->GetTextAngle() == ANGLE_VERTICAL )
@ -537,7 +539,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
}
if( !commit.Empty() )
commit.Push( _( "Edit Text" ), SKIP_CONNECTIVITY );
commit.Push( _( "Edit Text Properties" ), SKIP_CONNECTIVITY );
return true;
}

View File

@ -83,12 +83,10 @@ void LIB_TEXTBOX::MirrorHorizontally( const VECTOR2I& center )
// Text is NOT really mirrored; it just has its justification flipped
if( GetTextAngle() == ANGLE_HORIZONTAL )
{
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
case GR_TEXT_H_ALIGN_CENTER: break;
case GR_TEXT_H_ALIGN_RIGHT: SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
}
if( GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
}
}
@ -98,12 +96,10 @@ void LIB_TEXTBOX::MirrorVertically( const VECTOR2I& center )
// Text is NOT really mirrored; it just has its justification flipped
if( GetTextAngle() == ANGLE_VERTICAL )
{
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
case GR_TEXT_H_ALIGN_CENTER: break;
case GR_TEXT_H_ALIGN_RIGHT: SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
}
if( GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
}
}
@ -135,6 +131,9 @@ VECTOR2I LIB_TEXTBOX::GetDrawPos() const
case GR_TEXT_H_ALIGN_RIGHT:
pos.y = bbox.GetTop() + m_marginTop;
break;
case GR_TEXT_H_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
}
switch( GetVertJustify() )
@ -148,6 +147,9 @@ VECTOR2I LIB_TEXTBOX::GetDrawPos() const
case GR_TEXT_V_ALIGN_BOTTOM:
pos.x = bbox.GetRight() - m_marginRight;
break;
case GR_TEXT_V_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
}
}
else
@ -163,6 +165,9 @@ VECTOR2I LIB_TEXTBOX::GetDrawPos() const
case GR_TEXT_H_ALIGN_RIGHT:
pos.x = bbox.GetRight() - m_marginRight;
break;
case GR_TEXT_H_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
}
switch( GetVertJustify() )
@ -176,6 +181,9 @@ VECTOR2I LIB_TEXTBOX::GetDrawPos() const
case GR_TEXT_V_ALIGN_BOTTOM:
pos.y = bbox.GetBottom() - m_marginBottom;
break;
case GR_TEXT_V_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
}
}

View File

@ -2370,7 +2370,7 @@ void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer )
{
drawText();
if( borderWidth > 0 )
if( aTextBox->Type() != SCH_TABLECELL_T && borderWidth > 0 )
{
COLOR4D borderColor = aTextBox->GetStroke().GetColor();
LINE_STYLE borderStyle = aTextBox->GetEffectiveLineStyle();
@ -2522,7 +2522,7 @@ void SCH_PAINTER::draw( const SCH_TABLE* aTable, int aLayer )
{
for( int col = 0; col < aTable->GetColCount(); ++col )
{
SCH_TABLECELL* cell = aTable->GetCell( row, 0 );
SCH_TABLECELL* cell = aTable->GetCell( row, col );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
{

View File

@ -86,12 +86,10 @@ void SCH_TEXTBOX::MirrorHorizontally( int aCenter )
// Text is NOT really mirrored; it just has its justification flipped
if( GetTextAngle() == ANGLE_HORIZONTAL )
{
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
case GR_TEXT_H_ALIGN_CENTER: break;
case GR_TEXT_H_ALIGN_RIGHT: SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
}
if( GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
}
}
@ -101,12 +99,10 @@ void SCH_TEXTBOX::MirrorVertically( int aCenter )
// Text is NOT really mirrored; it just has its justification flipped
if( GetTextAngle() == ANGLE_VERTICAL )
{
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
case GR_TEXT_H_ALIGN_CENTER: break;
case GR_TEXT_H_ALIGN_RIGHT: SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
}
if( GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
}
}
@ -145,6 +141,9 @@ VECTOR2I SCH_TEXTBOX::GetDrawPos() const
case GR_TEXT_H_ALIGN_RIGHT:
pos.y = bbox.GetTop() + m_marginTop;
break;
case GR_TEXT_H_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
}
switch( GetVertJustify() )
@ -158,6 +157,9 @@ VECTOR2I SCH_TEXTBOX::GetDrawPos() const
case GR_TEXT_V_ALIGN_BOTTOM:
pos.x = bbox.GetRight() - m_marginRight;
break;
case GR_TEXT_V_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
}
}
else
@ -173,6 +175,9 @@ VECTOR2I SCH_TEXTBOX::GetDrawPos() const
case GR_TEXT_H_ALIGN_RIGHT:
pos.x = bbox.GetRight() - m_marginRight;
break;
case GR_TEXT_H_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
}
switch( GetVertJustify() )
@ -186,6 +191,9 @@ VECTOR2I SCH_TEXTBOX::GetDrawPos() const
case GR_TEXT_V_ALIGN_BOTTOM:
pos.y = bbox.GetBottom() - m_marginBottom;
break;
case GR_TEXT_V_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
}
}

View File

@ -23,6 +23,7 @@
#include <ee_actions.h>
#include <tools/sch_edit_table_tool.h>
#include <dialogs/dialog_table_properties.h>
SCH_EDIT_TABLE_TOOL::SCH_EDIT_TABLE_TOOL() :
@ -41,6 +42,44 @@ bool SCH_EDIT_TABLE_TOOL::Init()
}
int SCH_EDIT_TABLE_TOOL::EditTable( const TOOL_EVENT& aEvent )
{
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::EditableItems );
bool clearSelection = selection.IsHover();
SCH_TABLE* parentTable = nullptr;
for( EDA_ITEM* item : selection.Items() )
{
if( item->Type() != SCH_TABLECELL_T )
return 0;
SCH_TABLE* table = static_cast<SCH_TABLE*>( item->GetParent() );
if( !parentTable )
{
parentTable = table;
}
else if( parentTable != table )
{
parentTable = nullptr;
break;
}
}
if( parentTable )
{
DIALOG_TABLE_PROPERTIES dlg( m_frame, parentTable );
dlg.ShowQuasiModal(); // Scintilla's auto-complete requires quasiModal
}
if( clearSelection )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
return 0;
}
SCH_TABLECELL* SCH_EDIT_TABLE_TOOL::copyCell( SCH_TABLECELL* aSource )
{
SCH_TABLECELL* cell = new SCH_TABLECELL();
@ -72,4 +111,6 @@ void SCH_EDIT_TABLE_TOOL::setTransitions()
Go( &SCH_EDIT_TABLE_TOOL::MergeCells, ACTIONS::mergeCells.MakeEvent() );
Go( &SCH_EDIT_TABLE_TOOL::UnmergeCells, ACTIONS::unmergeCells.MakeEvent() );
Go( &SCH_EDIT_TABLE_TOOL::EditTable, ACTIONS::editTable.MakeEvent() );
}

View File

@ -54,6 +54,8 @@ public:
int MergeCells( const TOOL_EVENT& aEvent ) { return doMergeCells( aEvent ); }
int UnmergeCells( const TOOL_EVENT& aEvent ) { return doUnmergeCells( aEvent ); }
int EditTable( const TOOL_EVENT& aEvent );
private:
///< Set up handlers for various events.
void setTransitions() override;

View File

@ -63,6 +63,7 @@
#include <dialogs/dialog_label_properties.h>
#include <dialogs/dialog_text_properties.h>
#include <dialogs/dialog_tablecell_properties.h>
#include <dialogs/dialog_table_properties.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <symbol_editor_settings.h>
@ -1771,6 +1772,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
case SCH_LINE_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_JUNCTION_T:
case SCH_TABLECELL_T:
break;
default:
@ -1899,9 +1901,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
DIALOG_SHEET_PIN_PROPERTIES dlg( m_frame, pin );
// QuasiModal required for help dialog
if( dlg.ShowQuasiModal() == wxID_OK )
m_frame->OnModify();
dlg.ShowQuasiModal();
break;
}
@ -1911,21 +1911,32 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
DIALOG_TEXT_PROPERTIES dlg( m_frame, static_cast<SCH_ITEM*>( curr_item ) );
// QuasiModal required for syntax help and Scintilla auto-complete
if( dlg.ShowQuasiModal() == wxID_OK )
m_frame->OnModify();
dlg.ShowQuasiModal();
break;
}
case SCH_TABLECELL_T:
{
DIALOG_TABLECELL_PROPERTIES dlg( m_frame, static_cast<SCH_TABLECELL*>( curr_item ) );
if( SELECTION_CONDITIONS::OnlyTypes( { SCH_TABLECELL_T } )( selection ) )
{
std::vector<SCH_TABLECELL*> cells;
if( dlg.ShowModal() == wxID_OK )
m_frame->OnModify();
for( EDA_ITEM* item : selection.Items() )
cells.push_back( static_cast<SCH_TABLECELL*>( item ) );
DIALOG_TABLECELL_PROPERTIES dlg( m_frame, cells );
dlg.ShowModal();
if( dlg.GetReturnValue() == DIALOG_TABLECELL_PROPERTIES::TABLECELL_PROPS_EDIT_TABLE )
{
SCH_TABLE* table = static_cast<SCH_TABLE*>( cells[0]->GetParent() );
DIALOG_TABLE_PROPERTIES tableDlg( m_frame, table );
tableDlg.ShowQuasiModal(); // Scintilla's auto-complete requires quasiModal
}
}
break;
}
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
@ -1935,9 +1946,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
DIALOG_LABEL_PROPERTIES dlg( m_frame, static_cast<SCH_LABEL_BASE*>( curr_item ) );
// Must be quasi modal for syntax help
if( dlg.ShowQuasiModal() == wxID_OK )
m_frame->OnModify();
dlg.ShowQuasiModal();
break;
}
@ -1957,9 +1966,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
DIALOG_SHAPE_PROPERTIES dlg( m_frame, static_cast<SCH_SHAPE*>( curr_item ) );
if( dlg.ShowModal() == wxID_OK )
m_frame->OnModify();
dlg.ShowModal();
break;
}
@ -1972,7 +1979,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
// The bitmap is cached in Opengl: clear the cache in case it has become invalid
getView()->RecacheAllItems();
m_frame->OnModify();
}
break;
@ -1981,12 +1987,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
case SCH_LINE_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_JUNCTION_T:
if( std::all_of( selection.Items().begin(), selection.Items().end(),
[&]( const EDA_ITEM* item )
{
return item->Type() == SCH_LINE_T
&& static_cast<const SCH_LINE*>( item )->IsGraphicLine();
} ) )
if( SELECTION_CONDITIONS::OnlyTypes( { SCH_ITEM_LOCATE_GRAPHIC_LINE_T } )( selection ) )
{
std::deque<SCH_LINE*> lines;
@ -1995,14 +1996,9 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
DIALOG_LINE_PROPERTIES dlg( m_frame, lines );
if( dlg.ShowModal() == wxID_OK )
m_frame->OnModify();
dlg.ShowModal();
}
else if( std::all_of( selection.Items().begin(), selection.Items().end(),
[&]( const EDA_ITEM* item )
{
return item->Type() == SCH_JUNCTION_T;
} ) )
else if( SELECTION_CONDITIONS::OnlyTypes( { SCH_JUNCTION_T } )( selection ) )
{
std::deque<SCH_JUNCTION*> junctions;
@ -2011,19 +2007,12 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
if( dlg.ShowModal() == wxID_OK )
m_frame->OnModify();
dlg.ShowModal();
}
else if( std::all_of( selection.Items().begin(), selection.Items().end(),
[&]( const EDA_ITEM* item )
{
const SCH_ITEM* schItem = dynamic_cast<const SCH_ITEM*>( item );
wxCHECK( schItem, false );
return ( schItem->HasLineStroke() && schItem->IsConnectable() )
|| item->Type() == SCH_JUNCTION_T;
} ) )
else if( SELECTION_CONDITIONS::OnlyTypes( { SCH_ITEM_LOCATE_WIRE_T,
SCH_ITEM_LOCATE_BUS_T,
SCH_BUS_WIRE_ENTRY_T,
SCH_JUNCTION_T } )( selection ) )
{
std::deque<SCH_ITEM*> items;
@ -2032,8 +2021,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
DIALOG_WIRE_BUS_PROPERTIES dlg( m_frame, items );
if( dlg.ShowModal() == wxID_OK )
m_frame->OnModify();
dlg.ShowModal();
}
else
{

View File

@ -78,6 +78,7 @@
#include <sch_sheet_path.h>
#include <wx/filedlg.h>
#include <wx/treectrl.h>
#include "sch_edit_table_tool.h"
int SCH_EDITOR_CONTROL::New( const TOOL_EVENT& aEvent )
@ -2213,7 +2214,17 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( !symbol || symbol->GetEditFlags() != 0 )
if( !symbol )
{
// Giant hack: by default we assign Edit Table to the same hotkey, so give the table
// tool a chance to handle it if we can't.
if( SCH_EDIT_TABLE_TOOL* tableTool = m_toolMgr->GetTool<SCH_EDIT_TABLE_TOOL>() )
tableTool->EditTable( aEvent );
return 0;
}
if( symbol->GetEditFlags() != 0 )
return 0;
if( symbol->IsMissingLibSymbol() )

View File

@ -199,7 +199,7 @@ void SCH_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
item->Set( property, newValue );
}
changes.Push( _( "Change property" ) );
changes.Push( _( "Edit Properties" ) );
m_frame->Refresh();
// Perform grid updates as necessary based on value change

View File

@ -42,14 +42,16 @@ enum GR_TEXT_H_ALIGN_T
{
GR_TEXT_H_ALIGN_LEFT = -1,
GR_TEXT_H_ALIGN_CENTER = 0,
GR_TEXT_H_ALIGN_RIGHT = 1
GR_TEXT_H_ALIGN_RIGHT = 1,
GR_TEXT_H_ALIGN_INDETERMINATE
};
enum GR_TEXT_V_ALIGN_T
{
GR_TEXT_V_ALIGN_TOP = -1,
GR_TEXT_V_ALIGN_CENTER = 0,
GR_TEXT_V_ALIGN_BOTTOM = 1
GR_TEXT_V_ALIGN_BOTTOM = 1,
GR_TEXT_V_ALIGN_INDETERMINATE
};

View File

@ -92,6 +92,7 @@ public:
static TOOL_ACTION deleteColumns;
static TOOL_ACTION mergeCells;
static TOOL_ACTION unmergeCells;
static TOOL_ACTION editTable;
// Find and Replace
static TOOL_ACTION showSearch;

View File

@ -108,6 +108,9 @@ protected:
selToolMenu.AddItem( ACTIONS::mergeCells, cellSelection && cellBlockSelection, 100 );
selToolMenu.AddItem( ACTIONS::unmergeCells, cellSelection && mergedCellsSelection, 100 );
selToolMenu.AddSeparator( 100 );
selToolMenu.AddItem( ACTIONS::editTable, cellSelection && SELECTION_CONDITIONS::Idle, 100 );
selToolMenu.AddSeparator( 100 );
}

View File

@ -132,6 +132,8 @@ set( PCBNEW_DIALOGS
dialogs/dialog_print_pcbnew.cpp
dialogs/dialog_swap_layers.cpp
dialogs/dialog_swap_layers_base.cpp
dialogs/dialog_table_properties.cpp
dialogs/dialog_table_properties_base.cpp
dialogs/dialog_tablecell_properties.cpp
dialogs/dialog_tablecell_properties_base.cpp
dialogs/dialog_target_properties.cpp

View File

@ -229,5 +229,5 @@ void ARRAY_CREATOR::Invoke()
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, &all_added_items );
commit.Push( _( "Create an array" ) );
commit.Push( _( "Create Array" ) );
}

View File

@ -92,7 +92,7 @@ int AUTOPLACE_TOOL::autoplace( std::vector<FOOTPRINT*>& aFootprints, bool aPlace
auto result = autoplacer.AutoplaceFootprints( aFootprints, &commit, aPlaceOffboard );
if( result == AR_COMPLETED )
commit.Push( _( "Autoplace components" ) );
commit.Push( _( "Autoplace Components" ) );
else
commit.Revert();

View File

@ -131,7 +131,7 @@ void DIALOG_CLEANUP_GRAPHICS::doCleanup( bool aDryRun )
else if( !commit.Empty() )
{
// Clear undo and redo lists to avoid inconsistencies between lists
commit.Push( _( "Graphics cleanup" ) );
commit.Push( _( "Graphics Cleanup" ) );
m_parentFrame->GetCanvas()->Refresh( true );
}
}

View File

@ -167,7 +167,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
else if( !commit.Empty() )
{
// Clear undo and redo lists to avoid inconsistencies between lists
commit.Push( _( "Board cleanup" ) );
commit.Push( _( "Board Cleanup" ) );
m_parentFrame->GetCanvas()->Refresh( true );
}

View File

@ -252,9 +252,10 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
switch ( m_dimension->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
m_mirrored->Check( m_dimension->IsMirrored() );
@ -308,7 +309,7 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow()
updateDimensionFromDialog( m_dimension );
if( pushCommit )
commit.Push( _( "Change dimension properties" ) );
commit.Push( _( "Edit Dimension Properties" ) );
return true;
}

View File

@ -611,7 +611,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
// This is a simple edit, we must create an undo entry
if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
commit.Push( _( "Modify footprint properties" ) );
commit.Push( _( "Edit Footprint Properties" ) );
m_returnValue = FP_PROPS_OK;
return true;

View File

@ -637,7 +637,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
fpList->clear();
fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
commit.Push( _( "Modify footprint properties" ) );
commit.Push( _( "Edit Footprint Properties" ) );
return true;
}

View File

@ -111,7 +111,7 @@ bool DIALOG_GROUP_PROPERTIES::TransferDataFromWindow()
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, m_group );
commit.Push( _( "Modified group" ) );
commit.Push( _( "Edit Group Properties" ) );
return true;
}

View File

@ -1643,7 +1643,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
// redraw the area where the pad was
m_parent->GetCanvas()->Refresh();
commit.Push( _( "Modify pad" ) );
commit.Push( _( "Edit Pad Properties" ) );
return true;
}

View File

@ -512,7 +512,7 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
else
m_item->SetNetCode( -1 );
commit.Push( _( "Modify drawing properties" ) );
commit.Push( _( "Edit Shape Properties" ) );
// Notify clients which treat locked and unlocked items differently (ie: POINT_EDITOR)
if( wasLocked != m_item->IsLocked() )

View File

@ -0,0 +1,393 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <kiplatform/ui.h>
#include <widgets/font_choice.h>
#include <widgets/color_swatch.h>
#include <widgets/wx_grid.h>
#include <widgets/grid_text_helpers.h>
#include <widgets/grid_color_swatch_helpers.h>
#include <grid_tricks.h>
#include <scintilla_tricks.h>
#include <confirm.h>
#include <board_commit.h>
#include <board_design_settings.h>
#include <footprint.h>
#include <pcb_textbox.h>
#include <pcb_tablecell.h>
#include <pcb_table.h>
#include <project.h>
#include <pcb_edit_frame.h>
#include <pcb_layer_box_selector.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <dialog_table_properties.h>
DIALOG_TABLE_PROPERTIES::DIALOG_TABLE_PROPERTIES( PCB_BASE_EDIT_FRAME* aFrame, PCB_TABLE* aTable ) :
DIALOG_TABLE_PROPERTIES_BASE( aFrame ),
m_frame( aFrame ),
m_table( aTable ),
m_borderWidth( aFrame, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
m_separatorsWidth( aFrame, m_separatorsWidthLabel, m_separatorsWidthCtrl, m_separatorsWidthUnits )
{
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_grid->CreateGrid( m_table->GetRowCount(), m_table->GetColCount() );
m_grid->EnableEditing( true );
m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false );
m_grid->SetMargins( 0, 0 );
m_grid->SetCellHighlightROPenWidth( 0 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( false );
m_grid->SetColLabelSize( 0 );
m_grid->EnableDragRowMove( false );
m_grid->EnableDragRowSize( false );
m_grid->SetRowLabelSize( 0 );
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_gridSizer->Add( m_grid, 1, wxEXPAND, 5 );
m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) );
for( int row = 0; row < m_table->GetRowCount(); ++row )
{
for( int col = 0; col < m_table->GetColCount(); ++col )
{
PCB_TABLECELL* cell = m_table->GetCell( row, col );
wxGridCellAttr* attr = new wxGridCellAttr;
if( cell->GetColSpan() == 0 || cell->GetRowSpan() == 0 )
{
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( this ) );
attr->SetReadOnly();
}
else
{
attr->SetEditor( new GRID_CELL_STC_EDITOR( true,
[this, cell]( wxStyledTextEvent& aEvent, SCINTILLA_TRICKS* aScintillaTricks )
{
aScintillaTricks->DoTextVarAutocomplete(
[this, cell]( const wxString& crossRef, wxArrayString* tokens )
{
m_frame->GetContextualTextVars( cell, crossRef, tokens );
} );
} ) );
}
m_grid->SetAttr( row, col, attr );
}
}
if( m_table->GetParentFootprint() )
{
// Do not allow locking items in the footprint editor
m_cbLocked->Show( false );
}
// Configure the layers list selector. Note that footprints are built outside the current
// board and so we may need to show all layers if the text is on an unactivated layer.
if( !m_frame->GetBoard()->IsLayerEnabled( m_table->GetLayer() ) )
m_LayerSelectionCtrl->ShowNonActivatedLayers( true );
m_LayerSelectionCtrl->SetLayersHotkeys( false );
m_LayerSelectionCtrl->SetBoardFrame( m_frame );
m_LayerSelectionCtrl->Resync();
for( const auto& [lineStyle, lineStyleDesc] : lineTypeNames )
{
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_separatorsStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
}
m_borderStyleCombo->Append( DEFAULT_STYLE );
m_separatorsStyleCombo->Append( DEFAULT_STYLE );
SetupStandardButtons();
Layout();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
DIALOG_TABLE_PROPERTIES::~DIALOG_TABLE_PROPERTIES()
{
// Delete the GRID_TRICKS.
m_grid->PopEventHandler( true );
}
bool DIALOG_TABLE_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
//
// Cell Contents
//
wxColour coveredColor = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
if( KIPLATFORM::UI::IsDarkTheme() )
coveredColor = coveredColor.ChangeLightness( 140 );
else
coveredColor = coveredColor.ChangeLightness( 100 );
for( int row = 0; row < m_table->GetRowCount(); ++row )
{
for( int col = 0; col < m_table->GetColCount(); ++col )
{
PCB_TABLECELL* tableCell = m_table->GetCell( row, col );
if( tableCell->GetColSpan() == 0 || tableCell->GetRowSpan() == 0 )
m_grid->SetCellValue( row, col, coveredColor.GetAsString() );
else
m_grid->SetCellValue( row, col, tableCell->GetText() );
}
}
CallAfter( [this]()
{
for( int row = 0; row < m_table->GetRowCount(); ++row )
{
for( int col = 0; col < m_table->GetColCount(); ++col )
{
PCB_TABLECELL* tableCell = m_table->GetCell( row, col );
if( tableCell->IsSelected() )
{
m_grid->SetGridCursor( row, col );
m_grid->EnableCellEditControl();
m_grid->ShowCellEditControl();
return;
}
}
}
} );
sizeGridToTable();
//
// Table Properties
//
m_LayerSelectionCtrl->SetLayerSelection( m_table->GetLayer() );
m_cbLocked->SetValue( m_table->IsLocked() );
m_borderCheckbox->SetValue( m_table->StrokeExternal() );
m_headerBorder->SetValue( m_table->StrokeHeader() );
if( m_table->GetBorderStroke().GetWidth() >= 0 )
m_borderWidth.SetValue( m_table->GetBorderStroke().GetWidth() );
int style = static_cast<int>( m_table->GetBorderStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_borderStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_borderWidth.Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderStyleLabel->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderStyleCombo->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
bool rows = m_table->StrokeRows() && m_table->GetSeparatorsStroke().GetWidth() >= 0;
bool cols = m_table->StrokeColumns() && m_table->GetSeparatorsStroke().GetWidth() >= 0;
m_rowSeparators->SetValue( rows );
m_colSeparators->SetValue( cols );
if( m_table->GetSeparatorsStroke().GetWidth() >= 0 )
m_separatorsWidth.SetValue( m_table->GetSeparatorsStroke().GetWidth() );
style = static_cast<int>( m_table->GetSeparatorsStroke().GetLineStyle() );
if( style == -1 )
m_separatorsStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_separatorsStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_separatorsWidth.Enable( rows || cols );
m_separatorsStyleLabel->Enable( rows || cols );
m_separatorsStyleCombo->Enable( rows || cols );
return true;
}
void DIALOG_TABLE_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
{
BOARD_DESIGN_SETTINGS& bds = m_frame->GetDesignSettings();
PCB_LAYER_ID currentLayer = ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() );
int defaultLineThickness = bds.GetLineThickness( currentLayer );
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( defaultLineThickness );
m_borderWidth.Enable( border );
m_borderStyleLabel->Enable( border );
m_borderStyleCombo->Enable( border );
bool row = m_rowSeparators->GetValue();
bool col = m_colSeparators->GetValue();
if( ( row || col ) && m_separatorsWidth.GetValue() < 0 )
m_separatorsWidth.SetValue( defaultLineThickness );
m_separatorsWidth.Enable( row || col );
m_separatorsStyleLabel->Enable( row || col );
m_separatorsStyleCombo->Enable( row || col );
}
bool DIALOG_TABLE_PROPERTIES::TransferDataFromWindow()
{
if( !m_grid->CommitPendingChanges() )
return false;
if( !wxDialog::TransferDataFromWindow() )
return false;
BOARD_COMMIT commit( m_frame );
commit.Modify( m_table );
// If no other command in progress, prepare undo command
// (for a command in progress, will be made later, at the completion of command)
bool pushCommit = ( m_table->GetEditFlags() == 0 );
// Set IN_EDIT flag to force undo/redo/abort proper operation and avoid new calls to
// SaveCopyInUndoList for the same text if is moved, and then rotated, edited, etc....
if( !pushCommit )
m_table->SetFlags( IN_EDIT );
for( int row = 0; row < m_table->GetRowCount(); ++row )
{
for( int col = 0; col < m_table->GetColCount(); ++col )
{
PCB_TABLECELL* tableCell = m_table->GetCell( row, col );
wxString txt = m_grid->GetCellValue( row, col );
#ifdef __WXMAC__
// On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting.
// Replace it now.
txt.Replace( "\r", "\n" );
#elif defined( __WINDOWS__ )
// On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
// drawing routines so strip the \r char.
txt.Replace( "\r", "" );
#endif
tableCell->SetText( txt );
}
}
m_table->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
m_table->SetLocked( m_cbLocked->GetValue() );
m_table->SetStrokeExternal( m_borderCheckbox->GetValue() );
m_table->SetStrokeHeader( m_headerBorder->GetValue() );
{
STROKE_PARAMS stroke = m_table->GetBorderStroke();
if( m_borderCheckbox->GetValue() )
stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
else
stroke.SetWidth( -1 );
auto it = lineTypeNames.begin();
std::advance( it, m_borderStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
m_table->SetBorderStroke( stroke );
}
m_table->SetStrokeRows( m_rowSeparators->GetValue() );
m_table->SetStrokeColumns( m_colSeparators->GetValue() );
{
STROKE_PARAMS stroke = m_table->GetSeparatorsStroke();
if( m_rowSeparators->GetValue() || m_colSeparators->GetValue() )
stroke.SetWidth( std::max( 0, m_separatorsWidth.GetIntValue() ) );
else
stroke.SetWidth( -1 );
auto it = lineTypeNames.begin();
std::advance( it, m_separatorsStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
m_table->SetSeparatorsStroke( stroke );
}
if( !commit.Empty() )
commit.Push( _( "Edit Table" ), SKIP_CONNECTIVITY );
return true;
}
void DIALOG_TABLE_PROPERTIES::sizeGridToTable()
{
Layout(); // Make sure we get the current client size for the grid
wxSize availableGridSize = m_grid->GetClientSize();
if( availableGridSize.x == 0 || availableGridSize.y == 0 )
return;
BOX2I tableBBox = m_table->GetBoundingBox();
double scalerX = static_cast<double>( availableGridSize.x ) / tableBBox.GetWidth();
double scalerY = static_cast<double>( availableGridSize.y ) / tableBBox.GetHeight();
for( int row = 0; row < m_table->GetRowCount(); ++row )
m_grid->SetRowSize( row, std::floor( m_table->GetRowHeight( row ) * scalerY ) );
for( int col = 0; col < m_table->GetColCount(); ++col )
m_grid->SetColSize( col, std::floor( m_table->GetColWidth( col ) * scalerX ) );
}
void DIALOG_TABLE_PROPERTIES::onSize( wxSizeEvent& aEvent )
{
if( m_table )
sizeGridToTable();
aEvent.Skip();
}

View File

@ -0,0 +1,62 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_TABLE_PROPERTIES_H
#define DIALOG_TABLE_PROPERTIES_H
#include <widgets/unit_binder.h>
#include <dialog_table_properties_base.h>
class PCB_BASE_EDIT_FRAME;
class PCB_TABLE;
class WX_GRID;
class DIALOG_TABLE_PROPERTIES : public DIALOG_TABLE_PROPERTIES_BASE
{
public:
DIALOG_TABLE_PROPERTIES( PCB_BASE_EDIT_FRAME* aParentFrame, PCB_TABLE* aTable );
~DIALOG_TABLE_PROPERTIES();
private:
void sizeGridToTable();
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void onBorderChecked( wxCommandEvent& aEvent ) override;
void onSize( wxSizeEvent& aEvent ) override;
private:
PCB_BASE_EDIT_FRAME* m_frame;
PCB_TABLE* m_table;
WX_GRID* m_grid;
UNIT_BINDER m_borderWidth;
UNIT_BINDER m_separatorsWidth;
};
#endif //DIALOG_TABLE_PROPERTIES_H

View File

@ -0,0 +1,177 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "pcb_layer_box_selector.h"
#include "widgets/wx_infobar.h"
#include "dialog_table_properties_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_TABLE_PROPERTIES_BASE::DIALOG_TABLE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_infoBar = new WX_INFOBAR( this );
m_infoBar->SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE );
m_infoBar->SetEffectDuration( 500 );
m_infoBar->Hide();
bMainSizer->Add( m_infoBar, 0, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bColumns;
bColumns = new wxBoxSizer( wxHORIZONTAL );
m_gridSizer = new wxBoxSizer( wxVERTICAL );
m_gridSizer->SetMinSize( wxSize( 600,400 ) );
wxStaticText* cellContentsLabel;
cellContentsLabel = new wxStaticText( this, wxID_ANY, _("Cell contents:"), wxDefaultPosition, wxDefaultSize, 0 );
cellContentsLabel->Wrap( -1 );
m_gridSizer->Add( cellContentsLabel, 0, wxTOP|wxBOTTOM, 3 );
bColumns->Add( m_gridSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bColumns->Add( 15, 0, 0, wxEXPAND, 5 );
wxGridBagSizer* bPropertiesSizer;
bPropertiesSizer = new wxGridBagSizer( 3, 3 );
bPropertiesSizer->SetFlexibleDirection( wxBOTH );
bPropertiesSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
bPropertiesSizer->SetEmptyCellSize( wxSize( 0,2 ) );
m_layerLabel = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_layerLabel->Wrap( -1 );
bPropertiesSizer->Add( m_layerLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_LayerSelectionCtrl->SetMinSize( wxSize( 175,-1 ) );
bPropertiesSizer->Add( m_LayerSelectionCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_cbLocked = new wxCheckBox( this, wxID_ANY, _("Locked"), wxDefaultPosition, wxDefaultSize, 0 );
bPropertiesSizer->Add( m_cbLocked, wxGBPosition( 1, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM, 20 );
m_borderCheckbox = new wxCheckBox( this, wxID_ANY, _("External border"), wxDefaultPosition, wxDefaultSize, 0 );
bPropertiesSizer->Add( m_borderCheckbox, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 );
m_headerBorder = new wxCheckBox( this, wxID_ANY, _("Header border"), wxDefaultPosition, wxDefaultSize, 0 );
bPropertiesSizer->Add( m_headerBorder, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxLEFT, 20 );
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
bPropertiesSizer->Add( m_borderWidthLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
m_borderWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer7->Add( m_borderWidthCtrl, 0, wxEXPAND, 5 );
m_borderWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthUnits->Wrap( -1 );
bSizer7->Add( m_borderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
bPropertiesSizer->Add( bSizer7, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderStyleLabel->Wrap( -1 );
bPropertiesSizer->Add( m_borderStyleLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_borderStyleCombo->SetMinSize( wxSize( 200,-1 ) );
bPropertiesSizer->Add( m_borderStyleCombo, wxGBPosition( 5, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
bPropertiesSizer->Add( 0, 15, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_rowSeparators = new wxCheckBox( this, wxID_ANY, _("Row lines"), wxDefaultPosition, wxDefaultSize, 0 );
bPropertiesSizer->Add( m_rowSeparators, wxGBPosition( 7, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 15 );
m_colSeparators = new wxCheckBox( this, wxID_ANY, _("Column lines"), wxDefaultPosition, wxDefaultSize, 0 );
bPropertiesSizer->Add( m_colSeparators, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 20 );
m_separatorsWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsWidthLabel->Wrap( -1 );
bPropertiesSizer->Add( m_separatorsWidthLabel, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer71;
bSizer71 = new wxBoxSizer( wxHORIZONTAL );
m_separatorsWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer71->Add( m_separatorsWidthCtrl, 0, wxEXPAND, 5 );
m_separatorsWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsWidthUnits->Wrap( -1 );
bSizer71->Add( m_separatorsWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
bPropertiesSizer->Add( bSizer71, wxGBPosition( 9, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_separatorsStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsStyleLabel->Wrap( -1 );
bPropertiesSizer->Add( m_separatorsStyleLabel, wxGBPosition( 10, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_separatorsStyleCombo = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_separatorsStyleCombo->SetMinSize( wxSize( 200,-1 ) );
bPropertiesSizer->Add( m_separatorsStyleCombo, wxGBPosition( 10, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
bPropertiesSizer->AddGrowableCol( 1 );
bColumns->Add( bPropertiesSizer, 0, wxEXPAND|wxALL, 5 );
bMainSizer->Add( bColumns, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
wxBoxSizer* bButtons;
bButtons = new wxBoxSizer( wxHORIZONTAL );
bButtons->Add( 0, 0, 1, wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bButtons->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 );
bMainSizer->Add( bButtons, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onSize ) );
m_borderCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_rowSeparators->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_colSeparators->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
}
DIALOG_TABLE_PROPERTIES_BASE::~DIALOG_TABLE_PROPERTIES_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onSize ) );
m_borderCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_rowSeparators->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_colSeparators->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLE_PROPERTIES_BASE::onBorderChecked ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,77 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class PCB_LAYER_BOX_SELECTOR;
class WX_INFOBAR;
#include "dialog_shim.h"
#include <wx/infobar.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/bmpcbox.h>
#include <wx/checkbox.h>
#include <wx/textctrl.h>
#include <wx/gbsizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_TABLE_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_TABLE_PROPERTIES_BASE : public DIALOG_SHIM
{
private:
protected:
WX_INFOBAR* m_infoBar;
wxBoxSizer* m_gridSizer;
wxStaticText* m_layerLabel;
PCB_LAYER_BOX_SELECTOR* m_LayerSelectionCtrl;
wxCheckBox* m_cbLocked;
wxCheckBox* m_borderCheckbox;
wxCheckBox* m_headerBorder;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
wxStaticText* m_borderWidthUnits;
wxStaticText* m_borderStyleLabel;
wxBitmapComboBox* m_borderStyleCombo;
wxCheckBox* m_rowSeparators;
wxCheckBox* m_colSeparators;
wxStaticText* m_separatorsWidthLabel;
wxTextCtrl* m_separatorsWidthCtrl;
wxStaticText* m_separatorsWidthUnits;
wxStaticText* m_separatorsStyleLabel;
wxBitmapComboBox* m_separatorsStyleCombo;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, override them in your derived class
virtual void onSize( wxSizeEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_TABLE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Table Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_TABLE_PROPERTIES_BASE();
};

View File

@ -39,38 +39,12 @@
#include <scintilla_tricks.h>
#include "dialog_tablecell_properties.h"
class TABLECELL_SCINTILLA_TRICKS : public SCINTILLA_TRICKS
{
public:
TABLECELL_SCINTILLA_TRICKS( wxStyledTextCtrl* aScintilla,
std::function<void( wxKeyEvent& )> onAcceptHandler,
std::function<void()> onNextHandler ) :
SCINTILLA_TRICKS( aScintilla, wxT( "{}" ), false, std::move( onAcceptHandler ) ),
m_onNextHandler( std::move( onNextHandler ) )
{ }
protected:
void onCharHook( wxKeyEvent& aEvent ) override
{
if( aEvent.GetKeyCode() == WXK_TAB && aEvent.AltDown() && !aEvent.ControlDown() )
m_onNextHandler();
else
SCINTILLA_TRICKS::onCharHook( aEvent );
}
private:
std::function<void()> m_onNextHandler;
};
DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( PCB_BASE_EDIT_FRAME* aFrame,
PCB_TABLECELL* aCell ) :
std::vector<PCB_TABLECELL*> aCells ) :
DIALOG_TABLECELL_PROPERTIES_BASE( aFrame ),
m_frame( aFrame ),
m_table( nullptr ),
m_cell( aCell ),
m_borderWidth( aFrame, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
m_separatorsWidth( aFrame, m_separatorsWidthLabel, m_separatorsWidthCtrl, m_separatorsWidthUnits ),
m_cells( std::move( aCells ) ),
m_textHeight( aFrame, m_SizeYLabel, m_SizeYCtrl, m_SizeYUnits ),
m_textWidth( aFrame, m_SizeXLabel, m_SizeXCtrl, m_SizeXUnits ),
m_textThickness( aFrame, m_ThicknessLabel, m_ThicknessCtrl, m_ThicknessUnits ),
@ -78,69 +52,11 @@ DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( PCB_BASE_EDIT_FRAME* a
m_marginTop( aFrame, nullptr, m_marginTopCtrl, m_marginTopUnits ),
m_marginRight( aFrame, nullptr, m_marginRightCtrl, nullptr ),
m_marginBottom( aFrame, nullptr, m_marginBottomCtrl, nullptr ),
m_scintillaTricks( nullptr )
m_returnValue( TABLECELL_PROPS_CANCEL )
{
m_table = static_cast<PCB_TABLE*>( m_cell->GetParent() );
wxASSERT( m_cells.size() > 0 && m_cells[0] );
#ifdef _WIN32
// Without this setting, on Windows, some esoteric unicode chars create display issue
// in a wxStyledTextCtrl.
// for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
m_textCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
#endif
m_scintillaTricks = new TABLECELL_SCINTILLA_TRICKS( m_textCtrl,
// onAccept handler
[this]( wxKeyEvent& aEvent )
{
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
},
// onNext handler
[this]()
{
wxCommandEvent dummy;
OnApply( dummy );
} );
// A hack which causes Scintilla to auto-size the text editor canvas
// See: https://github.com/jacobslusser/ScintillaNET/issues/216
m_textCtrl->SetScrollWidth( 1 );
m_textCtrl->SetScrollWidthTracking( true );
SetInitialFocus( m_textCtrl );
if( m_table->GetParentFootprint() )
{
// Do not allow locking items in the footprint editor
m_cbLocked->Show( false );
}
// Configure the layers list selector. Note that footprints are built outside the current
// board and so we may need to show all layers if the text is on an unactivated layer.
if( !m_frame->GetBoard()->IsLayerEnabled( m_table->GetLayer() ) )
m_LayerSelectionCtrl->ShowNonActivatedLayers( true );
m_LayerSelectionCtrl->SetLayersHotkeys( false );
m_LayerSelectionCtrl->SetBoardFrame( m_frame );
m_LayerSelectionCtrl->Resync();
for( const auto& [lineStyle, lineStyleDesc] : lineTypeNames )
{
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_separatorsStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
}
m_borderStyleCombo->Append( DEFAULT_STYLE );
m_separatorsStyleCombo->Append( DEFAULT_STYLE );
m_separator1->SetIsSeparator();
m_bold->SetIsCheckButton();
m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
m_italic->SetIsCheckButton();
m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
m_separator2->SetIsSeparator();
m_table = static_cast<PCB_TABLE*>( m_cells[0]->GetParent() );
m_hAlignLeft->SetIsRadioButton();
m_hAlignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
@ -149,8 +65,6 @@ DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( PCB_BASE_EDIT_FRAME* a
m_hAlignRight->SetIsRadioButton();
m_hAlignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
m_separator3->SetIsSeparator();
m_vAlignTop->SetIsRadioButton();
m_vAlignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
m_vAlignCenter->SetIsRadioButton();
@ -158,13 +72,6 @@ DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( PCB_BASE_EDIT_FRAME* a
m_vAlignBottom->SetIsRadioButton();
m_vAlignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
m_separator4->SetIsSeparator();
m_hotkeyHint->SetFont( KIUI::GetInfoFont( this ) );
m_hotkeyHint->SetLabel( wxString::Format( wxT( "(%s+%s)" ),
KeyNameFromKeyCode( WXK_ALT ),
KeyNameFromKeyCode( WXK_TAB ) ) );
SetupStandardButtons();
Layout();
@ -180,88 +87,96 @@ DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES( PCB_BASE_EDIT_FRAME* a
}
DIALOG_TABLECELL_PROPERTIES::~DIALOG_TABLECELL_PROPERTIES()
{
delete m_scintillaTricks;
}
bool DIALOG_TABLECELL_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
m_LayerSelectionCtrl->SetLayerSelection( m_table->GetLayer() );
m_cbLocked->SetValue( m_table->IsLocked() );
bool firstCell = true;
GR_TEXT_H_ALIGN_T hAlign;
GR_TEXT_V_ALIGN_T vAlign;
m_borderCheckbox->SetValue( m_table->StrokeExternal() );
m_headerBorder->SetValue( m_table->StrokeHeader() );
if( m_table->GetBorderStroke().GetWidth() >= 0 )
m_borderWidth.SetValue( m_table->GetBorderStroke().GetWidth() );
int style = static_cast<int>( m_table->GetBorderStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_borderStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_borderWidth.Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderStyleLabel->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
m_borderStyleCombo->Enable( m_table->StrokeExternal() || m_table->StrokeHeader() );
bool rows = m_table->StrokeRows() && m_table->GetSeparatorsStroke().GetWidth() >= 0;
bool cols = m_table->StrokeColumns() && m_table->GetSeparatorsStroke().GetWidth() >= 0;
m_rowSeparators->SetValue( rows );
m_colSeparators->SetValue( cols );
if( m_table->GetSeparatorsStroke().GetWidth() >= 0 )
m_separatorsWidth.SetValue( m_table->GetSeparatorsStroke().GetWidth() );
style = static_cast<int>( m_table->GetSeparatorsStroke().GetLineStyle() );
if( style == -1 )
m_separatorsStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_separatorsStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_separatorsWidth.Enable( rows || cols );
m_separatorsStyleLabel->Enable( rows || cols );
m_separatorsStyleCombo->Enable( rows || cols );
m_textCtrl->SetValue( m_cell->GetText() );
m_fontCtrl->SetFontSelection( m_cell->GetFont() );
m_textWidth.SetValue( m_cell->GetTextWidth() );
m_textHeight.SetValue( m_cell->GetTextHeight() );
m_textThickness.SetValue( m_cell->GetTextThickness() );
m_bold->Check( m_cell->IsBold() );
m_italic->Check( m_cell->IsItalic() );
switch( m_cell->GetHorizJustify() )
for( PCB_TABLECELL* cell : m_cells )
{
case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break;
}
if( firstCell )
{
m_fontCtrl->SetFontSelection( cell->GetFont() );
m_textWidth.SetValue( cell->GetTextWidth() );
m_textHeight.SetValue( cell->GetTextHeight() );
m_textThickness.SetValue( cell->GetTextThickness() );
switch( m_cell->GetVertJustify() )
{
case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
}
m_bold->Set3StateValue( cell->IsBold() ? wxCHK_CHECKED : wxCHK_UNCHECKED );
m_italic->Set3StateValue( cell->IsItalic() ? wxCHK_CHECKED : wxCHK_UNCHECKED );
m_marginLeft.SetValue( m_cell->GetMarginLeft() );
m_marginTop.SetValue( m_cell->GetMarginTop() );
m_marginRight.SetValue( m_cell->GetMarginRight() );
m_marginBottom.SetValue( m_cell->GetMarginBottom() );
hAlign = cell->GetHorizJustify();
vAlign = cell->GetVertJustify();
m_marginLeft.SetValue( cell->GetMarginLeft() );
m_marginTop.SetValue( cell->GetMarginTop() );
m_marginRight.SetValue( cell->GetMarginRight() );
m_marginBottom.SetValue( cell->GetMarginBottom() );
firstCell = false;
}
else
{
if( cell->GetFont() != m_fontCtrl->GetFontSelection( cell->IsBold(), cell->IsItalic() ) )
m_fontCtrl->SetSelection( -1 );
if( cell->GetTextWidth() != m_textWidth.GetValue() )
m_textWidth.SetValue( INDETERMINATE_STATE );
if( cell->GetTextHeight() != m_textHeight.GetValue() )
m_textHeight.SetValue( INDETERMINATE_STATE );
if( cell->GetTextThickness() != m_textThickness.GetValue() )
m_textThickness.SetValue( INDETERMINATE_STATE );
wxCheckBoxState bold = cell->IsBold() ? wxCHK_CHECKED : wxCHK_UNCHECKED;
if( bold != m_bold->Get3StateValue() )
m_bold->Set3StateValue( wxCHK_UNDETERMINED );
wxCheckBoxState italic = cell->IsItalic() ? wxCHK_CHECKED : wxCHK_UNCHECKED;
if( italic != m_italic->Get3StateValue() )
m_italic->Set3StateValue( wxCHK_UNDETERMINED );
if( cell->GetHorizJustify() != hAlign )
hAlign = GR_TEXT_H_ALIGN_INDETERMINATE;
if( cell->GetVertJustify() != vAlign )
vAlign = GR_TEXT_V_ALIGN_INDETERMINATE;
if( cell->GetMarginLeft() != m_marginLeft.GetIntValue() )
m_marginLeft.SetValue( INDETERMINATE_STATE );
if( cell->GetMarginTop() != m_marginTop.GetIntValue() )
m_marginTop.SetValue( INDETERMINATE_STATE );
if( cell->GetMarginRight() != m_marginRight.GetIntValue() )
m_marginRight.SetValue( INDETERMINATE_STATE );
if( cell->GetMarginBottom() != m_marginBottom.GetIntValue() )
m_marginBottom.SetValue( INDETERMINATE_STATE );
}
switch( hAlign )
{
case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break;
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
switch( vAlign )
{
case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
case GR_TEXT_V_ALIGN_INDETERMINATE: break;
}
}
return true;
}
@ -287,73 +202,6 @@ void DIALOG_TABLECELL_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
}
void DIALOG_TABLECELL_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
{
BOARD_DESIGN_SETTINGS& bds = m_frame->GetDesignSettings();
PCB_LAYER_ID currentLayer = ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() );
int defaultLineThickness = bds.GetLineThickness( currentLayer );
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( defaultLineThickness );
m_borderWidth.Enable( border );
m_borderStyleLabel->Enable( border );
m_borderStyleCombo->Enable( border );
bool row = m_rowSeparators->GetValue();
bool col = m_colSeparators->GetValue();
if( ( row || col ) && m_separatorsWidth.GetValue() < 0 )
m_separatorsWidth.SetValue( defaultLineThickness );
m_separatorsWidth.Enable( row || col );
m_separatorsStyleLabel->Enable( row || col );
m_separatorsStyleCombo->Enable( row || col );
}
void DIALOG_TABLECELL_PROPERTIES::OnCharHook( wxKeyEvent& aEvt )
{
if( aEvt.GetKeyCode() == WXK_TAB && aEvt.AltDown() && !aEvt.ControlDown() )
{
wxCommandEvent dummy;
OnApply( dummy );
}
else
{
DIALOG_SHIM::OnCharHook( aEvt );
}
}
void DIALOG_TABLECELL_PROPERTIES::OnApply( wxCommandEvent& aEvent )
{
TransferDataFromWindow();
for( size_t ii = 0; ii < m_table->GetCells().size(); ++ii )
{
if( m_table->GetCells()[ii] == m_cell )
{
ii++;
if( ii >= m_table->GetCells().size() )
ii = 0;
m_cell = m_table->GetCells()[ii];
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
m_frame->GetToolManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, m_cell );
break;
}
}
TransferDataToWindow();
m_textCtrl->SelectAll();
}
bool DIALOG_TABLECELL_PROPERTIES::TransferDataFromWindow()
{
if( !wxDialog::TransferDataFromWindow() )
@ -371,121 +219,70 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataFromWindow()
if( !pushCommit )
m_table->SetFlags( IN_EDIT );
m_table->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
m_table->SetLocked( m_cbLocked->GetValue() );
m_table->SetStrokeExternal( m_borderCheckbox->GetValue() );
m_table->SetStrokeHeader( m_headerBorder->GetValue() );
for( PCB_TABLECELL* cell : m_cells )
{
STROKE_PARAMS stroke = m_table->GetBorderStroke();
if( m_bold->Get3StateValue() == wxCHK_CHECKED )
cell->SetBold( true );
else if( m_bold->Get3StateValue() == wxCHK_UNCHECKED )
cell->SetBold( false );
if( m_borderCheckbox->GetValue() )
stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
else
stroke.SetWidth( -1 );
if( m_italic->Get3StateValue() == wxCHK_CHECKED )
cell->SetItalic( true );
else if( m_italic->Get3StateValue() == wxCHK_UNCHECKED )
cell->SetItalic( false );
auto it = lineTypeNames.begin();
std::advance( it, m_borderStyleCombo->GetSelection() );
if( m_fontCtrl->HaveFontSelection() )
cell->SetFont( m_fontCtrl->GetFontSelection( cell->IsBold(), cell->IsItalic() ) );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
if( !m_textWidth.IsIndeterminate() )
cell->SetTextWidth( m_textWidth.GetIntValue() );
m_table->SetBorderStroke( stroke );
if( !m_textHeight.IsIndeterminate() )
cell->SetTextHeight( m_textHeight.GetIntValue() );
if( !m_textThickness.IsIndeterminate() )
cell->SetTextThickness( m_textThickness.GetIntValue() );
if( m_hAlignLeft->IsChecked() )
cell->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
else if( m_hAlignRight->IsChecked() )
cell->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else if( m_hAlignCenter->IsChecked() )
cell->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
if( m_vAlignTop->IsChecked() )
cell->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
else if( m_vAlignBottom->IsChecked() )
cell->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
else if( m_vAlignCenter->IsChecked() )
cell->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
if( !m_marginLeft.IsIndeterminate() )
cell->SetMarginLeft( m_marginLeft.GetIntValue() );
if( !m_marginTop.IsIndeterminate() )
cell->SetMarginTop( m_marginTop.GetIntValue() );
if( !m_marginRight.IsIndeterminate() )
cell->SetMarginRight( m_marginRight.GetIntValue() );
if( !m_marginBottom.IsIndeterminate() )
cell->SetMarginBottom( m_marginBottom.GetIntValue() );
}
m_table->SetStrokeRows( m_rowSeparators->GetValue() );
m_table->SetStrokeColumns( m_colSeparators->GetValue() );
{
STROKE_PARAMS stroke = m_table->GetSeparatorsStroke();
if( m_rowSeparators->GetValue() || m_colSeparators->GetValue() )
stroke.SetWidth( std::max( 0, m_separatorsWidth.GetIntValue() ) );
else
stroke.SetWidth( -1 );
auto it = lineTypeNames.begin();
std::advance( it, m_separatorsStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
m_table->SetSeparatorsStroke( stroke );
}
wxString txt = m_textCtrl->GetValue();
#ifdef __WXMAC__
// On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting.
// Replace it now.
txt.Replace( "\r", "\n" );
#elif defined( __WINDOWS__ )
// On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
// drawing routines so strip the \r char.
txt.Replace( "\r", "" );
#endif
m_cell->SetText( txt );
if( m_fontCtrl->HaveFontSelection() )
{
m_cell->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(),
m_italic->IsChecked() ) );
}
m_cell->SetTextWidth( m_textWidth.GetIntValue() );
m_cell->SetTextHeight( m_textHeight.GetIntValue() );
m_cell->SetTextThickness( m_textThickness.GetIntValue() );
if( m_bold->IsChecked() != m_cell->IsBold() )
{
if( m_bold->IsChecked() )
{
m_cell->SetBold( true );
m_cell->SetTextThickness( GetPenSizeForBold( m_cell->GetTextWidth() ) );
}
else
{
m_cell->SetBold( false );
m_cell->SetTextThickness( 0 ); // Use default pen width
}
}
if( m_hAlignRight->IsChecked() )
m_cell->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else if( m_hAlignCenter->IsChecked() )
m_cell->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
else
m_cell->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
if( m_vAlignBottom->IsChecked() )
m_cell->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
else if( m_vAlignCenter->IsChecked() )
m_cell->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
else
m_cell->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
m_cell->SetMarginLeft( m_marginLeft.GetIntValue() );
m_cell->SetMarginTop( m_marginTop.GetIntValue() );
m_cell->SetMarginRight( m_marginRight.GetIntValue() );
m_cell->SetMarginBottom( m_marginBottom.GetIntValue() );
if( !commit.Empty() )
commit.Push( _( "Edit Table Cell" ), SKIP_CONNECTIVITY );
commit.Push( _( "Edit Table Cell Properties" ), SKIP_CONNECTIVITY );
m_returnValue = TABLECELL_PROPS_OK;
return true;
}
void PCB_BASE_EDIT_FRAME::ShowTableCellPropertiesDialog( PCB_TABLECELL* aTableCell )
void DIALOG_TABLECELL_PROPERTIES::onEditTable( wxCommandEvent& aEvent )
{
DIALOG_TABLECELL_PROPERTIES dlg( this, aTableCell );
// QuasiModal required for Scintilla auto-complete
dlg.ShowQuasiModal();
}
if( TransferDataFromWindow() )
{
m_returnValue = TABLECELL_PROPS_EDIT_TABLE;
Close();
}
}

View File

@ -33,43 +33,48 @@
class PCB_BASE_EDIT_FRAME;
class PCB_TABLE;
class PCB_TABLECELL;
class SCINTILLA_TRICKS;
class DIALOG_TABLECELL_PROPERTIES : public DIALOG_TABLECELL_PROPERTIES_BASE
{
public:
DIALOG_TABLECELL_PROPERTIES( PCB_BASE_EDIT_FRAME* aParentFrame, PCB_TABLECELL* aCell );
~DIALOG_TABLECELL_PROPERTIES();
// The dialog can be closed for several reasons.
enum TABLECELL_PROPS_RETVALUE
{
TABLECELL_PROPS_CANCEL,
TABLECELL_PROPS_OK,
TABLECELL_PROPS_EDIT_TABLE
};
protected:
void OnCharHook( wxKeyEvent& aEvt ) override;
DIALOG_TABLECELL_PROPERTIES( PCB_BASE_EDIT_FRAME* aParentFrame,
std::vector<PCB_TABLECELL*> aCells );
///< @return the value depending on the way the dialog was closed.
enum TABLECELL_PROPS_RETVALUE GetReturnValue() { return m_returnValue; }
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void onHAlignButton( wxCommandEvent &aEvent );
void onVAlignButton( wxCommandEvent &aEvent );
void onBorderChecked( wxCommandEvent& aEvent ) override;
void OnApply( wxCommandEvent& aEvent ) override;
void onHAlignButton( wxCommandEvent& aEvent );
void onVAlignButton( wxCommandEvent& aEvent );
void onEditTable( wxCommandEvent& aEvent ) override;
private:
PCB_BASE_EDIT_FRAME* m_frame;
PCB_TABLE* m_table;
PCB_TABLECELL* m_cell;
PCB_BASE_EDIT_FRAME* m_frame;
PCB_TABLE* m_table;
std::vector<PCB_TABLECELL*> m_cells;
UNIT_BINDER m_borderWidth;
UNIT_BINDER m_separatorsWidth;
UNIT_BINDER m_textHeight;
UNIT_BINDER m_textWidth;
UNIT_BINDER m_textThickness;
UNIT_BINDER m_marginLeft;
UNIT_BINDER m_marginTop;
UNIT_BINDER m_marginRight;
UNIT_BINDER m_marginBottom;
UNIT_BINDER m_textHeight;
UNIT_BINDER m_textWidth;
UNIT_BINDER m_textThickness;
UNIT_BINDER m_marginLeft;
UNIT_BINDER m_marginTop;
UNIT_BINDER m_marginRight;
UNIT_BINDER m_marginBottom;
SCINTILLA_TRICKS* m_scintillaTricks;
enum TABLECELL_PROPS_RETVALUE m_returnValue; // the option that closed the dialog
};

View File

@ -5,7 +5,6 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "pcb_layer_box_selector.h"
#include "widgets/bitmap_button.h"
#include "widgets/font_choice.h"
#include "widgets/wx_infobar.h"
@ -28,369 +27,213 @@ DIALOG_TABLECELL_PROPERTIES_BASE::DIALOG_TABLECELL_PROPERTIES_BASE( wxWindow* pa
bMainSizer->Add( m_infoBar, 0, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bColumns;
bColumns = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bCellContentMargins;
bCellContentMargins = new wxBoxSizer( wxVERTICAL );
m_textCtrl = new wxStyledTextCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN, wxEmptyString );
m_textCtrl->SetUseTabs( true );
m_textCtrl->SetTabWidth( 4 );
m_textCtrl->SetIndent( 4 );
m_textCtrl->SetTabIndents( false );
m_textCtrl->SetBackSpaceUnIndents( false );
m_textCtrl->SetViewEOL( false );
m_textCtrl->SetViewWhiteSpace( false );
m_textCtrl->SetMarginWidth( 2, 0 );
m_textCtrl->SetIndentationGuides( false );
m_textCtrl->SetReadOnly( false );
m_textCtrl->SetMarginWidth( 1, 0 );
m_textCtrl->SetMarginWidth( 0, 0 );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY );
m_textCtrl->SetSelBackground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
m_textCtrl->SetSelForeground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
m_textCtrl->SetMinSize( wxSize( 500,-1 ) );
bCellContentMargins->Add( m_textCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM, 1 );
bColumns->Add( bCellContentMargins, 1, wxEXPAND|wxTOP, 6 );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_tablePage = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer16;
bSizer16 = new wxBoxSizer( wxVERTICAL );
m_textEntrySizer = new wxGridBagSizer( 3, 3 );
m_textEntrySizer->SetFlexibleDirection( wxBOTH );
m_textEntrySizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_textEntrySizer->SetEmptyCellSize( wxSize( 0,2 ) );
m_layerLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_layerLabel->Wrap( -1 );
m_textEntrySizer->Add( m_layerLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( m_tablePage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_LayerSelectionCtrl->SetMinSize( wxSize( 175,-1 ) );
m_textEntrySizer->Add( m_LayerSelectionCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_cbLocked = new wxCheckBox( m_tablePage, wxID_ANY, _("Locked"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_cbLocked, wxGBPosition( 1, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM, 20 );
m_borderCheckbox = new wxCheckBox( m_tablePage, wxID_ANY, _("External border"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 );
m_headerBorder = new wxCheckBox( m_tablePage, wxID_ANY, _("Header border"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_headerBorder, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxLEFT, 20 );
m_borderWidthLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
m_borderWidthCtrl = new wxTextCtrl( m_tablePage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer7->Add( m_borderWidthCtrl, 0, wxEXPAND, 5 );
m_borderWidthUnits = new wxStaticText( m_tablePage, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthUnits->Wrap( -1 );
bSizer7->Add( m_borderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_textEntrySizer->Add( bSizer7, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderStyleLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_borderStyleCombo = new wxBitmapComboBox( m_tablePage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_borderStyleCombo->SetMinSize( wxSize( 200,-1 ) );
m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 5, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_textEntrySizer->Add( 0, 15, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_rowSeparators = new wxCheckBox( m_tablePage, wxID_ANY, _("Row lines"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_rowSeparators, wxGBPosition( 7, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 15 );
m_colSeparators = new wxCheckBox( m_tablePage, wxID_ANY, _("Column lines"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_colSeparators, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 20 );
m_separatorsWidthLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsWidthLabel->Wrap( -1 );
m_textEntrySizer->Add( m_separatorsWidthLabel, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer71;
bSizer71 = new wxBoxSizer( wxHORIZONTAL );
m_separatorsWidthCtrl = new wxTextCtrl( m_tablePage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer71->Add( m_separatorsWidthCtrl, 0, wxEXPAND, 5 );
m_separatorsWidthUnits = new wxStaticText( m_tablePage, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsWidthUnits->Wrap( -1 );
bSizer71->Add( m_separatorsWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_textEntrySizer->Add( bSizer71, wxGBPosition( 9, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_separatorsStyleLabel = new wxStaticText( m_tablePage, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_separatorsStyleLabel->Wrap( -1 );
m_textEntrySizer->Add( m_separatorsStyleLabel, wxGBPosition( 10, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_separatorsStyleCombo = new wxBitmapComboBox( m_tablePage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_separatorsStyleCombo->SetMinSize( wxSize( 200,-1 ) );
m_textEntrySizer->Add( m_separatorsStyleCombo, wxGBPosition( 10, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_textEntrySizer->AddGrowableCol( 1 );
bSizer16->Add( m_textEntrySizer, 1, wxEXPAND|wxALL, 5 );
m_tablePage->SetSizer( bSizer16 );
m_tablePage->Layout();
bSizer16->Fit( m_tablePage );
m_notebook->AddPage( m_tablePage, _("Table"), false );
m_cellPage = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bMargins;
bMargins = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizeCtrlSizer;
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* fgTextStyleSizer;
fgTextStyleSizer = new wxFlexGridSizer( 0, 2, 5, 5 );
fgTextStyleSizer->SetFlexibleDirection( wxBOTH );
fgTextStyleSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_separator1 = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator1->Enable( false );
wxStaticText* hAlignLabel;
hAlignLabel = new wxStaticText( this, wxID_ANY, _("Horizontal alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
hAlignLabel->Wrap( -1 );
hAlignLabel->SetToolTip( _("Horizontal alignment") );
bSizeCtrlSizer->Add( m_separator1, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgTextStyleSizer->Add( hAlignLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_bold = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_bold->SetToolTip( _("Bold") );
wxBoxSizer* hAlignButtons;
hAlignButtons = new wxBoxSizer( wxHORIZONTAL );
bSizeCtrlSizer->Add( m_bold, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_italic = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_italic->SetToolTip( _("Italic") );
bSizeCtrlSizer->Add( m_italic, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator2 = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator2->Enable( false );
bSizeCtrlSizer->Add( m_separator2, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hAlignLeft = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignLeft = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignLeft->SetToolTip( _("Align left") );
bSizeCtrlSizer->Add( m_hAlignLeft, 0, wxALIGN_CENTER_VERTICAL, 5 );
hAlignButtons->Add( m_hAlignLeft, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hAlignCenter = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignCenter->SetToolTip( _("Align horizontal center") );
bSizeCtrlSizer->Add( m_hAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
hAlignButtons->Add( m_hAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hAlignRight = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignRight = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignRight->SetToolTip( _("Align right") );
bSizeCtrlSizer->Add( m_hAlignRight, 0, wxALIGN_CENTER_VERTICAL, 5 );
hAlignButtons->Add( m_hAlignRight, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator3 = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator3->Enable( false );
bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgTextStyleSizer->Add( hAlignButtons, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_vAlignTop = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
vAlignLabel = new wxStaticText( this, wxID_ANY, _("Vertical alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
vAlignLabel->Wrap( -1 );
vAlignLabel->SetToolTip( _("Vertical alignment") );
fgTextStyleSizer->Add( vAlignLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* vAlignButtons;
vAlignButtons = new wxBoxSizer( wxHORIZONTAL );
m_vAlignTop = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignTop->SetToolTip( _("Align top") );
bSizeCtrlSizer->Add( m_vAlignTop, 0, wxALIGN_CENTER_VERTICAL, 5 );
vAlignButtons->Add( m_vAlignTop, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_vAlignCenter = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignCenter->SetToolTip( _("Align vertical center") );
bSizeCtrlSizer->Add( m_vAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
vAlignButtons->Add( m_vAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_vAlignBottom = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignBottom = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignBottom->SetToolTip( _("Align bottom") );
bSizeCtrlSizer->Add( m_vAlignBottom, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator4 = new BITMAP_BUTTON( m_cellPage, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator4->Enable( false );
bSizeCtrlSizer->Add( m_separator4, 0, wxALIGN_CENTER_VERTICAL, 5 );
vAlignButtons->Add( m_vAlignBottom, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMargins->Add( bSizeCtrlSizer, 0, wxBOTTOM, 5 );
fgTextStyleSizer->Add( vAlignButtons, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
wxGridBagSizer* gbSizer2;
gbSizer2 = new wxGridBagSizer( 4, 5 );
gbSizer2->SetFlexibleDirection( wxBOTH );
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer2->SetEmptyCellSize( wxSize( -1,5 ) );
m_fontLabel = new wxStaticText( m_cellPage, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
bMargins->Add( fgTextStyleSizer, 0, wxEXPAND, 5 );
bMargins->Add( 0, 20, 0, wxEXPAND, 5 );
wxGridBagSizer* gbFontSizer;
gbFontSizer = new wxGridBagSizer( 7, 5 );
gbFontSizer->SetFlexibleDirection( wxBOTH );
gbFontSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbFontSizer->SetEmptyCellSize( wxSize( -1,5 ) );
m_fontLabel = new wxStaticText( this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fontLabel->Wrap( -1 );
gbSizer2->Add( m_fontLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 1 );
gbFontSizer->Add( m_fontLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 1 );
wxString m_fontCtrlChoices[] = { _("Default Font"), _("KiCad Font") };
int m_fontCtrlNChoices = sizeof( m_fontCtrlChoices ) / sizeof( wxString );
m_fontCtrl = new FONT_CHOICE( m_cellPage, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 );
m_fontCtrl = new FONT_CHOICE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 );
m_fontCtrl->SetSelection( 0 );
gbSizer2->Add( m_fontCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
gbFontSizer->Add( m_fontCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_styleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_styleLabel->Wrap( -1 );
gbFontSizer->Add( m_styleLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer14;
bSizer14 = new wxBoxSizer( wxHORIZONTAL );
m_bold = new wxCheckBox( this, wxID_ANY, _("Bold"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
bSizer14->Add( m_bold, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_italic = new wxCheckBox( this, wxID_ANY, _("Italic"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
bSizer14->Add( m_italic, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 45 );
gbSizer2->AddGrowableCol( 1 );
gbFontSizer->Add( bSizer14, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
bMargins->Add( gbSizer2, 0, wxEXPAND, 5 );
gbFontSizer->AddGrowableCol( 1 );
bMargins->Add( gbFontSizer, 0, wxEXPAND|wxBOTTOM, 1 );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 3, 5 );
gbSizer1 = new wxGridBagSizer( 4, 5 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer1->SetEmptyCellSize( wxSize( -1,8 ) );
m_SizeXLabel = new wxStaticText( m_cellPage, wxID_ANY, _("Text width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXLabel = new wxStaticText( this, wxID_ANY, _("Text width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXLabel->Wrap( -1 );
m_SizeXLabel->SetToolTip( _("Text width") );
gbSizer1->Add( m_SizeXLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 4 );
m_SizeXCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_SizeXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
gbSizer1->Add( m_SizeXCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_SizeXUnits = new wxStaticText( m_cellPage, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXUnits->Wrap( -1 );
gbSizer1->Add( m_SizeXUnits, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_SizeYLabel = new wxStaticText( m_cellPage, wxID_ANY, _("Text height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYLabel = new wxStaticText( this, wxID_ANY, _("Text height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYLabel->Wrap( -1 );
m_SizeYLabel->SetToolTip( _("Text height") );
gbSizer1->Add( m_SizeYLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 4 );
m_SizeYCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_SizeYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
gbSizer1->Add( m_SizeYCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_SizeYUnits = new wxStaticText( m_cellPage, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYUnits->Wrap( -1 );
gbSizer1->Add( m_SizeYUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_ThicknessLabel = new wxStaticText( m_cellPage, wxID_ANY, _("Thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessLabel = new wxStaticText( this, wxID_ANY, _("Thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessLabel->Wrap( -1 );
m_ThicknessLabel->SetToolTip( _("Text thickness") );
gbSizer1->Add( m_ThicknessLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 4 );
m_ThicknessCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_ThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
gbSizer1->Add( m_ThicknessCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_ThicknessUnits = new wxStaticText( m_cellPage, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessUnits->Wrap( -1 );
gbSizer1->Add( m_ThicknessUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
bMargins->Add( gbSizer1, 1, wxEXPAND|wxTOP, 5 );
bMargins->Add( gbSizer1, 0, wxEXPAND|wxTOP, 5 );
wxGridBagSizer* gbSizer3;
gbSizer3 = new wxGridBagSizer( 1, 0 );
gbSizer3->SetFlexibleDirection( wxBOTH );
gbSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_marginsLable = new wxStaticText( m_cellPage, wxID_ANY, _("Margins:"), wxDefaultPosition, wxDefaultSize, 0 );
m_marginsLable->Wrap( -1 );
gbSizer3->Add( m_marginsLable, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 35 );
bMargins->Add( 0, 20, 0, wxEXPAND, 5 );
wxBoxSizer* marginTopSizer;
marginTopSizer = new wxBoxSizer( wxHORIZONTAL );
wxGridSizer* gMarginsSizer;
gMarginsSizer = new wxGridSizer( 0, 3, 4, 2 );
m_marginTopCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
marginTopSizer->Add( m_marginTopCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxStaticText* marginsLabel;
marginsLabel = new wxStaticText( this, wxID_ANY, _("Cell margins:"), wxDefaultPosition, wxDefaultSize, 0 );
marginsLabel->Wrap( -1 );
gMarginsSizer->Add( marginsLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_marginTopUnits = new wxStaticText( m_cellPage, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_marginTopCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gMarginsSizer->Add( m_marginTopCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_marginTopUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_marginTopUnits->Wrap( -1 );
marginTopSizer->Add( m_marginTopUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
gMarginsSizer->Add( m_marginTopUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 2 );
m_marginLeftCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gMarginsSizer->Add( m_marginLeftCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer3->Add( marginTopSizer, wxGBPosition( 0, 2 ), wxGBSpan( 1, 4 ), wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
gMarginsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
wxBoxSizer* marginLeftSizer;
marginLeftSizer = new wxBoxSizer( wxHORIZONTAL );
m_marginLeftCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
marginLeftSizer->Add( m_marginLeftCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_marginRightCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gMarginsSizer->Add( m_marginRightCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer3->Add( marginLeftSizer, wxGBPosition( 1, 0 ), wxGBSpan( 1, 3 ), wxEXPAND|wxRIGHT|wxLEFT, 25 );
gMarginsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
wxBoxSizer* marginRightSizer;
marginRightSizer = new wxBoxSizer( wxHORIZONTAL );
m_marginRightCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
marginRightSizer->Add( m_marginRightCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_marginBottomCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gMarginsSizer->Add( m_marginBottomCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
gbSizer3->Add( marginRightSizer, wxGBPosition( 1, 3 ), wxGBSpan( 1, 3 ), wxEXPAND, 5 );
wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxHORIZONTAL );
m_marginBottomCtrl = new wxTextCtrl( m_cellPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer19->Add( m_marginBottomCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMargins->Add( gMarginsSizer, 0, wxEXPAND, 5 );
gbSizer3->Add( bSizer19, wxGBPosition( 2, 2 ), wxGBSpan( 1, 4 ), wxEXPAND, 5 );
bMainSizer->Add( bMargins, 1, wxEXPAND|wxALL, 10 );
bMargins->Add( gbSizer3, 1, wxEXPAND, 5 );
bSizer13->Add( bMargins, 1, wxEXPAND|wxALL, 5 );
m_cellPage->SetSizer( bSizer13 );
m_cellPage->Layout();
bSizer13->Fit( m_cellPage );
m_notebook->AddPage( m_cellPage, _("Cell"), true );
bColumns->Add( m_notebook, 0, wxEXPAND|wxBOTTOM|wxLEFT, 10 );
bMainSizer->Add( bColumns, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bButtons;
bButtons = new wxBoxSizer( wxHORIZONTAL );
m_editTable = new wxButton( this, wxID_ANY, _("Edit Table..."), wxDefaultPosition, wxDefaultSize, 0 );
m_editTable->SetToolTip( _("Edit table properties and cell contents") );
bButtons->Add( m_editTable, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
bButtons->Add( 0, 0, 1, wxEXPAND, 5 );
m_applyButton = new wxButton( this, wxID_ANY, _("Apply && Go to Next Cell"), wxDefaultPosition, wxDefaultSize, 0 );
bButtons->Add( m_applyButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_hotkeyHint = new wxStaticText( this, wxID_ANY, _("(Option+Tab)"), wxDefaultPosition, wxDefaultSize, 0 );
m_hotkeyHint->Wrap( -1 );
bButtons->Add( m_hotkeyHint, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 10 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
@ -409,26 +252,18 @@ DIALOG_TABLECELL_PROPERTIES_BASE::DIALOG_TABLECELL_PROPERTIES_BASE( wxWindow* pa
bMainSizer->Fit( this );
// Connect Events
m_textCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_borderCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_rowSeparators->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_colSeparators->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_SizeXCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_SizeYCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_ThicknessCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onThickness ), NULL, this );
m_applyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnApply ), NULL, this );
m_editTable->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onEditTable ), NULL, this );
}
DIALOG_TABLECELL_PROPERTIES_BASE::~DIALOG_TABLECELL_PROPERTIES_BASE()
{
// Disconnect Events
m_textCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_borderCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_rowSeparators->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_colSeparators->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_SizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_SizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnOkClick ), NULL, this );
m_ThicknessCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onThickness ), NULL, this );
m_applyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::OnApply ), NULL, this );
m_editTable->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TABLECELL_PROPERTIES_BASE::onEditTable ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@
#include <wx/intl.h>
class BITMAP_BUTTON;
class FONT_CHOICE;
class PCB_LAYER_BOX_SELECTOR;
class WX_INFOBAR;
#include "dialog_shim.h"
@ -22,21 +21,18 @@ class WX_INFOBAR;
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/stc/stc.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/bmpcbox.h>
#include <wx/checkbox.h>
#include <wx/textctrl.h>
#include <wx/gbsizer.h>
#include <wx/panel.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/choice.h>
#include <wx/notebook.h>
#include <wx/checkbox.h>
#include <wx/gbsizer.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -50,42 +46,18 @@ class DIALOG_TABLECELL_PROPERTIES_BASE : public DIALOG_SHIM
protected:
WX_INFOBAR* m_infoBar;
wxStyledTextCtrl* m_textCtrl;
wxNotebook* m_notebook;
wxPanel* m_tablePage;
wxGridBagSizer* m_textEntrySizer;
wxStaticText* m_layerLabel;
PCB_LAYER_BOX_SELECTOR* m_LayerSelectionCtrl;
wxCheckBox* m_cbLocked;
wxCheckBox* m_borderCheckbox;
wxCheckBox* m_headerBorder;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
wxStaticText* m_borderWidthUnits;
wxStaticText* m_borderStyleLabel;
wxBitmapComboBox* m_borderStyleCombo;
wxCheckBox* m_rowSeparators;
wxCheckBox* m_colSeparators;
wxStaticText* m_separatorsWidthLabel;
wxTextCtrl* m_separatorsWidthCtrl;
wxStaticText* m_separatorsWidthUnits;
wxStaticText* m_separatorsStyleLabel;
wxBitmapComboBox* m_separatorsStyleCombo;
wxPanel* m_cellPage;
BITMAP_BUTTON* m_separator1;
BITMAP_BUTTON* m_bold;
BITMAP_BUTTON* m_italic;
BITMAP_BUTTON* m_separator2;
BITMAP_BUTTON* m_hAlignLeft;
BITMAP_BUTTON* m_hAlignCenter;
BITMAP_BUTTON* m_hAlignRight;
BITMAP_BUTTON* m_separator3;
wxStaticText* vAlignLabel;
BITMAP_BUTTON* m_vAlignTop;
BITMAP_BUTTON* m_vAlignCenter;
BITMAP_BUTTON* m_vAlignBottom;
BITMAP_BUTTON* m_separator4;
wxStaticText* m_fontLabel;
FONT_CHOICE* m_fontCtrl;
wxStaticText* m_styleLabel;
wxCheckBox* m_bold;
wxCheckBox* m_italic;
wxStaticText* m_SizeXLabel;
wxTextCtrl* m_SizeXCtrl;
wxStaticText* m_SizeXUnits;
@ -95,24 +67,21 @@ class DIALOG_TABLECELL_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_ThicknessLabel;
wxTextCtrl* m_ThicknessCtrl;
wxStaticText* m_ThicknessUnits;
wxStaticText* m_marginsLable;
wxTextCtrl* m_marginTopCtrl;
wxStaticText* m_marginTopUnits;
wxTextCtrl* m_marginLeftCtrl;
wxTextCtrl* m_marginRightCtrl;
wxTextCtrl* m_marginBottomCtrl;
wxButton* m_applyButton;
wxStaticText* m_hotkeyHint;
wxStaticLine* m_staticline1;
wxButton* m_editTable;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, override them in your derived class
virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onThickness( wxCommandEvent& event ) { event.Skip(); }
virtual void OnApply( wxCommandEvent& event ) { event.Skip(); }
virtual void onEditTable( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -106,7 +106,7 @@ bool DIALOG_TARGET_PROPERTIES::TransferDataFromWindow()
m_Target->SetShape( m_TargetShape->GetSelection() ? 1 : 0 );
if( pushCommit )
commit.Push( _( "Modified alignment target" ) );
commit.Push( _( "Edit Alignment Target" ) );
return true;
}

View File

@ -340,16 +340,18 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
switch ( m_item->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
switch ( m_item->GetVertJustify() )
{
case GR_TEXT_V_ALIGN_BOTTOM: m_valignBottom->Check( true ); break;
case GR_TEXT_V_ALIGN_CENTER: m_valignCenter->Check( true ); break;
case GR_TEXT_V_ALIGN_TOP: m_valignTop->Check( true ); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_valignBottom->Check( true ); break;
case GR_TEXT_V_ALIGN_CENTER: m_valignCenter->Check( true ); break;
case GR_TEXT_V_ALIGN_TOP: m_valignTop->Check( true ); break;
case GR_TEXT_V_ALIGN_INDETERMINATE: break;
}
m_mirrored->Check( m_item->IsMirrored() );
@ -528,7 +530,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
m_item->SetMirrored( m_mirrored->IsChecked() );
if( pushCommit )
commit.Push( _( "Change text properties" ) );
commit.Push( _( "Edit Text Properties" ) );
return true;
}

View File

@ -185,9 +185,10 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow()
switch ( m_textBox->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
m_mirrored->Check( m_textBox->IsMirrored() );
@ -377,7 +378,7 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow()
m_textBox->ClearRenderCache();
if( pushCommit )
commit.Push( _( "Change text box properties" ) );
commit.Push( _( "Edit Text Box Properties" ) );
return true;
}

View File

@ -796,7 +796,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
}
}
commit.Push( _( "Edit track/via properties" ) );
commit.Push( _( "Edit Track/Via Properties" ) );
// Pushing the commit will have updated the connectivity so we can now test to see if we
// need to update any pad nets.
@ -861,7 +861,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
pad->SetNetCode( newNetCode );
}
commit.Push( _( "Updating nets" ) );
commit.Push( _( "Update Nets" ) );
}
return true;

View File

@ -4,7 +4,7 @@
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -38,7 +38,7 @@
#include <pcb_target.h>
#include <pcb_dimension.h>
#include <pcb_textbox.h>
#include <pcb_tablecell.h>
#include <pcb_table.h>
#include <pcb_shape.h>
#include <dialog_drc.h>
#include <connectivity/connectivity_data.h>
@ -137,10 +137,6 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
break;
case PCB_TABLECELL_T:
ShowTableCellPropertiesDialog( static_cast<PCB_TABLECELL*>( aItem ) );
break;
case PCB_PAD_T:
ShowPadPropertiesDialog( static_cast<PAD*>( aItem ) );
break;

View File

@ -81,8 +81,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone )
m_pcb->GetDesignSettings().SetDefaultZoneSettings( zoneInfo );
// TODO: 9.0: Use title capitalization
commit.Push( _( "Modify zone properties" ), SKIP_CONNECTIVITY );
commit.Push( _( "Edit Zone Properties" ), SKIP_CONNECTIVITY );
rebuildConnectivity();
}

View File

@ -313,7 +313,7 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR
BOARD_COMMIT commit( this );
commit.Add( inductorFP.release() );
commit.Push( _("Add microwave inductor" ) );
commit.Push( _("Add Microwave Inductor" ) );
}
}

View File

@ -1320,7 +1320,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
// * it creates crashes when calculating dynamic ratsnests if auto refill is enabled.
// (the auto refills rebuild the connectivity with incomplete data)
// * it is useless because zones will be refilled after placing new footprints
m_commit.Push( _( "Update netlist" ), m_newFootprintsCount ? ZONE_FILL_OP : 0 );
m_commit.Push( _( "Update Netlist" ), m_newFootprintsCount ? ZONE_FILL_OP : 0 );
m_board->SynchronizeNetsAndNetClasses( true );

View File

@ -33,7 +33,7 @@ class APPEARANCE_CONTROLS;
class BOARD_ITEM_CONTAINER;
class PANEL_SELECTION_FILTER;
class PCB_TEXTBOX;
class PCB_TABLECELL;
class PCB_TABLE;
class PCB_TEXT;
class PCB_SHAPE;
@ -179,7 +179,6 @@ public:
void ShowReferenceImagePropertiesDialog( BOARD_ITEM* aBitmap );
void ShowTextPropertiesDialog( PCB_TEXT* aText );
int ShowTextBoxPropertiesDialog( PCB_TEXTBOX* aTextBox );
void ShowTableCellPropertiesDialog( PCB_TABLECELL* aTableCell );
void ShowGraphicItemPropertiesDialog( PCB_SHAPE* aShape );
///< @copydoc EDA_DRAW_FRAME::UseGalCanvas()

View File

@ -2197,7 +2197,7 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
m_gal->SetIsFill( true );
m_gal->SetIsStroke( false );
if( aTextBox->IsBorderEnabled() )
if( aTextBox->Type() != PCB_TABLECELL_T && aTextBox->IsBorderEnabled() )
{
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
{
@ -2367,7 +2367,7 @@ void PCB_PAINTER::draw( const PCB_TABLE* aTable, int aLayer )
{
for( int col = 0; col < aTable->GetColCount(); ++col )
{
PCB_TABLECELL* cell = aTable->GetCell( row, 0 );
PCB_TABLECELL* cell = aTable->GetCell( row, col );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
{

View File

@ -253,9 +253,10 @@ VECTOR2I PCB_TEXTBOX::GetDrawPos() const
{
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: effectiveAlignment = GR_TEXT_H_ALIGN_RIGHT; break;
case GR_TEXT_H_ALIGN_CENTER: effectiveAlignment = GR_TEXT_H_ALIGN_CENTER; break;
case GR_TEXT_H_ALIGN_RIGHT: effectiveAlignment = GR_TEXT_H_ALIGN_LEFT; break;
case GR_TEXT_H_ALIGN_LEFT: effectiveAlignment = GR_TEXT_H_ALIGN_RIGHT; break;
case GR_TEXT_H_ALIGN_CENTER: effectiveAlignment = GR_TEXT_H_ALIGN_CENTER; break;
case GR_TEXT_H_ALIGN_RIGHT: effectiveAlignment = GR_TEXT_H_ALIGN_LEFT; break;
case GR_TEXT_H_ALIGN_INDETERMINATE: wxFAIL_MSG( wxT( "Legal only in dialogs" ) ); break;
}
}
@ -273,6 +274,9 @@ VECTOR2I PCB_TEXTBOX::GetDrawPos() const
textAnchor = corners[1];
offset = VECTOR2I( -GetMarginRight(), GetMarginTop() );
break;
case GR_TEXT_H_ALIGN_INDETERMINATE:
wxFAIL_MSG( wxT( "Indeterminate state legal only in dialogs." ) );
break;
}
RotatePoint( offset, GetDrawRotation() );

View File

@ -409,7 +409,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
}
// Apply changes, UndoList already handled
commit.Push( _( "Apply action script" ), SKIP_UNDO | SKIP_SET_DIRTY );
commit.Push( _( "Apply Action Script" ), SKIP_UNDO | SKIP_SET_DIRTY );
RebuildAndRefresh();
}

View File

@ -57,6 +57,7 @@
#include <tool/tool_event.h>
#include <tools/drawing_tool.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_edit_table_tool.h>
#include <tools/pcb_picker_tool.h>
#include <tools/pcb_selection_conditions.h>
#include <tools/pcb_selection_tool.h>
@ -1158,7 +1159,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
else
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
commit.Push( _( "Place a footprint" ) );
commit.Push( _( "Place a Footprint" ) );
fp = nullptr; // to indicate that there is no footprint that we currently modify
m_placingFootprint = false;
}
@ -1566,7 +1567,14 @@ int BOARD_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent )
const PCB_SELECTION& selection = selTool->RequestSelection( EDIT_TOOL::FootprintFilter );
if( selection.Empty() )
{
// Giant hack: by default we assign Edit Table to the same hotkey, so give the table
// tool a chance to handle it if we can't.
if( PCB_EDIT_TABLE_TOOL* tableTool = m_toolMgr->GetTool<PCB_EDIT_TABLE_TOOL>() )
tableTool->EditTable( aEvent );
return 0;
}
FOOTPRINT* fp = selection.FirstOfKind<FOOTPRINT>();

View File

@ -351,7 +351,7 @@ std::vector<BOARD_ITEM*> DRAWING_TOOL::DrawSpecificationStackup( const VECTOR2I&
for( BOARD_ITEM* item : table )
commit.Add( item );
commit.Push( _( "Insert board stackup table" ) );
commit.Push( _( "Insert Board Stackup Table" ) );
}
return table;

View File

@ -36,6 +36,7 @@
#include <pcb_target.h>
#include <pcb_text.h>
#include <pcb_textbox.h>
#include <pcb_table.h>
#include <pcb_tablecell.h>
#include <pcb_generator.h>
#include <collectors.h>
@ -69,6 +70,8 @@ using namespace std::placeholders;
#include <router/router_tool.h>
#include <dialogs/dialog_move_exact.h>
#include <dialogs/dialog_track_via_properties.h>
#include <dialogs/dialog_tablecell_properties.h>
#include <dialogs/dialog_table_properties.h>
#include <dialogs/dialog_unit_entry.h>
#include <board_commit.h>
#include <zone_filler.h>
@ -943,7 +946,7 @@ int EDIT_TOOL::ChangeTrackWidth( const TOOL_EVENT& aEvent )
}
}
commit.Push( _( "Edit track width/via size" ) );
commit.Push( _( "Edit Track Width/Via Size" ) );
if( selection.IsHover() )
{
@ -1523,7 +1526,7 @@ int EDIT_TOOL::HealShapes( const TOOL_EVENT& aEvent )
items_to_select.push_back( shape );
}
commit.Push( _( "Heal shapes" ) );
commit.Push( _( "Heal Shapes" ) );
// Select added items
for( PCB_SHAPE* item : items_to_select )
@ -1664,6 +1667,25 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
DIALOG_TRACK_VIA_PROPERTIES dlg( editFrame, selection );
dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR
}
else if( ( SELECTION_CONDITIONS::OnlyTypes( { PCB_TABLECELL_T } ) )( selection ) )
{
std::vector<PCB_TABLECELL*> cells;
for( EDA_ITEM* item : selection.Items() )
cells.push_back( static_cast<PCB_TABLECELL*>( item ) );
DIALOG_TABLECELL_PROPERTIES dlg( editFrame, cells );
dlg.ShowModal();
if( dlg.GetReturnValue() == DIALOG_TABLECELL_PROPERTIES::TABLECELL_PROPS_EDIT_TABLE )
{
PCB_TABLE* table = static_cast<PCB_TABLE*>( cells[0]->GetParent() );
DIALOG_TABLE_PROPERTIES tableDlg( frame(), table );
tableDlg.ShowQuasiModal(); // Scintilla's auto-complete requires quasiModal
}
}
else if( selection.Size() == 1 )
{
// Display properties dialog
@ -2493,7 +2515,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
getView()->Update( boardItem );
}
commit.Push( _( "Move exact" ) );
commit.Push( _( "Move Exactly" ) );
if( selection.IsHover() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );

View File

@ -198,7 +198,7 @@ int EDIT_TOOL::PackAndMoveFootprints( const TOOL_EVENT& aEvent )
SpreadFootprints( &footprintsToPack, footprintsBbox.Normalize().GetOrigin(), false );
if( doMoveSelection( aEvent, &commit, true ) )
commit.Push( _( "Pack footprints" ) );
commit.Push( _( "Pack Footprints" ) );
else
commit.Revert();

View File

@ -398,7 +398,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
}
else if( evt->IsActivate() )
{
commit.Push( _( "Renumber pads" ) );
commit.Push( _( "Renumber Pads" ) );
frame()->PopTool( aEvent );
break;
@ -496,7 +496,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
}
else if( evt->IsDblClick( BUT_LEFT ) )
{
commit.Push( _( "Renumber pads" ) );
commit.Push( _( "Renumber Pads" ) );
frame()->PopTool( aEvent );
break;
}

View File

@ -25,6 +25,7 @@
#include <tools/pcb_selection_tool.h>
#include <tools/pcb_actions.h>
#include <collectors.h>
#include <dialogs/dialog_table_properties.h>
#include <tools/pcb_edit_table_tool.h>
@ -78,6 +79,44 @@ void PCB_EDIT_TABLE_TOOL::clearSelection()
};
int PCB_EDIT_TABLE_TOOL::EditTable( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = getTableCellSelection();
bool clearSelection = selection.IsHover();
PCB_TABLE* parentTable = nullptr;
for( EDA_ITEM* item : selection.Items() )
{
if( item->Type() != PCB_TABLECELL_T )
return 0;
PCB_TABLE* table = static_cast<PCB_TABLE*>( item->GetParent() );
if( !parentTable )
{
parentTable = table;
}
else if( parentTable != table )
{
parentTable = nullptr;
break;
}
}
if( parentTable )
{
DIALOG_TABLE_PROPERTIES dlg( frame(), parentTable );
dlg.ShowQuasiModal(); // Scintilla's auto-complete requires quasiModal
}
if( clearSelection )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
return 0;
}
void PCB_EDIT_TABLE_TOOL::setTransitions()
{
Go( &PCB_EDIT_TABLE_TOOL::AddRowAbove, ACTIONS::addRowAbove.MakeEvent() );
@ -91,4 +130,6 @@ void PCB_EDIT_TABLE_TOOL::setTransitions()
Go( &PCB_EDIT_TABLE_TOOL::MergeCells, ACTIONS::mergeCells.MakeEvent() );
Go( &PCB_EDIT_TABLE_TOOL::UnmergeCells, ACTIONS::unmergeCells.MakeEvent() );
Go( &PCB_EDIT_TABLE_TOOL::EditTable, ACTIONS::editTable.MakeEvent() );
}

View File

@ -51,6 +51,8 @@ public:
int MergeCells( const TOOL_EVENT& aEvent ) { return doMergeCells( aEvent ); }
int UnmergeCells( const TOOL_EVENT& aEvent ) { return doUnmergeCells( aEvent ); }
int EditTable( const TOOL_EVENT& aEvent );
private:
///< Set up handlers for various events.
void setTransitions() override;

View File

@ -2938,6 +2938,14 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili
return false;
}
if( aItem->Type() == PCB_TABLECELL_T )
{
const PCB_TABLECELL* cell = static_cast<const PCB_TABLECELL*>( aItem );
if( cell->GetRowSpan() == 0 || cell->GetColSpan() == 0 )
return false;
}
break;
case PCB_DIM_ALIGNED_T:

View File

@ -228,7 +228,7 @@ void PCB_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
item->Set( property, newValue );
}
changes.Push( _( "Change property" ) );
changes.Push( _( "Edit Properties" ) );
m_frame->Refresh();