7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-03-30 06:16:56 +00:00

Jobset Output -> Destination.

This commit is contained in:
Jeff Young 2025-03-03 18:34:20 +00:00
parent 6f6ca2a35f
commit d8cdb69831
18 changed files with 325 additions and 337 deletions

View File

@ -36,18 +36,19 @@
const int jobsFileSchemaVersion = 1;
KICOMMON_API std::map<JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO> JobsetOutputTypeInfos = {
{ JOBSET_OUTPUT_TYPE::FOLDER,
KICOMMON_API std::map<JOBSET_DESTINATION_T, JOBSET_DESTINATION_T_INFO> JobsetDestinationTypeInfos =
{
{ JOBSET_DESTINATION_T::FOLDER,
{ _HKI( "Folder" ), BITMAPS::small_folder, true, "" } },
{ JOBSET_OUTPUT_TYPE::ARCHIVE,
{ JOBSET_DESTINATION_T::ARCHIVE,
{ _HKI( "Archive" ), BITMAPS::zip, false, FILEEXT::ZipFileWildcard() } },
};
NLOHMANN_JSON_SERIALIZE_ENUM( JOBSET_OUTPUT_TYPE,
NLOHMANN_JSON_SERIALIZE_ENUM( JOBSET_DESTINATION_T,
{
{ JOBSET_OUTPUT_TYPE::FOLDER, "folder" },
{ JOBSET_OUTPUT_TYPE::ARCHIVE, "archive" }
{ JOBSET_DESTINATION_T::FOLDER, "folder" },
{ JOBSET_DESTINATION_T::ARCHIVE, "archive" }
} )
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_JOB& f )
@ -79,44 +80,42 @@ KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_JOB& f )
}
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_OUTPUT& f )
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_DESTINATION& destination )
{
j = nlohmann::json{ { "id", f.m_id },
{ "type", f.m_type },
{ "only", f.m_only },
{ "description", f.m_description },
j = nlohmann::json{ { "id", destination.m_id },
{ "type", destination.m_type },
{ "only", destination.m_only },
{ "description", destination.m_description },
{ "settings", nlohmann::json::object( {} ) }
};
f.m_outputHandler->ToJson( j.at( "settings" ) );
destination.m_outputHandler->ToJson( j.at( "settings" ) );
}
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_OUTPUT& f )
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_DESTINATION& destination )
{
// During 9.0 development outputs didn't get ids.
if( j.contains( "id" ) )
j.at( "id" ).get_to( f.m_id );
j.at( "id" ).get_to( destination.m_id );
else
f.m_id = KIID().AsString();
destination.m_id = KIID().AsString();
j.at( "type" ).get_to( f.m_type );
f.m_only = j.value( "only", std::vector<wxString>() );
f.m_description = j.value( "description", "" );
j.at( "type" ).get_to( destination.m_type );
destination.m_only = j.value( "only", std::vector<wxString>() );
destination.m_description = j.value( "description", "" );
const nlohmann::json& settings_obj = j.at( "settings" );
f.InitOutputHandler();
destination.InitOutputHandler();
if( f.m_outputHandler != nullptr )
{
f.m_outputHandler->FromJson( settings_obj );
}
if( destination.m_outputHandler != nullptr )
destination.m_outputHandler->FromJson( settings_obj );
}
JOBSET_OUTPUT::JOBSET_OUTPUT() :
m_type( JOBSET_OUTPUT_TYPE::FOLDER ),
JOBSET_DESTINATION::JOBSET_DESTINATION() :
m_type( JOBSET_DESTINATION_T::FOLDER ),
m_outputHandler( nullptr ),
m_lastRunSuccess(),
m_lastRunReporters()
@ -124,7 +123,7 @@ JOBSET_OUTPUT::JOBSET_OUTPUT() :
}
JOBSET_OUTPUT::JOBSET_OUTPUT( const wxString& id, JOBSET_OUTPUT_TYPE type ) :
JOBSET_DESTINATION::JOBSET_DESTINATION( const wxString& id, JOBSET_DESTINATION_T type ) :
m_id( id ),
m_type( type ),
m_outputHandler( nullptr ),
@ -135,7 +134,7 @@ JOBSET_OUTPUT::JOBSET_OUTPUT( const wxString& id, JOBSET_OUTPUT_TYPE type ) :
}
JOBSET_OUTPUT::~JOBSET_OUTPUT()
JOBSET_DESTINATION::~JOBSET_DESTINATION()
{
for( auto& [name, reporter] : m_lastRunReporters )
delete reporter;
@ -144,26 +143,26 @@ JOBSET_OUTPUT::~JOBSET_OUTPUT()
}
void JOBSET_OUTPUT::InitOutputHandler()
void JOBSET_DESTINATION::InitOutputHandler()
{
if( m_type == JOBSET_OUTPUT_TYPE::FOLDER )
if( m_type == JOBSET_DESTINATION_T::FOLDER )
{
m_outputHandler = new JOBS_OUTPUT_FOLDER();
}
else if( m_type == JOBSET_OUTPUT_TYPE::ARCHIVE )
else if( m_type == JOBSET_DESTINATION_T::ARCHIVE )
{
m_outputHandler = new JOBS_OUTPUT_ARCHIVE();
}
}
wxString JOBSET_OUTPUT::GetDescription() const
wxString JOBSET_DESTINATION::GetDescription() const
{
return m_description.IsEmpty() ? m_outputHandler->GetDefaultDescription() : m_description;
}
void JOBSET_OUTPUT::SetDescription( const wxString& aDescription )
void JOBSET_DESTINATION::SetDescription( const wxString& aDescription )
{
if( aDescription == m_outputHandler->GetDefaultDescription() )
m_description = wxEmptyString;
@ -193,7 +192,7 @@ void JOBSET_JOB::SetDescription( const wxString& aDescription )
}
bool JOBSET_OUTPUT::operator==( const JOBSET_OUTPUT& rhs ) const
bool JOBSET_DESTINATION::operator==( const JOBSET_DESTINATION& rhs ) const
{
return rhs.m_type == m_type;
}
@ -204,7 +203,7 @@ JOBSET::JOBSET( const wxString& aFilename ) :
m_dirty( false )
{
m_params.emplace_back( new PARAM_LIST<JOBSET_JOB>( "jobs", &m_jobs, {} ) );
m_params.emplace_back( new PARAM_LIST<JOBSET_OUTPUT>( "outputs", &m_outputs, {} ) );
m_params.emplace_back( new PARAM_LIST<JOBSET_DESTINATION>( "outputs", &m_destinations, {} ) );
m_fileNameWithoutPath = wxFileName( aFilename ).GetFullName();
}
@ -223,21 +222,21 @@ void JOBSET::AddNewJob( wxString aType, JOB* aJob )
}
JOBSET_OUTPUT* JOBSET::AddNewJobOutput( JOBSET_OUTPUT_TYPE aType )
JOBSET_DESTINATION* JOBSET::AddNewDestination( JOBSET_DESTINATION_T aType )
{
m_outputs.emplace_back( KIID().AsString(), aType );
m_destinations.emplace_back( KIID().AsString(), aType );
SetDirty();
return &m_outputs.back();
return &m_destinations.back();
}
void JOBSET::RemoveOutput( JOBSET_OUTPUT* aOutput )
void JOBSET::RemoveDestination( JOBSET_DESTINATION* aDestination )
{
std::erase_if( m_outputs,
[&]( JOBSET_OUTPUT const& output )
std::erase_if( m_destinations,
[&]( JOBSET_DESTINATION const& destination )
{
return output.m_id == aOutput->m_id;
return destination.m_id == aDestination->m_id;
} );
}
@ -281,35 +280,35 @@ bool JOBSET::SaveToFile( const wxString& aDirectory, bool aForce )
}
JOBSET_OUTPUT* JOBSET::GetOutput( wxString& aOutput )
JOBSET_DESTINATION* JOBSET::GetDestination( wxString& aDestination )
{
auto it = std::find_if( m_outputs.begin(), m_outputs.end(),
[&]( const JOBSET_OUTPUT& output )
auto it = std::find_if( m_destinations.begin(), m_destinations.end(),
[&]( const JOBSET_DESTINATION& destination )
{
if( output.m_id == aOutput )
if( destination.m_id == aDestination )
return true;
return false;
} );
if( it != m_outputs.end() )
if( it != m_destinations.end() )
return &(*it);
return nullptr;
}
std::vector<JOBSET_JOB> JOBSET::GetJobsForOutput( JOBSET_OUTPUT* aOutput )
std::vector<JOBSET_JOB> JOBSET::GetJobsForDestination( JOBSET_DESTINATION* aDestination )
{
wxASSERT( aOutput != nullptr );
wxASSERT( aDestination != nullptr );
if( aOutput->m_only.size() == 0 )
if( aDestination->m_only.size() == 0 )
{
return m_jobs;
}
std::vector<JOBSET_JOB> result;
for( wxString& onlyId : aOutput->m_only )
for( wxString& onlyId : aDestination->m_only )
{
auto it = std::find_if( m_jobs.begin(), m_jobs.end(),
[&]( const JOBSET_JOB& job )
@ -330,5 +329,5 @@ std::vector<JOBSET_JOB> JOBSET::GetJobsForOutput( JOBSET_OUTPUT* aOutput )
#if !defined( __MINGW32__ )
template class KICOMMON_API PARAM_LIST<JOBSET_JOB>;
template class KICOMMON_API PARAM_LIST<JOBSET_OUTPUT>;
template class KICOMMON_API PARAM_LIST<JOBSET_DESTINATION>;
#endif

View File

@ -55,13 +55,13 @@ struct KICOMMON_API JOBSET_JOB
};
enum class KICOMMON_API JOBSET_OUTPUT_TYPE
enum class KICOMMON_API JOBSET_DESTINATION_T
{
FOLDER,
ARCHIVE
};
struct KICOMMON_API JOBSET_OUTPUT_TYPE_INFO
struct KICOMMON_API JOBSET_DESTINATION_T_INFO
{
wxString name;
BITMAPS bitmap;
@ -69,21 +69,22 @@ struct KICOMMON_API JOBSET_OUTPUT_TYPE_INFO
wxString fileWildcard;
};
extern KICOMMON_API std::map<JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO> JobsetOutputTypeInfos;
extern KICOMMON_API
std::map<JOBSET_DESTINATION_T, JOBSET_DESTINATION_T_INFO> JobsetDestinationTypeInfos;
struct KICOMMON_API JOBSET_OUTPUT
struct KICOMMON_API JOBSET_DESTINATION
{
JOBSET_OUTPUT();
JOBSET_DESTINATION();
JOBSET_OUTPUT( const wxString& id, JOBSET_OUTPUT_TYPE type );
JOBSET_DESTINATION( const wxString& id, JOBSET_DESTINATION_T type );
~JOBSET_OUTPUT();
~JOBSET_DESTINATION();
void InitOutputHandler();
wxString m_id;
JOBSET_OUTPUT_TYPE m_type;
JOBSET_DESTINATION_T m_type;
wxString m_description;
JOBS_OUTPUT_HANDLER* m_outputHandler;
std::vector<wxString> m_only;
@ -96,7 +97,7 @@ struct KICOMMON_API JOBSET_OUTPUT
std::unordered_map<wxString, std::optional<bool>> m_lastRunSuccessMap;
std::unordered_map<wxString, REPORTER*> m_lastRunReporters;
bool operator==( const JOBSET_OUTPUT& rhs ) const;
bool operator==( const JOBSET_DESTINATION& rhs ) const;
};
@ -113,11 +114,11 @@ public:
return m_jobs;
}
std::vector<JOBSET_JOB> GetJobsForOutput( JOBSET_OUTPUT* aOutput );
std::vector<JOBSET_JOB> GetJobsForDestination( JOBSET_DESTINATION* aDestination );
std::vector<JOBSET_OUTPUT>& GetOutputs() { return m_outputs; }
std::vector<JOBSET_DESTINATION>& GetDestinations() { return m_destinations; }
JOBSET_OUTPUT* GetOutput( wxString& aOutput );
JOBSET_DESTINATION* GetDestination( wxString& aDestination );
bool SaveToFile( const wxString& aDirectory = "", bool aForce = false ) override;
@ -127,9 +128,9 @@ public:
wxString GetFullName() const { return m_fileNameWithoutPath; }
void AddNewJob( wxString aType, JOB* aJob );
JOBSET_OUTPUT* AddNewJobOutput( JOBSET_OUTPUT_TYPE aType );
JOBSET_DESTINATION* AddNewDestination( JOBSET_DESTINATION_T aType );
void RemoveOutput( JOBSET_OUTPUT* aOutput );
void RemoveDestination( JOBSET_DESTINATION* aDestination );
void MoveJobUp( size_t aJobIdx );
void MoveJobDown( size_t aJobIdx );
void RemoveJob( size_t aJobIdx );
@ -138,25 +139,26 @@ protected:
wxString getFileExt() const override;
private:
std::vector<JOBSET_JOB> m_jobs;
std::vector<JOBSET_OUTPUT> m_outputs;
std::vector<JOBSET_JOB> m_jobs;
std::vector<JOBSET_DESTINATION> m_destinations;
bool m_dirty;
wxString m_fileNameWithoutPath;
bool m_dirty;
wxString m_fileNameWithoutPath;
};
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_JOB& f );
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_JOB& f );
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_OUTPUT& f );
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_OUTPUT& f );
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_DESTINATION& f );
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_DESTINATION& f );
#if defined( __MINGW32__ )
template class KICOMMON_API PARAM_LIST<struct JOBSET_JOB>;
template class KICOMMON_API PARAM_LIST<struct JOBSET_OUTPUT>;
#else
extern template class APIVISIBLE PARAM_LIST<JOBSET_JOB>;
extern template class APIVISIBLE PARAM_LIST<JOBSET_OUTPUT>;
extern template class APIVISIBLE PARAM_LIST<JOBSET_DESTINATION>;
#endif
#endif

