mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-03-30 06:56:57 +00:00
Add ability to embed files in various elements
Schematics, symbols, boards and footprints all get the ability to store files inside their file structures. File lookups now have a kicad-embed:// URI to allow various parts of KiCad to refer to files stored in this manner. kicad-embed://datasheet.pdf references the file named "datasheet.pdf" embedded in the document. Embeds are allowed in schematics, boards, symbols and footprints. Currently supported embeddings are Datasheets, 3D Models and drawingsheets Fixes https://gitlab.com/kicad/code/kicad/-/issues/6918 Fixes https://gitlab.com/kicad/code/kicad/-/issues/2376 Fixes https://gitlab.com/kicad/code/kicad/-/issues/17827
This commit is contained in:
parent
8d0c629f37
commit
77797103f7
3d-viewer
CMakeLists.txtcmake
common
CMakeLists.txt
dialogs
dialog_embed_files.cppdialog_page_settings.cpppanel_embedded_files.cpppanel_embedded_files.hpanel_embedded_files_base.cpppanel_embedded_files_base.fbppanel_embedded_files_base.h
drawing_sheet
dsnlexer.cppeda_doc.cppembedded_files.cppembedded_files.keywordsfilename_resolver.cppfont
io/altium
pcb.keywordstool
widgets
wildcards_and_files_ext.cppeeschema
dialogs
dialog_eeschema_page_settings.cppdialog_eeschema_page_settings.hdialog_label_properties.cppdialog_lib_symbol_properties.cppdialog_lib_symbol_properties.hdialog_schematic_setup.cppdialog_schematic_setup.hdialog_sheet_properties.cppdialog_symbol_fields_table.cppdialog_symbol_properties.cpp
eeschema_config.cppeeschema_jobs_handler.cppfields_grid_table.cppfields_grid_table.hfiles-io.cpplib_symbol.cpplib_symbol.hsch_edit_frame.cppsch_edit_frame.hsch_file_versions.hsch_io/kicad_sexpr
sch_io_kicad_sexpr.cppsch_io_kicad_sexpr_lib_cache.cppsch_io_kicad_sexpr_lib_cache.hsch_io_kicad_sexpr_parser.cppsch_io_kicad_sexpr_parser.h
sch_screen.cppsch_screen.hschematic.cppschematic.hschematic.keywordssymbol_editor
tools
widgets
include
dialogs
dsnlexer.heda_doc.heda_item.hembedded_files.hfilename_resolver.hfont
tool
widgets
wildcards_and_files_ext.hpagelayout_editor/tools
pcbnew
board.cppboard.hpcbnew_config.cpppcbnew_jobs_handler.cpp
dialogs
dialog_board_setup.cppdialog_board_setup.hdialog_footprint_properties.cppdialog_footprint_properties.hdialog_footprint_properties_fp_editor.cppdialog_global_edit_text_and_graphics.cpppanel_fp_properties_3d_model.cpp
exporters
files.cppfootprint.cppfootprint.hfootprint_edit_frame.cpppcb_edit_frame.cpppcb_edit_frame.hpcb_fields_grid_table.cpppcb_io
altium
CMakeLists.txtaltium_parser_pcb.cppaltium_parser_pcb.haltium_pcb.cppaltium_pcb.haltium_pcb_compound_file.cppaltium_pcb_compound_file.hpcb_io_altium_circuit_maker.cpppcb_io_altium_circuit_studio.cpppcb_io_altium_designer.cpppcb_io_altium_designer.hpcb_io_solidworks.cpp
kicad_sexpr
python/scripting
tools
widgets
qa/tests/common
@ -202,12 +202,12 @@ S3D_CACHE::~S3D_CACHE()
|
||||
|
||||
|
||||
SCENEGRAPH* S3D_CACHE::load( const wxString& aModelFile, const wxString& aBasePath,
|
||||
S3D_CACHE_ENTRY** aCachePtr )
|
||||
S3D_CACHE_ENTRY** aCachePtr, const EMBEDDED_FILES* aEmbeddedFiles )
|
||||
{
|
||||
if( aCachePtr )
|
||||
*aCachePtr = nullptr;
|
||||
|
||||
wxString full3Dpath = m_FNResolver->ResolvePath( aModelFile, aBasePath );
|
||||
wxString full3Dpath = m_FNResolver->ResolvePath( aModelFile, aBasePath, aEmbeddedFiles );
|
||||
|
||||
if( full3Dpath.empty() )
|
||||
{
|
||||
@ -272,9 +272,9 @@ SCENEGRAPH* S3D_CACHE::load( const wxString& aModelFile, const wxString& aBasePa
|
||||
}
|
||||
|
||||
|
||||
SCENEGRAPH* S3D_CACHE::Load( const wxString& aModelFile, const wxString& aBasePath )
|
||||
SCENEGRAPH* S3D_CACHE::Load( const wxString& aModelFile, const wxString& aBasePath, const EMBEDDED_FILES* aEmbeddedFiles )
|
||||
{
|
||||
return load( aModelFile, aBasePath );
|
||||
return load( aModelFile, aBasePath, nullptr, aEmbeddedFiles );
|
||||
}
|
||||
|
||||
|
||||
@ -631,10 +631,11 @@ void S3D_CACHE::ClosePlugins()
|
||||
}
|
||||
|
||||
|
||||
S3DMODEL* S3D_CACHE::GetModel( const wxString& aModelFileName, const wxString& aBasePath )
|
||||
S3DMODEL* S3D_CACHE::GetModel( const wxString& aModelFileName, const wxString& aBasePath,
|
||||
const EMBEDDED_FILES* aEmbeddedFiles )
|
||||
{
|
||||
S3D_CACHE_ENTRY* cp = nullptr;
|
||||
SCENEGRAPH* sp = load( aModelFileName, aBasePath,&cp );
|
||||
SCENEGRAPH* sp = load( aModelFileName, aBasePath, &cp, aEmbeddedFiles );
|
||||
|
||||
if( !sp )
|
||||
return nullptr;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <project.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
class EMBEDDED_FILES;
|
||||
class PGM_BASE;
|
||||
class S3D_CACHE_ENTRY;
|
||||
class SCENEGRAPH;
|
||||
@ -93,9 +94,10 @@ public:
|
||||
*
|
||||
* @param aModelFile is the partial or full path to the model to be loaded.
|
||||
* @param aBasePath is the path to search for any relative files
|
||||
* @param aEmbeddedFiles is a pointer to the embedded files list.
|
||||
* @return true if the model was successfully loaded, otherwise false.
|
||||
*/
|
||||
SCENEGRAPH* Load( const wxString& aModelFile, const wxString& aBasePath );
|
||||
SCENEGRAPH* Load( const wxString& aModelFile, const wxString& aBasePath, const EMBEDDED_FILES* aEmbeddedFiles );
|
||||
|
||||
FILENAME_RESOLVER* GetResolver() noexcept;
|
||||
|
||||
@ -123,9 +125,11 @@ public:
|
||||
* structure for display by a renderer.
|
||||
*
|
||||
* @param aModelFileName is the full path to the model to be loaded.
|
||||
* @param aBasePath is the path to search for any relative files.
|
||||
* @param aEmbeddedFiles is a pointer to the embedded files list.
|
||||
* @return is a pointer to the render data or NULL if not available.
|
||||
*/
|
||||
S3DMODEL* GetModel( const wxString& aModelFileName, const wxString& aBasePath );
|
||||
S3DMODEL* GetModel( const wxString& aModelFileName, const wxString& aBasePath, const EMBEDDED_FILES* aEmbeddedFiles );
|
||||
|
||||
/**
|
||||
* Delete up old cache files in cache directory.
|
||||
@ -165,7 +169,9 @@ private:
|
||||
bool saveCacheData( S3D_CACHE_ENTRY* aCacheItem );
|
||||
|
||||
// the real load function (can supply a cache entry pointer to member functions)
|
||||
SCENEGRAPH* load( const wxString& aModelFile, const wxString& aBasePath, S3D_CACHE_ENTRY** aCachePtr = nullptr );
|
||||
SCENEGRAPH* load( const wxString& aModelFile, const wxString& aBasePath,
|
||||
S3D_CACHE_ENTRY** aCachePtr = nullptr,
|
||||
const EMBEDDED_FILES* aEmbeddedFiles = nullptr );
|
||||
|
||||
/// cache entries
|
||||
std::list< S3D_CACHE_ENTRY* > m_CacheList;
|
||||
|
@ -156,7 +156,7 @@ void EDA_3D_MODEL_VIEWER::Set3DModel( const wxString& aModelPathName)
|
||||
|
||||
if( m_cacheManager )
|
||||
{
|
||||
const S3DMODEL* model = m_cacheManager->GetModel( aModelPathName, wxEmptyString );
|
||||
const S3DMODEL* model = m_cacheManager->GetModel( aModelPathName, wxEmptyString, nullptr );
|
||||
|
||||
if( model )
|
||||
Set3DModel( (const S3DMODEL &)*model );
|
||||
|
@ -66,7 +66,9 @@ public:
|
||||
/**
|
||||
* Set this model to be displayed.
|
||||
*
|
||||
* @param aModelPathName 3D model path name.
|
||||
* N.B. This will not load a model from the internal cache. Only from on disk.
|
||||
*
|
||||
* @param aModelPathName 3D model path name. Must be a file on disk.
|
||||
*/
|
||||
void Set3DModel( const wxString& aModelPathName );
|
||||
|
||||
|
@ -974,7 +974,7 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
|
||||
{
|
||||
// It is not present, try get it from cache
|
||||
const S3DMODEL* modelPtr =
|
||||
m_boardAdapter.Get3dCacheManager()->GetModel( fp_model.m_Filename, footprintBasePath );
|
||||
m_boardAdapter.Get3dCacheManager()->GetModel( fp_model.m_Filename, footprintBasePath, footprint );
|
||||
|
||||
// only add it if the return is not NULL
|
||||
if( modelPtr )
|
||||
|
@ -1247,8 +1247,6 @@ void RENDER_3D_RAYTRACE_BASE::load3DModels( CONTAINER_3D& aDstContainer, bool aS
|
||||
|
||||
// Get the list of model files for this model
|
||||
S3D_CACHE* cacheMgr = m_boardAdapter.Get3dCacheManager();
|
||||
auto sM = fp->Models().begin();
|
||||
auto eM = fp->Models().end();
|
||||
|
||||
wxString libraryName = fp->GetFPID().GetLibNickname();
|
||||
|
||||
@ -1271,44 +1269,38 @@ void RENDER_3D_RAYTRACE_BASE::load3DModels( CONTAINER_3D& aDstContainer, bool aS
|
||||
}
|
||||
}
|
||||
|
||||
while( sM != eM )
|
||||
for( FP_3DMODEL& model : fp->Models() )
|
||||
{
|
||||
if( ( static_cast<float>( sM->m_Opacity ) > FLT_EPSILON )
|
||||
&& ( sM->m_Show && !sM->m_Filename.empty() ) )
|
||||
// get it from cache
|
||||
const S3DMODEL* modelPtr =
|
||||
cacheMgr->GetModel( model.m_Filename, footprintBasePath, fp );
|
||||
|
||||
// only add it if the return is not NULL.
|
||||
if( modelPtr )
|
||||
{
|
||||
// get it from cache
|
||||
const S3DMODEL* modelPtr =
|
||||
cacheMgr->GetModel( sM->m_Filename, footprintBasePath );
|
||||
glm::mat4 modelMatrix = fpMatrix;
|
||||
|
||||
// only add it if the return is not NULL.
|
||||
if( modelPtr )
|
||||
{
|
||||
glm::mat4 modelMatrix = fpMatrix;
|
||||
modelMatrix = glm::translate( modelMatrix,
|
||||
SFVEC3F( model.m_Offset.x, model.m_Offset.y, model.m_Offset.z ) );
|
||||
|
||||
modelMatrix = glm::translate( modelMatrix,
|
||||
SFVEC3F( sM->m_Offset.x, sM->m_Offset.y, sM->m_Offset.z ) );
|
||||
modelMatrix = glm::rotate( modelMatrix,
|
||||
(float) -( model.m_Rotation.z / 180.0f ) * glm::pi<float>(),
|
||||
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
|
||||
|
||||
modelMatrix = glm::rotate( modelMatrix,
|
||||
(float) -( sM->m_Rotation.z / 180.0f ) * glm::pi<float>(),
|
||||
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
|
||||
modelMatrix = glm::rotate( modelMatrix,
|
||||
(float) -( model.m_Rotation.y / 180.0f ) * glm::pi<float>(),
|
||||
SFVEC3F( 0.0f, 1.0f, 0.0f ) );
|
||||
|
||||
modelMatrix = glm::rotate( modelMatrix,
|
||||
(float) -( sM->m_Rotation.y / 180.0f ) * glm::pi<float>(),
|
||||
SFVEC3F( 0.0f, 1.0f, 0.0f ) );
|
||||
modelMatrix = glm::rotate( modelMatrix,
|
||||
(float) -( model.m_Rotation.x / 180.0f ) * glm::pi<float>(),
|
||||
SFVEC3F( 1.0f, 0.0f, 0.0f ) );
|
||||
|
||||
modelMatrix = glm::rotate( modelMatrix,
|
||||
(float) -( sM->m_Rotation.x / 180.0f ) * glm::pi<float>(),
|
||||
SFVEC3F( 1.0f, 0.0f, 0.0f ) );
|
||||
modelMatrix = glm::scale( modelMatrix,
|
||||
SFVEC3F( model.m_Scale.x, model.m_Scale.y, model.m_Scale.z ) );
|
||||
|
||||
modelMatrix = glm::scale( modelMatrix,
|
||||
SFVEC3F( sM->m_Scale.x, sM->m_Scale.y, sM->m_Scale.z ) );
|
||||
|
||||
addModels( aDstContainer, modelPtr, modelMatrix, (float) sM->m_Opacity,
|
||||
aSkipMaterialInformation, boardItem );
|
||||
}
|
||||
addModels( aDstContainer, modelPtr, modelMatrix, (float) model.m_Opacity,
|
||||
aSkipMaterialInformation, boardItem );
|
||||
}
|
||||
|
||||
++sM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ set(3D-VIEWER_SRCS
|
||||
common_ogl/ogl_utils.cpp
|
||||
3d_fastmath.cpp
|
||||
3d_math.cpp
|
||||
dialogs/3d_cache_dialogs.cpp
|
||||
dialogs/appearance_controls_3D.cpp
|
||||
dialogs/appearance_controls_3D_base.cpp
|
||||
dialogs/dialog_select_3d_model_base.cpp
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
* Copyright (C) 2020-2021 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_configure_paths.h>
|
||||
|
||||
#include "3d_info.h"
|
||||
#include "3d_cache.h"
|
||||
#include "3d_cache_dialogs.h"
|
||||
#include "dialog_select_3d_model.h"
|
||||
|
||||
|
||||
bool S3D::Select3DModel( wxWindow* aParent, S3D_CACHE* aCache, wxString& prevModelSelectDir,
|
||||
int& prevModelWildcard, FP_3DMODEL* aModel )
|
||||
{
|
||||
if( nullptr == aModel )
|
||||
return false;
|
||||
|
||||
DIALOG_SELECT_3DMODEL dm( aParent, aCache, aModel, prevModelSelectDir, prevModelWildcard );
|
||||
|
||||
// Use QuasiModal so that Configure3DPaths (and its help window) will work
|
||||
return dm.ShowQuasiModal() == wxID_OK;
|
||||
}
|
||||
|
||||
|
||||
bool S3D::Configure3DPaths( wxWindow* aParent, FILENAME_RESOLVER* aResolver )
|
||||
{
|
||||
DIALOG_CONFIGURE_PATHS dlg( aParent );
|
||||
|
||||
// Use QuasiModal so that HTML help window will work
|
||||
return( dlg.ShowQuasiModal() == wxID_OK );
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef CACHE_DIALOGS_3D_H
|
||||
#define CACHE_DIALOGS_3D_H
|
||||
|
||||
#include <wx/window.h>
|
||||
|
||||
class S3D_CACHE;
|
||||
class FILENAME_RESOLVER;
|
||||
|
||||
namespace S3D
|
||||
{
|
||||
bool Select3DModel( wxWindow* aParent, S3D_CACHE* aCache, wxString& prevModelSelectDir,
|
||||
int& prevModelWildcard, FP_3DMODEL* aModel );
|
||||
|
||||
bool Configure3DPaths( wxWindow* aParent, FILENAME_RESOLVER* aResolver );
|
||||
}
|
||||
|
||||
#endif // CACHE_DIALOGS_3D_H
|
@ -29,9 +29,9 @@
|
||||
#include "project.h"
|
||||
#include "3d_cache/3d_info.h"
|
||||
#include "3d_cache/3d_cache.h"
|
||||
#include "3d_cache_dialogs.h"
|
||||
#include <3d_model_viewer/eda_3d_model_viewer.h>
|
||||
#include <common_ogl/ogl_attr_list.h>
|
||||
#include <dialogs/dialog_configure_paths.h>
|
||||
#include <filename_resolver.h>
|
||||
#include <pcbnew/footprint.h>
|
||||
#include <wx_filename.h>
|
||||
@ -197,7 +197,9 @@ void DIALOG_SELECT_3DMODEL::SetRootDir( wxCommandEvent& event )
|
||||
|
||||
void DIALOG_SELECT_3DMODEL::Cfg3DPaths( wxCommandEvent& event )
|
||||
{
|
||||
if( S3D::Configure3DPaths( this, m_resolver ) )
|
||||
DIALOG_CONFIGURE_PATHS dlg( this );
|
||||
|
||||
if( dlg.ShowQuasiModal() == wxID_OK )
|
||||
updateDirChoiceList();
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,11 @@ public:
|
||||
void SetRootDir( wxCommandEvent& event ) override;
|
||||
void Cfg3DPaths( wxCommandEvent& event ) override;
|
||||
|
||||
bool IsEmbedded3DModel() const
|
||||
{
|
||||
return m_EmbedModelCb->IsChecked();
|
||||
}
|
||||
|
||||
private:
|
||||
void updateDirChoiceList( void );
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf0)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@ -35,6 +35,12 @@ DIALOG_SELECT_3D_MODEL_BASE::DIALOG_SELECT_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
|
||||
bSizerLeft->Add( m_FileTree, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer7;
|
||||
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
bSizerLeft->Add( bSizer7, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelLeft->SetSizer( bSizerLeft );
|
||||
m_panelLeft->Layout();
|
||||
@ -70,6 +76,15 @@ DIALOG_SELECT_3D_MODEL_BASE::DIALOG_SELECT_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
|
||||
bSizerMain->Add( bSizerLower, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer6;
|
||||
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_EmbedModelCb = new wxCheckBox( this, wxID_ANY, _("Embed Model"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer6->Add( m_EmbedModelCb, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizer6->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
||||
@ -77,7 +92,10 @@ DIALOG_SELECT_3D_MODEL_BASE::DIALOG_SELECT_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
bSizer6->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizer6, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf0)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@ -26,6 +26,7 @@
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -47,6 +48,7 @@ class DIALOG_SELECT_3D_MODEL_BASE : public DIALOG_SHIM
|
||||
wxStaticText* m_stDirChoice;
|
||||
wxChoice* m_dirChoices;
|
||||
wxButton* m_cfgPathsButt;
|
||||
wxCheckBox* m_EmbedModelCb;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
@ -92,6 +92,12 @@ public:
|
||||
*/
|
||||
void UpdateDummyFootprint( bool aRelaodRequired = true );
|
||||
|
||||
/**
|
||||
* Get the dummy footprint that is used for previewing the 3D model.
|
||||
* We use this to hold the temporary 3D model shapes.
|
||||
*/
|
||||
FOOTPRINT* GetDummyFootprint() const { return m_dummyFootprint; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Load 3D relevant settings from the user configuration
|
||||
|
@ -809,6 +809,11 @@ include_directories( SYSTEM ${GLM_INCLUDE_DIR} )
|
||||
#
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
#
|
||||
# Find Zstd library, required
|
||||
#
|
||||
find_package(ZSTD REQUIRED)
|
||||
|
||||
#
|
||||
# Find libcurl, required
|
||||
#
|
||||
|
@ -145,6 +145,7 @@ namespace ${enum}
|
||||
// these first few are negative special ones for syntax, and are
|
||||
// inherited from DSNLEXER.
|
||||
T_NONE = DSN_NONE,
|
||||
T_BAR = DSN_BAR, // Also called pipe: '|'
|
||||
T_COMMENT = DSN_COMMENT,
|
||||
T_STRING_QUOTE = DSN_STRING_QUOTE,
|
||||
T_QUOTE_DEF = DSN_QUOTE_DEF,
|
||||
|
41
cmake/FindZSTD.cmake
Normal file
41
cmake/FindZSTD.cmake
Normal file
@ -0,0 +1,41 @@
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#
|
||||
# - Try to find Facebook zstd library
|
||||
# This will define
|
||||
# ZSTD_FOUND
|
||||
# ZSTD_INCLUDE_DIR
|
||||
# ZSTD_LIBRARY
|
||||
#
|
||||
|
||||
find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
|
||||
|
||||
find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd zstd_staticd)
|
||||
find_library(ZSTD_LIBRARY_RELEASE NAMES zstd zstd_static)
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
SELECT_LIBRARY_CONFIGURATIONS(ZSTD)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
ZSTD DEFAULT_MSG
|
||||
ZSTD_LIBRARY ZSTD_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if (ZSTD_FOUND)
|
||||
message(STATUS "Found Zstd: ${ZSTD_LIBRARY}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY)
|
@ -195,6 +195,8 @@ target_link_libraries( kicommon
|
||||
nlohmann_json
|
||||
fmt::fmt
|
||||
CURL::libcurl
|
||||
picosha2
|
||||
zstd
|
||||
${wxWidgets_LIBRARIES}
|
||||
${LIBGIT2_LIBRARIES}
|
||||
|
||||
@ -267,6 +269,7 @@ target_include_directories( kicommon
|
||||
$<TARGET_PROPERTY:pegtl,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:expected,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:kiapi,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:picosha2,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
add_dependencies( kicommon pegtl version_header )
|
||||
@ -304,6 +307,7 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/dialog_configure_paths_base.cpp
|
||||
dialogs/dialog_display_html_text_base.cpp
|
||||
dialogs/dialog_edit_library_tables.cpp
|
||||
dialogs/dialog_embed_files.cpp
|
||||
dialogs/dialog_global_lib_table_config.cpp
|
||||
dialogs/dialog_global_lib_table_config_base.cpp
|
||||
dialogs/dialog_grid_settings.cpp
|
||||
@ -338,6 +342,8 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/panel_color_settings.cpp
|
||||
dialogs/panel_common_settings.cpp
|
||||
dialogs/panel_common_settings_base.cpp
|
||||
dialogs/panel_embedded_files.cpp
|
||||
dialogs/panel_embedded_files_base.cpp
|
||||
dialogs/panel_gal_display_options.cpp
|
||||
dialogs/panel_hotkeys_editor.cpp
|
||||
dialogs/panel_image_editor.cpp
|
||||
@ -534,6 +540,7 @@ set( COMMON_SRCS
|
||||
eda_shape.cpp
|
||||
eda_text.cpp
|
||||
eda_tools.cpp
|
||||
embedded_files.cpp
|
||||
env_paths.cpp
|
||||
executable_names.cpp
|
||||
filename_resolver.cpp
|
||||
@ -589,6 +596,7 @@ set( COMMON_SRCS
|
||||
tool/edit_constraints.cpp
|
||||
tool/edit_points.cpp
|
||||
tool/editor_conditions.cpp
|
||||
tool/embed_tool.cpp
|
||||
tool/grid_helper.cpp
|
||||
tool/grid_menu.cpp
|
||||
tool/picker_tool.cpp
|
||||
@ -921,6 +929,17 @@ make_lexer_export(
|
||||
kicommon.h
|
||||
)
|
||||
|
||||
# auto-generate embedded files lexer and keywords
|
||||
make_lexer_export(
|
||||
kicommon
|
||||
embedded_files.keywords
|
||||
embedded_files_lexer.h
|
||||
embedded_files_keywords.cpp
|
||||
EMBEDDED_FILES_T
|
||||
KICOMMON_API
|
||||
kicommon.h
|
||||
)
|
||||
|
||||
# This one gets made only when testing.
|
||||
# to build it, first enable #define STAND_ALONE at top of dsnlexer.cpp
|
||||
add_executable( dsntest EXCLUDE_FROM_ALL dsnlexer.cpp )
|
||||
|
78
common/dialogs/dialog_embed_files.cpp
Normal file
78
common/dialogs/dialog_embed_files.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
|
||||
#include <dialogs/dialog_embed_files.h>
|
||||
|
||||
|
||||
DIALOG_EMBED_FILES::DIALOG_EMBED_FILES( wxWindow* aParent, const wxString& aTitle ) :
|
||||
DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
|
||||
m_contentPanel( nullptr )
|
||||
{
|
||||
// Construction delayed until after panel is installed
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_EMBED_FILES::InstallPanel( wxPanel* aPanel )
|
||||
{
|
||||
m_contentPanel = aPanel;
|
||||
|
||||
// Now perform the body of the constructor
|
||||
auto mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
SetSizer( mainSizer );
|
||||
|
||||
mainSizer->Add( m_contentPanel, 1, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 5 );
|
||||
m_contentPanel->SetMinSize( FromDIP( wxSize( 1000, 600 ) ) );
|
||||
|
||||
auto sdbSizer = new wxStdDialogButtonSizer();
|
||||
auto sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
sdbSizer->AddButton( sdbSizerOK );
|
||||
auto sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
sdbSizer->AddButton( sdbSizerCancel );
|
||||
sdbSizer->Realize();
|
||||
|
||||
mainSizer->Add( sdbSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
SetupStandardButtons();
|
||||
|
||||
finishDialogSettings();
|
||||
|
||||
// On some windows manager (Unity, XFCE), this dialog is not always raised, depending
|
||||
// on how the dialog is run.
|
||||
Raise();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_EMBED_FILES::TransferDataToWindow()
|
||||
{
|
||||
return m_contentPanel->TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_EMBED_FILES::TransferDataFromWindow()
|
||||
{
|
||||
/**
|
||||
* N.B. *do not* call wxDialog::TransferDataFromWindow() in the dialog code.
|
||||
*/
|
||||
return m_contentPanel->TransferDataFromWindow();
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include <dialogs/dialog_page_settings.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <eda_item.h>
|
||||
#include <embedded_files.h>
|
||||
#include <filename_resolver.h>
|
||||
#include <gr_basic.h>
|
||||
#include <kiface_base.h>
|
||||
#include <macros.h>
|
||||
@ -38,6 +40,7 @@
|
||||
#include <drawing_sheet/ds_painter.h>
|
||||
#include <string_utils.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <widgets/filedlg_open_embed_file.h>
|
||||
#include <wx/valgen.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/filedlg.h>
|
||||
@ -75,7 +78,7 @@ static const wxString pageFmts[] =
|
||||
// to be recognized in code
|
||||
};
|
||||
|
||||
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils,
|
||||
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, EMBEDDED_FILES* aEmbeddedFiles, double aIuPerMils,
|
||||
const VECTOR2D& aMaxUserSizeMils ) :
|
||||
DIALOG_PAGES_SETTINGS_BASE( aParent ),
|
||||
m_parent( aParent ),
|
||||
@ -83,6 +86,7 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aI
|
||||
m_initialized( false ),
|
||||
m_pageBitmap( nullptr ),
|
||||
m_iuPerMils( aIuPerMils ),
|
||||
m_embeddedFiles( aEmbeddedFiles ),
|
||||
m_customSizeX( aParent, m_userSizeXLabel, m_userSizeXCtrl, m_userSizeXUnits ),
|
||||
m_customSizeY( aParent, m_userSizeYLabel, m_userSizeYCtrl, m_userSizeYUnits )
|
||||
{
|
||||
@ -114,6 +118,10 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aI
|
||||
m_staticTextTitleBlock->SetLabel( _( "Title Block" ) );
|
||||
}
|
||||
|
||||
m_filenameResolver = new FILENAME_RESOLVER;
|
||||
m_filenameResolver->SetProject( &Prj() );
|
||||
m_filenameResolver->SetProgramBase( &Pgm() );
|
||||
|
||||
SetupStandardButtons();
|
||||
|
||||
Centre();
|
||||
@ -467,7 +475,8 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
|
||||
|
||||
if( fileName != BASE_SCREEN::m_DrawingSheetFileName )
|
||||
{
|
||||
wxString fullFileName = DS_DATA_MODEL::ResolvePath( fileName, m_projectPath );
|
||||
|
||||
wxString fullFileName = m_filenameResolver->ResolvePath( fileName, m_projectPath, m_embeddedFiles );
|
||||
|
||||
BASE_SCREEN::m_DrawingSheetFileName = fileName;
|
||||
|
||||
@ -794,19 +803,30 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
// Display a file picker dialog
|
||||
FILEDLG_OPEN_EMBED_FILE customize;
|
||||
wxFileDialog fileDialog( this, _( "Drawing Sheet File" ), path, name,
|
||||
FILEEXT::DrawingSheetFileWildcard(),
|
||||
wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( m_embeddedFiles )
|
||||
fileDialog.SetCustomizeHook( customize );
|
||||
|
||||
if( fileDialog.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
wxString fileName = fileDialog.GetPath();
|
||||
wxString shortFileName;
|
||||
|
||||
// Try to use a project-relative path first:
|
||||
if( !m_projectPath.IsEmpty() && fileName.StartsWith( m_projectPath ) )
|
||||
if( m_embeddedFiles && customize.GetEmbed() )
|
||||
{
|
||||
fn.Assign( fileName );
|
||||
EMBEDDED_FILES::EMBEDDED_FILE* result = m_embeddedFiles->AddFile( fn, false );
|
||||
shortFileName = result->GetLink();
|
||||
fileName = m_embeddedFiles->GetTempFileName( result->name ).GetFullPath();
|
||||
}
|
||||
else if( !m_projectPath.IsEmpty() && fileName.StartsWith( m_projectPath ) )
|
||||
{
|
||||
// Try to use a project-relative path
|
||||
fn = wxFileName( fileName );
|
||||
fn.MakeRelativeTo( m_projectPath );
|
||||
shortFileName = fn.GetFullPath();
|
||||
|
314
common/dialogs/panel_embedded_files.cpp
Normal file
314
common/dialogs/panel_embedded_files.cpp
Normal file
@ -0,0 +1,314 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 3
|
||||
* 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/gpl-3.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 3 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <dialogs/panel_embedded_files.h>
|
||||
#include <embedded_files.h>
|
||||
#include <kidialog.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <widgets/wx_grid.h>
|
||||
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/dirdlg.h>
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/menu.h>
|
||||
|
||||
PANEL_EMBEDDED_FILES::PANEL_EMBEDDED_FILES( wxWindow* parent, EMBEDDED_FILES* aFiles ) :
|
||||
PANEL_EMBEDDED_FILES_BASE( parent ),
|
||||
m_files( aFiles )
|
||||
{
|
||||
m_localFiles = new EMBEDDED_FILES();
|
||||
|
||||
for( auto& [name, file] : m_files->EmbeddedFileMap() )
|
||||
{
|
||||
EMBEDDED_FILES::EMBEDDED_FILE* newFile = new EMBEDDED_FILES::EMBEDDED_FILE( *file );
|
||||
m_localFiles->AddFile( newFile );
|
||||
}
|
||||
|
||||
// Set up the standard buttons
|
||||
m_delete_button->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
|
||||
m_browse_button->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
|
||||
m_files_grid->SetMargins( 0 - wxSYS_VSCROLL_X, 0 );
|
||||
m_files_grid->EnableAlternateRowColors();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_EMBEDDED_FILES::onSize( wxSizeEvent& event )
|
||||
{
|
||||
resizeGrid();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_EMBEDDED_FILES::resizeGrid()
|
||||
{
|
||||
int panel_width = GetClientRect().GetWidth();
|
||||
int first_width = m_files_grid->GetColSize( 0 );
|
||||
int second_width = m_files_grid->GetColSize( 1 );
|
||||
|
||||
double ratio;
|
||||
|
||||
if( first_width + second_width > 0 )
|
||||
ratio = (double)first_width / (double)( first_width + second_width );
|
||||
else
|
||||
ratio = 0.3;
|
||||
|
||||
|
||||
m_files_grid->SetColSize( 0, panel_width * ratio );
|
||||
m_files_grid->SetColSize( 1, panel_width * ( 1 - ratio ) );
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_EMBEDDED_FILES::onGridRightClick( wxGridEvent& event )
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append( wxID_COPY, _( "Copy Embedded Reference" ) );
|
||||
|
||||
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
|
||||
[&]( wxCommandEvent& )
|
||||
{
|
||||
int row = event.GetRow();
|
||||
if( row >= 0 && row < m_files_grid->GetNumberRows() )
|
||||
{
|
||||
wxString cellValue = m_files_grid->GetCellValue( row, 1 );
|
||||
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
wxTheClipboard->SetData( new wxTextDataObject( cellValue ) );
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
}
|
||||
}, wxID_COPY );
|
||||
|
||||
PopupMenu( &menu );
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_EMBEDDED_FILES::TransferDataToWindow()
|
||||
{
|
||||
m_files_grid->ClearGrid();
|
||||
|
||||
if( m_files_grid->GetNumberRows() > 0 )
|
||||
m_files_grid->DeleteRows( 0, m_files_grid->GetNumberRows() );
|
||||
|
||||
int ii = 0;
|
||||
for( auto& [name, file] : m_localFiles->EmbeddedFileMap() )
|
||||
{
|
||||
while( m_files_grid->GetNumberRows() < ii + 1 )
|
||||
m_files_grid->AppendRows( 1 );
|
||||
|
||||
m_files_grid->SetCellValue( ii, 0, name );
|
||||
m_files_grid->SetCellValue( ii, 1, file->GetLink() );
|
||||
|
||||
ii++;
|
||||
}
|
||||
|
||||
m_cbEmbedFonts->SetValue( m_files->GetAreFontsEmbedded() );
|
||||
|
||||
resizeGrid();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_EMBEDDED_FILES::TransferDataFromWindow()
|
||||
{
|
||||
m_files->ClearEmbeddedFiles();
|
||||
|
||||
std::vector<EMBEDDED_FILES::EMBEDDED_FILE*> files;
|
||||
|
||||
for( auto it = m_localFiles->EmbeddedFileMap().begin(); it != m_localFiles->EmbeddedFileMap().end(); it++ )
|
||||
files.push_back( it->second );
|
||||
|
||||
for( auto& file : files )
|
||||
{
|
||||
m_files->AddFile( file );
|
||||
m_localFiles->RemoveFile( file->name, false );
|
||||
}
|
||||
|
||||
m_files->SetAreFontsEmbedded( m_cbEmbedFonts->IsChecked() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_EMBEDDED_FILES::onAddEmbeddedFile( wxCommandEvent& event )
|
||||
{
|
||||
wxFileDialog fileDialog( this, _( "Select a file to embed" ), wxEmptyString, wxEmptyString,
|
||||
_( "All files|*.*" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( fileDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
wxFileName fileName( fileDialog.GetPath() );
|
||||
wxString name = fileName.GetFullName();
|
||||
|
||||
if( m_localFiles->HasFile( name ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "File '%s' already exists." ),
|
||||
name );
|
||||
|
||||
KIDIALOG errorDlg( m_parent, msg, _( "Confirmation" ),
|
||||
wxOK | wxCANCEL | wxICON_WARNING );
|
||||
errorDlg.SetOKLabel( _( "Overwrite" ) );
|
||||
|
||||
if( errorDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
for( int ii = 0; ii < m_files_grid->GetNumberRows(); ii++ )
|
||||
{
|
||||
if( m_files_grid->GetCellValue( ii, 0 ) == name )
|
||||
{
|
||||
m_files_grid->DeleteRows( ii );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EMBEDDED_FILES::EMBEDDED_FILE* result = m_localFiles->AddFile( fileName, true );
|
||||
|
||||
if( !result )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Failed to add file '%s'." ),
|
||||
name );
|
||||
|
||||
KIDIALOG errorDlg( m_parent, msg, _( "Error" ), wxOK | wxICON_ERROR );
|
||||
errorDlg.ShowModal();
|
||||
return;
|
||||
}
|
||||
|
||||
m_files_grid->AppendRows( 1 );
|
||||
int ii = m_files_grid->GetNumberRows() - 1;
|
||||
m_files_grid->SetCellValue( ii, 0, name );
|
||||
m_files_grid->SetCellValue( ii, 1, result->GetLink() );
|
||||
}
|
||||
}
|
||||
|
||||
void PANEL_EMBEDDED_FILES::onDeleteEmbeddedFile( wxCommandEvent& event )
|
||||
{
|
||||
int row = m_files_grid->GetGridCursorRow();
|
||||
|
||||
if( row < 0 )
|
||||
return;
|
||||
|
||||
wxString name = m_files_grid->GetCellValue( row, 0 );
|
||||
|
||||
m_localFiles->RemoveFile( name );
|
||||
|
||||
m_files_grid->DeleteRows( row );
|
||||
|
||||
if( row < m_files_grid->GetNumberRows() )
|
||||
m_files_grid->SetGridCursor( row, 0 );
|
||||
else if( m_files_grid->GetNumberRows() > 0 )
|
||||
m_files_grid->SetGridCursor( m_files_grid->GetNumberRows() - 1, 0 );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_EMBEDDED_FILES::onExportFiles( wxCommandEvent& event )
|
||||
{
|
||||
wxDirDialog dirDialog( this, _( "Select a directory to export files" ) );
|
||||
|
||||
if( dirDialog.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
wxString path = dirDialog.GetPath();
|
||||
|
||||
for( auto& [name, file] : m_localFiles->EmbeddedFileMap() )
|
||||
{
|
||||
wxFileName fileName( path, name );
|
||||
|
||||
if( fileName.FileExists() )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "File '%s' already exists." ),
|
||||
fileName.GetFullName() );
|
||||
|
||||
KIDIALOG errorDlg( m_parent, msg, _( "Confirmation" ),
|
||||
wxOK | wxCANCEL | wxICON_WARNING );
|
||||
errorDlg.SetOKCancelLabels( _( "Overwrite" ), _( "Skip" ) );
|
||||
errorDlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||
|
||||
if( errorDlg.ShowModal() != wxID_OK )
|
||||
continue;
|
||||
}
|
||||
|
||||
bool skip_file = false;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
if( !fileName.IsDirWritable() )
|
||||
{
|
||||
#ifndef __WXMAC__
|
||||
wxString msg = wxString::Format( _( "Directory '%s' is not writable." ),
|
||||
fileName.GetFullName() );
|
||||
#else
|
||||
wxString msg = wxString::Format( _( "Folder '%s' is not writable." ),
|
||||
fileName.GetPath() );
|
||||
#endif
|
||||
// Don't set a 'do not show again' checkbox for this dialog
|
||||
KIDIALOG errorDlg( m_parent, msg, _( "Error" ), wxYES_NO | wxCANCEL | wxICON_ERROR );
|
||||
errorDlg.SetYesNoCancelLabels( _( "Retry" ), _( "Skip" ), _( "Cancel" ) );
|
||||
|
||||
int result = errorDlg.ShowModal();
|
||||
|
||||
if( result == wxID_CANCEL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if( result == wxID_NO )
|
||||
{
|
||||
skip_file = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( skip_file )
|
||||
continue;
|
||||
|
||||
wxFFile ffile( fileName.GetFullPath(), wxT( "w" ) );
|
||||
|
||||
if( !ffile.IsOpened() )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Failed to open file '%s'." ),
|
||||
fileName.GetFullName() );
|
||||
|
||||
KIDIALOG errorDlg( m_parent, msg, _( "Error" ), wxOK | wxICON_ERROR );
|
||||
errorDlg.ShowModal();
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !ffile.Write( file->decompressedData.data(), file->decompressedData.size() ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Failed to write file '%s'." ),
|
||||
fileName.GetFullName() );
|
||||
|
||||
KIDIALOG errorDlg( m_parent, msg, _( "Error" ), wxOK | wxICON_ERROR );
|
||||
errorDlg.ShowModal();
|
||||
}
|
||||
}
|
||||
}
|
58
common/dialogs/panel_embedded_files.h
Normal file
58
common/dialogs/panel_embedded_files.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 3
|
||||
* 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/gpl-3.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 3 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef PANEL_EMBEDDED_FILES_H
|
||||
#define PANEL_EMBEDDED_FILES_H
|
||||
|
||||
#include "panel_embedded_files_base.h"
|
||||
|
||||
class EMBEDDED_FILES;
|
||||
|
||||
class PANEL_EMBEDDED_FILES : public PANEL_EMBEDDED_FILES_BASE
|
||||
{
|
||||
public:
|
||||
PANEL_EMBEDDED_FILES( wxWindow* parent, EMBEDDED_FILES* aFiles );
|
||||
~PANEL_EMBEDDED_FILES() override {};
|
||||
|
||||
bool TransferDataFromWindow() override;
|
||||
bool TransferDataToWindow() override;
|
||||
bool GetEmbedFonts() const { return m_cbEmbedFonts->GetValue(); }
|
||||
|
||||
protected:
|
||||
|
||||
void onGridRightClick( wxGridEvent& event ) override;
|
||||
void onAddEmbeddedFile( wxCommandEvent& event ) override;
|
||||
void onDeleteEmbeddedFile( wxCommandEvent& event ) override;
|
||||
void onExportFiles( wxCommandEvent& event ) override;
|
||||
void onSize( wxSizeEvent& event ) override;
|
||||
|
||||
private:
|
||||
|
||||
void resizeGrid();
|
||||
|
||||
EMBEDDED_FILES* m_files;
|
||||
EMBEDDED_FILES* m_localFiles;
|
||||
};
|
||||
|
||||
|
||||
#endif // PANEL_EMBEDDED_FILES_H
|
118
common/dialogs/panel_embedded_files_base.cpp
Normal file
118
common/dialogs/panel_embedded_files_base.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/std_bitmap_button.h"
|
||||
#include "widgets/wx_grid.h"
|
||||
|
||||
#include "panel_embedded_files_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_EMBEDDED_FILES_BASE::PANEL_EMBEDDED_FILES_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||
{
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* m_global_sizer;
|
||||
m_global_sizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_files_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
// Grid
|
||||
m_files_grid->CreateGrid( 1, 2 );
|
||||
m_files_grid->EnableEditing( false );
|
||||
m_files_grid->EnableGridLines( true );
|
||||
m_files_grid->EnableDragGridSize( false );
|
||||
m_files_grid->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_files_grid->SetColSize( 0, 440 );
|
||||
m_files_grid->SetColSize( 1, 180 );
|
||||
m_files_grid->EnableDragColMove( false );
|
||||
m_files_grid->EnableDragColSize( true );
|
||||
m_files_grid->SetColLabelValue( 0, _("Filename") );
|
||||
m_files_grid->SetColLabelValue( 1, _("Internal Reference") );
|
||||
m_files_grid->SetColLabelSize( 22 );
|
||||
m_files_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Rows
|
||||
m_files_grid->AutoSizeRows();
|
||||
m_files_grid->EnableDragRowSize( false );
|
||||
m_files_grid->SetRowLabelSize( 0 );
|
||||
m_files_grid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_files_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
||||
m_global_sizer->Add( m_files_grid, 5, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( m_global_sizer, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bButtonsSizer;
|
||||
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_browse_button = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_browse_button->SetToolTip( _("Add embedded file") );
|
||||
|
||||
bButtonsSizer->Add( m_browse_button, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bButtonsSizer->Add( 20, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
m_delete_button = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_delete_button->SetToolTip( _("Remove embedded file") );
|
||||
|
||||
bButtonsSizer->Add( m_delete_button, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bButtonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_export = new wxButton( this, wxID_ANY, _("&Export"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtonsSizer->Add( m_export, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bButtonsSizer, 0, wxEXPAND|wxALL, 3 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_cbEmbedFonts = new wxCheckBox( this, wxID_ANY, _("Embed Fonts"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbEmbedFonts->SetToolTip( _("Store a copy of all fonts used") );
|
||||
|
||||
bSizer4->Add( m_cbEmbedFonts, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bSizer4, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_EMBEDDED_FILES_BASE::onSize ) );
|
||||
m_files_grid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( PANEL_EMBEDDED_FILES_BASE::onGridRightClick ), NULL, this );
|
||||
m_browse_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EMBEDDED_FILES_BASE::onAddEmbeddedFile ), NULL, this );
|
||||
m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EMBEDDED_FILES_BASE::onDeleteEmbeddedFile ), NULL, this );
|
||||
m_export->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EMBEDDED_FILES_BASE::onExportFiles ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_EMBEDDED_FILES_BASE::~PANEL_EMBEDDED_FILES_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_EMBEDDED_FILES_BASE::onSize ) );
|
||||
m_files_grid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( PANEL_EMBEDDED_FILES_BASE::onGridRightClick ), NULL, this );
|
||||
m_browse_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EMBEDDED_FILES_BASE::onAddEmbeddedFile ), NULL, this );
|
||||
m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EMBEDDED_FILES_BASE::onDeleteEmbeddedFile ), NULL, this );
|
||||
m_export->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_EMBEDDED_FILES_BASE::onExportFiles ), NULL, this );
|
||||
|
||||
}
|
559
common/dialogs/panel_embedded_files_base.fbp
Normal file
559
common/dialogs/panel_embedded_files_base.fbp
Normal file
@ -0,0 +1,559 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="18"/>
|
||||
<object class="Project" expanded="true">
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="cpp_class_decoration"></property>
|
||||
<property name="cpp_disconnect_events">1</property>
|
||||
<property name="cpp_event_generation">connect</property>
|
||||
<property name="cpp_help_provider">none</property>
|
||||
<property name="cpp_namespace"></property>
|
||||
<property name="cpp_precompiled_header"></property>
|
||||
<property name="cpp_use_array_enum">0</property>
|
||||
<property name="cpp_use_enum">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="file">panel_embedded_files_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="lua_skip_events">1</property>
|
||||
<property name="lua_ui_table">UI</property>
|
||||
<property name="name">panel_embedded_files</property>
|
||||
<property name="path">.</property>
|
||||
<property name="php_disconnect_events">0</property>
|
||||
<property name="php_disconnect_mode">source_name</property>
|
||||
<property name="php_skip_events">1</property>
|
||||
<property name="python_disconnect_events">0</property>
|
||||
<property name="python_disconnect_mode">source_name</property>
|
||||
<property name="python_image_path_wrapper_function_name"></property>
|
||||
<property name="python_indent_with_spaces"></property>
|
||||
<property name="python_skip_events">1</property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<property name="use_native_eol">0</property>
|
||||
<object class="Panel" expanded="true">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></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="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">-1,-1</property>
|
||||
<property name="name">PANEL_EMBEDDED_FILES_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="subclass">; forward_declare</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">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnSize">onSize</event>
|
||||
<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">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="false">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_global_sizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">5</property>
|
||||
<object class="wxGrid" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="autosize_cols">0</property>
|
||||
<property name="autosize_rows">1</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">"Filename" "Internal Reference"</property>
|
||||
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="cols">2</property>
|
||||
<property name="column_sizes">440,180</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">1</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">0</property>
|
||||
<property name="editing">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">0</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,-1</property>
|
||||
<property name="moveable">0</property>
|
||||
<property name="name">m_files_grid</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">Fixed</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="OnGridCellRightClick">onGridRightClick</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">3</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="false">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bButtonsSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</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">Add Embedded File</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_browse_button</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">-1,-1</property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Add embedded file</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">onAddEmbeddedFile</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="false">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">20</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</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">Delete SelectedFile</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_delete_button</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">-1,-1</property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Remove embedded file</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">onDeleteEmbeddedFile</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="false">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</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">&Export</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_export</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">onExportFiles</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" 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">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</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="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticline1</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">wxLI_HORIZONTAL</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>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer4</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" 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">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</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="checked">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">Embed Fonts</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_cbEmbedFonts</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">Store a copy of all fonts used</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>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user