Commit d7f569ae authored by jean-pierre charras's avatar jean-pierre charras

Fix GOST compatibility.

parent c328d6b1
......@@ -26,14 +26,8 @@ set(COMMON_ABOUT_DLG_SRCS
dialogs/dialog_page_settings_base.cpp
)
if(KICAD_GOST)
set( TITLE_BLOCK_SHAPES title_block_shapes_gost )
else()
set( TITLE_BLOCK_SHAPES title_block_shapes )
endif()
set(COMMON_PAGE_LAYOUT_SRCS
page_layout/${TITLE_BLOCK_SHAPES}.cpp
page_layout/title_block_shapes.cpp
page_layout/class_worksheet_dataitem.cpp
page_layout/class_worksheet_layout.cpp
page_layout/page_layout_default_description.cpp
......
......@@ -630,6 +630,7 @@ void WORKSHEET_LAYOUT::SetDefaultLayout()
try
{
lp_parser.Parse( this );
SetDefaultDescrFlag( true );
}
catch( IO_ERROR ioe )
{
......@@ -693,6 +694,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append
try
{
lp_parser.Parse( this );
SetDefaultDescrFlag( false );
}
catch( IO_ERROR ioe )
{
......
......@@ -61,19 +61,35 @@
#include <worksheet_shape_builder.h>
#include <class_worksheet_dataitem.h>
// Temporary include. Will be removed when a GOST page layout descr file is available
#ifdef KICAD_GOST
#include "title_block_shapes_gost.cpp"
#endif
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
const PAGE_INFO& aPageInfo,
const TITLE_BLOCK& aTitleBlock,
EDA_COLOR_T aColor, EDA_COLOR_T aAltColor )
{
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
// Ugly hack: will be removed when a GOST page layout descr file is available
#ifdef KICAD_GOST
if( pglayout.IsDefaultDescr() )
{
((WS_DRAW_ITEM_LIST_GOST*)this)->BuildWorkSheetGraphicListGOST( aPageInfo,
aTitleBlock, aColor, aAltColor );
return;
}
#endif
#define milsTomm (25.4/1000)
#define mmTomils (1000/25.4)
m_titleBlock = &aTitleBlock;
m_paperFormat = &aPageInfo.GetType();
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
wxPoint LTmargin( Mm2mils( pglayout.GetLeftMargin() ),
Mm2mils( pglayout.GetTopMargin() ) );
wxPoint RBmargin( Mm2mils( pglayout.GetRightMargin() ),
......
......@@ -977,7 +977,16 @@ Ki_WorkSheetData WS_DopTop_Line6 =
#include <worksheet_shape_builder.h>
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
class WS_DRAW_ITEM_LIST_GOST : public WS_DRAW_ITEM_LIST
{
public:
void BuildWorkSheetGraphicListGOST(
const PAGE_INFO& aPageInfo,
const TITLE_BLOCK& aTitleBlock,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor );
};
void WS_DRAW_ITEM_LIST_GOST::BuildWorkSheetGraphicListGOST(
const PAGE_INFO& aPageInfo,
const TITLE_BLOCK& aTitleBlock,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
......
......@@ -143,7 +143,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText23->Wrap( -1 );
fgSizer1->Add( m_staticText23, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
m_staticText26 = new wxStaticText( m_panel1, wxID_ANY, _("part id notation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText26 = new wxStaticText( m_panel1, wxID_ANY, _("Part id notation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText26->Wrap( -1 );
fgSizer1->Add( m_staticText26, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
......
......@@ -2455,7 +2455,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">part id notation:</property>
<property name="label">Part id notation:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......
......@@ -240,6 +240,7 @@ public:
*/
class WS_DRAW_ITEM_LIST
{
protected:
std::vector <WS_DRAW_ITEM_BASE*> m_graphicList; // Items to draw/plot
unsigned m_idx; // for GetFirst, GetNext functions
wxPoint m_LTmargin; // The left top margin in mils of the page layout.
......@@ -464,6 +465,10 @@ class WORKSHEET_LAYOUT
double m_rightMargin; // the right page margin in mm
double m_topMargin; // the top page margin in mm
double m_bottomMargin; // the bottom page margin in mm
bool m_isDefaultDescr; // true if the internal default descr is loaded
// mainly used in Kicad GOST version, until
// a GOST page descr file is available
// to force the GOST default title block
public:
WORKSHEET_LAYOUT();
......@@ -480,6 +485,9 @@ public:
}
// Accessors:
bool IsDefaultDescr() { return m_isDefaultDescr; }
void SetDefaultDescrFlag( bool aFlg ) { m_isDefaultDescr = aFlg; }
double GetLeftMargin() { return m_leftMargin; }
double GetRightMargin() { return m_rightMargin; }
double GetTopMargin() { return m_topMargin; }
......
......@@ -96,6 +96,9 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
{
case ID_LOAD_DEFAULT_PAGE_LAYOUT:
pglayout.SetPageLayout();
// Force DefaultDescrFlag to false in page layout editor,
// has meaning only for GOST version
pglayout.SetDefaultDescrFlag( false );
OnNewPageLayout();
break;
......@@ -103,6 +106,9 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
pglayout.AllowVoidList( true );
SetCurrFileName( wxEmptyString );
pglayout.ClearList();
// Force DefaultDescrFlag to false in page layout editor,
// has meaning only for GOST version
pglayout.SetDefaultDescrFlag( false );
OnNewPageLayout();
break;
......
......@@ -120,6 +120,9 @@ bool EDA_APP::OnInit()
if( !descrLoaded )
{
WORKSHEET_LAYOUT::GetTheInstance().SetPageLayout();
// Force DefaultDescrFlag to false in page layout editor,
// has meaning only for GOST version
WORKSHEET_LAYOUT::GetTheInstance().SetDefaultDescrFlag( false );
frame->OnNewPageLayout();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment