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
|
// height of the band reference grid 2.0 mm
|
||||||
// worksheet frame reference text size 1.3 mm
|
// worksheet frame reference text size 1.3 mm
|
||||||
|
@ -124,41 +123,45 @@
|
||||||
// default line width 0.15 mm
|
// default line width 0.15 mm
|
||||||
// frame ref pitch 50 mm
|
// frame ref pitch 50 mm
|
||||||
|
|
||||||
// export defaultPageLayout:
|
|
||||||
extern const char defaultPageLayout[];
|
|
||||||
|
|
||||||
// Default page layout (sizes are in mm)
|
// Default page layout (sizes are in mm)
|
||||||
const char defaultPageLayout[] = "( page_layout\n"
|
extern const char defaultPageLayout[] =
|
||||||
"(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15)\n"
|
"(page_layout\n"
|
||||||
"(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
|
"(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15)\n"
|
||||||
"(rect (comment \"rect around the title block\") (linewidth 0.15) (start 110 34) (end 2 2) )\n"
|
"(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
|
||||||
"(rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )\n"
|
"(rect (comment \"rect around the title block\") (linewidth 0.15) (start 110 34) (end 2 2) )\n"
|
||||||
"(line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )\n"
|
"(rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )\n"
|
||||||
"(tbtext \"1\" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )\n"
|
"(line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )\n"
|
||||||
"(line (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50) )\n"
|
"(tbtext \"1\" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )\n"
|
||||||
"(tbtext \"1\" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )\n"
|
"(line (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50) )\n"
|
||||||
"(line (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50) )\n"
|
"(tbtext \"1\" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )\n"
|
||||||
"(tbtext \"A\" (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center)(repeat 100) (incry 50) )\n"
|
"(line (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50) )\n"
|
||||||
"(line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )\n"
|
"(tbtext \"A\" (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center)(repeat 100) (incry 50) )\n"
|
||||||
"(tbtext \"A\" (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) )\n"
|
"(line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )\n"
|
||||||
"(tbtext \"Date: %D\" (pos 87 6.9) )\n"
|
"(tbtext \"A\" (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) )\n"
|
||||||
"(line (start 110 5.5) (end 2 5.5) )\n"
|
"(tbtext \"Date: %D\" (pos 87 6.9) )\n"
|
||||||
"(tbtext \"%K\" (pos 109 4.1) (comment \"Kicad version\" ) )\n"
|
"(line (start 110 5.5) (end 2 5.5) )\n"
|
||||||
"(line (start 110 8.5) (end 2 8.5) )\n"
|
"(tbtext \"%K\" (pos 109 4.1) (comment \"Kicad version\" ) )\n"
|
||||||
"(tbtext \"Rev: %R\" (pos 24 6.9)(font bold)(justify left) )\n"
|
"(line (start 110 8.5) (end 2 8.5) )\n"
|
||||||
"(tbtext \"Size: %Z\" (comment \"Paper format name\")(pos 109 6.9) )\n"
|
"(tbtext \"Rev: %R\" (pos 24 6.9)(font bold)(justify left) )\n"
|
||||||
"(tbtext \"Id: %S/%N\" (comment \"Sheet id\")(pos 24 4.1) )\n"
|
"(tbtext \"Size: %Z\" (comment \"Paper format name\")(pos 109 6.9) )\n"
|
||||||
"(line (start 110 12.5) (end 2 12.5) )\n"
|
"(tbtext \"Id: %S/%N\" (comment \"Sheet id\")(pos 24 4.1) )\n"
|
||||||
"(tbtext \"Title: %T\" (pos 109 10.7)(font bold italic (size 2 2)) )\n"
|
"(line (start 110 12.5) (end 2 12.5) )\n"
|
||||||
"(tbtext \"File: %F\" (pos 109 14.3) )\n"
|
"(tbtext \"Title: %T\" (pos 109 10.7)(font bold italic (size 2 2)) )\n"
|
||||||
"(line (start 110 18.5) (end 2 18.5) )\n"
|
"(tbtext \"File: %F\" (pos 109 14.3) )\n"
|
||||||
"(tbtext \"Sheet: %P\" (pos 109 17) )\n"
|
"(line (start 110 18.5) (end 2 18.5) )\n"
|
||||||
"(tbtext \"%Y\" (comment \"Company name\") (pos 109 20)(font bold) )\n"
|
"(tbtext \"Sheet: %P\" (pos 109 17) )\n"
|
||||||
"(tbtext \"%C0\" (comment \"Comment 0\") (pos 109 23) )\n"
|
"(tbtext \"%Y\" (comment \"Company name\") (pos 109 20)(font bold) )\n"
|
||||||
"(tbtext \"%C1\" (comment \"Comment 1\") (pos 109 26) )\n"
|
"(tbtext \"%C0\" (comment \"Comment 0\") (pos 109 23) )\n"
|
||||||
"(tbtext \"%C2\" (comment \"Comment 2\") (pos 109 29) )\n"
|
"(tbtext \"%C1\" (comment \"Comment 1\") (pos 109 26) )\n"
|
||||||
"(tbtext \"%C3\" (comment \"Comment 3\") (pos 109 32) )\n"
|
"(tbtext \"%C2\" (comment \"Comment 2\") (pos 109 29) )\n"
|
||||||
"(line (start 90 8.5) (end 90 5.5) )\n"
|
"(tbtext \"%C3\" (comment \"Comment 3\") (pos 109 32) )\n"
|
||||||
"(line (start 26 8.5) (end 26 2) )\n"
|
"(line (start 90 8.5) (end 90 5.5) )\n"
|
||||||
")\n"
|
"(line (start 26 8.5) (end 26 2) )\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()
|
void WORKSHEET_LAYOUT::SetDefaultLayout()
|
||||||
{
|
{
|
||||||
ClearList();
|
SetPageLayout( defaultPageLayout, false, wxT( "default page" ) );
|
||||||
PAGE_LAYOUT_READER_PARSER lp_parser( defaultPageLayout, wxT( "default page" ) );
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
lp_parser.Parse( this );
|
|
||||||
}
|
|
||||||
catch( const IO_ERROR& ioe )
|
|
||||||
{
|
|
||||||
wxLogMessage( ioe.What() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
* Populates the list from a S expr description stored in a string
|
||||||
* @param aPageLayout = the S expr 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 )
|
if( ! Append )
|
||||||
ClearList();
|
ClearList();
|
||||||
|
@ -859,4 +873,3 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append
|
||||||
|
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <sch_junction.h>
|
#include <sch_junction.h>
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include <sch_edit_frame.h>
|
#include <sch_edit_frame.h>
|
||||||
|
#include <worksheet_shape_builder.h>
|
||||||
#include <template_fieldnames.h>
|
#include <template_fieldnames.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <sch_screen.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() );
|
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;
|
return m_rootSheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -717,6 +717,21 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetDefaultLayout();
|
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
|
* Populates the list with a custom layout, or
|
||||||
* the default layout, if no custom layout available
|
* 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
|
* Populates the list from a S expr description stored in a string
|
||||||
* @param aPageLayout = the S expr 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.
|
* 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:
|
* @return a short filename from a full filename:
|
||||||
|
|
Loading…
Reference in New Issue