Add empty eeschema page layout for Eagle schematic import.
Fixes: lp:1729722 * https://bugs.launchpad.net/kicad/+bug/1729722
This commit is contained in:
parent
90d53df790
commit
34b52c91b7
|
@ -115,8 +115,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <worksheet.h> // defaultPageLayout
|
||||
|
||||
#include <worksheet.h>
|
||||
|
||||
// height of the band reference grid 2.0 mm
|
||||
// worksheet frame reference text size 1.3 mm
|
||||
|
@ -124,11 +123,9 @@
|
|||
// default line width 0.15 mm
|
||||
// frame ref pitch 50 mm
|
||||
|
||||
// export defaultPageLayout:
|
||||
extern const char defaultPageLayout[];
|
||||
|
||||
// Default page layout (sizes are in mm)
|
||||
const char defaultPageLayout[] = "( page_layout\n"
|
||||
extern const char defaultPageLayout[] =
|
||||
"(page_layout\n"
|
||||
"(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15)\n"
|
||||
"(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
|
||||
"(rect (comment \"rect around the title block\") (linewidth 0.15) (start 110 34) (end 2 2) )\n"
|
||||
|
@ -160,5 +157,11 @@ const char defaultPageLayout[] = "( page_layout\n"
|
|||
"(tbtext \"%C3\" (comment \"Comment 3\") (pos 109 32) )\n"
|
||||
"(line (start 90 8.5) (end 90 5.5) )\n"
|
||||
"(line (start 26 8.5) (end 26 2) )\n"
|
||||
")\n"
|
||||
;
|
||||
")\n";
|
||||
|
||||
extern const char emptyPageLayout[] =
|
||||
"(page_layout\n"
|
||||
"(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)\n"
|
||||
"(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
|
||||
"(line (name segm1:Line) (start 0 0) (end 0 0))\n"
|
||||
")\n";
|
||||
|
|
|
@ -760,24 +760,38 @@ extern const char defaultPageLayout[];
|
|||
|
||||
void WORKSHEET_LAYOUT::SetDefaultLayout()
|
||||
{
|
||||
ClearList();
|
||||
PAGE_LAYOUT_READER_PARSER lp_parser( defaultPageLayout, wxT( "default page" ) );
|
||||
|
||||
try
|
||||
{
|
||||
lp_parser.Parse( this );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogMessage( ioe.What() );
|
||||
}
|
||||
SetPageLayout( defaultPageLayout, false, wxT( "default page" ) );
|
||||
}
|
||||
|
||||
// Returns defaultPageLayout as a string;
|
||||
wxString WORKSHEET_LAYOUT::DefaultLayout()
|
||||
{
|
||||
return wxString(defaultPageLayout);
|
||||
}
|
||||
|
||||
// emptyPageLayout is a "empty" page layout description
|
||||
// there is a 0 length line to fool something somewhere.
|
||||
// using the S expr.
|
||||
// see page_layout_empty_description.cpp
|
||||
extern const char emptyPageLayout[];
|
||||
|
||||
void WORKSHEET_LAYOUT::SetEmptyLayout()
|
||||
{
|
||||
SetPageLayout( emptyPageLayout, false, wxT( "empty page" ) );
|
||||
}
|
||||
|
||||
// Returns emptyPageLayout as a string;
|
||||
wxString WORKSHEET_LAYOUT::EmptyLayout()
|
||||
{
|
||||
return wxString(emptyPageLayout);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Populates the list from a S expr description stored in a string
|
||||
* @param aPageLayout = the S expr string
|
||||
*/
|
||||
void WORKSHEET_LAYOUT::SetPageLayout( const char* aPageLayout, bool Append )
|
||||
void WORKSHEET_LAYOUT::SetPageLayout( const char* aPageLayout, bool Append, const wxString& aSource )
|
||||
{
|
||||
if( ! Append )
|
||||
ClearList();
|
||||
|
@ -859,4 +873,3 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append
|
|||
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <sch_junction.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <worksheet_shape_builder.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <sch_screen.h>
|
||||
|
@ -424,6 +425,21 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway,
|
|||
|
||||
m_pi->SaveLibrary( getLibFileName().GetFullPath() );
|
||||
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
pglayout.SetEmptyLayout( );
|
||||
|
||||
wxFileName layoutfn( m_kiway->Prj().GetProjectPath(), "empty.kicad_wks");
|
||||
wxFile layoutfile;
|
||||
if( layoutfile.Create( layoutfn.GetFullPath() ) ) {
|
||||
layoutfile.Write( WORKSHEET_LAYOUT::EmptyLayout() );
|
||||
layoutfile.Close();
|
||||
}
|
||||
|
||||
BASE_SCREEN::m_PageLayoutDescrFileName = "empty.kicad_wks";
|
||||
|
||||
SCH_EDIT_FRAME* editor = (SCH_EDIT_FRAME*) m_kiway->Player( FRAME_SCH, true );
|
||||
editor->SaveProjectSettings( false );
|
||||
|
||||
return m_rootSheet;
|
||||
}
|
||||
|
||||
|
|
|
@ -717,6 +717,21 @@ public:
|
|||
*/
|
||||
void SetDefaultLayout();
|
||||
|
||||
/**
|
||||
* Fills the list with an empty layout shape
|
||||
*/
|
||||
void SetEmptyLayout();
|
||||
|
||||
/**
|
||||
* Returns a string containing the empty layout shape
|
||||
*/
|
||||
static wxString EmptyLayout();
|
||||
|
||||
/**
|
||||
* Returns a string containing the empty layout shape
|
||||
*/
|
||||
static wxString DefaultLayout();
|
||||
|
||||
/**
|
||||
* Populates the list with a custom layout, or
|
||||
* the default layout, if no custom layout available
|
||||
|
@ -732,10 +747,12 @@ public:
|
|||
/**
|
||||
* Populates the list from a S expr description stored in a string
|
||||
* @param aPageLayout = the S expr string
|
||||
* @param Append Do not delete old layout if true and append \a aPageLayout
|
||||
* @param aAppend Do not delete old layout if true and append \a aPageLayout
|
||||
* the existing one.
|
||||
@param aSource is the layout source description.
|
||||
*/
|
||||
void SetPageLayout( const char* aPageLayout, bool Append = false );
|
||||
void SetPageLayout( const char* aPageLayout, bool aAppend = false,
|
||||
const wxString& aSource = wxT( "Sexpr_string" ) );
|
||||
|
||||
/**
|
||||
* @return a short filename from a full filename:
|
||||
|
|
Loading…
Reference in New Issue