Fix print dialog settings not persisting between sessions
This commit is contained in:
@@ -51,6 +51,8 @@ void BOARD_PRINTOUT_SETTINGS::Load( APP_SETTINGS_BASE* aConfig )
|
||||
|
||||
for( int layer : aConfig->m_Printing.layers )
|
||||
m_LayerSet.set( layer, true );
|
||||
|
||||
m_Mirror = aConfig->m_Printing.mirror;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +65,8 @@ void BOARD_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
|
||||
for( unsigned layer = 0; layer < m_LayerSet.size(); ++layer )
|
||||
if( m_LayerSet.test( layer ) )
|
||||
aConfig->m_Printing.layers.push_back( layer );
|
||||
|
||||
aConfig->m_Printing.mirror = m_Mirror;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -189,6 +189,21 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaV
|
||||
m_params.emplace_back( new PARAM_LIST<int>( "printing.layers",
|
||||
&m_Printing.layers, {} ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "printing.mirror",
|
||||
&m_Printing.mirror, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "printing.drill_marks",
|
||||
&m_Printing.drill_marks, 1 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "printing.pagination",
|
||||
&m_Printing.pagination, 1 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "printing.edge_cuts_on_all_pages",
|
||||
&m_Printing.edge_cuts_on_all_pages, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "printing.as_item_checkboxes",
|
||||
&m_Printing.as_item_checkboxes, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "search_pane.selection_zoom",
|
||||
reinterpret_cast<int*>( &m_SearchPane.selection_zoom ),
|
||||
static_cast<int>( SEARCH_PANE::SELECTION_ZOOM::PAN ) ) );
|
||||
|
||||
@@ -178,13 +178,18 @@ public:
|
||||
|
||||
struct PRINTING
|
||||
{
|
||||
bool background; ///< Whether or not to print background color.
|
||||
bool monochrome; ///< Whether or not to print in monochrome.
|
||||
double scale; ///< Printout scale.
|
||||
bool use_theme; ///< If false, display color theme will be used.
|
||||
wxString color_theme; ///< Color theme to use for printing.
|
||||
bool title_block; ///< Whether or not to print title block.
|
||||
std::vector<int> layers; ///< List of enabled layers for printing.
|
||||
bool background; ///< Whether or not to print background color.
|
||||
bool monochrome; ///< Whether or not to print in monochrome.
|
||||
double scale; ///< Printout scale.
|
||||
bool use_theme; ///< If false, display color theme will be used.
|
||||
wxString color_theme; ///< Color theme to use for printing.
|
||||
bool title_block; ///< Whether or not to print title block.
|
||||
std::vector<int> layers; ///< List of enabled layers for printing.
|
||||
bool mirror; ///< Print mirrored.
|
||||
int drill_marks; ///< Drill marks type (0=none, 1=small, 2=real).
|
||||
int pagination; ///< 0=all layers on one page, 1=one page per layer.
|
||||
bool edge_cuts_on_all_pages; ///< Print board edges on all pages.
|
||||
bool as_item_checkboxes; ///< Honor checkboxes in appearance manager.
|
||||
};
|
||||
|
||||
struct SYSTEM
|
||||
|
||||
@@ -454,6 +454,8 @@ void DIALOG_PRINT_PCBNEW::saveSettings()
|
||||
}
|
||||
|
||||
DIALOG_PRINT_GENERIC::saveSettings();
|
||||
|
||||
settings()->Save( cfg );
|
||||
}
|
||||
|
||||
|
||||
@@ -463,6 +465,11 @@ int PCB_CONTROL::Print( const TOOL_EVENT& aEvent )
|
||||
m_toolMgr->RunAction( ACTIONS::selectionClear );
|
||||
|
||||
PCBNEW_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() );
|
||||
|
||||
// Load saved settings
|
||||
PCBNEW_SETTINGS* cfg = static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->GetPcbNewSettings();
|
||||
settings.Load( cfg );
|
||||
|
||||
DIALOG_PRINT_PCBNEW dlg( (PCB_BASE_EDIT_FRAME*) m_frame, &settings );
|
||||
|
||||
if( m_isFootprintEditor )
|
||||
|
||||
@@ -53,12 +53,22 @@ PCBNEW_PRINTOUT_SETTINGS::PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo )
|
||||
void PCBNEW_PRINTOUT_SETTINGS::Load( APP_SETTINGS_BASE* aConfig )
|
||||
{
|
||||
BOARD_PRINTOUT_SETTINGS::Load( aConfig );
|
||||
|
||||
m_DrillMarks = static_cast<DRILL_MARKS>( aConfig->m_Printing.drill_marks );
|
||||
m_Pagination = static_cast<PAGINATION_T>( aConfig->m_Printing.pagination );
|
||||
m_PrintEdgeCutsOnAllPages = aConfig->m_Printing.edge_cuts_on_all_pages;
|
||||
m_AsItemCheckboxes = aConfig->m_Printing.as_item_checkboxes;
|
||||
}
|
||||
|
||||
|
||||
void PCBNEW_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
|
||||
{
|
||||
BOARD_PRINTOUT_SETTINGS::Save( aConfig );
|
||||
|
||||
aConfig->m_Printing.drill_marks = static_cast<int>( m_DrillMarks );
|
||||
aConfig->m_Printing.pagination = static_cast<int>( m_Pagination );
|
||||
aConfig->m_Printing.edge_cuts_on_all_pages = m_PrintEdgeCutsOnAllPages;
|
||||
aConfig->m_Printing.as_item_checkboxes = m_AsItemCheckboxes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user