24#include <wx/aui/auibook.h>
28#include <wx/checkbox.h>
63 int jobBmpColId =
m_jobList->AppendColumn( wxT(
"" ) );
64 int jobNoColId =
m_jobList->AppendColumn(
_(
"No." ) );
65 int jobDescColId =
m_jobList->AppendColumn(
_(
"Job Description" ) );
66 int jobSourceColId =
m_jobList->AppendColumn( wxT(
"Source" ) );
67 m_jobList->SetColumnWidth( jobBmpColId, wxLIST_AUTOSIZE_USEHEADER );
68 m_jobList->SetColumnWidth( jobNoColId, wxLIST_AUTOSIZE_USEHEADER );
69 m_jobList->SetColumnWidth( jobDescColId, wxLIST_AUTOSIZE_USEHEADER );
71 wxImageList* imageList =
new wxImageList( 16, 16,
true, 3 );
72 imageList->Add(
KiBitmapBundle( BITMAPS::ercerr ).GetBitmap( wxSize( 16, 16 ) ) );
73 imageList->Add(
KiBitmapBundle( BITMAPS::checked_ok ).GetBitmap( wxSize( 16, 16 ) ) );
74 m_jobList->SetImageList( imageList, wxIMAGE_LIST_SMALL );
90 m_jobList->SetItem( itemIndex, jobNoColId, wxString::Format(
"%d", num++ ) );
91 m_jobList->SetItem( itemIndex, jobDescColId, job.GetDescription() );
94 wxString source = wxEmptyString;
100 source = wxT(
"PCB" );
104 source = wxT(
"SCH" );
107 m_jobList->SetItem( itemIndex, jobSourceColId, source );
125 int itemIndex =
event.GetIndex();
133 if(
static_cast<size_t>( itemIndex ) < jobs.size() )
174 long style = GetWindowStyleFlag();
175 style &= ~wxBORDER_MASK;
176 style |= wxBORDER_SIMPLE;
177 SetWindowStyleFlag( style );
246 wxFileName fn =
project.GetProjectFullName();
247 wxSetWorkingDirectory( fn.GetPath() );
259 delete progressReporter;
281 menu.Append( wxID_EDIT,
_(
"Edit Output Options..." ) );
282 menu.Append( wxID_DELETE,
_(
"Delete Output" ) );
284 menu.AppendSeparator();
285 menu.Append( wxID_VIEW_DETAILS,
_(
"View Last Run Results..." ) );
307 virtual void OnDelete( wxCommandEvent& aEvent )
override
326 switch( aEvent.GetId() )
330 wxCommandEvent
dummy;
337 wxCommandEvent
dummy;
342 case wxID_VIEW_DETAILS:
350 wxFAIL_MSG( wxT(
"Unknown ID in context menu event" ) );
373 wxArrayInt selectedRows =
m_grid->GetSelectedRows();
377 menu.AppendSeparator();
379 _(
"Copy selected cells to clipboard" ) );
381 _(
"Delete selected jobs" ) );
383 _(
"Select all jobs" ) );
389 m_grid->PopupMenu( &menu );
395 wxArrayInt selectedRows =
m_grid->GetSelectedRows();
399 if( selectedRows.size() > 0 )
401 m_grid->SetGridCursor( selectedRows[0], 2 );
402 m_grid->EnableCellEditControl();
407 if( selectedRows.size() > 0 )
412 wxCommandEvent
dummy;
426 int curr_col = aEvent.GetCol();
427 int curr_row = aEvent.GetRow();
429 if( ( curr_col == 0 || curr_col == 1 || curr_col == 2 )
456 std::unique_ptr<JOBSET> aJobsFile ) :
458 m_parentBook( aParent ),
460 m_jobsFile(
std::
move( aJobsFile ) )
466 m_jobsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
469 m_jobsGrid->SetColSize( 0, GetTextExtent( wxT(
"99m" ) ).x );
470 m_jobsGrid->SetColSize( 1, GetTextExtent( wxT(
"PCBm" ) ).x );
521 m_jobsGrid->SetCellValue( num - 1, 0, wxString::Format(
"%d", num ) );
524 m_jobsGrid->SetCellValue( num - 1, 2, job.GetDescription() );
529 wxString source = wxEmptyString;
534 source = wxT(
"PCB" );
538 source = wxT(
"SCH" );
542 m_jobsGrid->SetCellValue( num - 1, 1, source );
551 panel->UpdateStatus();
560 tabName = wxS(
"*" ) + tabName;
584 std::vector<PANEL_JOBSET_OUTPUT*> panels;
589 panels.push_back( panel );
611 bool success =
false;
623 if( job.
m_job->GetType() ==
"special_execute" )
632 else if( job.
m_job->GetType() ==
"special_copyfiles" )
658 int row = aEvent.GetRow();
659 int col = aEvent.GetCol();
671 m_jobsFile->SaveToFile( wxEmptyString,
true );
681 wxArrayString headers;
682 std::vector<wxArrayString> items;
684 headers.Add(
_(
"Job Types" ) );
688 for(
const std::pair<const wxString, JOB_REGISTRY_ENTRY>& entry : jobMap )
691 item.Add( wxGetTranslation( entry.second.title ) );
692 items.emplace_back( item );
703 if( !selectedString.IsEmpty() )
705 for(
const std::pair<const wxString, JOB_REGISTRY_ENTRY>& entry : jobMap )
707 if( wxGetTranslation( entry.second.title ) == selectedString )
709 jobKey = entry.first;
715 if( !jobKey.IsEmpty() )
719 JOB* job = JOB_REGISTRY::CreateInstance<JOB>( jobKey );
745 wxArrayInt selectedRows =
m_jobsGrid->GetSelectedRows();
747 if( selectedRows.empty() )
754 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
756 int select = selectedRows[0];
758 for(
int row : selectedRows )
773 wxArrayString headers;
774 std::vector<wxArrayString> items;
776 headers.Add(
_(
"Output Types" ) );
778 for(
const std::pair<const JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO>& outputType :
JobsetOutputTypeInfos )
781 item.Add( wxGetTranslation( outputType.second.name ) );
782 items.emplace_back( item );
793 for(
const std::pair<const JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO>& jobType :
JobsetOutputTypeInfos )
795 if( wxGetTranslation( jobType.second.name ) == selectedString )
822 wxFileName fileName =
m_jobsFile->GetFullFilename();
823 wxString msg =
_(
"Save changes to '%s' before closing?" );
828 return m_jobsFile->SaveToFile(wxEmptyString, true);
853 wxFileName boardfn =
project.GetProjectFullName();
854 boardfn.SetExt( FILEEXT::PcbFileExtension );
857 wxEventBlocker blocker(
this );
859 frame->
OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
861 if( !frame->IsVisible() )
876 wxFileName schFn =
project.GetProjectFullName();
879 wxEventBlocker blocker(
this );
883 if( !frame->IsVisible() )
927 if( item < m_jobsGrid->GetNumberRows() - 1 )
956 panel->ClearStatus();
966 wxFileName fn =
project.GetProjectFullName();
967 wxSetWorkingDirectory( fn.GetPath() );
977 panel->UpdateStatus();
979 delete progressReporter;
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Class DIALOG_OUTPUT_RUN_RESULTS_BASE.
wxTextCtrl * m_textCtrlOutput
wxStaticText * m_staticTextOutputName
void OnJobListItemSelected(wxListEvent &event) override
DIALOG_OUTPUT_RUN_RESULTS(wxWindow *aParent, JOBSET *aJobsFile, JOBSET_OUTPUT *aOutput)
void onJobListSize(wxSizeEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
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
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
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.