View File

@ -17,8 +17,8 @@ include_directories(
)
set( KICAD_SRCS
dialogs/dialog_jobset_output_options.cpp
dialogs/dialog_jobset_output_options_base.cpp
dialogs/dialog_destination.cpp
dialogs/dialog_destination_base.cpp
dialogs/dialog_copyfiles_job_settings.cpp
dialogs/dialog_copyfiles_job_settings_base.cpp
dialogs/dialog_executecommand_job_settings.cpp

View File

@ -87,18 +87,15 @@ int CLI::JOBSET_RUN_COMMAND::doPerform( KIWAY& aKiway )
if( !outputKey.IsEmpty() )
{
JOBSET_OUTPUT* output = jobFile.GetOutput( outputKey );
if( output == nullptr || !jobsRunner.RunJobsForOutput( output, bail ) )
{
JOBSET_DESTINATION* destination = jobFile.GetDestination( outputKey );
if( destination == nullptr || !jobsRunner.RunJobsForDestination( destination, bail ) )
return_code = CLI::EXIT_CODES::ERR_JOBS_RUN_FAILED;
}
}
else
{
if( !jobsRunner.RunJobsAllOutputs( bail ) )
{
if( !jobsRunner.RunJobsAllDestinations( bail ) )
return_code = CLI::EXIT_CODES::ERR_JOBS_RUN_FAILED;
}
}
return return_code;

View File

@ -18,7 +18,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dialog_jobset_output_options.h"
#include "dialog_destination.h"
#include "dialog_copyfiles_job_settings.h"
#include <wx/aui/auibook.h>
#include <jobs/jobset.h>
@ -39,41 +39,42 @@
#include <confirm.h>
extern KICOMMON_API std::map<JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO> JobsetOutputTypeInfos;
extern KICOMMON_API
std::map<JOBSET_DESTINATION_T, JOBSET_DESTINATION_T_INFO> JobsetDestinationTypeInfos;
DIALOG_JOBSET_OUTPUT_OPTIONS::DIALOG_JOBSET_OUTPUT_OPTIONS( wxWindow* aParent, JOBSET* aJobsFile,
JOBSET_OUTPUT* aOutput ) :
DIALOG_JOBSET_OUTPUT_OPTIONS_BASE( aParent ),
DIALOG_DESTINATION::DIALOG_DESTINATION( wxWindow* aParent, JOBSET* aJobsFile,
JOBSET_DESTINATION* aDestination ) :
DIALOG_DESTINATION_BASE( aParent ),
m_jobsFile( aJobsFile ),
m_output( aOutput )
m_destination( aDestination )
{
// prevent someone from failing to add the type info in the future
wxASSERT( JobsetOutputTypeInfos.contains( m_output->m_type ) );
wxASSERT( JobsetDestinationTypeInfos.contains( m_destination->m_type ) );
SetTitle( wxString::Format( _( "%s Output Options" ),
m_output->m_outputHandler->GetDefaultDescription() ) );
SetTitle( wxString::Format( _( "%s Destination" ),
m_destination->m_outputHandler->GetDefaultDescription() ) );
if( m_output->m_type != JOBSET_OUTPUT_TYPE::ARCHIVE )
if( m_destination->m_type != JOBSET_DESTINATION_T::ARCHIVE )
{
m_textArchiveFormat->Hide();
m_choiceArchiveformat->Hide();
}
m_textCtrlOutputPath->SetValue( m_output->m_outputHandler->GetOutputPath() );
m_textCtrlOutputPath->SetValue( m_destination->m_outputHandler->GetOutputPath() );
m_buttonOutputPath->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
m_textCtrlDescription->SetValue( m_output->GetDescription() );
m_textCtrlDescription->SetValue( m_destination->GetDescription() );
SetupStandardButtons();
}
void DIALOG_JOBSET_OUTPUT_OPTIONS::onOutputPathBrowseClicked(wxCommandEvent& event)
void DIALOG_DESTINATION::onOutputPathBrowseClicked(wxCommandEvent& event)
{
bool isFolder = false;
wxString fileWildcard = "";
isFolder = JobsetOutputTypeInfos[m_output->m_type].outputPathIsFolder;
fileWildcard = JobsetOutputTypeInfos[m_output->m_type].fileWildcard;
isFolder = JobsetDestinationTypeInfos[m_destination->m_type].outputPathIsFolder;
fileWildcard = JobsetDestinationTypeInfos[m_destination->m_type].fileWildcard;
if( isFolder )
{
@ -108,7 +109,7 @@ void DIALOG_JOBSET_OUTPUT_OPTIONS::onOutputPathBrowseClicked(wxCommandEvent& eve
}
bool DIALOG_JOBSET_OUTPUT_OPTIONS::TransferDataFromWindow()
bool DIALOG_DESTINATION::TransferDataFromWindow()
{
wxString outputPath = m_textCtrlOutputPath->GetValue().Trim().Trim( false );
@ -122,34 +123,34 @@ bool DIALOG_JOBSET_OUTPUT_OPTIONS::TransferDataFromWindow()
m_includeJobs->GetCheckedItems( selectedItems );
// Update the only job map
m_output->m_only.clear();
m_destination->m_only.clear();
if( selectedItems.size() < m_includeJobs->GetCount() )
{
for( int i : selectedItems )
{
if( m_onlyMap.contains( i ) )
m_output->m_only.emplace_back( m_onlyMap[i] );
m_destination->m_only.emplace_back( m_onlyMap[i] );
}
}
m_output->m_outputHandler->SetOutputPath( outputPath );
m_destination->m_outputHandler->SetOutputPath( outputPath );
if( m_output->m_type == JOBSET_OUTPUT_TYPE::ARCHIVE )
if( m_destination->m_type == JOBSET_DESTINATION_T::ARCHIVE )
{
JOBS_OUTPUT_ARCHIVE* archive =
static_cast<JOBS_OUTPUT_ARCHIVE*>( m_output->m_outputHandler );
static_cast<JOBS_OUTPUT_ARCHIVE*>( m_destination->m_outputHandler );
archive->SetFormat( JOBS_OUTPUT_ARCHIVE::FORMAT::ZIP );
}
m_output->SetDescription( m_textCtrlDescription->GetValue() );
m_destination->SetDescription( m_textCtrlDescription->GetValue() );
return true;
}
bool DIALOG_JOBSET_OUTPUT_OPTIONS::TransferDataToWindow()
bool DIALOG_DESTINATION::TransferDataToWindow()
{
wxArrayString arrayStr;
std::vector<int> selectedList;
@ -160,7 +161,7 @@ bool DIALOG_JOBSET_OUTPUT_OPTIONS::TransferDataToWindow()
(int) arrayStr.size() + 1,
job.GetDescription() ) );
auto it = std::find_if( m_output->m_only.begin(), m_output->m_only.end(),
auto it = std::find_if( m_destination->m_only.begin(), m_destination->m_only.end(),
[&]( const wxString& only )
{
if( only == job.m_id )
@ -169,7 +170,7 @@ bool DIALOG_JOBSET_OUTPUT_OPTIONS::TransferDataToWindow()
return false;
} );
if( it != m_output->m_only.end() )
if( it != m_destination->m_only.end() )
selectedList.emplace_back( arrayStr.size() - 1 );
m_onlyMap.emplace( arrayStr.size() - 1, job.m_id );

View File

@ -20,15 +20,15 @@
#pragma once
#include "dialog_jobset_output_options_base.h"
#include <dialogs/dialog_destination_base.h>
class JOBSET;
struct JOBSET_OUTPUT;
struct JOBSET_DESTINATION;
class DIALOG_JOBSET_OUTPUT_OPTIONS : public DIALOG_JOBSET_OUTPUT_OPTIONS_BASE
class DIALOG_DESTINATION : public DIALOG_DESTINATION_BASE
{
public:
DIALOG_JOBSET_OUTPUT_OPTIONS( wxWindow* aParent, JOBSET* aJobsFile, JOBSET_OUTPUT* aOutput );
DIALOG_DESTINATION( wxWindow* aParent, JOBSET* aJobsFile, JOBSET_DESTINATION* aDestination );
private:
virtual void onOutputPathBrowseClicked(wxCommandEvent& event) override;
@ -38,7 +38,7 @@ private:
private:
JOBSET* m_jobsFile;
JOBSET_OUTPUT* m_output;
JOBSET_DESTINATION* m_destination;
std::map<int, wxString> m_onlyMap;
};

View File

@ -7,11 +7,11 @@
#include "widgets/std_bitmap_button.h"
#include "dialog_jobset_output_options_base.h"
#include "dialog_destination_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_JOBSET_OUTPUT_OPTIONS_BASE::DIALOG_JOBSET_OUTPUT_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_DESTINATION_BASE::DIALOG_DESTINATION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
@ -43,7 +43,7 @@ DIALOG_JOBSET_OUTPUT_OPTIONS_BASE::DIALOG_JOBSET_OUTPUT_OPTIONS_BASE( wxWindow*
fgSizer1->Add( m_choiceArchiveformat, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textOutputPath = new wxStaticText( this, wxID_ANY, _("Output path:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textOutputPath = new wxStaticText( this, wxID_ANY, _("Destination path:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textOutputPath->Wrap( -1 );
fgSizer1->Add( m_textOutputPath, 0, wxALIGN_CENTER_VERTICAL, 5 );
@ -91,12 +91,12 @@ DIALOG_JOBSET_OUTPUT_OPTIONS_BASE::DIALOG_JOBSET_OUTPUT_OPTIONS_BASE( wxWindow*
this->Centre( wxBOTH );
// Connect Events
m_buttonOutputPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JOBSET_OUTPUT_OPTIONS_BASE::onOutputPathBrowseClicked ), NULL, this );
m_buttonOutputPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESTINATION_BASE::onOutputPathBrowseClicked ), NULL, this );
}
DIALOG_JOBSET_OUTPUT_OPTIONS_BASE::~DIALOG_JOBSET_OUTPUT_OPTIONS_BASE()
DIALOG_DESTINATION_BASE::~DIALOG_DESTINATION_BASE()
{
// Disconnect Events
m_buttonOutputPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JOBSET_OUTPUT_OPTIONS_BASE::onOutputPathBrowseClicked ), NULL, this );
m_buttonOutputPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESTINATION_BASE::onOutputPathBrowseClicked ), NULL, this );
}

