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 ...@@ -26,14 +26,8 @@ set(COMMON_ABOUT_DLG_SRCS
dialogs/dialog_page_settings_base.cpp 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 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_dataitem.cpp
page_layout/class_worksheet_layout.cpp page_layout/class_worksheet_layout.cpp
page_layout/page_layout_default_description.cpp page_layout/page_layout_default_description.cpp
......
...@@ -630,6 +630,7 @@ void WORKSHEET_LAYOUT::SetDefaultLayout() ...@@ -630,6 +630,7 @@ void WORKSHEET_LAYOUT::SetDefaultLayout()
try try
{ {
lp_parser.Parse( this ); lp_parser.Parse( this );
SetDefaultDescrFlag( true );
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
...@@ -693,6 +694,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append ...@@ -693,6 +694,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append
try try
{ {
lp_parser.Parse( this ); lp_parser.Parse( this );
SetDefaultDescrFlag( false );
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
......
...@@ -61,19 +61,35 @@ ...@@ -61,19 +61,35 @@
#include <worksheet_shape_builder.h> #include <worksheet_shape_builder.h>
#include <class_worksheet_dataitem.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( void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
const PAGE_INFO& aPageInfo, const PAGE_INFO& aPageInfo,
const TITLE_BLOCK& aTitleBlock, const TITLE_BLOCK& aTitleBlock,
EDA_COLOR_T aColor, EDA_COLOR_T aAltColor ) 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 milsTomm (25.4/1000)
#define mmTomils (1000/25.4) #define mmTomils (1000/25.4)
m_titleBlock = &aTitleBlock; m_titleBlock = &aTitleBlock;
m_paperFormat = &aPageInfo.GetType(); m_paperFormat = &aPageInfo.GetType();
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
wxPoint LTmargin( Mm2mils( pglayout.GetLeftMargin() ), wxPoint LTmargin( Mm2mils( pglayout.GetLeftMargin() ),
Mm2mils( pglayout.GetTopMargin() ) ); Mm2mils( pglayout.GetTopMargin() ) );
wxPoint RBmargin( Mm2mils( pglayout.GetRightMargin() ), wxPoint RBmargin( Mm2mils( pglayout.GetRightMargin() ),
......
...@@ -977,7 +977,16 @@ Ki_WorkSheetData WS_DopTop_Line6 = ...@@ -977,7 +977,16 @@ Ki_WorkSheetData WS_DopTop_Line6 =
#include <worksheet_shape_builder.h> #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 PAGE_INFO& aPageInfo,
const TITLE_BLOCK& aTitleBlock, const TITLE_BLOCK& aTitleBlock,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor ) EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
......
...@@ -143,7 +143,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -143,7 +143,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText23->Wrap( -1 ); m_staticText23->Wrap( -1 );
fgSizer1->Add( m_staticText23, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 ); 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 ); m_staticText26->Wrap( -1 );
fgSizer1->Add( m_staticText26, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); fgSizer1->Add( m_staticText26, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
......
...@@ -2455,7 +2455,7 @@ ...@@ -2455,7 +2455,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</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="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
......
...@@ -240,6 +240,7 @@ public: ...@@ -240,6 +240,7 @@ public:
*/ */
class WS_DRAW_ITEM_LIST class WS_DRAW_ITEM_LIST
{ {
protected:
std::vector <WS_DRAW_ITEM_BASE*> m_graphicList; // Items to draw/plot std::vector <WS_DRAW_ITEM_BASE*> m_graphicList; // Items to draw/plot
unsigned m_idx; // for GetFirst, GetNext functions unsigned m_idx; // for GetFirst, GetNext functions
wxPoint m_LTmargin; // The left top margin in mils of the page layout. wxPoint m_LTmargin; // The left top margin in mils of the page layout.
...@@ -464,6 +465,10 @@ class WORKSHEET_LAYOUT ...@@ -464,6 +465,10 @@ class WORKSHEET_LAYOUT
double m_rightMargin; // the right page margin in mm double m_rightMargin; // the right page margin in mm
double m_topMargin; // the top page margin in mm double m_topMargin; // the top page margin in mm
double m_bottomMargin; // the bottom 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: public:
WORKSHEET_LAYOUT(); WORKSHEET_LAYOUT();
...@@ -480,6 +485,9 @@ public: ...@@ -480,6 +485,9 @@ public:
} }
// Accessors: // Accessors:
bool IsDefaultDescr() { return m_isDefaultDescr; }
void SetDefaultDescrFlag( bool aFlg ) { m_isDefaultDescr = aFlg; }
double GetLeftMargin() { return m_leftMargin; } double GetLeftMargin() { return m_leftMargin; }
double GetRightMargin() { return m_rightMargin; } double GetRightMargin() { return m_rightMargin; }
double GetTopMargin() { return m_topMargin; } double GetTopMargin() { return m_topMargin; }
......
...@@ -96,6 +96,9 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) ...@@ -96,6 +96,9 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
{ {
case ID_LOAD_DEFAULT_PAGE_LAYOUT: case ID_LOAD_DEFAULT_PAGE_LAYOUT:
pglayout.SetPageLayout(); pglayout.SetPageLayout();
// Force DefaultDescrFlag to false in page layout editor,
// has meaning only for GOST version
pglayout.SetDefaultDescrFlag( false );
OnNewPageLayout(); OnNewPageLayout();
break; break;
...@@ -103,6 +106,9 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) ...@@ -103,6 +106,9 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
pglayout.AllowVoidList( true ); pglayout.AllowVoidList( true );
SetCurrFileName( wxEmptyString ); SetCurrFileName( wxEmptyString );
pglayout.ClearList(); pglayout.ClearList();
// Force DefaultDescrFlag to false in page layout editor,
// has meaning only for GOST version
pglayout.SetDefaultDescrFlag( false );
OnNewPageLayout(); OnNewPageLayout();
break; break;
......
...@@ -120,6 +120,9 @@ bool EDA_APP::OnInit() ...@@ -120,6 +120,9 @@ bool EDA_APP::OnInit()
if( !descrLoaded ) if( !descrLoaded )
{ {
WORKSHEET_LAYOUT::GetTheInstance().SetPageLayout(); 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(); 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