22 changed files with 894 additions and 76 deletions
-
2common/CMakeLists.txt
-
112common/dialogs/dialog_import_choose_project.cpp
-
53common/dialogs/dialog_import_choose_project.h
-
54common/dialogs/dialog_import_choose_project_base.cpp
-
221common/dialogs/dialog_import_choose_project_base.fbp
-
53common/dialogs/dialog_import_choose_project_base.h
-
73common/plugins/common/plugin_common_choose_project.h
-
79common/plugins/easyedapro/easyedapro_import_utils.cpp
-
6common/plugins/easyedapro/easyedapro_import_utils.h
-
34eeschema/cross-probing.cpp
-
69eeschema/files-io.cpp
-
3eeschema/sch_edit_frame.h
-
22eeschema/sch_plugins/easyedapro/sch_easyedapro_plugin.cpp
-
3eeschema/sch_plugins/easyedapro/sch_easyedapro_plugin.h
-
69kicad/import_proj.cpp
-
5kicad/import_proj.h
-
35pcbnew/cross-probing.cpp
-
23pcbnew/files.cpp
-
3pcbnew/pcb_edit_frame.cpp
-
19pcbnew/pcb_edit_frame.h
-
29pcbnew/plugins/easyedapro/pcb_easyedapro_plugin.cpp
-
3pcbnew/plugins/easyedapro/pcb_easyedapro_plugin.h
@ -0,0 +1,112 @@ |
|||
/*
|
|||
* 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, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
#include <dialog_import_choose_project.h>
|
|||
|
|||
#include <wx/msgdlg.h>
|
|||
#include <wx/listctrl.h>
|
|||
|
|||
|
|||
DIALOG_IMPORT_CHOOSE_PROJECT::DIALOG_IMPORT_CHOOSE_PROJECT( |
|||
wxWindow* aParent, const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc ) : |
|||
DIALOG_IMPORT_CHOOSE_PROJECT_BASE( aParent ) |
|||
{ |
|||
m_project_desc = aProjectDesc; |
|||
|
|||
// Initialize columns in the wxListCtrl elements:
|
|||
int comboNameColId = m_listCtrl->AppendColumn( _( "Project Name" ) ); |
|||
int pcbNameColId = m_listCtrl->AppendColumn( _( "PCB" ) ); |
|||
int schNameColId = m_listCtrl->AppendColumn( _( "Schematic" ) ); |
|||
|
|||
// Load the project/PCB/schematic names
|
|||
int row = 0; |
|||
|
|||
auto convertName = []( const wxString& aName, const wxString& aId ) -> wxString |
|||
{ |
|||
if( aId.empty() ) |
|||
return wxEmptyString; |
|||
|
|||
return aName; |
|||
}; |
|||
|
|||
for( const IMPORT_PROJECT_DESC& desc : m_project_desc ) |
|||
{ |
|||
m_listCtrl->InsertItem( row, convertName( desc.ComboName, desc.ComboId ) ); |
|||
m_listCtrl->SetItem( row, pcbNameColId, convertName( desc.PCBName, desc.PCBId ) ); |
|||
m_listCtrl->SetItem( row, schNameColId, |
|||
convertName( desc.SchematicName, desc.SchematicId ) ); |
|||
|
|||
++row; |
|||
} |
|||
|
|||
// Auto select the first item to improve ease-of-use
|
|||
m_listCtrl->SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); |
|||
|
|||
m_listCtrl->SetColumnWidth( comboNameColId, wxLIST_AUTOSIZE_USEHEADER ); |
|||
m_listCtrl->SetColumnWidth( pcbNameColId, wxLIST_AUTOSIZE_USEHEADER ); |
|||
m_listCtrl->SetColumnWidth( schNameColId, wxLIST_AUTOSIZE_USEHEADER ); |
|||
|
|||
SetupStandardButtons(); |
|||
|
|||
Fit(); |
|||
finishDialogSettings(); |
|||
} |
|||
|
|||
|
|||
void DIALOG_IMPORT_CHOOSE_PROJECT::onItemActivated( wxListEvent& event ) |
|||
{ |
|||
EndModal( wxID_OK ); |
|||
} |
|||
|
|||
|
|||
void DIALOG_IMPORT_CHOOSE_PROJECT::onClose( wxCloseEvent& event ) |
|||
{ |
|||
EndModal( wxID_CANCEL ); |
|||
} |
|||
|
|||
|
|||
std::vector<IMPORT_PROJECT_DESC> DIALOG_IMPORT_CHOOSE_PROJECT::GetProjectSelections() |
|||
{ |
|||
std::vector<IMPORT_PROJECT_DESC> result; |
|||
|
|||
long selected = -1; |
|||
|
|||
do |
|||
{ |
|||
selected = m_listCtrl->GetNextItem( selected, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); |
|||
|
|||
if( selected != -1 && selected < long( m_project_desc.size() ) ) |
|||
result.emplace_back( m_project_desc[selected] ); |
|||
|
|||
} while( selected != -1 ); |
|||
|
|||
return result; |
|||
} |
|||
|
|||
|
|||
std::vector<IMPORT_PROJECT_DESC> DIALOG_IMPORT_CHOOSE_PROJECT::GetSelectionsModal( |
|||
wxWindow* aParent, const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc ) |
|||
{ |
|||
DIALOG_IMPORT_CHOOSE_PROJECT dlg( aParent, aProjectDesc ); |
|||
|
|||
if( dlg.ShowModal() != wxID_OK ) |
|||
return {}; |
|||
|
|||
return dlg.GetProjectSelections(); |
|||
} |
@ -0,0 +1,53 @@ |
|||
/* |
|||
* 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, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#ifndef DIALOG_IMPORT_CHOOSE_PROJECT_H |
|||
#define DIALOG_IMPORT_CHOOSE_PROJECT_H |
|||
|
|||
#include "dialog_import_choose_project_base.h" |
|||
#include <plugins/common/plugin_common_choose_project.h> |
|||
|
|||
|
|||
class DIALOG_IMPORT_CHOOSE_PROJECT : public DIALOG_IMPORT_CHOOSE_PROJECT_BASE |
|||
{ |
|||
public: |
|||
DIALOG_IMPORT_CHOOSE_PROJECT( wxWindow* aParent, |
|||
const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc ); |
|||
|
|||
/** |
|||
* Create and show a dialog (modal) and returns the data from it after completion. If the |
|||
* dialog is closed or cancel is pressed, returns an empty vector. |
|||
* |
|||
* @param aParent Parent window for the invoked dialog. |
|||
* @param aProjectDesc are project descriptors. |
|||
*/ |
|||
static std::vector<IMPORT_PROJECT_DESC> |
|||
GetSelectionsModal( wxWindow* aParent, const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc ); |
|||
|
|||
void onItemActivated( wxListEvent& event ) override; |
|||
|
|||
void onClose( wxCloseEvent& event ) override; |
|||
|
|||
std::vector<IMPORT_PROJECT_DESC> GetProjectSelections(); |
|||
|
|||
private: |
|||
std::vector<IMPORT_PROJECT_DESC> m_project_desc; |
|||
}; |
|||
|
|||
#endif // DIALOG_IMPORT_CHOOSE_PROJECT_H |
@ -0,0 +1,54 @@ |
|||
///////////////////////////////////////////////////////////////////////////
|
|||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
|||
// http://www.wxformbuilder.org/
|
|||
//
|
|||
// PLEASE DO *NOT* EDIT THIS FILE!
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
#include "dialog_import_choose_project_base.h"
|
|||
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
DIALOG_IMPORT_CHOOSE_PROJECT_BASE::DIALOG_IMPORT_CHOOSE_PROJECT_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( wxSize( -1,-1 ), wxDefaultSize ); |
|||
|
|||
bSizerMain = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_titleText = new wxStaticText( this, wxID_ANY, _("This project file contains multiple PCB+Schematic combinations.\nChoose which one should be imported to KiCad."), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_titleText->Wrap( -1 ); |
|||
bSizerMain->Add( m_titleText, 0, wxALL, 5 ); |
|||
|
|||
m_listCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); |
|||
bSizerMain->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); |
|||
|
|||
wxBoxSizer* bSizerBottom; |
|||
bSizerBottom = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
m_sdbSizer = new wxStdDialogButtonSizer(); |
|||
m_sdbSizerOK = new wxButton( this, wxID_OK ); |
|||
m_sdbSizer->AddButton( m_sdbSizerOK ); |
|||
m_sdbSizer->Realize(); |
|||
|
|||
bSizerBottom->Add( m_sdbSizer, 1, wxEXPAND, 5 ); |
|||
|
|||
|
|||
bSizerMain->Add( bSizerBottom, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); |
|||
|
|||
|
|||
this->SetSizer( bSizerMain ); |
|||
this->Layout(); |
|||
bSizerMain->Fit( this ); |
|||
|
|||
// Connect Events
|
|||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_IMPORT_CHOOSE_PROJECT_BASE::onClose ) ); |
|||
m_listCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( DIALOG_IMPORT_CHOOSE_PROJECT_BASE::onItemActivated ), NULL, this ); |
|||
} |
|||
|
|||
DIALOG_IMPORT_CHOOSE_PROJECT_BASE::~DIALOG_IMPORT_CHOOSE_PROJECT_BASE() |
|||
{ |
|||
// Disconnect Events
|
|||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_IMPORT_CHOOSE_PROJECT_BASE::onClose ) ); |
|||
m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( DIALOG_IMPORT_CHOOSE_PROJECT_BASE::onItemActivated ), NULL, this ); |
|||
|
|||
} |
@ -0,0 +1,221 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> |
|||
<wxFormBuilder_Project> |
|||
<FileVersion major="1" minor="16" /> |
|||
<object class="Project" expanded="1"> |
|||
<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_import_choose_project_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">1</property> |
|||
<property name="name">dialog_import_choose_project_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">1</property> |
|||
<property name="use_microsoft_bom">0</property> |
|||
<object class="Dialog" expanded="1"> |
|||
<property name="aui_managed">0</property> |
|||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property> |
|||
<property name="bg"></property> |
|||
<property name="center"></property> |
|||
<property name="context_help"></property> |
|||
<property name="context_menu">1</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">-1,-1</property> |
|||
<property name="name">DIALOG_IMPORT_CHOOSE_PROJECT_BASE</property> |
|||
<property name="pos"></property> |
|||
<property name="size">-1,-1</property> |
|||
<property name="style">wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER</property> |
|||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> |
|||
<property name="title">Choose Project to Import</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> |
|||
<event name="OnClose">onClose</event> |
|||
<object class="wxBoxSizer" expanded="1"> |
|||
<property name="minimum_size"></property> |
|||
<property name="name">bSizerMain</property> |
|||
<property name="orient">wxVERTICAL</property> |
|||
<property name="permission">protected</property> |
|||
<object class="sizeritem" expanded="1"> |
|||
<property name="border">5</property> |
|||
<property name="flag">wxALL</property> |
|||
<property name="proportion">0</property> |
|||
<object class="wxStaticText" expanded="1"> |
|||
<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="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">This project file contains multiple PCB+Schematic combinations.
Choose which one should be imported to KiCad.</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_titleText</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="1"> |
|||
<property name="border">5</property> |
|||
<property name="flag">wxALL|wxEXPAND</property> |
|||
<property name="proportion">1</property> |
|||
<object class="wxListCtrl" expanded="1"> |
|||
<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="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_listCtrl</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">wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES</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="OnListItemActivated">onItemActivated</event> |
|||
</object> |
|||
</object> |
|||
<object class="sizeritem" expanded="1"> |
|||
<property name="border">5</property> |
|||
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property> |
|||
<property name="proportion">0</property> |
|||
<object class="wxBoxSizer" expanded="1"> |
|||
<property name="minimum_size"></property> |
|||
<property name="name">bSizerBottom</property> |
|||
<property name="orient">wxHORIZONTAL</property> |
|||
<property name="permission">none</property> |
|||
<object class="sizeritem" expanded="1"> |
|||
<property name="border">5</property> |
|||
<property name="flag">wxEXPAND</property> |
|||
<property name="proportion">1</property> |
|||
<object class="wxStdDialogButtonSizer" expanded="1"> |
|||
<property name="Apply">0</property> |
|||
<property name="Cancel">0</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_sdbSizer</property> |
|||
<property name="permission">protected</property> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
</wxFormBuilder_Project> |
@ -0,0 +1,53 @@ |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) |
|||
// http://www.wxformbuilder.org/ |
|||
// |
|||
// PLEASE DO *NOT* EDIT THIS FILE! |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
#pragma once |
|||
|
|||
#include <wx/artprov.h> |
|||
#include <wx/xrc/xmlres.h> |
|||
#include <wx/intl.h> |
|||
#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/listctrl.h> |
|||
#include <wx/sizer.h> |
|||
#include <wx/button.h> |
|||
#include <wx/dialog.h> |
|||
|
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
/// Class DIALOG_IMPORT_CHOOSE_PROJECT_BASE |
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
class DIALOG_IMPORT_CHOOSE_PROJECT_BASE : public DIALOG_SHIM |
|||
{ |
|||
private: |
|||
|
|||
protected: |
|||
wxBoxSizer* bSizerMain; |
|||
wxStaticText* m_titleText; |
|||
wxListCtrl* m_listCtrl; |
|||
wxStdDialogButtonSizer* m_sdbSizer; |
|||
wxButton* m_sdbSizerOK; |
|||
|
|||
// Virtual event handlers, override them in your derived class |
|||
virtual void onClose( wxCloseEvent& event ) { event.Skip(); } |
|||
virtual void onItemActivated( wxListEvent& event ) { event.Skip(); } |
|||
|
|||
|
|||
public: |
|||
|
|||
DIALOG_IMPORT_CHOOSE_PROJECT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Choose Project to Import"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER ); |
|||
|
|||
~DIALOG_IMPORT_CHOOSE_PROJECT_BASE(); |
|||
|
|||
}; |
|||
|
@ -0,0 +1,73 @@ |
|||
/* |
|||
* 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, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#ifndef PLUGIN_COMMON_CHOOSE_PROJECT_H |
|||
#define PLUGIN_COMMON_CHOOSE_PROJECT_H |
|||
|
|||
#include <functional> |
|||
#include <map> |
|||
|
|||
/** |
|||
* @brief Describes how non-KiCad boards and schematics should be imported as KiCad projects |
|||
*/ |
|||
struct IMPORT_PROJECT_DESC |
|||
{ |
|||
wxString ComboName; |
|||
wxString PCBName; |
|||
wxString SchematicName; |
|||
|
|||
wxString ComboId; |
|||
wxString PCBId; |
|||
wxString SchematicId; |
|||
|
|||
IMPORT_PROJECT_DESC() {} |
|||
}; |
|||
|
|||
/** |
|||
* @brief Pointer to a function that takes descriptions of the source projects |
|||
* and removes the ones that are not needed, or clears their ID fields. |
|||
*/ |
|||
using CHOOSE_PROJECT_HANDLER = std::function<std::vector<IMPORT_PROJECT_DESC>( const std::vector<IMPORT_PROJECT_DESC>& )>; |
|||
|
|||
|
|||
/** |
|||
* @brief Plugin class for import plugins that support choosing a project |
|||
*/ |
|||
class PROJECT_CHOOSER_PLUGIN |
|||
{ |
|||
public: |
|||
/** |
|||
* @brief Register a different handler to be called when a non-KiCad project |
|||
* contains multiple PCB+Schematic combinations. |
|||
* |
|||
* The function is marked as virtual, so the plugins can implement extra |
|||
* logic (e.g., enable warnings or checks) |
|||
*/ |
|||
virtual void RegisterChooseProjectCallback( CHOOSE_PROJECT_HANDLER aChooseProjectHandler ) |
|||
{ |
|||
m_choose_project_handler = aChooseProjectHandler; |
|||
} |
|||
|
|||
virtual ~PROJECT_CHOOSER_PLUGIN() = default; |
|||
|
|||
protected: |
|||
CHOOSE_PROJECT_HANDLER m_choose_project_handler; ///< Callback to choose projects to import |
|||
}; |
|||
|
|||
#endif // PLUGIN_COMMON_CHOOSE_PROJECT_H |
Write
Preview
Loading…
Cancel
Save
Reference in new issue