View File

@ -13,12 +13,12 @@
<property name="cpp_use_enum">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="file">dialog_jobset_output_options_base</property>
<property name="file">dialog_destination_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">DIALOG_JOBSET_OUTPUT_OPTIONS</property>
<property name="name">DIALOG_DESTINATION</property>
<property name="path">.</property>
<property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property>
@ -48,12 +48,12 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_JOBSET_OUTPUT_OPTIONS_BASE</property>
<property name="name">DIALOG_DESTINATION_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
<property name="title">%s Output Options</property>
<property name="title">%s Destination</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
@ -367,7 +367,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Output path:</property>
<property name="label">Destination path:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>

View File

@ -33,9 +33,9 @@ class STD_BITMAP_BUTTON;
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_JOBSET_OUTPUT_OPTIONS_BASE
/// Class DIALOG_DESTINATION_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_JOBSET_OUTPUT_OPTIONS_BASE : public DIALOG_SHIM
class DIALOG_DESTINATION_BASE : public DIALOG_SHIM
{
private:
@ -59,9 +59,9 @@ class DIALOG_JOBSET_OUTPUT_OPTIONS_BASE : public DIALOG_SHIM
public:
DIALOG_JOBSET_OUTPUT_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("%s Output Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_DESTINATION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("%s Destination"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_JOBSET_OUTPUT_OPTIONS_BASE();
~DIALOG_DESTINATION_BASE();
};

View File

@ -19,7 +19,7 @@
*/
#include "panel_jobset.h"
#include "dialog_jobset_output_options.h"
#include "dialog_destination.h"
#include "dialog_copyfiles_job_settings.h"
#include <wx/aui/auibook.h>
#include <jobs/jobset.h>
@ -46,19 +46,21 @@
#include <dialogs/dialog_executecommand_job_settings.h>
extern KICOMMON_API std::map<JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO> JobsetOutputTypeInfos;
extern KICOMMON_API
std::map<JOBSET_DESTINATION_T, JOBSET_DESTINATION_T_INFO> JobsetDestinationTypeInfos;
class DIALOG_OUTPUT_RUN_RESULTS : public DIALOG_OUTPUT_RUN_RESULTS_BASE
class DIALOG_JOBSET_RUN_LOG : public DIALOG_JOBSET_RUN_LOG_BASE
{
public:
DIALOG_OUTPUT_RUN_RESULTS( wxWindow* aParent, JOBSET* aJobsFile, JOBSET_OUTPUT* aOutput ) :
DIALOG_OUTPUT_RUN_RESULTS_BASE( aParent ),
DIALOG_JOBSET_RUN_LOG( wxWindow* aParent, JOBSET* aJobsFile,
JOBSET_DESTINATION* aDestination ) :
DIALOG_JOBSET_RUN_LOG_BASE( aParent ),
m_jobsFile( aJobsFile ),
m_output( aOutput )
m_destination( aDestination )
{
m_staticTextOutputName->SetLabel( wxString::Format( _( "Output: %s" ),
aOutput->GetDescription() ) );
m_staticTextOutputName->SetLabel( wxString::Format( _( "Destination: %s" ),
aDestination->GetDescription() ) );
int jobBmpColId = m_jobList->AppendColumn( wxT( "" ) );
int jobNoColId = m_jobList->AppendColumn( _( "No." ) );
@ -74,12 +76,13 @@ public:
m_jobList->SetImageList( imageList, wxIMAGE_LIST_SMALL );
int num = 1;
for( auto& job : aJobsFile->GetJobsForOutput( aOutput ) )
for( auto& job : aJobsFile->GetJobsForDestination( aDestination ) )
{
int imageIdx = -1;
if( aOutput->m_lastRunSuccessMap.contains( job.m_id ) )
if( aDestination->m_lastRunSuccessMap.contains( job.m_id ) )
{
if( aOutput->m_lastRunSuccessMap[job.m_id].value() )
if( aDestination->m_lastRunSuccessMap[job.m_id].value() )
imageIdx = 1;
else
imageIdx = 0;
@ -125,16 +128,16 @@ public:
if( itemIndex < 0 )
return;
std::vector<JOBSET_JOB> jobs = m_jobsFile->GetJobsForOutput( m_output );
std::vector<JOBSET_JOB> jobs = m_jobsFile->GetJobsForDestination( m_destination );
if( static_cast<size_t>( itemIndex ) < jobs.size() )
{
JOBSET_JOB& job = jobs[itemIndex];
if( m_output->m_lastRunReporters.contains( job.m_id ) )
if( m_destination->m_lastRunReporters.contains( job.m_id ) )
{
WX_STRING_REPORTER* reporter =
static_cast<WX_STRING_REPORTER*>( m_output->m_lastRunReporters[job.m_id] );
static_cast<WX_STRING_REPORTER*>( m_destination->m_lastRunReporters[job.m_id] );
if( reporter )
m_textCtrlOutput->SetValue( reporter->GetMessages() );
@ -147,19 +150,19 @@ public:
}
private:
JOBSET* m_jobsFile;
JOBSET_OUTPUT* m_output;
JOBSET* m_jobsFile;
JOBSET_DESTINATION* m_destination;
};
class PANEL_JOBSET_OUTPUT : public PANEL_JOBSET_OUTPUT_BASE
class PANEL_DESTINATION : public PANEL_DESTINATION_BASE
{
public:
PANEL_JOBSET_OUTPUT( wxWindow* aParent, PANEL_JOBSET* aPanelParent, KICAD_MANAGER_FRAME* aFrame,
JOBSET* aFile, JOBSET_OUTPUT* aOutput ) :
PANEL_JOBSET_OUTPUT_BASE( aParent ),
PANEL_DESTINATION( wxWindow* aParent, PANEL_JOBSET* aPanelParent, KICAD_MANAGER_FRAME* aFrame,
JOBSET* aFile, JOBSET_DESTINATION* aDestination ) :
PANEL_DESTINATION_BASE( aParent ),
m_jobsFile( aFile ),
m_outputId( aOutput->m_id ),
m_destinationId( aDestination->m_id ),
m_frame( aFrame ),
m_panelParent( aPanelParent )
{
@ -174,41 +177,40 @@ public:
SetWindowStyleFlag( style );
#endif // _WIN32
Connect( wxEVT_MENU, wxCommandEventHandler( PANEL_JOBSET_OUTPUT::onMenu ), nullptr, this );
Connect( wxEVT_MENU, wxCommandEventHandler( PANEL_DESTINATION::onMenu ), nullptr, this );
if( JobsetOutputTypeInfos.contains( aOutput->m_type ) )
if( JobsetDestinationTypeInfos.contains( aDestination->m_type ) )
{
JOBSET_OUTPUT_TYPE_INFO& jobTypeInfo = JobsetOutputTypeInfos[aOutput->m_type];
m_textOutputType->SetLabel( aOutput->GetDescription() );
JOBSET_DESTINATION_T_INFO& jobTypeInfo = JobsetDestinationTypeInfos[aDestination->m_type];
m_textOutputType->SetLabel( aDestination->GetDescription() );
m_bitmapOutputType->SetBitmap( KiBitmapBundle( jobTypeInfo.bitmap ) );
}
UpdateStatus();
}
~PANEL_JOBSET_OUTPUT()
~PANEL_DESTINATION()
{
Disconnect( wxEVT_MENU, wxCommandEventHandler( PANEL_JOBSET_OUTPUT::onMenu ), nullptr, this );
Disconnect( wxEVT_MENU, wxCommandEventHandler( PANEL_DESTINATION::onMenu ), nullptr, this );
}
void ClearStatus()
{
JOBSET_OUTPUT* output = GetOutput();
wxCHECK( output, /*void*/ );
JOBSET_DESTINATION* destination = GetDestination();
wxCHECK( destination, /*void*/ );
output->m_lastRunSuccess = std::nullopt;
destination->m_lastRunSuccess = std::nullopt;
m_statusBitmap->SetBitmap( wxNullBitmap );
}
void UpdateStatus()
{
JOBSET_OUTPUT* output = GetOutput();
wxCHECK( output, /*void*/ );
JOBSET_DESTINATION* destination = GetDestination();
wxCHECK( destination, /*void*/ );
if( output->m_lastRunSuccess.has_value() )
if( destination->m_lastRunSuccess.has_value() )
{
if( output->m_lastRunSuccess.value() )
if( destination->m_lastRunSuccess.value() )
{
m_statusBitmap->SetBitmap( KiBitmapBundle( BITMAPS::checked_ok ) );
m_statusBitmap->Show();
@ -226,7 +228,7 @@ public:
m_statusBitmap->SetBitmap( wxNullBitmap );
}
m_buttonGenerate->Enable( !m_jobsFile->GetJobsForOutput( output ).empty() );
m_buttonGenerate->Enable( !m_jobsFile->GetJobsForDestination( destination ).empty() );
}
virtual void OnGenerate( wxCommandEvent& event ) override
@ -248,8 +250,8 @@ public:
auto* progressReporter = new WX_PROGRESS_REPORTER( m_frame, _( "Running jobs" ),
1 );
if( JOBSET_OUTPUT* output = GetOutput() )
jobRunner.RunJobsForOutput( output );
if( JOBSET_DESTINATION* destination = GetDestination() )
jobRunner.RunJobsForDestination( destination );
UpdateStatus();
@ -262,40 +264,40 @@ public:
virtual void OnLastStatusClick( wxMouseEvent& aEvent ) override
{
JOBSET_OUTPUT* output = GetOutput();
wxCHECK( output, /*void*/ );
JOBSET_DESTINATION* destination = GetDestination();
wxCHECK( destination, /*void*/ );
DIALOG_OUTPUT_RUN_RESULTS dialog( m_frame, m_jobsFile, output );
DIALOG_JOBSET_RUN_LOG dialog( m_frame, m_jobsFile, destination );
dialog.ShowModal();
}
void OnRightDown( wxMouseEvent& aEvent ) override
{
JOBSET_OUTPUT* output = GetOutput();
wxCHECK( output, /*void*/ );
JOBSET_DESTINATION* destination = GetDestination();
wxCHECK( destination, /*void*/ );
wxMenu menu;
menu.Append( wxID_EDIT, _( "Edit Output Options..." ) );
menu.Append( wxID_DELETE, _( "Delete Output" ) );
menu.Append( wxID_EDIT, _( "Edit Destination Options..." ) );
menu.Append( wxID_DELETE, _( "Delete Destination" ) );
menu.AppendSeparator();
menu.Append( wxID_VIEW_DETAILS, _( "View Last Run Results..." ) );
menu.Append( wxID_VIEW_DETAILS, _( "View Last Run Log..." ) );
menu.Enable( wxID_VIEW_DETAILS, output->m_lastRunSuccess.has_value() );
menu.Enable( wxID_VIEW_DETAILS, destination->m_lastRunSuccess.has_value() );
PopupMenu( &menu );
}
void OnProperties( wxCommandEvent& aEvent ) override
{
JOBSET_OUTPUT* output = GetOutput();
wxCHECK( output, /*void*/ );
JOBSET_DESTINATION* destination = GetDestination();
wxCHECK( destination, /*void*/ );
DIALOG_JOBSET_OUTPUT_OPTIONS dialog( m_frame, m_jobsFile, output );
DIALOG_DESTINATION dialog( m_frame, m_jobsFile, destination );
if( dialog.ShowModal() == wxID_OK )
{
m_textOutputType->SetLabel( output->GetDescription() );
m_textOutputType->SetLabel( destination->GetDescription() );
m_jobsFile->SetDirty();
m_panelParent->UpdateTitle();
}
@ -303,15 +305,15 @@ public:
virtual void OnDelete( wxCommandEvent& aEvent ) override
{
m_panelParent->RemoveOutput( this );
m_panelParent->RemoveDestination( this );
}
JOBSET_OUTPUT* GetOutput()
JOBSET_DESTINATION* GetDestination()
{
for( JOBSET_OUTPUT& jobset : m_jobsFile->GetOutputs() )
for( JOBSET_DESTINATION& destination : m_jobsFile->GetDestinations() )
{
if( jobset.m_id == m_outputId )
return &jobset;
if( destination.m_id == m_destinationId )
return &destination;
}
return nullptr;
@ -350,7 +352,7 @@ private:
private:
JOBSET* m_jobsFile;
wxString m_outputId;
wxString m_destinationId;
KICAD_MANAGER_FRAME* m_frame;
PANEL_JOBSET* m_panelParent;
};
@ -470,13 +472,10 @@ PANEL_JOBSET::PANEL_JOBSET( wxAuiNotebook* aParent, KICAD_MANAGER_FRAME* aFrame,
m_buttonUp->SetBitmap( KiBitmapBundle( BITMAPS::small_up ) );
m_buttonDown->SetBitmap( KiBitmapBundle( BITMAPS::small_down ) );
m_buttonDelete->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
m_buttonOutputAdd->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
m_buttonAddDestination->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
rebuildJobList();
buildOutputList();
m_buttonRunAllOutputs->Enable( !m_jobsFile->GetOutputs().empty()
&& !m_jobsFile->GetJobs().empty() );
buildDestinationList();
}
@ -487,20 +486,18 @@ PANEL_JOBSET::~PANEL_JOBSET()
}
void PANEL_JOBSET::RemoveOutput( PANEL_JOBSET_OUTPUT* aPanel )
void PANEL_JOBSET::RemoveDestination( PANEL_DESTINATION* aPanel )
{
JOBSET_OUTPUT* output = aPanel->GetOutput();
JOBSET_DESTINATION* output = aPanel->GetDestination();
m_outputListSizer->Detach( aPanel );
m_destinationListSizer->Detach( aPanel );
aPanel->Destroy();
// ensure the window contents get shifted as needed
m_outputList->Layout();
m_destinationList->Layout();
Layout();
m_jobsFile->RemoveOutput( output );
m_buttonRunAllOutputs->Enable( !m_jobsFile->GetOutputs().empty() );
m_jobsFile->RemoveDestination( output );
}
@ -541,7 +538,7 @@ void PANEL_JOBSET::rebuildJobList()
UpdateTitle();
// Ensure the outputs get their Run-ability status updated
for( PANEL_JOBSET_OUTPUT* panel : GetOutputPanels() )
for( PANEL_DESTINATION* panel : GetDestinationPanels() )
panel->UpdateStatus();
}
@ -558,28 +555,28 @@ void PANEL_JOBSET::UpdateTitle()
}
void PANEL_JOBSET::addJobOutputPanel( JOBSET_OUTPUT* aOutput )
void PANEL_JOBSET::addDestinationPanel( JOBSET_DESTINATION* aOutput )
{
PANEL_JOBSET_OUTPUT* outputPanel = new PANEL_JOBSET_OUTPUT( m_outputList, this, m_frame,
m_jobsFile.get(), aOutput );
PANEL_DESTINATION* destinationPanel = new PANEL_DESTINATION( m_destinationList, this, m_frame,
m_jobsFile.get(), aOutput );
#if __OSX__
m_outputListSizer->Add( outputPanel, 0, wxEXPAND, 5 );
m_outputListSizer->Add( destinationPanel, 0, wxEXPAND, 5 );
#else
m_outputListSizer->Add( outputPanel, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
m_destinationListSizer->Add( destinationPanel, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
#endif
m_outputList->Layout();
m_destinationList->Layout();
}
std::vector<PANEL_JOBSET_OUTPUT*> PANEL_JOBSET::GetOutputPanels()
std::vector<PANEL_DESTINATION*> PANEL_JOBSET::GetDestinationPanels()
{
std::vector<PANEL_JOBSET_OUTPUT*> panels;
std::vector<PANEL_DESTINATION*> panels;
for( const wxSizerItem* item : m_outputListSizer->GetChildren() )
for( const wxSizerItem* item : m_destinationListSizer->GetChildren() )
{
if( PANEL_JOBSET_OUTPUT* panel = dynamic_cast<PANEL_JOBSET_OUTPUT*>( item->GetWindow() ) )
if( PANEL_DESTINATION* panel = dynamic_cast<PANEL_DESTINATION*>( item->GetWindow() ) )
panels.push_back( panel );
}
@ -587,12 +584,12 @@ std::vector<PANEL_JOBSET_OUTPUT*> PANEL_JOBSET::GetOutputPanels()
}
void PANEL_JOBSET::buildOutputList()
void PANEL_JOBSET::buildDestinationList()
{
Freeze();
for( JOBSET_OUTPUT& job : m_jobsFile->GetOutputs() )
addJobOutputPanel( &job );
for( JOBSET_DESTINATION& job : m_jobsFile->GetDestinations() )
addDestinationPanel( &job );
// ensure the window contents get shifted as needed
Layout();
@ -763,47 +760,46 @@ void PANEL_JOBSET::OnJobButtonDelete( wxCommandEvent& aEvent )
}
void PANEL_JOBSET::OnAddOutputClick( wxCommandEvent& aEvent )
void PANEL_JOBSET::OnAddDestinationClick( wxCommandEvent& aEvent )
{
wxArrayString headers;
std::vector<wxArrayString> items;
headers.Add( _( "Output Types" ) );
headers.Add( _( "Destination Types" ) );
for( const std::pair<const JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO>& outputType : JobsetOutputTypeInfos )
for( const auto& [destinationType, destinationTypeInfo] : JobsetDestinationTypeInfos )
{
wxArrayString item;
item.Add( wxGetTranslation( outputType.second.name ) );
item.Add( wxGetTranslation( destinationTypeInfo.name ) );
items.emplace_back( item );
}
EDA_LIST_DIALOG dlg( this, _( "Add New Output" ), headers, items );
dlg.SetListLabel( _( "Select output type:" ) );
EDA_LIST_DIALOG dlg( this, _( "Add New Destination" ), headers, items );
dlg.SetListLabel( _( "Select destination type:" ) );
dlg.HideFilter();
if( dlg.ShowModal() == wxID_OK )
{
wxString selectedString = dlg.GetTextSelection();
for( const auto& [outputType, outputTypeInfo] : JobsetOutputTypeInfos )
for( const auto& [destinationType, destinationTypeInfo] : JobsetDestinationTypeInfos )
{
if( wxGetTranslation( outputTypeInfo.name ) == selectedString )
if( wxGetTranslation( destinationTypeInfo.name ) == selectedString )
{
JOBSET_OUTPUT* output = m_jobsFile->AddNewJobOutput( outputType );
JOBSET_DESTINATION* destination = m_jobsFile->AddNewDestination( destinationType );
DIALOG_JOBSET_OUTPUT_OPTIONS dialog( m_frame, m_jobsFile.get(), output );
DIALOG_DESTINATION dialog( m_frame, m_jobsFile.get(), destination );
if (dialog.ShowModal() == wxID_OK)
{
Freeze();
addJobOutputPanel( output );
m_buttonRunAllOutputs->Enable( !m_jobsFile->GetOutputs().empty() );
addDestinationPanel( destination );
Thaw();
}
else
{
// canceled
m_jobsFile->RemoveOutput( output );
m_jobsFile->RemoveDestination( destination );
}
}
}
@ -936,19 +932,19 @@ void PANEL_JOBSET::OnJobButtonDown( wxCommandEvent& aEvent )
}
void PANEL_JOBSET::OnGenerateAllOutputsClick( wxCommandEvent& event )
void PANEL_JOBSET::OnGenerateAllDestinationsClick( wxCommandEvent& event )
{
if( !m_jobsGrid->CommitPendingChanges() )
return;
// sanity
if( m_jobsFile->GetOutputs().empty() )
if( m_jobsFile->GetDestinations().empty() )
{
DisplayError( this, _( "No outputs defined" ) );
DisplayError( this, _( "No destinations defined" ) );
return;
}
for( PANEL_JOBSET_OUTPUT* panel : GetOutputPanels() )
for( PANEL_DESTINATION* panel : GetDestinationPanels() )
panel->ClearStatus();
Refresh();
@ -967,9 +963,9 @@ void PANEL_JOBSET::OnGenerateAllOutputsClick( wxCommandEvent& event )
WX_PROGRESS_REPORTER* progressReporter =
new WX_PROGRESS_REPORTER( m_frame, _( "Running jobs" ), 1 );
jobRunner.RunJobsAllOutputs();
jobRunner.RunJobsAllDestinations();
for( PANEL_JOBSET_OUTPUT* panel : GetOutputPanels() )
for( PANEL_DESTINATION* panel : GetDestinationPanels() )
panel->UpdateStatus();
delete progressReporter;

View File

@ -28,8 +28,8 @@ class wxAuiNotebook;
class JOBSET;
class KICAD_MANAGER_FRAME;
class PANEL_JOBSET;
class PANEL_JOBSET_OUTPUT;
struct JOBSET_OUTPUT;
class PANEL_DESTINATION;
struct JOBSET_DESTINATION;
enum COL_ORDER
{
@ -73,7 +73,7 @@ public:
~PANEL_JOBSET();
void RemoveOutput( PANEL_JOBSET_OUTPUT* aPanel );
void RemoveDestination( PANEL_DESTINATION* aPanel );
void EnsurePcbSchFramesOpen();
@ -85,24 +85,24 @@ public:
bool OpenJobOptionsForListItem( size_t aItemIndex );
void OnJobButtonDelete( wxCommandEvent& aEvent ) override;
std::vector<PANEL_JOBSET_OUTPUT*> GetOutputPanels();
std::vector<PANEL_DESTINATION*> GetDestinationPanels();
protected:
virtual void OnSizeGrid( wxSizeEvent& aEvent ) override;
virtual void OnAddJobClick( wxCommandEvent& aEvent ) override;
virtual void OnAddOutputClick( wxCommandEvent& aEvent ) override;
virtual void OnAddDestinationClick( wxCommandEvent& aEvent ) override;
virtual void OnSaveButtonClick( wxCommandEvent& aEvent ) override;
virtual void OnJobButtonUp( wxCommandEvent& aEvent ) override;
virtual void OnJobButtonDown( wxCommandEvent& aEvent ) override;
virtual void OnGenerateAllOutputsClick( wxCommandEvent& event ) override;
virtual void OnGenerateAllDestinationsClick( wxCommandEvent& event ) override;
virtual void OnGridCellChange( wxGridEvent& aEvent ) override;
bool GetCanClose() override;
private:
void rebuildJobList();
void buildOutputList();
void addJobOutputPanel( JOBSET_OUTPUT* aOutput );
void buildDestinationList();
void addDestinationPanel( JOBSET_DESTINATION* aDestination );
private:
wxAuiNotebook* m_parentBook;

View File

@ -79,30 +79,30 @@ PANEL_JOBSET_BASE::PANEL_JOBSET_BASE( wxWindow* parent, wxWindowID id, const wxP
bSizerUpper->Add( sbJobs, 7, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbOutputs;
sbOutputs = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outputs") ), wxVERTICAL );
wxStaticBoxSizer* sbDestinations;
sbDestinations = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Destinations") ), wxVERTICAL );
m_outputList = new wxScrolledWindow( sbOutputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_outputList->SetScrollRate( 5, 5 );
m_outputListSizer = new wxBoxSizer( wxVERTICAL );
m_destinationList = new wxScrolledWindow( sbDestinations->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_destinationList->SetScrollRate( 5, 5 );
m_destinationListSizer = new wxBoxSizer( wxVERTICAL );
m_outputList->SetSizer( m_outputListSizer );
m_outputList->Layout();
m_outputListSizer->Fit( m_outputList );
sbOutputs->Add( m_outputList, 1, wxEXPAND, 0 );
m_destinationList->SetSizer( m_destinationListSizer );
m_destinationList->Layout();
m_destinationListSizer->Fit( m_destinationList );
sbDestinations->Add( m_destinationList, 1, wxEXPAND, 0 );
wxBoxSizer* bOutputButtons;
bOutputButtons = new wxBoxSizer( wxHORIZONTAL );
m_buttonOutputAdd = new STD_BITMAP_BUTTON( sbOutputs->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bOutputButtons->Add( m_buttonOutputAdd, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxTOP, 5 );
m_buttonAddDestination = new STD_BITMAP_BUTTON( sbDestinations->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bOutputButtons->Add( m_buttonAddDestination, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxTOP, 5 );
sbOutputs->Add( bOutputButtons, 0, wxEXPAND|wxLEFT, 3 );
sbDestinations->Add( bOutputButtons, 0, wxEXPAND|wxLEFT, 3 );
bSizerUpper->Add( sbOutputs, 4, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerUpper->Add( sbDestinations, 4, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
@ -119,8 +119,8 @@ PANEL_JOBSET_BASE::PANEL_JOBSET_BASE( wxWindow* parent, wxWindowID id, const wxP
bSizerButtons->Add( 10, 0, 0, wxEXPAND, 5 );
m_buttonRunAllOutputs = new wxButton( this, wxID_ANY, _("Generate All Outputs"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonRunAllOutputs, 0, wxALL, 5 );
m_buttonGenerateAllDestinations = new wxButton( this, wxID_ANY, _("Generate All Destinations"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonGenerateAllDestinations, 0, wxALL, 5 );
bSizerMain->Add( bSizerButtons, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
@ -136,9 +136,9 @@ PANEL_JOBSET_BASE::PANEL_JOBSET_BASE( wxWindow* parent, wxWindowID id, const wxP
m_buttonUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnJobButtonUp ), NULL, this );
m_buttonDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnJobButtonDown ), NULL, this );
m_buttonDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnJobButtonDelete ), NULL, this );
m_buttonOutputAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnAddOutputClick ), NULL, this );
m_buttonAddDestination->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnAddDestinationClick ), NULL, this );
m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnSaveButtonClick ), NULL, this );
m_buttonRunAllOutputs->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnGenerateAllOutputsClick ), NULL, this );
m_buttonGenerateAllDestinations->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnGenerateAllDestinationsClick ), NULL, this );
}
PANEL_JOBSET_BASE::~PANEL_JOBSET_BASE()
@ -150,13 +150,13 @@ PANEL_JOBSET_BASE::~PANEL_JOBSET_BASE()
m_buttonUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnJobButtonUp ), NULL, this );
m_buttonDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnJobButtonDown ), NULL, this );
m_buttonDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnJobButtonDelete ), NULL, this );
m_buttonOutputAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnAddOutputClick ), NULL, this );
m_buttonAddDestination->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnAddDestinationClick ), NULL, this );
m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnSaveButtonClick ), NULL, this );
m_buttonRunAllOutputs->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnGenerateAllOutputsClick ), NULL, this );
m_buttonGenerateAllDestinations->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_BASE::OnGenerateAllDestinationsClick ), NULL, this );
}
PANEL_JOBSET_OUTPUT_BASE::PANEL_JOBSET_OUTPUT_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
PANEL_DESTINATION_BASE::PANEL_DESTINATION_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) );
@ -208,25 +208,25 @@ PANEL_JOBSET_OUTPUT_BASE::PANEL_JOBSET_OUTPUT_BASE( wxWindow* parent, wxWindowID
bSizerMain->Fit( this );
// Connect Events
this->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnRightDown ) );
m_statusBitmap->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnLastStatusClick ), NULL, this );
m_buttonProperties->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnProperties ), NULL, this );
m_buttonDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnDelete ), NULL, this );
m_buttonGenerate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnGenerate ), NULL, this );
this->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( PANEL_DESTINATION_BASE::OnRightDown ) );
m_statusBitmap->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( PANEL_DESTINATION_BASE::OnLastStatusClick ), NULL, this );
m_buttonProperties->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DESTINATION_BASE::OnProperties ), NULL, this );
m_buttonDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DESTINATION_BASE::OnDelete ), NULL, this );
m_buttonGenerate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DESTINATION_BASE::OnGenerate ), NULL, this );
}
PANEL_JOBSET_OUTPUT_BASE::~PANEL_JOBSET_OUTPUT_BASE()
PANEL_DESTINATION_BASE::~PANEL_DESTINATION_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnRightDown ) );
m_statusBitmap->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnLastStatusClick ), NULL, this );
m_buttonProperties->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnProperties ), NULL, this );
m_buttonDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnDelete ), NULL, this );
m_buttonGenerate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBSET_OUTPUT_BASE::OnGenerate ), NULL, this );
this->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( PANEL_DESTINATION_BASE::OnRightDown ) );
m_statusBitmap->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( PANEL_DESTINATION_BASE::OnLastStatusClick ), NULL, this );
m_buttonProperties->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DESTINATION_BASE::OnProperties ), NULL, this );
m_buttonDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DESTINATION_BASE::OnDelete ), NULL, this );
m_buttonGenerate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_DESTINATION_BASE::OnGenerate ), NULL, this );
}
DIALOG_OUTPUT_RUN_RESULTS_BASE::DIALOG_OUTPUT_RUN_RESULTS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_JOBSET_RUN_LOG_BASE::DIALOG_JOBSET_RUN_LOG_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( 450,250 ), wxDefaultSize );
@ -266,16 +266,16 @@ DIALOG_OUTPUT_RUN_RESULTS_BASE::DIALOG_OUTPUT_RUN_RESULTS_BASE( wxWindow* parent
this->Centre( wxBOTH );
// Connect Events
m_jobList->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::OnJobListItemSelected ), NULL, this );
m_jobList->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::onJobListSize ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::OnButtonOk ), NULL, this );
m_jobList->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnJobListItemSelected ), NULL, this );
m_jobList->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::onJobListSize ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnButtonOk ), NULL, this );
}
DIALOG_OUTPUT_RUN_RESULTS_BASE::~DIALOG_OUTPUT_RUN_RESULTS_BASE()
DIALOG_JOBSET_RUN_LOG_BASE::~DIALOG_JOBSET_RUN_LOG_BASE()
{
// Disconnect Events
m_jobList->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::OnJobListItemSelected ), NULL, this );
m_jobList->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::onJobListSize ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::OnButtonOk ), NULL, this );
m_jobList->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnJobListItemSelected ), NULL, this );
m_jobList->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::onJobListSize ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JOBSET_RUN_LOG_BASE::OnButtonOk ), NULL, this );
}

