24#include <wx/aui/auibook.h>
28#include <wx/checkbox.h>
65 int jobBmpColId =
m_jobList->AppendColumn( wxT(
"" ) );
66 int jobNoColId =
m_jobList->AppendColumn(
_(
"No." ) );
67 int jobDescColId =
m_jobList->AppendColumn(
_(
"Job Description" ) );
68 m_jobList->SetColumnWidth( jobBmpColId, wxLIST_AUTOSIZE_USEHEADER );
69 m_jobList->SetColumnWidth( jobNoColId, wxLIST_AUTOSIZE_USEHEADER );
70 m_jobList->SetColumnWidth( jobDescColId, wxLIST_AUTOSIZE_USEHEADER );
72 wxImageList* imageList =
new wxImageList( 16, 16,
true, 3 );
73 imageList->Add(
KiBitmapBundle( BITMAPS::ercerr ).GetBitmap( wxSize( 16, 16 ) ) );
74 imageList->Add(
KiBitmapBundle( BITMAPS::checked_ok ).GetBitmap( wxSize( 16, 16 ) ) );
75 m_jobList->SetImageList( imageList, wxIMAGE_LIST_SMALL );
91 m_jobList->SetItem( itemIndex, jobNoColId, wxString::Format(
"%d", num++ ) );
92 m_jobList->SetItem( itemIndex, jobDescColId, job.GetDescription() );
101 int itemIndex =
event.GetIndex();
109 if(
static_cast<size_t>( itemIndex ) < jobs.size() )
148 long style = GetWindowStyleFlag();
149 style &= ~wxBORDER_MASK;
150 style |= wxBORDER_SIMPLE;
151 SetWindowStyleFlag( style );
208 wxFileName fn =
project.GetProjectFullName();
209 wxSetWorkingDirectory( fn.GetPath() );
221 delete progressReporter;
243 menu.Append( wxID_EDIT,
_(
"Edit Output Options..." ) );
244 menu.Append( wxID_DELETE,
_(
"Delete Output" ) );
246 menu.AppendSeparator();
247 menu.Append( wxID_VIEW_DETAILS,
_(
"View Last Run Results..." ) );
269 virtual void OnDelete( wxCommandEvent& aEvent )
override
288 switch( aEvent.GetId() )
292 wxCommandEvent
dummy;
299 wxCommandEvent
dummy;
304 case wxID_VIEW_DETAILS:
312 wxFAIL_MSG( wxT(
"Unknown ID in context menu event" ) );
335 wxArrayInt selectedRows =
m_grid->GetSelectedRows();
339 menu.AppendSeparator();
341 _(
"Copy selected cells to clipboard" ) );
343 _(
"Delete selected jobs" ) );
345 _(
"Select all jobs" ) );
351 m_grid->PopupMenu( &menu );
357 wxArrayInt selectedRows =
m_grid->GetSelectedRows();
361 if( selectedRows.size() > 0 )
363 m_grid->SetGridCursor( selectedRows[0], 1 );
364 m_grid->EnableCellEditControl();
369 if( selectedRows.size() > 0 )
374 wxCommandEvent
dummy;
388 int curr_col = aEvent.GetCol();
389 int curr_row = aEvent.GetRow();
391 if( ( curr_col == 0 || curr_col == 1 )
418 std::unique_ptr<JOBSET> aJobsFile ) :
420 m_parentBook( aParent ),
422 m_jobsFile(
std::
move( aJobsFile ) )
428 m_jobsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
431 m_jobsGrid->SetColSize( 0, GetTextExtent( wxT(
"99m" ) ).x );
482 m_jobsGrid->SetCellValue( num - 1, 0, wxString::Format(
"%d", num ) );
485 m_jobsGrid->SetCellValue( num - 1, 1, job.GetDescription() );
494 panel->UpdateStatus();
503 tabName = wxS(
"*" ) + tabName;
527 std::vector<PANEL_JOBSET_OUTPUT*> panels;
532 panels.push_back( panel );
554 bool success =
false;
566 if( job.
m_job->GetType() ==
"special_execute" )
575 else if( job.
m_job->GetType() ==
"special_copyfiles" )
601 int row = aEvent.GetRow();
602 int col = aEvent.GetCol();
614 m_jobsFile->SaveToFile( wxEmptyString,
true );
624 wxArrayString headers;
625 std::vector<wxArrayString> items;
627 headers.Add(
_(
"Job Types" ) );
631 for(
const std::pair<const wxString, JOB_REGISTRY_ENTRY>& entry : jobMap )
634 item.Add( wxGetTranslation( entry.second.title ) );
635 items.emplace_back( item );
646 if( !selectedString.IsEmpty() )
648 for(
const std::pair<const wxString, JOB_REGISTRY_ENTRY>& entry : jobMap )
650 if( wxGetTranslation( entry.second.title ) == selectedString )
652 jobKey = entry.first;
658 if( !jobKey.IsEmpty() )
662 JOB* job = JOB_REGISTRY::CreateInstance<JOB>( jobKey );
688 wxArrayInt selectedRows =
m_jobsGrid->GetSelectedRows();
690 if( selectedRows.empty() )
697 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
699 int select = selectedRows[0];
701 for(
int row : selectedRows )
716 wxArrayString headers;
717 std::vector<wxArrayString> items;
719 headers.Add(
_(
"Output Types" ) );
721 for(
const std::pair<const JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO>& outputType :
JobsetOutputTypeInfos )
724 item.Add( wxGetTranslation( outputType.second.name ) );
725 items.emplace_back( item );
736 for(
const std::pair<const JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO>& jobType :
JobsetOutputTypeInfos )
738 if( wxGetTranslation( jobType.second.name ) == selectedString )
765 wxFileName fileName =
m_jobsFile->GetFullFilename();
766 wxString msg =
_(
"Save changes to '%s' before closing?" );
771 return m_jobsFile->SaveToFile(wxEmptyString, true);
796 wxFileName boardfn =
project.GetProjectFullName();
797 boardfn.SetExt( FILEEXT::PcbFileExtension );
800 wxEventBlocker blocker(
this );
802 frame->
OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
804 if( !frame->IsVisible() )
819 wxFileName schFn =
project.GetProjectFullName();
822 wxEventBlocker blocker(
this );
826 if( !frame->IsVisible() )
870 if( item < m_jobsGrid->GetNumberRows() - 1 )
904 wxFileName fn =
project.GetProjectFullName();
905 wxSetWorkingDirectory( fn.GetPath() );
915 panel->UpdateStatus();
917 delete progressReporter;
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Class DIALOG_OUTPUT_RUN_RESULTS_BASE.
wxTextCtrl * m_textCtrlOutput
wxStaticText * m_staticTextOutputName
DIALOG_OUTPUT_RUN_RESULTS(wxWindow *aParent, JOBSET *aJobsFile, JOBSET_OUTPUT *aOutput)
virtual void OnJobListItemSelected(wxListEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
void SetListLabel(const wxString &aLabel)
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
bool m_multiCellEditEnabled
bool m_enableSingleClickEdit
virtual void doPopupSelection(wxCommandEvent &event)
WX_GRID * m_grid
I don't own the grid, but he owns me.
std::vector< JOBSET_JOB > GetJobsForOutput(JOBSET_OUTPUT *aOutput)
void SetDirty(bool aFlag=true)
std::vector< JOBSET_JOB > & GetJobs()
std::vector< JOBSET_OUTPUT > & GetOutputs()
void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent) override
void doPopupSelection(wxCommandEvent &event) override
bool handleDoubleClick(wxGridEvent &aEvent) override
JOBS_GRID_TRICKS(PANEL_JOBSET *aParent, WX_GRID *aGrid)
bool RunJobsForOutput(JOBSET_OUTPUT *aOutput, bool aBail=false)
bool RunJobsAllOutputs(bool aBail=false)
static const REGISTRY_MAP_T & GetRegistry()
std::unordered_map< wxString, JOB_REGISTRY_ENTRY > REGISTRY_MAP_T
static KIWAY::FACE_T GetKifaceType(const wxString &aName)
An simple container class that lets us dispatch output jobs to kifaces.
The main KiCad project manager frame.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
bool ProcessJobConfigDialog(KIWAY::FACE_T aFace, JOB *aJob, wxWindow *aWindow)
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
FACE_T
Known KIFACE implementations.
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
wxBoxSizer * m_outputListSizer
STD_BITMAP_BUTTON * m_buttonDown
wxButton * m_buttonRunAllOutputs
wxScrolledWindow * m_outputList
STD_BITMAP_BUTTON * m_buttonOutputAdd
STD_BITMAP_BUTTON * m_buttonAddJob
STD_BITMAP_BUTTON * m_buttonDelete
STD_BITMAP_BUTTON * m_buttonUp
Class PANEL_JOBSET_OUTPUT_BASE.
wxStaticBitmap * m_bitmapOutputType
STD_BITMAP_BUTTON * m_buttonDelete
STD_BITMAP_BUTTON * m_buttonProperties
wxButton * m_buttonGenerate
wxStaticBitmap * m_statusBitmap
wxStaticText * m_textOutputType
PANEL_JOBSET_OUTPUT(wxWindow *aParent, PANEL_JOBSET *aPanelParent, KICAD_MANAGER_FRAME *aFrame, JOBSET *aFile, JOBSET_OUTPUT *aOutput)
PANEL_JOBSET * m_panelParent
JOBSET_OUTPUT * GetOutput()
virtual void OnLastStatusClick(wxMouseEvent &aEvent) override
KICAD_MANAGER_FRAME * m_frame
void onMenu(wxCommandEvent &aEvent)
virtual void OnDelete(wxCommandEvent &aEvent) override
virtual void OnGenerate(wxCommandEvent &event) override
void OnProperties(wxCommandEvent &aEvent) override
void OnRightDown(wxMouseEvent &aEvent) override
wxString GetFilePath() const
virtual void OnSaveButtonClick(wxCommandEvent &aEvent) override
void OnJobButtonDelete(wxCommandEvent &aEvent) override
virtual void OnJobButtonDown(wxCommandEvent &aEvent) override
void EnsurePcbSchFramesOpen()
bool GetCanClose() override
virtual void OnGenerateAllOutputsClick(wxCommandEvent &event) override
wxAuiNotebook * m_parentBook
bool OpenJobOptionsForListItem(size_t aItemIndex)
std::vector< PANEL_JOBSET_OUTPUT * > GetOutputPanels()
KICAD_MANAGER_FRAME * m_frame
PANEL_JOBSET(wxAuiNotebook *aParent, KICAD_MANAGER_FRAME *aFrame, std::unique_ptr< JOBSET > aJobsFile)
void RemoveOutput(PANEL_JOBSET_OUTPUT *aPanel)
virtual void OnAddJobClick(wxCommandEvent &aEvent) override
std::unique_ptr< JOBSET > m_jobsFile
virtual void OnGridCellChange(wxGridEvent &aEvent) override
virtual void OnAddOutputClick(wxCommandEvent &aEvent) override
void addJobOutputPanel(JOBSET_OUTPUT *aOutput)
virtual void OnJobButtonUp(wxCommandEvent &aEvent) override
virtual void OnSizeGrid(wxSizeEvent &aEvent) override
Container for project specific data.
void OverrideMinSize(double aXPct, double aYPct)
Grids that have column sizes automatically set to fill the available width don't want to shrink after...
bool CancelPendingChanges()
void CancelShowEditorOnMouseUp()
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
A wrapper for reporting to a wxString object.
const wxString & GetMessages() const
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
This file is part of the common library.
static const std::string KiCadSchematicFileExtension
Some functions to handle hotkeys in KiCad.
KICOMMON_API std::map< JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO > JobsetOutputTypeInfos
KICOMMON_API std::map< JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO > JobsetOutputTypeInfos
std::vector< FAB_LAYER_COLOR > dummy
std::shared_ptr< JOB > m_job
wxString GetDescription() const
std::unordered_map< wxString, std::optional< bool > > m_lastRunSuccessMap
std::optional< bool > m_lastRunSuccess
std::unordered_map< wxString, REPORTER * > m_lastRunReporters
JOBSET_OUTPUT_TYPE m_type
Definition of file extensions used in Kicad.