Save values of Page Settings Export buttons in project.

Fixes: lp:1791431
* https://bugs.launchpad.net/kicad/+bug/1791431
This commit is contained in:
Jeff Young 2019-08-26 10:07:38 +01:00
parent 8277aeec7d
commit 8d31c9a6c1
2 changed files with 59 additions and 22 deletions

View File

@ -44,10 +44,26 @@
#include <ws_painter.h>
#include <dialog_page_settings.h>
#include <tool/actions.h>
#include <kiface_i.h>
#define MAX_PAGE_EXAMPLE_SIZE 200
#define KEY_EXPORT_REVISION wxT( "PageSettingsExportRevision" )
#define KEY_EXPORT_DATE wxT( "PageSettingsExportDate" )
#define KEY_EXPORT_TITLE wxT( "PageSettingsExportTitle" )
#define KEY_EXPORT_COMPANY wxT( "PageSettingsExportCompany" )
#define KEY_EXPORT_COMMENT1 wxT( "PageSettingsExportComment1" )
#define KEY_EXPORT_COMMENT2 wxT( "PageSettingsExportComment2" )
#define KEY_EXPORT_COMMENT3 wxT( "PageSettingsExportComment3" )
#define KEY_EXPORT_COMMENT4 wxT( "PageSettingsExportComment4" )
#define KEY_EXPORT_COMMENT5 wxT( "PageSettingsExportComment5" )
#define KEY_EXPORT_COMMENT6 wxT( "PageSettingsExportComment6" )
#define KEY_EXPORT_COMMENT7 wxT( "PageSettingsExportComment7" )
#define KEY_EXPORT_COMMENT8 wxT( "PageSettingsExportComment8" )
#define KEY_EXPORT_COMMENT9 wxT( "PageSettingsExportComment9" )
// List of page formats.
// they are prefixed by "_HKI" (already in use for hotkeys) instead of "_",
// because we need both the translated and the not translated version.
@ -118,6 +134,24 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent, wxSize aMa
DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
{
wxConfigBase* config = Kiface().KifaceSettings();
#ifdef EESCHEMA
config->Write( KEY_EXPORT_REVISION, m_RevisionExport->GetValue() );
config->Write( KEY_EXPORT_DATE, m_DateExport->GetValue() );
config->Write( KEY_EXPORT_TITLE, m_TitleExport->GetValue() );
config->Write( KEY_EXPORT_COMPANY, m_CompanyExport->GetValue() );
config->Write( KEY_EXPORT_COMMENT1, m_Comment1Export->GetValue() );
config->Write( KEY_EXPORT_COMMENT2, m_Comment2Export->GetValue() );
config->Write( KEY_EXPORT_COMMENT3, m_Comment3Export->GetValue() );
config->Write( KEY_EXPORT_COMMENT4, m_Comment4Export->GetValue() );
config->Write( KEY_EXPORT_COMMENT5, m_Comment5Export->GetValue() );
config->Write( KEY_EXPORT_COMMENT6, m_Comment6Export->GetValue() );
config->Write( KEY_EXPORT_COMMENT7, m_Comment7Export->GetValue() );
config->Write( KEY_EXPORT_COMMENT8, m_Comment8Export->GetValue() );
config->Write( KEY_EXPORT_COMMENT9, m_Comment9Export->GetValue() );
#endif
delete m_page_bitmap;
delete m_pagelayout;
}
@ -125,7 +159,8 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
void DIALOG_PAGES_SETTINGS::initDialog()
{
wxString msg;
wxConfigBase* config = Kiface().KifaceSettings();
wxString msg;
// initialize page format choice box and page format list.
// The first shows translated strings, the second contains not translated strings
@ -187,9 +222,21 @@ void DIALOG_PAGES_SETTINGS::initDialog()
m_TextComment8->SetValue( m_tb.GetComment( 7 ) );
m_TextComment9->SetValue( m_tb.GetComment( 8 ) );
#ifndef EESCHEMA
// these options have meaning only for Eeschema.
// disable them for other apps
#ifdef EESCHEMA
m_RevisionExport->SetValue( config->ReadBool( KEY_EXPORT_REVISION, false ) );
m_DateExport->SetValue( config->ReadBool( KEY_EXPORT_DATE, false ) );
m_TitleExport->SetValue( config->ReadBool( KEY_EXPORT_TITLE, false ) );
m_CompanyExport->SetValue( config->ReadBool( KEY_EXPORT_COMPANY, false ) );
m_Comment1Export->SetValue( config->ReadBool( KEY_EXPORT_COMMENT1, false ) );
m_Comment2Export->SetValue( config->ReadBool( KEY_EXPORT_COMMENT2, false ) );
m_Comment3Export->SetValue( config->ReadBool( KEY_EXPORT_COMMENT3, false ) );
m_Comment4Export->SetValue( config->ReadBool( KEY_EXPORT_COMMENT4, false ) );
m_Comment5Export->SetValue( config->ReadBool( KEY_EXPORT_COMMENT5, false ) );
m_Comment6Export->SetValue( config->ReadBool( KEY_EXPORT_COMMENT6, false ) );
m_Comment7Export->SetValue( config->ReadBool( KEY_EXPORT_COMMENT7, false ) );
m_Comment8Export->SetValue( config->ReadBool( KEY_EXPORT_COMMENT8, false ) );
m_Comment9Export->SetValue( config->ReadBool( KEY_EXPORT_COMMENT9, false ) );
#else
m_RevisionExport->Show( false );
m_DateExport->Show( false );
m_TitleExport->Show( false );

View File

@ -146,34 +146,24 @@ void DIALOG_ANNOTATE::InitValues()
m_rbOptions->SetSelection( 0 );
m_Config->Read( KEY_ANNOTATE_SORT_OPTION, &option, 0L );
switch( option )
{
default:
case 0:
m_rbSortBy_X_Position->SetValue( 1 );
break;
case 1:
m_rbSortBy_Y_Position->SetValue( 1 );
break;
case 0: m_rbSortBy_X_Position->SetValue( 1 ); break;
case 1: m_rbSortBy_Y_Position->SetValue( 1 ); break;
}
m_Config->Read( KEY_ANNOTATE_ALGO_OPTION, &option, 0L );
switch( option )
{
default:
case 0:
m_rbFirstFree->SetValue( 1 );
break;
case 1:
m_rbSheetX100->SetValue( 100 );
break;
case 2:
m_rbSheetX1000->SetValue( 1000 );
break;
case 0: m_rbFirstFree->SetValue( 1 ); break;
case 1: m_rbSheetX100->SetValue( 100 ); break;
case 2: m_rbSheetX1000->SetValue( 1000 ); break;
}
m_textNumberAfter->SetValue( wxT( "0" ) );
annotate_down_right_bitmap->SetBitmap( KiBitmap( annotate_down_right_xpm ) );