View File

@ -511,9 +511,9 @@
<property name="proportion">4</property>
<object class="wxStaticBoxSizer" expanded="true">
<property name="id">wxID_ANY</property>
<property name="label">Outputs</property>
<property name="label">Destinations</property>
<property name="minimum_size"></property>
<property name="name">sbOutputs</property>
<property name="name">sbDestinations</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
@ -557,7 +557,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_outputList</property>
<property name="name">m_destinationList</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -577,7 +577,7 @@
<property name="window_style">wxVSCROLL</property>
<object class="wxBoxSizer" expanded="false">
<property name="minimum_size"></property>
<property name="name">m_outputListSizer</property>
<property name="name">m_destinationListSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
</object>
@ -631,7 +631,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add output</property>
<property name="label">Add destination</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
@ -641,7 +641,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonOutputAdd</property>
<property name="name">m_buttonAddDestination</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -664,7 +664,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAddOutputClick</event>
<event name="OnButtonClick">OnAddDestinationClick</event>
</object>
</object>
</object>
@ -816,7 +816,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Generate All Outputs</property>
<property name="label">Generate All Destinations</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
@ -826,7 +826,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonRunAllOutputs</property>
<property name="name">m_buttonGenerateAllDestinations</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -849,7 +849,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnGenerateAllOutputsClick</event>
<event name="OnButtonClick">OnGenerateAllDestinationsClick</event>
</object>
</object>
</object>
@ -871,7 +871,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">PANEL_JOBSET_OUTPUT_BASE</property>
<property name="name">PANEL_DESTINATION_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">; ; forward_declare</property>
@ -1350,12 +1350,12 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">450,250</property>
<property name="name">DIALOG_OUTPUT_RUN_RESULTS_BASE</property>
<property name="name">DIALOG_JOBSET_RUN_LOG_BASE</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
<property name="title">Job Output Run Log</property>
<property name="title">Jobset Run Log</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>

