diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 94f3bd3a08..c105dffdc3 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -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 diff --git a/common/page_layout/page_layout_reader.cpp b/common/page_layout/page_layout_reader.cpp index 256514c0d0..6d55ce10dc 100644 --- a/common/page_layout/page_layout_reader.cpp +++ b/common/page_layout/page_layout_reader.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 ) { diff --git a/common/page_layout/title_block_shapes.cpp b/common/page_layout/title_block_shapes.cpp index 595dfb525b..0dd6a3ef35 100644 --- a/common/page_layout/title_block_shapes.cpp +++ b/common/page_layout/title_block_shapes.cpp @@ -61,19 +61,35 @@ #include #include + +// 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() ), diff --git a/common/page_layout/title_block_shapes_gost.cpp b/common/page_layout/title_block_shapes_gost.cpp index 34a5fbfe2f..aafa906210 100644 --- a/common/page_layout/title_block_shapes_gost.cpp +++ b/common/page_layout/title_block_shapes_gost.cpp @@ -977,7 +977,16 @@ Ki_WorkSheetData WS_DopTop_Line6 = #include -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 ) diff --git a/eeschema/dialogs/dialog_eeschema_options_base.cpp b/eeschema/dialogs/dialog_eeschema_options_base.cpp index a6c77a8815..6dbad7738f 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.cpp +++ b/eeschema/dialogs/dialog_eeschema_options_base.cpp @@ -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 ); diff --git a/eeschema/dialogs/dialog_eeschema_options_base.fbp b/eeschema/dialogs/dialog_eeschema_options_base.fbp index 9f7a601efb..921c443c25 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.fbp +++ b/eeschema/dialogs/dialog_eeschema_options_base.fbp @@ -2455,7 +2455,7 @@ 0 0 wxID_ANY - part id notation: + Part id notation: 0 diff --git a/include/worksheet_shape_builder.h b/include/worksheet_shape_builder.h index a0d7130e73..b479fe5268 100644 --- a/include/worksheet_shape_builder.h +++ b/include/worksheet_shape_builder.h @@ -240,6 +240,7 @@ public: */ class WS_DRAW_ITEM_LIST { +protected: std::vector 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; } diff --git a/pagelayout_editor/files.cpp b/pagelayout_editor/files.cpp index 276e18cabd..7c5f2c9de4 100644 --- a/pagelayout_editor/files.cpp +++ b/pagelayout_editor/files.cpp @@ -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; diff --git a/pagelayout_editor/pl_editor.cpp b/pagelayout_editor/pl_editor.cpp index de1f2f096a..b31f79e68e 100644 --- a/pagelayout_editor/pl_editor.cpp +++ b/pagelayout_editor/pl_editor.cpp @@ -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(); }