mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-01-06 14:41:38 +00:00
design blocks: implement properties window
Also adds support for default fields when placing design blocks as a sheet.
This commit is contained in:
parent
51d615d30d
commit
953bc2d4bd
common
eeschema
@ -23,6 +23,7 @@
|
||||
*/
|
||||
#include <kicommon.h>
|
||||
#include <lib_id.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
||||
class DESIGN_BLOCK
|
||||
@ -31,24 +32,26 @@ public:
|
||||
void SetLibId( const LIB_ID& aName ) { m_lib_id = aName; }
|
||||
const LIB_ID& GetLibId() const { return m_lib_id; }
|
||||
|
||||
wxString GetLibIdAsString() const { return m_lib_id.Format(); }
|
||||
const wxString& GetLibDescription() const { return m_libDescription; }
|
||||
void SetLibDescription( const wxString& aDesc ) { m_libDescription = aDesc; }
|
||||
|
||||
wxString GetLibDescription() const { return m_libDescription; }
|
||||
void SetLibDescription( const wxString& aDesc ) { m_libDescription = aDesc; }
|
||||
const wxString& GetKeywords() const { return m_keywords; }
|
||||
void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
|
||||
|
||||
wxString GetKeywords() const { return m_keywords; }
|
||||
void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
|
||||
const wxString& GetSchematicFile() const { return m_schematicFile; }
|
||||
void SetSchematicFile( const wxString& aFile ) { m_schematicFile = aFile; }
|
||||
|
||||
wxString GetDocumentationUrl() const { return m_doc_url; }
|
||||
void SetDocumentationUrl( const wxString& aDocumentationUrl ) { m_doc_url = aDocumentationUrl; }
|
||||
|
||||
wxString GetSchematicFile() const { return m_schematicFile; }
|
||||
void SetSchematicFile( const wxString& aFile ) { m_schematicFile = aFile; }
|
||||
void SetFields( nlohmann::ordered_map<wxString, wxString>& aFields )
|
||||
{
|
||||
m_fields = std::move( aFields );
|
||||
}
|
||||
const nlohmann::ordered_map<wxString, wxString>& GetFields() const { return m_fields; }
|
||||
|
||||
private:
|
||||
LIB_ID m_lib_id;
|
||||
wxString m_schematicFile; // File name and path for schematic symbol.
|
||||
wxString m_libDescription; // File name and path for documentation file.
|
||||
wxString m_keywords; // Search keywords to find footprint in library.
|
||||
wxString m_doc_url; // URL of external documentation
|
||||
|
||||
nlohmann::ordered_map<wxString, wxString> m_fields;
|
||||
};
|
||||
|
@ -78,6 +78,8 @@ public:
|
||||
return m_doc;
|
||||
}
|
||||
|
||||
void SetDesc( const wxString& aDesc ) { m_doc = aDesc; }
|
||||
|
||||
wxString GetKeywords()
|
||||
{
|
||||
ensure_loaded();
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <common.h>
|
||||
#include <i18n_utility.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/translation.h>
|
||||
@ -137,9 +138,28 @@ const DESIGN_BLOCK_IO::IO_FILE_DESC DESIGN_BLOCK_IO::GetLibraryDesc() const
|
||||
|
||||
long long DESIGN_BLOCK_IO::GetLibraryTimestamp( const wxString& aLibraryPath ) const
|
||||
{
|
||||
wxString fileSpec = wxT( "*." ) + wxString( FILEEXT::KiCadDesignBlockPathExtension );
|
||||
wxDir libDir( aLibraryPath );
|
||||
|
||||
return TimestampDir( aLibraryPath, fileSpec );
|
||||
if( !libDir.IsOpened() )
|
||||
return 0;
|
||||
|
||||
long long ts = 0;
|
||||
|
||||
wxString filename;
|
||||
bool hasMoreFiles = libDir.GetFirst( &filename, wxEmptyString, wxDIR_DIRS );
|
||||
|
||||
while( hasMoreFiles )
|
||||
{
|
||||
wxFileName blockDir( aLibraryPath, filename );
|
||||
|
||||
// Check if the directory ends with ".block", if so hash all the files in it
|
||||
if( blockDir.GetFullName().EndsWith( FILEEXT::KiCadDesignBlockPathExtension ) )
|
||||
ts += TimestampDir( blockDir.GetFullPath(), wxT( "*" ) );
|
||||
|
||||
hasMoreFiles = libDir.GetNext( &filename );
|
||||
}
|
||||
|
||||
return ts;
|
||||
}
|
||||
|
||||
|
||||
@ -284,8 +304,9 @@ DESIGN_BLOCK* DESIGN_BLOCK_IO::DesignBlockLoad( const wxString& aLibraryPath,
|
||||
{
|
||||
try
|
||||
{
|
||||
nlohmann::json dbMetadata;
|
||||
std::ifstream dbMetadataFile( dbMetadataPath.fn_str() );
|
||||
nlohmann::ordered_json dbMetadata;
|
||||
std::ifstream dbMetadataFile( dbMetadataPath.fn_str() );
|
||||
|
||||
dbMetadataFile >> dbMetadata;
|
||||
|
||||
if( dbMetadata.contains( "description" ) )
|
||||
@ -294,8 +315,21 @@ DESIGN_BLOCK* DESIGN_BLOCK_IO::DesignBlockLoad( const wxString& aLibraryPath,
|
||||
if( dbMetadata.contains( "keywords" ) )
|
||||
newDB->SetKeywords( dbMetadata["keywords"] );
|
||||
|
||||
if( dbMetadata.contains( "documentation_url" ) )
|
||||
newDB->SetDocumentationUrl( dbMetadata["documentation_url"] );
|
||||
nlohmann::ordered_map<wxString, wxString> fields;
|
||||
|
||||
// Read the "fields" object from the JSON
|
||||
if( dbMetadata.contains( "fields" ) )
|
||||
{
|
||||
for( auto& item : dbMetadata["fields"].items() )
|
||||
{
|
||||
wxString name = wxString::FromUTF8( item.key() );
|
||||
wxString value = wxString::FromUTF8( item.value().get<std::string>() );
|
||||
|
||||
fields[name] = value;
|
||||
}
|
||||
|
||||
newDB->SetFields( fields );
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
@ -303,6 +337,8 @@ DESIGN_BLOCK* DESIGN_BLOCK_IO::DesignBlockLoad( const wxString& aLibraryPath,
|
||||
_( "Design block metadata file '%s' could not be read." ), dbMetadataPath ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
return nullptr;
|
||||
|
||||
|
||||
return newDB;
|
||||
@ -344,12 +380,49 @@ void DESIGN_BLOCK_IO::DesignBlockSave( const wxString& aLibra
|
||||
wxString dbSchematicFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName()
|
||||
+ wxT( "." ) + FILEEXT::KiCadSchematicFileExtension;
|
||||
|
||||
// Copy the source sheet file to the design block folder, under the design block name
|
||||
if( !wxCopyFile( aDesignBlock->GetSchematicFile(), dbSchematicFile ) )
|
||||
// If the source and destination files are the same, then we don't need to copy the file
|
||||
// as we are just updating the metadata
|
||||
if( aDesignBlock->GetSchematicFile() != dbSchematicFile )
|
||||
{
|
||||
// Copy the source sheet file to the design block folder, under the design block name
|
||||
if( !wxCopyFile( aDesignBlock->GetSchematicFile(), dbSchematicFile ) )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
_( "Schematic file '%s' could not be saved as design block at '%s'." ),
|
||||
aDesignBlock->GetSchematicFile().GetData(), dbSchematicFile ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxString dbMetadataFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName()
|
||||
+ wxT( "." ) + FILEEXT::JsonFileExtension;
|
||||
|
||||
// Write the metadata file
|
||||
nlohmann::ordered_json dbMetadata;
|
||||
dbMetadata["description"] = aDesignBlock->GetLibDescription();
|
||||
dbMetadata["keywords"] = aDesignBlock->GetKeywords();
|
||||
dbMetadata["fields"] = aDesignBlock->GetFields();
|
||||
|
||||
bool success = false;
|
||||
|
||||
try
|
||||
{
|
||||
wxFFile mdFile( dbMetadataFile, wxT( "wb" ) );
|
||||
|
||||
if( mdFile.IsOpened() )
|
||||
success = mdFile.Write( dbMetadata.dump( 0 ) );
|
||||
|
||||
// wxFFile dtor will close the file
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
|
||||
if( !success )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
_( "Schematic file '%s' could not be saved as design block at '%s'." ),
|
||||
aDesignBlock->GetSchematicFile().GetData(), dbSchematicFile ) );
|
||||
_( "Design block metadata file '%s' could not be saved." ), dbMetadataFile ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,8 @@ set( EESCHEMA_DLGS
|
||||
dialogs/dialog_change_symbols_base.cpp
|
||||
dialogs/dialog_database_lib_settings_base.cpp
|
||||
dialogs/dialog_database_lib_settings.cpp
|
||||
dialogs/dialog_design_block_properties_base.cpp
|
||||
dialogs/dialog_design_block_properties.cpp
|
||||
dialogs/dialog_edit_symbols_libid.cpp
|
||||
dialogs/dialog_edit_symbols_libid_base.cpp
|
||||
dialogs/dialog_eeschema_page_settings.cpp
|
||||
|
@ -162,7 +162,41 @@ wxString DESIGN_BLOCK_TREE_MODEL_ADAPTER::GenerateInfo( LIB_ID const& aLibId, in
|
||||
wxString name = aLibId.GetLibItemName();
|
||||
wxString desc = db->GetLibDescription();
|
||||
wxString keywords = db->GetKeywords();
|
||||
wxString doc = db->GetDocumentationUrl();
|
||||
wxString doc;
|
||||
|
||||
// It is currently common practice to store a documentation link in the description.
|
||||
size_t idx = desc.find( wxT( "http:" ) );
|
||||
|
||||
if( idx == wxString::npos )
|
||||
idx = desc.find( wxT( "https:" ) );
|
||||
|
||||
if( idx != wxString::npos )
|
||||
{
|
||||
int nesting = 0;
|
||||
|
||||
for( auto chit = desc.begin() + idx; chit != desc.end(); ++chit )
|
||||
{
|
||||
int ch = *chit;
|
||||
|
||||
// Break on invalid URI characters
|
||||
if( ch <= 0x20 || ch >= 0x7F || ch == '"' )
|
||||
break;
|
||||
|
||||
// Check for nesting parentheses, e.g. (Body style from: https://this.url/part.pdf)
|
||||
if( ch == '(' )
|
||||
++nesting;
|
||||
else if( ch == ')' && --nesting < 0 )
|
||||
break;
|
||||
|
||||
doc += ch;
|
||||
}
|
||||
|
||||
// Trim trailing punctuation
|
||||
static wxString punct = wxS( ".,:;" );
|
||||
|
||||
if( punct.find( doc.Last() ) != wxString::npos )
|
||||
doc = doc.Left( doc.Length() - 1 );
|
||||
}
|
||||
|
||||
wxString esc_desc = EscapeHTML( UnescapeString( desc ) );
|
||||
|
||||
|
@ -38,6 +38,24 @@
|
||||
#include <confirm.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <ee_selection_tool.h>
|
||||
#include <dialogs/dialog_design_block_properties.h>
|
||||
|
||||
|
||||
bool checkOverwrite( SCH_EDIT_FRAME* aFrame, wxString& libname, wxString& newName )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Design block '%s' already exists in library '%s'." ),
|
||||
newName.GetData(), libname.GetData() );
|
||||
|
||||
if( OKOrCancelDialog( aFrame, _( "Confirmation" ), msg, _( "Overwrite existing design block?" ),
|
||||
_( "Overwrite" ) )
|
||||
!= wxID_OK )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
DESIGN_BLOCK_LIB_TABLE* SCH_EDIT_FRAME::selectDesignBlockLibTable( bool aOptional )
|
||||
{
|
||||
@ -282,13 +300,14 @@ void SCH_EDIT_FRAME::SaveSheetAsDesignBlock( const wxString& aLibraryName )
|
||||
return;
|
||||
}
|
||||
|
||||
// Ask the user for the design block name
|
||||
wxFileName fn = wxFileNameFromPath( GetScreen()->GetFileName() );
|
||||
DESIGN_BLOCK blk;
|
||||
wxFileName fn = wxFileNameFromPath( GetScreen()->GetFileName() );
|
||||
|
||||
wxString name = wxGetTextFromUser( _( "Enter a name for the design block:" ),
|
||||
_( "Design Block Name" ), fn.GetName(), this );
|
||||
blk.SetLibId( LIB_ID( aLibraryName, fn.GetName() ) );
|
||||
|
||||
if( name.IsEmpty() )
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES dlg( this, &blk );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
// Save a temporary copy of the schematic file, as the plugin is just going to move it
|
||||
@ -300,13 +319,17 @@ void SCH_EDIT_FRAME::SaveSheetAsDesignBlock( const wxString& aLibraryName )
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DESIGN_BLOCK blk;
|
||||
blk.SetSchematicFile( tempFile );
|
||||
blk.SetLibId( LIB_ID( aLibraryName, name ) );
|
||||
|
||||
try
|
||||
{
|
||||
wxString libName = blk.GetLibId().GetLibNickname();
|
||||
wxString newName = blk.GetLibId().GetLibItemName();
|
||||
|
||||
if( Prj().DesignBlockLibs()->DesignBlockExists( libName, newName ) )
|
||||
if( !checkOverwrite( this, libName, newName ) )
|
||||
return;
|
||||
|
||||
Prj().DesignBlockLibs()->DesignBlockSave( aLibraryName, &blk );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
@ -347,11 +370,14 @@ void SCH_EDIT_FRAME::SaveSelectionAsDesignBlock( const wxString& aLibraryName )
|
||||
return;
|
||||
}
|
||||
|
||||
// Ask the user for the design block name
|
||||
wxString name = wxGetTextFromUser( _( "Enter a name for the design block:" ),
|
||||
_( "Design Block Name" ), wxEmptyString, this );
|
||||
DESIGN_BLOCK blk;
|
||||
wxFileName fn = wxFileNameFromPath( GetScreen()->GetFileName() );
|
||||
|
||||
if( name.IsEmpty() )
|
||||
blk.SetLibId( LIB_ID( aLibraryName, fn.GetName() ) );
|
||||
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES dlg( this, &blk );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
// Create a temperorary screen
|
||||
@ -377,14 +403,17 @@ void SCH_EDIT_FRAME::SaveSelectionAsDesignBlock( const wxString& aLibraryName )
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a design block
|
||||
DESIGN_BLOCK blk;
|
||||
blk.SetSchematicFile( tempFile );
|
||||
blk.SetLibId( LIB_ID( aLibraryName, name ) );
|
||||
|
||||
try
|
||||
{
|
||||
// Actually save it to disk
|
||||
wxString libName = blk.GetLibId().GetLibNickname();
|
||||
wxString newName = blk.GetLibId().GetLibItemName();
|
||||
|
||||
if( Prj().DesignBlockLibs()->DesignBlockExists( libName, newName ) )
|
||||
if( !checkOverwrite( this, libName, newName ) )
|
||||
return;
|
||||
|
||||
Prj().DesignBlockLibs()->DesignBlockSave( aLibraryName, &blk );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
@ -487,6 +516,61 @@ bool SCH_EDIT_FRAME::DeleteDesignBlockFromLibrary( const LIB_ID& aLibId, bool aC
|
||||
}
|
||||
|
||||
|
||||
bool SCH_EDIT_FRAME::EditDesignBlockProperties( const LIB_ID& aLibId )
|
||||
{
|
||||
if( !aLibId.IsValid() )
|
||||
return false;
|
||||
|
||||
wxString libname = aLibId.GetLibNickname();
|
||||
wxString dbname = aLibId.GetLibItemName();
|
||||
|
||||
if( !Prj().DesignBlockLibs()->IsDesignBlockLibWritable( libname ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Library '%s' is read only." ), libname );
|
||||
ShowInfoBarError( msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
DESIGN_BLOCK* designBlock = GetDesignBlock( aLibId, true, true );
|
||||
|
||||
if( !designBlock )
|
||||
return false;
|
||||
|
||||
wxString originalName = designBlock->GetLibId().GetLibItemName();
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES dlg( this, designBlock );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return false;
|
||||
|
||||
wxString newName = designBlock->GetLibId().GetLibItemName();
|
||||
|
||||
try
|
||||
{
|
||||
if( originalName != newName )
|
||||
{
|
||||
if( Prj().DesignBlockLibs()->DesignBlockExists( libname, newName ) )
|
||||
if( !checkOverwrite( this, libname, newName ) )
|
||||
return false;
|
||||
|
||||
Prj().DesignBlockLibs()->DesignBlockSave( libname, designBlock );
|
||||
Prj().DesignBlockLibs()->DesignBlockDelete( libname, originalName );
|
||||
}
|
||||
else
|
||||
Prj().DesignBlockLibs()->DesignBlockSave( libname, designBlock );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
DisplayError( this, ioe.What() );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_designBlocksPane->RefreshLibs();
|
||||
m_designBlocksPane->SelectLibId( designBlock->GetLibId() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
DESIGN_BLOCK* SchGetDesignBlock( const LIB_ID& aLibId, DESIGN_BLOCK_LIB_TABLE* aLibTable,
|
||||
wxWindow* aParent, bool aShowErrorMsg )
|
||||
{
|
||||
|
263
eeschema/dialogs/dialog_design_block_properties.cpp
Normal file
263
eeschema/dialogs/dialog_design_block_properties.cpp
Normal file
@ -0,0 +1,263 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 Mike Williams <mikebwilliams@gmail.com>
|
||||
* Copyright (C) 1992-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 <dialogs/dialog_design_block_properties.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/tooltip.h>
|
||||
#include <grid_tricks.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
|
||||
#include <design_block.h>
|
||||
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES::DIALOG_DESIGN_BLOCK_PROPERTIES( SCH_EDIT_FRAME* aParent,
|
||||
DESIGN_BLOCK* aDesignBlock ) :
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES_BASE( aParent ), m_designBlock( aDesignBlock )
|
||||
{
|
||||
if( !m_textName->IsEmpty() )
|
||||
m_textName->SetEditable( false );
|
||||
|
||||
wxToolTip::Enable( true );
|
||||
SetupStandardButtons();
|
||||
|
||||
// Configure button logos
|
||||
m_bpAdd->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
|
||||
m_bpDelete->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
|
||||
m_bpMoveUp->SetBitmap( KiBitmapBundle( BITMAPS::small_up ) );
|
||||
m_bpMoveDown->SetBitmap( KiBitmapBundle( BITMAPS::small_down ) );
|
||||
|
||||
m_fieldsGrid->SetUseNativeColLabels();
|
||||
|
||||
m_fieldsGrid->PushEventHandler( new GRID_TRICKS( m_fieldsGrid, [this]( wxCommandEvent& aEvent )
|
||||
{
|
||||
OnAddField( aEvent );
|
||||
} ) );
|
||||
m_fieldsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
|
||||
}
|
||||
|
||||
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES::~DIALOG_DESIGN_BLOCK_PROPERTIES()
|
||||
{
|
||||
// Delete the GRID_TRICKS.
|
||||
m_fieldsGrid->PopEventHandler( true );
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_DESIGN_BLOCK_PROPERTIES::TransferDataToWindow()
|
||||
{
|
||||
m_textName->AppendText( m_designBlock->GetLibId().GetLibItemName() );
|
||||
m_textKeywords->AppendText( m_designBlock->GetKeywords() );
|
||||
m_textDescription->AppendText( m_designBlock->GetLibDescription() );
|
||||
|
||||
// Typical assignment operator does not work here because of the ordered_map
|
||||
auto source = m_designBlock->GetFields();
|
||||
m_fields.clear();
|
||||
for( const auto& field : source )
|
||||
{
|
||||
m_fields[field.first] = field.second;
|
||||
}
|
||||
|
||||
return TransferDataToGrid();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_DESIGN_BLOCK_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
m_designBlock->SetLibId(
|
||||
LIB_ID( m_designBlock->GetLibId().GetLibNickname(), m_textName->GetValue() ) );
|
||||
m_designBlock->SetLibDescription( m_textDescription->GetValue() );
|
||||
m_designBlock->SetKeywords( m_textKeywords->GetValue() );
|
||||
|
||||
return TransferDataFromGrid();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_DESIGN_BLOCK_PROPERTIES::OnAddField( wxCommandEvent& event )
|
||||
{
|
||||
if( !m_fieldsGrid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
int row = m_fieldsGrid->GetNumberRows();
|
||||
|
||||
m_fieldsGrid->AppendRows( 1 );
|
||||
|
||||
m_fieldsGrid->SetCellValue( row, 0, _( "Untitled Field" ) );
|
||||
//m_fieldsGrid->SetCellValue( row, 1, wxEmptyString );
|
||||
|
||||
// Set cell properties
|
||||
m_fieldsGrid->SetCellAlignment( row, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
|
||||
m_fieldsGrid->SetCellAlignment( row, 1, wxALIGN_LEFT, wxALIGN_CENTRE );
|
||||
|
||||
// wx documentation is wrong, SetGridCursor does not make visible.
|
||||
m_fieldsGrid->MakeCellVisible( row, 0 );
|
||||
m_fieldsGrid->SetGridCursor( row, 0 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_DESIGN_BLOCK_PROPERTIES::OnDeleteField( wxCommandEvent& event )
|
||||
{
|
||||
if( !m_fieldsGrid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
wxArrayInt selectedRows = m_fieldsGrid->GetSelectedRows();
|
||||
|
||||
if( selectedRows.empty() && m_fieldsGrid->GetGridCursorRow() >= 0 )
|
||||
selectedRows.push_back( m_fieldsGrid->GetGridCursorRow() );
|
||||
|
||||
if( selectedRows.empty() )
|
||||
return;
|
||||
|
||||
// Reverse sort so deleting a row doesn't change the indexes of the other rows.
|
||||
selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
|
||||
|
||||
for( int row : selectedRows )
|
||||
{
|
||||
m_fieldsGrid->DeleteRows( row );
|
||||
|
||||
m_fieldsGrid->MakeCellVisible( std::max( 0, row - 1 ), m_fieldsGrid->GetGridCursorCol() );
|
||||
m_fieldsGrid->SetGridCursor( std::max( 0, row - 1 ), m_fieldsGrid->GetGridCursorCol() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_DESIGN_BLOCK_PROPERTIES::OnMoveFieldUp( wxCommandEvent& event )
|
||||
{
|
||||
if( !m_fieldsGrid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
int row = m_fieldsGrid->GetGridCursorRow();
|
||||
|
||||
if( m_fieldsGrid->GetNumberRows() < 2 || row == 0 )
|
||||
return;
|
||||
|
||||
// Swap the grid at row with the grid at row - 1
|
||||
wxString temp0 = m_fieldsGrid->GetCellValue( row, 0 );
|
||||
m_fieldsGrid->SetCellValue( row, 0, m_fieldsGrid->GetCellValue( row - 1, 0 ) );
|
||||
m_fieldsGrid->SetCellValue( row - 1, 0, temp0 );
|
||||
|
||||
wxString temp1 = m_fieldsGrid->GetCellValue( row, 1 );
|
||||
m_fieldsGrid->SetCellValue( row, 1, m_fieldsGrid->GetCellValue( row - 1, 1 ) );
|
||||
m_fieldsGrid->SetCellValue( row - 1, 1, temp1 );
|
||||
|
||||
m_fieldsGrid->SetGridCursor( row - 1, 0 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_DESIGN_BLOCK_PROPERTIES::OnMoveFieldDown( wxCommandEvent& event )
|
||||
{
|
||||
if( !m_fieldsGrid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
int row = m_fieldsGrid->GetGridCursorRow();
|
||||
|
||||
if( m_fieldsGrid->GetNumberRows() < 2 || row == ( (int) m_fieldsGrid->GetNumberRows() - 1 ) )
|
||||
return;
|
||||
|
||||
// Swap the grid at row with the grid at row + 1
|
||||
wxString temp0 = m_fieldsGrid->GetCellValue( row, 0 );
|
||||
m_fieldsGrid->SetCellValue( row, 0, m_fieldsGrid->GetCellValue( row + 1, 0 ) );
|
||||
m_fieldsGrid->SetCellValue( row + 1, 0, temp0 );
|
||||
|
||||
wxString temp1 = m_fieldsGrid->GetCellValue( row, 1 );
|
||||
m_fieldsGrid->SetCellValue( row, 1, m_fieldsGrid->GetCellValue( row + 1, 1 ) );
|
||||
m_fieldsGrid->SetCellValue( row + 1, 1, temp1 );
|
||||
|
||||
m_fieldsGrid->SetGridCursor( row + 1, 0 );
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_DESIGN_BLOCK_PROPERTIES::TransferDataToGrid()
|
||||
{
|
||||
m_fieldsGrid->Freeze();
|
||||
|
||||
m_fieldsGrid->ClearRows();
|
||||
m_fieldsGrid->AppendRows( m_fields.size() );
|
||||
|
||||
int row = 0;
|
||||
|
||||
for( const auto& [fieldName, fieldValue] : m_fields )
|
||||
{
|
||||
m_fieldsGrid->SetCellValue( row, 0, fieldName );
|
||||
m_fieldsGrid->SetCellValue( row, 1, fieldValue );
|
||||
|
||||
// Set cell properties
|
||||
m_fieldsGrid->SetCellAlignment( row, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
|
||||
m_fieldsGrid->SetCellAlignment( row, 1, wxALIGN_LEFT, wxALIGN_CENTRE );
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
m_fieldsGrid->Thaw();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_DESIGN_BLOCK_PROPERTIES::TransferDataFromGrid()
|
||||
{
|
||||
if( !m_fieldsGrid->CommitPendingChanges() )
|
||||
return false;
|
||||
|
||||
nlohmann::ordered_map<wxString, wxString> newFields;
|
||||
|
||||
for( int row = 0; row < m_fieldsGrid->GetNumberRows(); row++ )
|
||||
{
|
||||
wxString fieldName = m_fieldsGrid->GetCellValue( row, 0 ).Strip();
|
||||
fieldName.Replace( wxT( "\n" ), wxT( "" ), true ); // strip all newlines
|
||||
fieldName.Replace( wxT( " " ), wxT( " " ), true ); // double space to single
|
||||
|
||||
if( newFields.count( fieldName ) )
|
||||
{
|
||||
wxMessageBox( _( "Duplicate fields are not allowed." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
newFields[fieldName] = m_fieldsGrid->GetCellValue( row, 1 );
|
||||
}
|
||||
|
||||
m_designBlock->SetFields( newFields );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_DESIGN_BLOCK_PROPERTIES::AdjustGridColumns( int aWidth )
|
||||
{
|
||||
if( aWidth <= 0 )
|
||||
return;
|
||||
|
||||
// Account for scroll bars
|
||||
aWidth -= ( m_fieldsGrid->GetSize().x - m_fieldsGrid->GetClientSize().x );
|
||||
|
||||
m_fieldsGrid->SetColSize( 1, aWidth - m_fieldsGrid->GetColSize( 0 ) );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_DESIGN_BLOCK_PROPERTIES::OnSizeGrid( wxSizeEvent& event )
|
||||
{
|
||||
AdjustGridColumns( event.GetSize().GetX() );
|
||||
|
||||
event.Skip();
|
||||
}
|
55
eeschema/dialogs/dialog_design_block_properties.h
Normal file
55
eeschema/dialogs/dialog_design_block_properties.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 Mike Williams <mikebwilliams@gmail.com>
|
||||
* Copyright (C) 1992-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 <dialogs/dialog_design_block_properties_base.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class DESIGN_BLOCK;
|
||||
|
||||
class DIALOG_DESIGN_BLOCK_PROPERTIES : public DIALOG_DESIGN_BLOCK_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES( SCH_EDIT_FRAME* aParent, DESIGN_BLOCK* aDesignBlock );
|
||||
~DIALOG_DESIGN_BLOCK_PROPERTIES() override;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
bool TransferDataToGrid();
|
||||
bool TransferDataFromGrid();
|
||||
|
||||
void OnAddField( wxCommandEvent& aEvent ) override;
|
||||
void OnDeleteField( wxCommandEvent& aEvent ) override;
|
||||
void OnMoveFieldUp( wxCommandEvent& aEvent ) override;
|
||||
void OnMoveFieldDown( wxCommandEvent& aEvent ) override;
|
||||
|
||||
void OnSizeGrid( wxSizeEvent& event ) override;
|
||||
|
||||
private:
|
||||
void AdjustGridColumns( int aWidth );
|
||||
|
||||
DESIGN_BLOCK* m_designBlock;
|
||||
nlohmann::ordered_map<wxString, wxString> m_fields;
|
||||
};
|
163
eeschema/dialogs/dialog_design_block_properties_base.cpp
Normal file
163
eeschema/dialogs/dialog_design_block_properties_base.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/wx_grid.h"
|
||||
|
||||
#include "dialog_design_block_properties_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::DIALOG_DESIGN_BLOCK_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 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerGeneral;
|
||||
sbSizerGeneral = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("General") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgProperties;
|
||||
fgProperties = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgProperties->AddGrowableCol( 1 );
|
||||
fgProperties->AddGrowableRow( 2 );
|
||||
fgProperties->SetFlexibleDirection( wxBOTH );
|
||||
fgProperties->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticTextName = new wxStaticText( sbSizerGeneral->GetStaticBox(), wxID_ANY, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextName->Wrap( -1 );
|
||||
fgProperties->Add( m_staticTextName, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_textName = new wxTextCtrl( sbSizerGeneral->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgProperties->Add( m_textName, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticTextKeywords = new wxStaticText( sbSizerGeneral->GetStaticBox(), wxID_ANY, wxT("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextKeywords->Wrap( -1 );
|
||||
fgProperties->Add( m_staticTextKeywords, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_textKeywords = new wxTextCtrl( sbSizerGeneral->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgProperties->Add( m_textKeywords, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer3;
|
||||
bSizer3 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextDescription = new wxStaticText( sbSizerGeneral->GetStaticBox(), wxID_ANY, wxT("Description:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDescription->Wrap( -1 );
|
||||
bSizer3->Add( m_staticTextDescription, 1, wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( 0, 0, 3, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgProperties->Add( bSizer3, 1, wxEXPAND, 5 );
|
||||
|
||||
m_textDescription = new wxTextCtrl( sbSizerGeneral->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
fgProperties->Add( m_textDescription, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbSizerGeneral->Add( fgProperties, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( sbSizerGeneral, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbFields;
|
||||
sbFields = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Default Fields") ), wxVERTICAL );
|
||||
|
||||
m_fieldsGrid = new WX_GRID( sbFields->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
// Grid
|
||||
m_fieldsGrid->CreateGrid( 1, 2 );
|
||||
m_fieldsGrid->EnableEditing( true );
|
||||
m_fieldsGrid->EnableGridLines( true );
|
||||
m_fieldsGrid->EnableDragGridSize( false );
|
||||
m_fieldsGrid->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_fieldsGrid->SetColSize( 0, 150 );
|
||||
m_fieldsGrid->SetColSize( 1, 300 );
|
||||
m_fieldsGrid->EnableDragColMove( false );
|
||||
m_fieldsGrid->EnableDragColSize( true );
|
||||
m_fieldsGrid->SetColLabelValue( 0, wxT("Name") );
|
||||
m_fieldsGrid->SetColLabelValue( 1, wxT("Value") );
|
||||
m_fieldsGrid->SetColLabelSize( 22 );
|
||||
m_fieldsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Rows
|
||||
m_fieldsGrid->EnableDragRowSize( true );
|
||||
m_fieldsGrid->SetRowLabelSize( 0 );
|
||||
m_fieldsGrid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_fieldsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
||||
m_fieldsGrid->SetMinSize( wxSize( -1,180 ) );
|
||||
|
||||
sbFields->Add( m_fieldsGrid, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bButtonSizer;
|
||||
bButtonSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_bpAdd = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bButtonSizer->Add( m_bpAdd, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_bpMoveUp = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bButtonSizer->Add( m_bpMoveUp, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_bpMoveDown = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bButtonSizer->Add( m_bpMoveDown, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bButtonSizer->Add( 20, 0, 0, wxEXPAND, 10 );
|
||||
|
||||
m_bpDelete = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bButtonSizer->Add( m_bpDelete, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bButtonSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbFields->Add( bButtonSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( sbFields, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_stdButtons = new wxStdDialogButtonSizer();
|
||||
m_stdButtonsOK = new wxButton( this, wxID_OK );
|
||||
m_stdButtons->AddButton( m_stdButtonsOK );
|
||||
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_stdButtons->AddButton( m_stdButtonsCancel );
|
||||
m_stdButtons->Realize();
|
||||
|
||||
bMainSizer->Add( m_stdButtons, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_fieldsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnSizeGrid ), NULL, this );
|
||||
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnAddField ), NULL, this );
|
||||
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnMoveFieldUp ), NULL, this );
|
||||
m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnMoveFieldDown ), NULL, this );
|
||||
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnDeleteField ), NULL, this );
|
||||
m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnCancelButtonClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::~DIALOG_DESIGN_BLOCK_PROPERTIES_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_fieldsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnSizeGrid ), NULL, this );
|
||||
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnAddField ), NULL, this );
|
||||
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnMoveFieldUp ), NULL, this );
|
||||
m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnMoveFieldDown ), NULL, this );
|
||||
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnDeleteField ), NULL, this );
|
||||
m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_BLOCK_PROPERTIES_BASE::OnCancelButtonClick ), NULL, this );
|
||||
|
||||
}
|
956
eeschema/dialogs/dialog_design_block_properties_base.fbp
Normal file
956
eeschema/dialogs/dialog_design_block_properties_base.fbp
Normal file
@ -0,0 +1,956 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="17"/>
|
||||
<object class="Project" expanded="true">
|
||||
<property name="class_decoration">; </property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_design_block_properties_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">0</property>
|
||||
<property name="name">dialog_design_block_properties_base</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="true">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_DESIGN_BLOCK_PROPERTIES_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">551,637</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
|
||||
<property name="title">Design Block Properties</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMainSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="true">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">General</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sbSizerGeneral</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxFlexGridSizer" expanded="true">
|
||||
<property name="cols">2</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">1</property>
|
||||
<property name="growablerows">2</property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">fgProperties</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">0</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Name:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticTextName</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textName</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Keywords:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticTextKeywords</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textKeywords</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer3</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT|wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Description:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticTextDescription</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">3</property>
|
||||
<object class="spacer" expanded="true">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textDescription</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxTE_MULTILINE</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticBoxSizer" expanded="true">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Default Fields</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sbFields</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxGrid" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="autosize_cols">0</property>
|
||||
<property name="autosize_rows">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="cell_bg"></property>
|
||||
<property name="cell_font"></property>
|
||||
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
|
||||
<property name="cell_text"></property>
|
||||
<property name="cell_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
|
||||
<property name="col_label_size">22</property>
|
||||
<property name="col_label_values">"Name" "Value"</property>
|
||||
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="cols">2</property>
|
||||
<property name="column_sizes">150,300</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="drag_col_move">0</property>
|
||||
<property name="drag_col_size">1</property>
|
||||
<property name="drag_grid_size">0</property>
|
||||
<property name="drag_row_size">1</property>
|
||||
<property name="editing">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="grid_line_color"></property>
|
||||
<property name="grid_lines">1</property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label_bg"></property>
|
||||
<property name="label_font"></property>
|
||||
<property name="label_text"></property>
|
||||
<property name="margin_height">0</property>
|
||||
<property name="margin_width">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,180</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_fieldsGrid</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="row_label_horiz_alignment">wxALIGN_CENTER</property>
|
||||
<property name="row_label_size">0</property>
|
||||
<property name="row_label_values"></property>
|
||||
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="row_sizes"></property>
|
||||
<property name="rows">1</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnSize">OnSizeGrid</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bButtonSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpAdd</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnAddField</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpMoveUp</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnMoveFieldUp</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpMoveDown</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnMoveFieldDown</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="true">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">20</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpDelete</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnDeleteField</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="true">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="true">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">1</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_stdButtons</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnCancelButtonClick">OnCancelButtonClick</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
74
eeschema/dialogs/dialog_design_block_properties_base.h
Normal file
74
eeschema/dialogs/dialog_design_block_properties_base.h
Normal file
@ -0,0 +1,74 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
class WX_GRID;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_DESIGN_BLOCK_PROPERTIES_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_DESIGN_BLOCK_PROPERTIES_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticTextName;
|
||||
wxTextCtrl* m_textName;
|
||||
wxStaticText* m_staticTextKeywords;
|
||||
wxTextCtrl* m_textKeywords;
|
||||
wxStaticText* m_staticTextDescription;
|
||||
wxTextCtrl* m_textDescription;
|
||||
WX_GRID* m_fieldsGrid;
|
||||
wxBitmapButton* m_bpAdd;
|
||||
wxBitmapButton* m_bpMoveUp;
|
||||
wxBitmapButton* m_bpMoveDown;
|
||||
wxBitmapButton* m_bpDelete;
|
||||
wxStdDialogButtonSizer* m_stdButtons;
|
||||
wxButton* m_stdButtonsOK;
|
||||
wxButton* m_stdButtonsCancel;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); }
|
||||
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnMoveFieldUp( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnMoveFieldDown( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Design Block Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 551,637 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
||||
~DIALOG_DESIGN_BLOCK_PROPERTIES_BASE();
|
||||
|
||||
};
|
||||
|
@ -799,7 +799,8 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
||||
CURRENT_TOOL( EE_ACTIONS::drawSheet );
|
||||
CURRENT_TOOL( EE_ACTIONS::placeSheetPin );
|
||||
CURRENT_TOOL( EE_ACTIONS::syncSheetPins );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawSheetCopy );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawSheetFromFile );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawSheetFromDesignBlock );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawRectangle );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawCircle );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawArc );
|
||||
|
@ -772,6 +772,8 @@ public:
|
||||
|
||||
bool DeleteDesignBlockFromLibrary( const LIB_ID& aLibId, bool aConfirm );
|
||||
|
||||
bool EditDesignBlockProperties( const LIB_ID& aLibId );
|
||||
|
||||
|
||||
/**
|
||||
* Load design block from design block library table.
|
||||
|
@ -174,6 +174,13 @@ TOOL_ACTION EE_ACTIONS::deleteDesignBlock( TOOL_ACTION_ARGS()
|
||||
.Tooltip( _( "Remove the selected design block from its library" ) )
|
||||
.Icon( BITMAPS::trash ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::editDesignBlockProperties( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.SchDesignBlockControl.editDesignBlockProperties" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Properties..." ) )
|
||||
.Tooltip( _( "Edit properies of design block" ) )
|
||||
.Icon( BITMAPS::edit ) );
|
||||
|
||||
// SYMBOL_EDITOR_CONTROL
|
||||
//
|
||||
TOOL_ACTION EE_ACTIONS::saveLibraryAs( TOOL_ACTION_ARGS()
|
||||
@ -500,15 +507,24 @@ TOOL_ACTION EE_ACTIONS::drawSheet( TOOL_ACTION_ARGS()
|
||||
.Flags( AF_ACTIVATE )
|
||||
.Parameter( SCH_SHEET_T ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::drawSheetCopy( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.InteractiveDrawing.drawSheetCopy" )
|
||||
TOOL_ACTION EE_ACTIONS::drawSheetFromFile( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.InteractiveDrawing.drawSheetFromFile" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Draw Sheet Copy" ) )
|
||||
.FriendlyName( _( "Draw Sheet from File" ) )
|
||||
.Tooltip( _( "Copy sheet into project and draw on current sheet" ) )
|
||||
.Icon( BITMAPS::add_hierarchical_subsheet )
|
||||
.Flags( AF_ACTIVATE )
|
||||
.Parameter<wxString*> ( nullptr ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::drawSheetFromDesignBlock( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.InteractiveDrawing.drawSheetFromDesignBlock" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Draw Sheet from Design Block" ) )
|
||||
.Tooltip( _( "Copy design block into project as a sheet on current sheet" ) )
|
||||
.Icon( BITMAPS::add_hierarchical_subsheet )
|
||||
.Flags( AF_ACTIVATE )
|
||||
.Parameter<DESIGN_BLOCK*> ( nullptr ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::placeSheetPin( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.InteractiveDrawing.placeSheetPin" )
|
||||
.Scope( AS_GLOBAL )
|
||||
|
@ -89,7 +89,8 @@ public:
|
||||
static TOOL_ACTION placeGlobalLabel;
|
||||
static TOOL_ACTION placeHierLabel;
|
||||
static TOOL_ACTION drawSheet;
|
||||
static TOOL_ACTION drawSheetCopy;
|
||||
static TOOL_ACTION drawSheetFromFile;
|
||||
static TOOL_ACTION drawSheetFromDesignBlock;
|
||||
static TOOL_ACTION placeSheetPin;
|
||||
static TOOL_ACTION importSheet;
|
||||
// Sync sheet pins for selected sheet symbol
|
||||
@ -204,6 +205,7 @@ public:
|
||||
static TOOL_ACTION saveSheetAsDesignBlock;
|
||||
static TOOL_ACTION saveSelectionAsDesignBlock;
|
||||
static TOOL_ACTION deleteDesignBlock;
|
||||
static TOOL_ACTION editDesignBlockProperties;
|
||||
|
||||
// Library management
|
||||
static TOOL_ACTION saveLibraryAs;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <sch_design_block_control.h>
|
||||
#include <design_block_pane.h>
|
||||
#include <panel_design_block_chooser.h>
|
||||
#include <dialog_design_block_properties.h>
|
||||
#include <ee_actions.h>
|
||||
|
||||
bool SCH_DESIGN_BLOCK_CONTROL::Init()
|
||||
@ -77,6 +78,7 @@ bool SCH_DESIGN_BLOCK_CONTROL::Init()
|
||||
ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLib, 1 );
|
||||
ctxMenu.AddSeparator( 1 );
|
||||
|
||||
ctxMenu.AddItem( EE_ACTIONS::editDesignBlockProperties, isDesignBlock, 10 );
|
||||
ctxMenu.AddItem( ACTIONS::newLibrary, SELECTION_CONDITIONS::ShowAlways, 10 );
|
||||
ctxMenu.AddItem( EE_ACTIONS::saveSheetAsDesignBlock, isInLibrary, 10 );
|
||||
ctxMenu.AddItem( EE_ACTIONS::saveSelectionAsDesignBlock, isInLibrary, 10 );
|
||||
@ -161,6 +163,20 @@ int SCH_DESIGN_BLOCK_CONTROL::DeleteDesignBlock( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
|
||||
|
||||
int SCH_DESIGN_BLOCK_CONTROL::EditDesignBlockProperties( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_TREE_NODE* current = getCurrentTreeNode();
|
||||
|
||||
if( !current )
|
||||
return -1;
|
||||
|
||||
if( m_editFrame->EditDesignBlockProperties( current->m_LibId ) )
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int SCH_DESIGN_BLOCK_CONTROL::HideLibraryTree( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_editFrame->ToggleLibraryTree();
|
||||
@ -178,6 +194,7 @@ void SCH_DESIGN_BLOCK_CONTROL::setTransitions()
|
||||
Go( &SCH_DESIGN_BLOCK_CONTROL::SaveSheetAsDesignBlock, EE_ACTIONS::saveSheetAsDesignBlock.MakeEvent() );
|
||||
Go( &SCH_DESIGN_BLOCK_CONTROL::SaveSelectionAsDesignBlock, EE_ACTIONS::saveSelectionAsDesignBlock.MakeEvent() );
|
||||
Go( &SCH_DESIGN_BLOCK_CONTROL::DeleteDesignBlock, EE_ACTIONS::deleteDesignBlock.MakeEvent() );
|
||||
Go( &SCH_DESIGN_BLOCK_CONTROL::EditDesignBlockProperties, EE_ACTIONS::editDesignBlockProperties.MakeEvent() );
|
||||
|
||||
Go( &SCH_DESIGN_BLOCK_CONTROL::HideLibraryTree, ACTIONS::hideLibraryTree.MakeEvent() );
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
int SaveSheetAsDesignBlock( const TOOL_EVENT& aEvent );
|
||||
int SaveSelectionAsDesignBlock( const TOOL_EVENT& aEvent );
|
||||
int DeleteDesignBlock( const TOOL_EVENT& aEvent );
|
||||
int EditDesignBlockProperties( const TOOL_EVENT& aEvent );
|
||||
|
||||
int HideLibraryTree( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
@ -547,20 +547,30 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||
int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
bool placingDesignBlock = aEvent.IsAction( &EE_ACTIONS::placeDesignBlock );
|
||||
DESIGN_BLOCK* designBlock =
|
||||
placingDesignBlock && m_frame->GetDesignBlockPane()->GetSelectedLibId().IsValid()
|
||||
? m_frame->GetDesignBlock( m_frame->GetDesignBlockPane()->GetSelectedLibId() )
|
||||
: nullptr;
|
||||
wxString* importSourceFile = !placingDesignBlock ? aEvent.Parameter<wxString*>() : nullptr;
|
||||
|
||||
DESIGN_BLOCK* designBlock = nullptr;
|
||||
wxString sheetFileName = wxEmptyString;
|
||||
|
||||
if( !placingDesignBlock )
|
||||
if( placingDesignBlock )
|
||||
{
|
||||
if( m_frame->GetDesignBlockPane()->GetSelectedLibId().IsValid() )
|
||||
{
|
||||
designBlock =
|
||||
m_frame->GetDesignBlock( m_frame->GetDesignBlockPane()->GetSelectedLibId() );
|
||||
|
||||
if( !designBlock )
|
||||
return 0;
|
||||
|
||||
sheetFileName = designBlock->GetSchematicFile();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString* importSourceFile = aEvent.Parameter<wxString*>();
|
||||
|
||||
if( importSourceFile != nullptr )
|
||||
sheetFileName = *importSourceFile;
|
||||
}
|
||||
else if( designBlock )
|
||||
sheetFileName = designBlock->GetSchematicFile();
|
||||
|
||||
COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
|
||||
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
|
||||
@ -776,8 +786,15 @@ int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) || isSyntheticClick )
|
||||
{
|
||||
wxString* tempFileName = new wxString( sheetFileName );
|
||||
m_toolMgr->PostAction( EE_ACTIONS::drawSheetCopy, tempFileName );
|
||||
if( placingDesignBlock )
|
||||
m_toolMgr->PostAction( EE_ACTIONS::drawSheetFromDesignBlock, designBlock );
|
||||
else
|
||||
{
|
||||
// drawSheet must delete
|
||||
m_toolMgr->PostAction( EE_ACTIONS::drawSheetFromFile,
|
||||
new wxString( sheetFileName ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
@ -2717,12 +2734,34 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent )
|
||||
|
||||
int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
bool isDrawSheetCopy = aEvent.IsAction( &EE_ACTIONS::drawSheetCopy );
|
||||
wxString* filename = isDrawSheetCopy ? aEvent.Parameter<wxString*>() : nullptr;
|
||||
SCH_SHEET* sheet = nullptr;
|
||||
bool isDrawSheetCopy = aEvent.IsAction( &EE_ACTIONS::drawSheetFromFile );
|
||||
bool isDrawSheetFromDesignBlock = aEvent.IsAction( &EE_ACTIONS::drawSheetFromDesignBlock );
|
||||
|
||||
// Make sure we've been passed a filename if we're importing a sheet
|
||||
wxCHECK( !isDrawSheetCopy || filename, 0 );
|
||||
DESIGN_BLOCK* designBlock = nullptr;
|
||||
SCH_SHEET* sheet = nullptr;
|
||||
wxString filename;
|
||||
|
||||
if( isDrawSheetCopy )
|
||||
{
|
||||
wxString* ptr = aEvent.Parameter<wxString*>();
|
||||
wxCHECK( ptr, 0 );
|
||||
|
||||
// We own the string if we're importing a sheet
|
||||
filename = *ptr;
|
||||
delete ptr;
|
||||
}
|
||||
else if( isDrawSheetFromDesignBlock )
|
||||
{
|
||||
designBlock = aEvent.Parameter<DESIGN_BLOCK*>();
|
||||
wxCHECK( designBlock, 0 );
|
||||
filename = designBlock->GetSchematicFile();
|
||||
}
|
||||
|
||||
if( ( isDrawSheetCopy || isDrawSheetFromDesignBlock ) && !wxFileExists( filename ) )
|
||||
{
|
||||
wxMessageBox( wxString::Format( _( "File '%s' does not exist." ), filename ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( m_inDrawingTool )
|
||||
return 0;
|
||||
@ -2762,7 +2801,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
// Set initial cursor
|
||||
setCursor();
|
||||
|
||||
if( aEvent.HasPosition() && !isDrawSheetCopy )
|
||||
if( aEvent.HasPosition() && !( isDrawSheetCopy || isDrawSheetFromDesignBlock ) )
|
||||
m_toolMgr->PrimeTool( aEvent.Position() );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
@ -2847,24 +2886,34 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
|
||||
|
||||
if( isDrawSheetCopy && !wxFileExists( *filename ) )
|
||||
{
|
||||
wxMessageBox( wxString::Format( _( "File '%s' does not exist." ), *filename ) );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
|
||||
sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), cursorPos );
|
||||
sheet->SetScreen( nullptr );
|
||||
|
||||
if( isDrawSheetCopy )
|
||||
{
|
||||
wxFileName fn( *filename );
|
||||
wxFileName fn( filename );
|
||||
|
||||
sheet->GetFields()[SHEETNAME].SetText( wxT( "Imported Sheet" ) );
|
||||
sheet->GetFields()[SHEETNAME].SetText( fn.GetName() );
|
||||
sheet->GetFields()[SHEETFILENAME].SetText( fn.GetName() + wxT( "." )
|
||||
+ FILEEXT::KiCadSchematicFileExtension );
|
||||
}
|
||||
else if( isDrawSheetFromDesignBlock )
|
||||
{
|
||||
sheet->GetFields()[SHEETNAME].SetText( designBlock->GetLibId().GetLibItemName() );
|
||||
sheet->GetFields()[SHEETFILENAME].SetText( designBlock->GetSchematicFile() );
|
||||
|
||||
std::vector<SCH_FIELD>& sheetFields = sheet->GetFields();
|
||||
|
||||
// Copy default fields into the sheet
|
||||
for( const auto& field : designBlock->GetFields() )
|
||||
{
|
||||
SCH_FIELD newField( sheet, sheetFields.size(), field.first );
|
||||
newField.SetText( field.second );
|
||||
newField.SetVisible( false );
|
||||
|
||||
sheetFields.emplace_back( newField );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sheet->GetFields()[SHEETNAME].SetText( wxT( "Untitled Sheet" ) );
|
||||
@ -2915,23 +2964,22 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
m_frame->AddToScreen( sheet );
|
||||
c.Added( sheet, m_frame->GetScreen() );
|
||||
|
||||
// isDrawSheetCopy is only true when the sheet placement is coming from the design blocks
|
||||
// placement. So, we need to respect the design block annotation options in that case.
|
||||
if( !isDrawSheetCopy || !cfg->m_DesignBlockChooserPanel.keep_annotations )
|
||||
// This convoluted logic means we always annotate unless we are drawing a copy/design block
|
||||
// and the user has explicitly requested we keep the annotations via checkbox
|
||||
EESCHEMA_SETTINGS::PANEL_ANNOTATE& annotate = cfg->m_AnnotatePanel;
|
||||
|
||||
if( annotate.automatic
|
||||
&& !( ( isDrawSheetCopy || isDrawSheetFromDesignBlock )
|
||||
&& cfg->m_DesignBlockChooserPanel.keep_annotations ) )
|
||||
{
|
||||
EESCHEMA_SETTINGS::PANEL_ANNOTATE& annotate = cfg->m_AnnotatePanel;
|
||||
// Annotation will remove this from selection, but we add it back later
|
||||
m_selectionTool->AddItemToSel( sheet );
|
||||
|
||||
if( annotate.automatic )
|
||||
{
|
||||
// Annotation will remove this from selection, but we add it back later
|
||||
m_selectionTool->AddItemToSel( sheet );
|
||||
|
||||
NULL_REPORTER reporter;
|
||||
m_frame->AnnotateSymbols(
|
||||
&c, ANNOTATE_SELECTION, (ANNOTATE_ORDER_T) annotate.sort_order,
|
||||
(ANNOTATE_ALGO_T) annotate.method, true /* recursive */,
|
||||
schSettings.m_AnnotateStartNum, true, false, reporter );
|
||||
}
|
||||
NULL_REPORTER reporter;
|
||||
m_frame->AnnotateSymbols(
|
||||
&c, ANNOTATE_SELECTION, (ANNOTATE_ORDER_T) annotate.sort_order,
|
||||
(ANNOTATE_ALGO_T) annotate.method, true /* recursive */,
|
||||
schSettings.m_AnnotateStartNum, true, false, reporter );
|
||||
}
|
||||
|
||||
c.Push( isDrawSheetCopy ? "Import Sheet Copy" : "Draw Sheet" );
|
||||
@ -2995,9 +3043,6 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
getViewControls()->CaptureCursor( false );
|
||||
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||
|
||||
// We own the string if we're importing a sheet
|
||||
delete filename;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3164,7 +3209,8 @@ void SCH_DRAWING_TOOLS::setTransitions()
|
||||
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeHierLabel.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeGlobalLabel.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::DrawSheet, EE_ACTIONS::drawSheet.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::DrawSheet, EE_ACTIONS::drawSheetCopy.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::DrawSheet, EE_ACTIONS::drawSheetFromFile.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::DrawSheet, EE_ACTIONS::drawSheetFromDesignBlock.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeSheetPin.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::ImportSheet, EE_ACTIONS::placeDesignBlock.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::ImportSheet, EE_ACTIONS::importSheet.MakeEvent() );
|
||||
|
Loading…
Reference in New Issue
Block a user