View File

@ -51,11 +51,11 @@ class PANEL_JOBSET_BASE : public PANEL_NOTEBOOK_BASE
STD_BITMAP_BUTTON* m_buttonUp;
STD_BITMAP_BUTTON* m_buttonDown;
STD_BITMAP_BUTTON* m_buttonDelete;
wxScrolledWindow* m_outputList;
wxBoxSizer* m_outputListSizer;
STD_BITMAP_BUTTON* m_buttonOutputAdd;
wxScrolledWindow* m_destinationList;
wxBoxSizer* m_destinationListSizer;
STD_BITMAP_BUTTON* m_buttonAddDestination;
wxButton* m_buttonSave;
wxButton* m_buttonRunAllOutputs;
wxButton* m_buttonGenerateAllDestinations;
// Virtual event handlers, override them in your derived class
virtual void OnGridCellChange( wxGridEvent& event ) { event.Skip(); }
@ -64,9 +64,9 @@ class PANEL_JOBSET_BASE : public PANEL_NOTEBOOK_BASE
virtual void OnJobButtonUp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnJobButtonDown( wxCommandEvent& event ) { event.Skip(); }
virtual void OnJobButtonDelete( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddOutputClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddDestinationClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSaveButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGenerateAllOutputsClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGenerateAllDestinationsClick( wxCommandEvent& event ) { event.Skip(); }
public:
@ -78,9 +78,9 @@ class PANEL_JOBSET_BASE : public PANEL_NOTEBOOK_BASE
};
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_JOBSET_OUTPUT_BASE
/// Class PANEL_DESTINATION_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_JOBSET_OUTPUT_BASE : public wxPanel
class PANEL_DESTINATION_BASE : public wxPanel
{
private:
@ -102,16 +102,16 @@ class PANEL_JOBSET_OUTPUT_BASE : public wxPanel
public:
PANEL_JOBSET_OUTPUT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxBORDER_SUNKEN|wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_DESTINATION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxBORDER_SUNKEN|wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_JOBSET_OUTPUT_BASE();
~PANEL_DESTINATION_BASE();
};
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_OUTPUT_RUN_RESULTS_BASE
/// Class DIALOG_JOBSET_RUN_LOG_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_OUTPUT_RUN_RESULTS_BASE : public DIALOG_SHIM
class DIALOG_JOBSET_RUN_LOG_BASE : public DIALOG_SHIM
{
private:
@ -130,9 +130,9 @@ class DIALOG_OUTPUT_RUN_RESULTS_BASE : public DIALOG_SHIM
public:
DIALOG_OUTPUT_RUN_RESULTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Job Output Run Log"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_JOBSET_RUN_LOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Jobset Run Log"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_OUTPUT_RUN_RESULTS_BASE();
~DIALOG_JOBSET_RUN_LOG_BASE();
};

