mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 00:21:25 +00:00
Moved jobs to a more direct-editing paradigm.
Uses WX_GRID for in-place editing of job descriptions and GRID_CELL_TEXT_BUTTON for context-menu-free editing of job properties. Also moves buttons down as the Save button (now renamed Save Jobset) also saves the output definitions.
This commit is contained in:
parent
f7aded00c7
commit
b36f67853c
@ -41,7 +41,8 @@
|
||||
|
||||
GRID_TRICKS::GRID_TRICKS( WX_GRID* aGrid ) :
|
||||
m_grid( aGrid ),
|
||||
m_addHandler( []( wxCommandEvent& ) {} )
|
||||
m_addHandler( []( wxCommandEvent& ) {} ),
|
||||
m_multiCellEditEnabled( true )
|
||||
{
|
||||
init();
|
||||
}
|
||||
@ -49,7 +50,8 @@ GRID_TRICKS::GRID_TRICKS( WX_GRID* aGrid ) :
|
||||
|
||||
GRID_TRICKS::GRID_TRICKS( WX_GRID* aGrid, std::function<void( wxCommandEvent& )> aAddHandler ) :
|
||||
m_grid( aGrid ),
|
||||
m_addHandler( aAddHandler )
|
||||
m_addHandler( aAddHandler ),
|
||||
m_multiCellEditEnabled( true )
|
||||
{
|
||||
init();
|
||||
}
|
||||
@ -356,10 +358,15 @@ void GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
|
||||
_( "Clear selected cells placing original contents on clipboard" ) );
|
||||
menu.Append( GRIDTRICKS_ID_COPY, _( "Copy" ) + "\tCtrl+C",
|
||||
_( "Copy selected cells to clipboard" ) );
|
||||
menu.Append( GRIDTRICKS_ID_PASTE, _( "Paste" ) + "\tCtrl+V",
|
||||
_( "Paste clipboard cells to matrix at current cell" ) );
|
||||
menu.Append( GRIDTRICKS_ID_DELETE, _( "Delete" ) + "\tDel",
|
||||
_( "Clear contents of selected cells" ) );
|
||||
|
||||
if( m_multiCellEditEnabled )
|
||||
{
|
||||
menu.Append( GRIDTRICKS_ID_PASTE, _( "Paste" ) + "\tCtrl+V",
|
||||
_( "Paste clipboard cells to matrix at current cell" ) );
|
||||
menu.Append( GRIDTRICKS_ID_DELETE, _( "Delete" ) + "\tDel",
|
||||
_( "Clear contents of selected cells" ) );
|
||||
}
|
||||
|
||||
menu.Append( GRIDTRICKS_ID_SELECT, _( "Select All" ) + "\tCtrl+A",
|
||||
_( "Select all cells" ) );
|
||||
|
||||
@ -713,6 +720,9 @@ void GRID_TRICKS::paste_clipboard()
|
||||
|
||||
void GRID_TRICKS::paste_text( const wxString& cb_text )
|
||||
{
|
||||
if( !m_multiCellEditEnabled )
|
||||
return;
|
||||
|
||||
wxGridTableBase* tbl = m_grid->GetTable();
|
||||
|
||||
const int cur_row = m_grid->GetGridCursorRow();
|
||||
|
@ -134,6 +134,8 @@ protected:
|
||||
std::function<void( wxCommandEvent& )> m_addHandler;
|
||||
|
||||
std::bitset<GRIDTRICKS_MAX_COL> m_tooltipEnabled;
|
||||
|
||||
bool m_multiCellEditEnabled;
|
||||
};
|
||||
|
||||
#endif // _GRID_TRICKS_H_
|
||||
|
@ -37,9 +37,12 @@
|
||||
|
||||
#include <wx/dirdlg.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/combo.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
|
||||
#include <widgets/wx_grid.h>
|
||||
#include <widgets/grid_text_button_helpers.h>
|
||||
#include <kiplatform/ui.h>
|
||||
#include <confirm.h>
|
||||
|
||||
#include <jobs/job_special_execute.h>
|
||||
@ -451,6 +454,79 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/* ---------- support for jobs grid ---------- */
|
||||
|
||||
JOBS_GRID_TRICKS::JOBS_GRID_TRICKS( PANEL_JOBS* aParent, WX_GRID* aGrid ) :
|
||||
GRID_TRICKS( aGrid ),
|
||||
m_parent( aParent )
|
||||
{
|
||||
m_multiCellEditEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
class TEXT_BUTTON_JOB_PROPERTIES : public wxComboCtrl
|
||||
{
|
||||
public:
|
||||
TEXT_BUTTON_JOB_PROPERTIES( wxWindow* aParent, PANEL_JOBS* aController, WX_GRID* aGrid ) :
|
||||
wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER | wxBORDER_NONE ),
|
||||
m_controller( aController ),
|
||||
m_grid( aGrid )
|
||||
{
|
||||
SetButtonBitmaps( KiBitmapBundle( BITMAPS::edit ) );
|
||||
|
||||
// win32 fix, avoids drawing the "native dropdown caret"
|
||||
Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoSetPopupControl( wxComboPopup* popup ) override
|
||||
{
|
||||
m_popup = nullptr;
|
||||
}
|
||||
|
||||
void OnButtonClick() override
|
||||
{
|
||||
int row = m_grid->GetGridCursorRow();
|
||||
|
||||
if( row >= 0 && row < (int) m_controller->GetJobsFile()->GetJobs().size() )
|
||||
m_controller->OpenJobOptionsForListItem( m_grid->GetGridCursorRow() );
|
||||
}
|
||||
|
||||
PANEL_JOBS* m_controller;
|
||||
WX_GRID* m_grid;
|
||||
};
|
||||
|
||||
|
||||
class GRID_CELL_JOB_PROPERTIES_EDITOR : public GRID_CELL_TEXT_BUTTON
|
||||
{
|
||||
public:
|
||||
GRID_CELL_JOB_PROPERTIES_EDITOR( PANEL_JOBS* aController, WX_GRID* aGrid ) :
|
||||
m_controller( aController ),
|
||||
m_grid( aGrid )
|
||||
{ }
|
||||
|
||||
wxGridCellEditor* Clone() const override
|
||||
{
|
||||
return new GRID_CELL_JOB_PROPERTIES_EDITOR( m_controller, m_grid );
|
||||
}
|
||||
|
||||
void Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler ) override
|
||||
{
|
||||
m_control = new TEXT_BUTTON_JOB_PROPERTIES( aParent, m_controller, m_grid );
|
||||
WX_GRID::CellEditorSetMargins( Combo() );
|
||||
|
||||
wxGridCellEditor::Create( aParent, aId, aEventHandler );
|
||||
}
|
||||
|
||||
protected:
|
||||
PANEL_JOBS* m_controller;
|
||||
WX_GRID* m_grid;
|
||||
};
|
||||
|
||||
/* ---------- end of support for jobs grid ---------- */
|
||||
|
||||
|
||||
PANEL_JOBS::PANEL_JOBS( wxAuiNotebook* aParent, KICAD_MANAGER_FRAME* aFrame,
|
||||
std::unique_ptr<JOBSET> aJobsFile ) :
|
||||
PANEL_JOBS_BASE( aParent ),
|
||||
@ -458,30 +534,30 @@ PANEL_JOBS::PANEL_JOBS( wxAuiNotebook* aParent, KICAD_MANAGER_FRAME* aFrame,
|
||||
m_frame( aFrame ),
|
||||
m_jobsFile( std::move( aJobsFile ) )
|
||||
{
|
||||
int jobNoColId = m_jobList->AppendColumn( _( "No." ) );
|
||||
int jobDescColId = m_jobList->AppendColumn( _( "Job Description" ) );
|
||||
m_jobList->SetColumnWidth( jobNoColId, wxLIST_AUTOSIZE_USEHEADER );
|
||||
m_jobList->SetColumnWidth( jobDescColId, wxLIST_AUTOSIZE_USEHEADER );
|
||||
m_jobsGrid->PushEventHandler( new JOBS_GRID_TRICKS( this, m_jobsGrid ) );
|
||||
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new GRID_CELL_JOB_PROPERTIES_EDITOR( this, m_jobsGrid ) );
|
||||
m_jobsGrid->SetColAttr( 1, attr );
|
||||
|
||||
m_buttonAddJob->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
|
||||
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_jobList->Connect( wxEVT_MENU, wxCommandEventHandler( PANEL_JOBS::onJobListMenu ),
|
||||
nullptr, this );
|
||||
|
||||
rebuildJobList();
|
||||
buildOutputList();
|
||||
|
||||
m_buttonRunAllOutputs->Enable( !m_jobsFile->GetOutputs().empty() && !m_jobsFile->GetJobs().empty() );
|
||||
m_buttonRunAllOutputs->Enable( !m_jobsFile->GetOutputs().empty()
|
||||
&& !m_jobsFile->GetJobs().empty() );
|
||||
}
|
||||
|
||||
|
||||
PANEL_JOBS::~PANEL_JOBS()
|
||||
{
|
||||
m_jobList->Disconnect( wxEVT_MENU, wxCommandEventHandler( PANEL_JOBS::onJobListMenu ),
|
||||
nullptr, this );
|
||||
// Delete the GRID_TRICKS.
|
||||
m_jobsGrid->PopEventHandler( true );
|
||||
}
|
||||
|
||||
|
||||
@ -509,14 +585,21 @@ void PANEL_JOBS::RemoveOutput( JOBSET_OUTPUT* aOutput )
|
||||
|
||||
void PANEL_JOBS::rebuildJobList()
|
||||
{
|
||||
m_jobList->DeleteAllItems();
|
||||
if( m_jobsGrid->GetNumberRows() )
|
||||
m_jobsGrid->DeleteRows( 0, m_jobsGrid->GetNumberRows() );
|
||||
|
||||
m_jobsGrid->AppendRows( m_jobsFile->GetJobs().size() );
|
||||
|
||||
int num = 1;
|
||||
for( auto& job : m_jobsFile->GetJobs() )
|
||||
|
||||
for( JOBSET_JOB& job : m_jobsFile->GetJobs() )
|
||||
{
|
||||
long itemIndex =
|
||||
m_jobList->InsertItem( m_jobList->GetItemCount(), wxString::Format( "%d", num++ ) );
|
||||
m_jobList->SetItem( itemIndex, 1, job.GetDescription() );
|
||||
m_jobsGrid->SetCellValue( num - 1, 0, wxString::Format( "%d", num ) );
|
||||
m_jobsGrid->SetReadOnly( num - 1, 0 );
|
||||
|
||||
m_jobsGrid->SetCellValue( num - 1, 1, job.GetDescription() );
|
||||
|
||||
num++;
|
||||
}
|
||||
|
||||
UpdateTitle();
|
||||
@ -560,9 +643,9 @@ void PANEL_JOBS::UpdateTitle()
|
||||
|
||||
void PANEL_JOBS::addJobOutputPanel( JOBSET_OUTPUT* aOutput )
|
||||
{
|
||||
PANEL_JOB_OUTPUT* outputPanel =
|
||||
new PANEL_JOB_OUTPUT( m_outputList, this, m_frame, m_jobsFile.get(), aOutput );
|
||||
m_outputListSizer->Add( outputPanel, 0, wxEXPAND | wxALL, 5 );
|
||||
PANEL_JOB_OUTPUT* outputPanel = new PANEL_JOB_OUTPUT( m_outputList, this, m_frame,
|
||||
m_jobsFile.get(), aOutput );
|
||||
m_outputListSizer->Add( outputPanel, 0, wxEXPAND, 5 );
|
||||
|
||||
m_outputPanelMap[aOutput] = outputPanel;
|
||||
|
||||
@ -575,7 +658,7 @@ void PANEL_JOBS::buildOutputList()
|
||||
Freeze();
|
||||
m_outputPanelMap.clear();
|
||||
|
||||
for( auto& job : m_jobsFile->GetOutputs() )
|
||||
for( JOBSET_OUTPUT& job : m_jobsFile->GetOutputs() )
|
||||
{
|
||||
addJobOutputPanel( &job );
|
||||
}
|
||||
@ -586,7 +669,7 @@ void PANEL_JOBS::buildOutputList()
|
||||
}
|
||||
|
||||
|
||||
void PANEL_JOBS::openJobOptionsForListItem( size_t aItemIndex )
|
||||
void PANEL_JOBS::OpenJobOptionsForListItem( size_t aItemIndex )
|
||||
{
|
||||
JOBSET_JOB& job = m_jobsFile->GetJobs()[aItemIndex];
|
||||
|
||||
@ -617,83 +700,6 @@ void PANEL_JOBS::openJobOptionsForListItem( size_t aItemIndex )
|
||||
}
|
||||
|
||||
|
||||
void PANEL_JOBS::OnJobListDoubleClicked( wxListEvent& aEvent )
|
||||
{
|
||||
long item = aEvent.GetIndex();
|
||||
|
||||
openJobOptionsForListItem( item );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_JOBS::OnJobListItemRightClick( wxListEvent& event )
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append( wxID_PROPERTIES, _( "Edit Options" ) );
|
||||
menu.Append( wxID_EDIT, _( "Edit Description" ) );
|
||||
menu.AppendSeparator();
|
||||
menu.Append( wxID_DELETE, _( "Delete" ) );
|
||||
|
||||
m_jobList->PopupMenu( &menu, event.GetPoint() );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_JOBS::onJobListMenu( wxCommandEvent& aEvent )
|
||||
{
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case wxID_PROPERTIES:
|
||||
{
|
||||
long item = m_jobList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
||||
|
||||
if( item == -1 )
|
||||
return;
|
||||
|
||||
openJobOptionsForListItem( item );
|
||||
}
|
||||
break;
|
||||
|
||||
case wxID_EDIT:
|
||||
{
|
||||
long item = m_jobList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
||||
if( item == -1 )
|
||||
return;
|
||||
|
||||
JOBSET_JOB& job = m_jobsFile->GetJobs()[item];
|
||||
wxString desc = job.GetDescription();
|
||||
|
||||
wxTextEntryDialog descDialog( this, _( "Edit Description" ), _( "Enter new description:" ),
|
||||
desc );
|
||||
|
||||
if( descDialog.ShowModal() == wxID_OK && desc != descDialog.GetValue() )
|
||||
{
|
||||
job.SetDescription( descDialog.GetValue() );
|
||||
|
||||
m_jobsFile->SetDirty();
|
||||
UpdateTitle();
|
||||
|
||||
m_jobList->SetItem( item, 1, job.GetDescription() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case wxID_DELETE:
|
||||
{
|
||||
long item = m_jobList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
||||
|
||||
if( item == -1 )
|
||||
return;
|
||||
|
||||
m_jobsFile->RemoveJob( item );
|
||||
rebuildJobList();
|
||||
break;
|
||||
}
|
||||
|
||||
default: wxFAIL_MSG( wxT( "Unknown ID in context menu event" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_JOBS::OnSaveButtonClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_jobsFile->SaveToFile( wxEmptyString, true );
|
||||
@ -868,37 +874,68 @@ wxString PANEL_JOBS::GetFilePath() const
|
||||
|
||||
void PANEL_JOBS::OnJobButtonUp( wxCommandEvent& aEvent )
|
||||
{
|
||||
long item = m_jobList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
||||
|
||||
if( item == -1 )
|
||||
if( !m_jobsGrid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
if( item == 0 )
|
||||
return;
|
||||
int item = m_jobsGrid->GetGridCursorRow();
|
||||
|
||||
m_jobsFile->MoveJobUp( item );
|
||||
if( item > 0 )
|
||||
{
|
||||
m_jobsFile->MoveJobUp( item );
|
||||
|
||||
rebuildJobList();
|
||||
rebuildJobList();
|
||||
|
||||
m_jobList->SetItemState( item - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
||||
m_jobsGrid->SelectRow( item - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_JOBS::OnJobButtonDown( wxCommandEvent& aEvent )
|
||||
{
|
||||
long item = m_jobList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
||||
|
||||
if( item == -1 )
|
||||
if( !m_jobsGrid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
if( item == m_jobList->GetItemCount() - 1 )
|
||||
int item = m_jobsGrid->GetGridCursorRow();
|
||||
|
||||
if( item < m_jobsGrid->GetNumberRows() - 1 )
|
||||
{
|
||||
m_jobsFile->MoveJobDown( item );
|
||||
|
||||
rebuildJobList();
|
||||
|
||||
m_jobsGrid->SelectRow( item + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_JOBS::OnJobButtonDelete( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxArrayInt selectedRows = m_jobsGrid->GetSelectedRows();
|
||||
|
||||
if( selectedRows.empty() && m_jobsGrid->GetGridCursorRow() >= 0 )
|
||||
selectedRows.push_back( m_jobsGrid->GetGridCursorRow() );
|
||||
|
||||
if( selectedRows.empty() )
|
||||
return;
|
||||
|
||||
m_jobsFile->MoveJobDown( item );
|
||||
m_jobsGrid->CommitPendingChanges( true /* quiet mode */ );
|
||||
m_jobsGrid->ClearSelection();
|
||||
|
||||
// Reverse sort so deleting a row doesn't change the indexes of the other rows.
|
||||
selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
|
||||
|
||||
for( int row : selectedRows )
|
||||
m_jobsFile->RemoveJob( row );
|
||||
|
||||
rebuildJobList();
|
||||
|
||||
m_jobList->SetItemState( item + 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
||||
}
|
||||
|
||||
|
||||
@ -935,4 +972,23 @@ void PANEL_JOBS::OnRunAllJobsClick( wxCommandEvent& event )
|
||||
|
||||
delete progressReporter;
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_JOBS::adjustGridColumns()
|
||||
{
|
||||
// Account for scroll bars
|
||||
int width = KIPLATFORM::UI::GetUnobscuredSize( m_jobsGrid ).x;
|
||||
|
||||
m_jobsGrid->SetColSize( 1, width - m_jobsGrid->GetColSize( 0 ) );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_JOBS::OnSizeGrid( wxSizeEvent& aEvent )
|
||||
{
|
||||
adjustGridColumns();
|
||||
|
||||
// Always propagate for a grid repaint (needed if the height changes, as well as width)
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,27 @@
|
||||
|
||||
#include "panel_jobs_base.h"
|
||||
#include <memory>
|
||||
#include <grid_tricks.h>
|
||||
|
||||
class wxAuiNotebook;
|
||||
class JOBSET;
|
||||
class KICAD_MANAGER_FRAME;
|
||||
class PANEL_JOBS;
|
||||
class PANEL_JOB_OUTPUT;
|
||||
struct JOBSET_OUTPUT;
|
||||
|
||||
class JOBS_GRID_TRICKS : public GRID_TRICKS
|
||||
{
|
||||
public:
|
||||
explicit JOBS_GRID_TRICKS( PANEL_JOBS* aParent, WX_GRID* aGrid );
|
||||
|
||||
~JOBS_GRID_TRICKS() override = default;
|
||||
|
||||
protected:
|
||||
PANEL_JOBS* m_parent;
|
||||
};
|
||||
|
||||
|
||||
class PANEL_JOBS : public PANEL_JOBS_BASE
|
||||
{
|
||||
public:
|
||||
@ -44,14 +58,18 @@ public:
|
||||
wxString GetFilePath() const;
|
||||
void UpdateTitle();
|
||||
|
||||
JOBSET* GetJobsFile() { return m_jobsFile.get(); }
|
||||
|
||||
void OpenJobOptionsForListItem( size_t aItemIndex );
|
||||
|
||||
protected:
|
||||
virtual void OnSizeGrid( wxSizeEvent& aEvent ) override;
|
||||
virtual void OnAddJobClick( wxCommandEvent& aEvent ) override;
|
||||
virtual void OnAddOutputClick( wxCommandEvent& aEvent ) override;
|
||||
virtual void OnJobListDoubleClicked( wxListEvent& aEvent ) override;
|
||||
virtual void OnJobListItemRightClick( wxListEvent& event ) override;
|
||||
virtual void OnSaveButtonClick( wxCommandEvent& aEvent ) override;
|
||||
virtual void OnJobButtonUp( wxCommandEvent& aEvent ) override;
|
||||
virtual void OnJobButtonDown( wxCommandEvent& aEvent ) override;
|
||||
virtual void OnJobButtonDelete( wxCommandEvent& aEvent ) override;
|
||||
virtual void OnRunAllJobsClick( wxCommandEvent& event ) override;
|
||||
|
||||
bool GetCanClose() override;
|
||||
@ -60,9 +78,9 @@ private:
|
||||
void rebuildJobList();
|
||||
void buildOutputList();
|
||||
void addJobOutputPanel( JOBSET_OUTPUT* aOutput );
|
||||
void onJobListMenu( wxCommandEvent& aEvent );
|
||||
void openJobOptionsForListItem( size_t aItemIndex );
|
||||
void adjustGridColumns();
|
||||
|
||||
private:
|
||||
wxAuiNotebook* m_parentBook;
|
||||
KICAD_MANAGER_FRAME* m_frame;
|
||||
std::unique_ptr<JOBSET> m_jobsFile;
|
||||
|
@ -1,11 +1,12 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/std_bitmap_button.h"
|
||||
#include "widgets/wx_grid.h"
|
||||
|
||||
#include "panel_jobs_base.h"
|
||||
|
||||
@ -14,59 +15,73 @@
|
||||
PANEL_JOBS_BASE::PANEL_JOBS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : PANEL_NOTEBOOK_BASE( parent, id, pos, size, style, name )
|
||||
{
|
||||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizer3;
|
||||
bSizer3 = new wxBoxSizer( wxVERTICAL );
|
||||
wxBoxSizer* bSizerUpper;
|
||||
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Jobs"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
bSizer3->Add( m_staticText1, 0, wxALL, 5 );
|
||||
wxStaticBoxSizer* sbJobs;
|
||||
sbJobs = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Jobs") ), wxVERTICAL );
|
||||
|
||||
m_jobList = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL );
|
||||
bSizer3->Add( m_jobList, 1, wxALL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
|
||||
m_jobsGrid = new WX_GRID( sbJobs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
|
||||
// Grid
|
||||
m_jobsGrid->CreateGrid( 5, 2 );
|
||||
m_jobsGrid->EnableEditing( true );
|
||||
m_jobsGrid->EnableGridLines( true );
|
||||
m_jobsGrid->EnableDragGridSize( false );
|
||||
m_jobsGrid->SetMargins( 0, 0 );
|
||||
|
||||
m_buttonAddJob = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer2->Add( m_buttonAddJob, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
// Columns
|
||||
m_jobsGrid->SetColSize( 0, 40 );
|
||||
m_jobsGrid->SetColSize( 1, 260 );
|
||||
m_jobsGrid->EnableDragColMove( false );
|
||||
m_jobsGrid->EnableDragColSize( true );
|
||||
m_jobsGrid->SetColLabelSize( 0 );
|
||||
m_jobsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
m_buttonUp = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer2->Add( m_buttonUp, 0, wxALL, 5 );
|
||||
// Rows
|
||||
m_jobsGrid->EnableDragRowSize( true );
|
||||
m_jobsGrid->SetRowLabelSize( 0 );
|
||||
m_jobsGrid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
m_buttonDown = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer2->Add( m_buttonDown, 0, wxALL, 5 );
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_jobsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||
sbJobs->Add( m_jobsGrid, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 3 );
|
||||
|
||||
wxBoxSizer* bJobsButtons;
|
||||
bJobsButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_buttonAddJob = new STD_BITMAP_BUTTON( sbJobs->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bJobsButtons->Add( m_buttonAddJob, 0, wxALIGN_CENTER|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
m_buttonUp = new STD_BITMAP_BUTTON( sbJobs->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bJobsButtons->Add( m_buttonUp, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_buttonDown = new STD_BITMAP_BUTTON( sbJobs->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bJobsButtons->Add( m_buttonDown, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
bJobsButtons->Add( 20, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
m_buttonSave = new wxButton( this, wxID_ANY, _("Save"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer2->Add( m_buttonSave, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
m_buttonDelete = new wxBitmapButton( sbJobs->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bJobsButtons->Add( m_buttonDelete, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( bSizer2, 0, wxEXPAND, 5 );
|
||||
bJobsButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizer3, 2, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizer14;
|
||||
bSizer14 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Outputs"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText4->Wrap( -1 );
|
||||
bSizer14->Add( m_staticText4, 0, wxALL, 5 );
|
||||
|
||||
m_buttonOutputAdd = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer14->Add( m_buttonOutputAdd, 0, 0, 5 );
|
||||
sbJobs->Add( bJobsButtons, 0, wxEXPAND|wxRIGHT|wxLEFT, 3 );
|
||||
|
||||
|
||||
bSizer4->Add( bSizer14, 0, wxEXPAND, 5 );
|
||||
bSizerUpper->Add( sbJobs, 2, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_outputList = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
|
||||
wxStaticBoxSizer* sbOutputs;
|
||||
sbOutputs = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outputs") ), wxVERTICAL );
|
||||
|
||||
m_outputList = new wxScrolledWindow( sbOutputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_RAISED|wxVSCROLL );
|
||||
m_outputList->SetScrollRate( 5, 5 );
|
||||
m_outputListSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
@ -74,41 +89,66 @@ PANEL_JOBS_BASE::PANEL_JOBS_BASE( wxWindow* parent, wxWindowID id, const wxPoint
|
||||
m_outputList->SetSizer( m_outputListSizer );
|
||||
m_outputList->Layout();
|
||||
m_outputListSizer->Fit( m_outputList );
|
||||
bSizer4->Add( m_outputList, 1, wxEXPAND | wxALL, 0 );
|
||||
sbOutputs->Add( m_outputList, 1, wxEXPAND|wxALL, 0 );
|
||||
|
||||
m_buttonRunAllOutputs = new wxButton( this, wxID_ANY, _("Run All Jobs"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonRunAllOutputs->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
|
||||
wxBoxSizer* bOutputButtons;
|
||||
bOutputButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
bSizer4->Add( m_buttonRunAllOutputs, 0, wxALIGN_RIGHT|wxALL, 5 );
|
||||
m_buttonOutputAdd = new STD_BITMAP_BUTTON( sbOutputs->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bOutputButtons->Add( m_buttonOutputAdd, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizer4, 1, wxEXPAND, 5 );
|
||||
sbOutputs->Add( bOutputButtons, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerUpper->Add( sbOutputs, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerButtons;
|
||||
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
bSizerButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_buttonSave = new wxButton( this, wxID_ANY, _("Save Jobset"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtons->Add( m_buttonSave, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerButtons->Add( 20, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
m_buttonRunAllOutputs = new wxButton( this, wxID_ANY, _("Generate All Outputs"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtons->Add( m_buttonRunAllOutputs, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizerButtons, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
m_jobList->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( PANEL_JOBS_BASE::OnJobListDoubleClicked ), NULL, this );
|
||||
m_jobList->Connect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( PANEL_JOBS_BASE::OnJobListItemRightClick ), NULL, this );
|
||||
m_jobsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_JOBS_BASE::OnSizeGrid ), NULL, this );
|
||||
m_buttonAddJob->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnAddJobClick ), NULL, this );
|
||||
m_buttonUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnJobButtonUp ), NULL, this );
|
||||
m_buttonDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnJobButtonDown ), NULL, this );
|
||||
m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnSaveButtonClick ), NULL, this );
|
||||
m_buttonDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnJobButtonDelete ), NULL, this );
|
||||
m_buttonOutputAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnAddOutputClick ), NULL, this );
|
||||
m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnSaveButtonClick ), NULL, this );
|
||||
m_buttonRunAllOutputs->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnRunAllJobsClick ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_JOBS_BASE::~PANEL_JOBS_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_jobList->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( PANEL_JOBS_BASE::OnJobListDoubleClicked ), NULL, this );
|
||||
m_jobList->Disconnect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( PANEL_JOBS_BASE::OnJobListItemRightClick ), NULL, this );
|
||||
m_jobsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_JOBS_BASE::OnSizeGrid ), NULL, this );
|
||||
m_buttonAddJob->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnAddJobClick ), NULL, this );
|
||||
m_buttonUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnJobButtonUp ), NULL, this );
|
||||
m_buttonDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnJobButtonDown ), NULL, this );
|
||||
m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnSaveButtonClick ), NULL, this );
|
||||
m_buttonDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnJobButtonDelete ), NULL, this );
|
||||
m_buttonOutputAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnAddOutputClick ), NULL, this );
|
||||
m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnSaveButtonClick ), NULL, this );
|
||||
m_buttonRunAllOutputs->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_JOBS_BASE::OnRunAllJobsClick ), NULL, this );
|
||||
|
||||
}
|
||||
@ -136,16 +176,16 @@ PANEL_JOB_OUTPUT_BASE::PANEL_JOB_OUTPUT_BASE( wxWindow* parent, wxWindowID id, c
|
||||
m_textOutputType->Wrap( -1 );
|
||||
m_textOutputType->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||
|
||||
bSizer17->Add( m_textOutputType, 0, wxALL, 5 );
|
||||
bSizer17->Add( m_textOutputType, 0, wxTOP, 8 );
|
||||
|
||||
|
||||
bSizer14->Add( bSizer17, 1, wxEXPAND, 5 );
|
||||
bSizer14->Add( bSizer17, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_statusBitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer14->Add( m_statusBitmap, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizer12->Add( bSizer14, 1, wxEXPAND, 5 );
|
||||
bSizer12->Add( bSizer14, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizer12, 1, wxEXPAND, 5 );
|
||||
@ -154,7 +194,7 @@ PANEL_JOB_OUTPUT_BASE::PANEL_JOB_OUTPUT_BASE( wxWindow* parent, wxWindowID id, c
|
||||
bSizer13 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_buttonOutputRun = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer13->Add( m_buttonOutputRun, 0, wxALL, 5 );
|
||||
bSizer13->Add( m_buttonOutputRun, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_buttonOutputOptions = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer13->Add( m_buttonOutputOptions, 0, wxALL, 5 );
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@ -11,33 +11,37 @@
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class STD_BITMAP_BUTTON;
|
||||
class WX_GRID;
|
||||
|
||||
#include "dialogs/panel_notebook_base.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/string.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_JOBS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -46,26 +50,25 @@ class PANEL_JOBS_BASE : public PANEL_NOTEBOOK_BASE
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticText1;
|
||||
wxListCtrl* m_jobList;
|
||||
wxBitmapButton* m_buttonAddJob;
|
||||
wxBitmapButton* m_buttonUp;
|
||||
wxBitmapButton* m_buttonDown;
|
||||
wxButton* m_buttonSave;
|
||||
wxStaticText* m_staticText4;
|
||||
wxBitmapButton* m_buttonOutputAdd;
|
||||
WX_GRID* m_jobsGrid;
|
||||
STD_BITMAP_BUTTON* m_buttonAddJob;
|
||||
STD_BITMAP_BUTTON* m_buttonUp;
|
||||
STD_BITMAP_BUTTON* m_buttonDown;
|
||||
wxBitmapButton* m_buttonDelete;
|
||||
wxScrolledWindow* m_outputList;
|
||||
wxBoxSizer* m_outputListSizer;
|
||||
STD_BITMAP_BUTTON* m_buttonOutputAdd;
|
||||
wxButton* m_buttonSave;
|
||||
wxButton* m_buttonRunAllOutputs;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnJobListDoubleClicked( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnJobListItemRightClick( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); }
|
||||
virtual void OnAddJobClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnJobButtonUp( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnJobButtonDown( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSaveButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnJobButtonDelete( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnAddOutputClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSaveButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRunAllJobsClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user