View File

@ -48,14 +48,12 @@ JOBS_RUNNER::JOBS_RUNNER( KIWAY* aKiway, JOBSET* aJobsFile, PROJECT* aProject,
}
bool JOBS_RUNNER::RunJobsAllOutputs( bool aBail )
bool JOBS_RUNNER::RunJobsAllDestinations( bool aBail )
{
bool success = true;
for( JOBSET_OUTPUT& output : m_jobsFile->GetOutputs() )
{
success &= RunJobsForOutput( &output, aBail );
}
for( JOBSET_DESTINATION& destination : m_jobsFile->GetDestinations() )
success &= RunJobsForDestination( &destination, aBail );
return success;
}
@ -124,8 +122,8 @@ int JOBS_RUNNER::runSpecialCopyFiles( const JOBSET_JOB* aJob, PROJECT* aProject
std::vector<wxString> exclusions;
for( const JOBSET_OUTPUT& output : m_jobsFile->GetOutputs() )
exclusions.push_back( projectPath + output.m_outputHandler->GetOutputPath() );
for( const JOBSET_DESTINATION& destination : m_jobsFile->GetDestinations() )
exclusions.push_back( projectPath + destination.m_outputHandler->GetOutputPath() );
wxString errors;
int copyCount = 0;
@ -165,23 +163,23 @@ private:
};
bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
bool JOBS_RUNNER::RunJobsForDestination( JOBSET_DESTINATION* aDestination, bool aBail )
{
bool genOutputs = true;
bool success = true;
std::vector<JOBSET_JOB> jobsForOutput = m_jobsFile->GetJobsForOutput( aOutput );
std::vector<JOBSET_JOB> jobsForDestination = m_jobsFile->GetJobsForDestination( aDestination );
wxString msg;
wxFileName tmp;
tmp.AssignDir( wxFileName::GetTempDir() );
tmp.AppendDir( KIID().AsString() );
aOutput->m_lastRunSuccessMap.clear();
aDestination->m_lastRunSuccessMap.clear();
for( auto& [name, reporter] : aOutput->m_lastRunReporters )
for( auto& [name, reporter] : aDestination->m_lastRunReporters )
delete reporter;
aOutput->m_lastRunReporters.clear();
aDestination->m_lastRunReporters.clear();
wxString tempDirPath = tmp.GetFullPath();
@ -193,22 +191,23 @@ bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
}
aOutput->m_lastRunSuccess = false;
aDestination->m_lastRunSuccess = false;
return false;
}
bool continueOuput = aOutput->m_outputHandler->OutputPrecheck();
bool continueOuput = aDestination->m_outputHandler->OutputPrecheck();
if( !continueOuput )
{
if( m_reporter )
{
msg = wxString::Format( wxT( "Output precheck failed for output %s" ), aOutput->m_id );
msg = wxString::Format( wxT( "Output precheck failed for output %s" ),
aDestination->m_id );
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
}
aOutput->m_lastRunSuccess = false;
aDestination->m_lastRunSuccess = false;
return false;
}
@ -216,7 +215,7 @@ bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
{
msg += wxT( "|--------------------------------\n" );
msg += wxT( "| " );
msg += wxString::Format( "Performing jobs for output %s", aOutput->m_id );
msg += wxString::Format( "Performing jobs for output %s", aDestination->m_id );
msg += wxT( "\n" );
msg += wxT( "|--------------------------------\n" );
@ -224,7 +223,7 @@ bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
int jobNum = 1;
for( const JOBSET_JOB& job : jobsForOutput )
for( const JOBSET_JOB& job : jobsForDestination )
{
msg += wxString::Format( wxT( "|%-5d | %-50s\n" ), jobNum, job.GetDescription() );
jobNum++;
@ -243,7 +242,7 @@ bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
int failCount = 0;
int successCount = 0;
for( const JOBSET_JOB& job : jobsForOutput )
for( const JOBSET_JOB& job : jobsForDestination )
{
if( m_reporter != nullptr )
{
@ -264,7 +263,7 @@ bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
if( !reporterToUse || reporterToUse == &NULL_REPORTER::GetInstance() )
{
reporterToUse = new JOBSET_OUTPUT_REPORTER( tempDirPath );
aOutput->m_lastRunReporters[job.m_id] = reporterToUse;
aDestination->m_lastRunReporters[job.m_id] = reporterToUse;
}
int result = CLI::EXIT_CODES::SUCCESS;
@ -286,7 +285,7 @@ bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
}
}
aOutput->m_lastRunSuccessMap[job.m_id] = ( result == CLI::EXIT_CODES::SUCCESS );
aDestination->m_lastRunSuccessMap[job.m_id] = ( result == CLI::EXIT_CODES::SUCCESS );
if( m_reporter )
{
@ -327,9 +326,9 @@ bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
}
if( genOutputs )
success &= aOutput->m_outputHandler->HandleOutputs( tempDirPath, m_project, outputs );
success &= aDestination->m_outputHandler->HandleOutputs( tempDirPath, m_project, outputs );
aOutput->m_lastRunSuccess = success;
aDestination->m_lastRunSuccess = success;
if( m_reporter )
{

View File

@ -21,7 +21,7 @@
#pragma once
class JOBSET;
struct JOBSET_OUTPUT;
struct JOBSET_DESTINATION;
struct JOBSET_JOB;
class KIWAY;
class REPORTER;
@ -33,8 +33,8 @@ public:
JOBS_RUNNER( KIWAY* aKiway, JOBSET* aJobsFile, PROJECT* aProject,
REPORTER* aReporter = nullptr );
bool RunJobsAllOutputs( bool aBail = false );
bool RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail = false );
bool RunJobsAllDestinations( bool aBail = false );
bool RunJobsForDestination( JOBSET_DESTINATION* aDestination, bool aBail = false );
private:
int runSpecialExecute( const JOBSET_JOB* aJob, PROJECT* aProject );

View File

@ -775,8 +775,8 @@ void KICAD_MANAGER_FRAME::OpenJobsFile( const wxFileName& aFileName, bool aCreat
if( aCreate && !aFileName.FileExists() )
{
JOBSET_OUTPUT* output = jobsFile->AddNewJobOutput( JOBSET_OUTPUT_TYPE::FOLDER );
output->m_outputHandler->SetOutputPath( aFileName.GetName() );
JOBSET_DESTINATION* dest = jobsFile->AddNewDestination( JOBSET_DESTINATION_T::FOLDER );
dest->m_outputHandler->SetOutputPath( aFileName.GetName() );
jobsFile->SaveToFile( wxEmptyString, true );
}

View File

@ -52,14 +52,8 @@
// Handles the selection of command events.
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
const PCB_DISPLAY_OPTIONS& displ_opts = GetDisplayOptions();
switch( id ) // Execute command
switch( event.GetId() ) // Execute command
{
case 0:
break;
case ID_MENU_EXPORT_FOOTPRINTS_TO_LIBRARY:
ExportFootprintsToLibrary( false );
break;