Use consistent PageLayout data structure names.
This commit is contained in:
parent
0e5cc54ec9
commit
bdd44ce88c
|
@ -36,7 +36,7 @@ set( GAL_SRCS
|
|||
newstroke_font.cpp
|
||||
painter.cpp
|
||||
text_utils.cpp
|
||||
page_layout/worksheet_viewitem.cpp
|
||||
page_layout/ws_view_item.cpp
|
||||
gal/color4d.cpp
|
||||
gal/gal_display_options.cpp
|
||||
gal/graphics_abstraction_layer.cpp
|
||||
|
@ -236,8 +236,8 @@ set( COMMON_WIDGET_SRCS
|
|||
)
|
||||
|
||||
set( COMMON_PAGE_LAYOUT_SRCS
|
||||
page_layout/worksheet_dataitem.cpp
|
||||
page_layout/worksheet_layout.cpp
|
||||
page_layout/ws_data_item.cpp
|
||||
page_layout/ws_data_model.cpp
|
||||
page_layout/page_layout_default_description.cpp
|
||||
page_layout/ws_draw_item.cpp
|
||||
page_layout/page_layout_reader_keywords.cpp
|
||||
|
@ -358,7 +358,7 @@ set( COMMON_SRCS
|
|||
utf8.cpp
|
||||
validators.cpp
|
||||
wildcards_and_files_ext.cpp
|
||||
page_layout/worksheet_painter.cpp
|
||||
page_layout/ws_painter.cpp
|
||||
wxdataviewctrl_helpers.cpp
|
||||
xnode.cpp
|
||||
)
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file dialog_page_settings.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <macros.h> // arrayDim()
|
||||
#include <common.h>
|
||||
|
@ -35,7 +31,7 @@
|
|||
#include <class_drawpanel.h>
|
||||
#include <title_block.h>
|
||||
#include <draw_frame.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <base_screen.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
|
@ -47,7 +43,7 @@
|
|||
#include <general.h>
|
||||
#endif
|
||||
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
#include <dialog_page_settings.h>
|
||||
|
||||
#define MAX_PAGE_EXAMPLE_SIZE 200
|
||||
|
@ -433,7 +429,7 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
|
|||
|
||||
if( fileName != BASE_SCREEN::m_PageLayoutDescrFileName )
|
||||
{
|
||||
wxString fullFileName = WORKSHEET_LAYOUT::MakeFullFileName( fileName, m_projectPath );
|
||||
wxString fullFileName = WS_DATA_MODEL::MakeFullFileName( fileName, m_projectPath );
|
||||
|
||||
if( !fullFileName.IsEmpty() && !wxFileExists( fullFileName ) )
|
||||
{
|
||||
|
@ -445,7 +441,7 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
|
|||
}
|
||||
|
||||
BASE_SCREEN::m_PageLayoutDescrFileName = fileName;
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
pglayout.SetPageLayout( fullFileName );
|
||||
m_localPrjConfigChanged = true;
|
||||
}
|
||||
|
@ -660,7 +656,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
|
|||
wxString emptyString;
|
||||
GRResetPenAndBrush( &memDC );
|
||||
|
||||
WORKSHEET_LAYOUT::SetAltInstance( m_pagelayout );
|
||||
WS_DATA_MODEL::SetAltInstance( m_pagelayout );
|
||||
GRFilledRect( NULL, &memDC, 0, 0, m_layout_size.x, m_layout_size.y, WHITE, WHITE );
|
||||
DrawPageLayout( &memDC, NULL, pageDUMMY,
|
||||
emptyString, emptyString,
|
||||
|
@ -669,7 +665,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
|
|||
|
||||
memDC.SelectObject( wxNullBitmap );
|
||||
m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap );
|
||||
WORKSHEET_LAYOUT::SetAltInstance( NULL );
|
||||
WS_DATA_MODEL::SetAltInstance( NULL );
|
||||
|
||||
// Refresh the dialog.
|
||||
Layout();
|
||||
|
@ -784,7 +780,7 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
|
|||
|
||||
// Try to remove the path, if the path is the current working dir,
|
||||
// or the dir of kicad.pro (template), and use a relative path
|
||||
wxString shortFileName = WORKSHEET_LAYOUT::MakeShortFileName( fileName, m_projectPath );
|
||||
wxString shortFileName = WS_DATA_MODEL::MakeShortFileName( fileName, m_projectPath );
|
||||
|
||||
// For Win/Linux/macOS compatibility, a relative path is a good idea
|
||||
if( shortFileName != GetWksFileName() && shortFileName != fileName )
|
||||
|
@ -803,7 +799,7 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
|
|||
SetWksFileName( shortFileName );
|
||||
|
||||
if( m_pagelayout == NULL )
|
||||
m_pagelayout = new WORKSHEET_LAYOUT;
|
||||
m_pagelayout = new WS_DATA_MODEL;
|
||||
|
||||
m_pagelayout->SetPageLayout( fileName );
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <widgets/unit_binder.h>
|
||||
#include <dialog_page_settings_base.h>
|
||||
|
||||
class WS_DATA_MODEL;
|
||||
|
||||
/*!
|
||||
* DIALOG_PAGES_SETTINGS class declaration
|
||||
*/
|
||||
|
@ -46,7 +48,7 @@ private:
|
|||
PAGE_INFO m_pageInfo; /// Temporary page info.
|
||||
bool m_customFmt; /// true if the page selection is custom
|
||||
TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions).
|
||||
WORKSHEET_LAYOUT *m_pagelayout; // the alternate and temporary page layout shown by the dialog
|
||||
WS_DATA_MODEL* m_pagelayout; // the alternate and temporary page layout shown by the dialog
|
||||
// when the initial one is replaced by a new one
|
||||
UNIT_BINDER m_customSizeX;
|
||||
UNIT_BINDER m_customSizeY;
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
|
||||
// height of the band reference grid 2.0 mm
|
||||
// worksheet frame reference text size 1.3 mm
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <base_struct.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <page_layout_reader_lexer.h>
|
||||
|
||||
#include <wx/file.h>
|
||||
|
@ -45,13 +45,13 @@ using namespace TB_READER_T;
|
|||
/**
|
||||
* Class PAGE_LAYOUT_READER_PARSER
|
||||
* holds data and functions pertinent to parsing a S-expression file
|
||||
* for a WORKSHEET_LAYOUT.
|
||||
* for a WS_DATA_MODEL.
|
||||
*/
|
||||
class PAGE_LAYOUT_READER_PARSER : public PAGE_LAYOUT_READER_LEXER
|
||||
{
|
||||
public:
|
||||
PAGE_LAYOUT_READER_PARSER( const char* aLine, const wxString& aSource );
|
||||
void Parse( WORKSHEET_LAYOUT* aLayout );
|
||||
void Parse( WS_DATA_MODEL* aLayout );
|
||||
|
||||
private:
|
||||
|
||||
|
@ -71,38 +71,38 @@ private:
|
|||
*/
|
||||
double parseDouble();
|
||||
|
||||
void parseSetup( WORKSHEET_LAYOUT* aLayout );
|
||||
void parseSetup( WS_DATA_MODEL* aLayout );
|
||||
|
||||
/**
|
||||
* parse a graphic item starting by "(line" or "(rect" and read parameters.
|
||||
*/
|
||||
void parseGraphic( WORKSHEET_DATAITEM * aItem );
|
||||
void parseGraphic( WS_DATA_ITEM * aItem );
|
||||
|
||||
/**
|
||||
* parse a text item starting by "(tbtext" and read parameters.
|
||||
*/
|
||||
void parseText( WORKSHEET_DATAITEM_TEXT * aItem );
|
||||
void parseText( WS_DATA_ITEM_TEXT * aItem );
|
||||
|
||||
/**
|
||||
* parse a polygon item starting by "( polygon" and read parameters.
|
||||
* the list of corners included in this description is read by parsePolyOutline
|
||||
*/
|
||||
void parsePolygon( WORKSHEET_DATAITEM_POLYPOLYGON * aItem );
|
||||
void parsePolygon( WS_DATA_ITEM_POLYGONS * aItem );
|
||||
|
||||
/**
|
||||
* parse a list of corners starting by "( pts" and read coordinates.
|
||||
*/
|
||||
void parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON * aItem );
|
||||
void parsePolyOutline( WS_DATA_ITEM_POLYGONS * aItem );
|
||||
|
||||
|
||||
/**
|
||||
* parse a bitmap item starting by "( bitmap" and read parameters.
|
||||
*/
|
||||
void parseBitmap( WORKSHEET_DATAITEM_BITMAP * aItem );
|
||||
void parseBitmap( WS_DATA_ITEM_BITMAP * aItem );
|
||||
|
||||
void parseCoordinate( POINT_COORD& aCoord);
|
||||
void readOption( WORKSHEET_DATAITEM * aItem );
|
||||
void readPngdata( WORKSHEET_DATAITEM_BITMAP * aItem );
|
||||
void readOption( WS_DATA_ITEM * aItem );
|
||||
void readPngdata( WS_DATA_ITEM_BITMAP * aItem );
|
||||
};
|
||||
|
||||
// PCB_PLOT_PARAMS_PARSER
|
||||
|
@ -113,9 +113,9 @@ PAGE_LAYOUT_READER_PARSER::PAGE_LAYOUT_READER_PARSER( const char* aLine, const w
|
|||
}
|
||||
|
||||
|
||||
void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
|
||||
void PAGE_LAYOUT_READER_PARSER::Parse( WS_DATA_MODEL* aLayout )
|
||||
{
|
||||
WORKSHEET_DATAITEM* item;
|
||||
WS_DATA_ITEM* item;
|
||||
LOCALE_IO toggle;
|
||||
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
|
@ -133,33 +133,33 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
|
|||
break;
|
||||
|
||||
case T_line:
|
||||
item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_SEGMENT );
|
||||
item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_SEGMENT );
|
||||
parseGraphic( item );
|
||||
aLayout->Append( item );
|
||||
break;
|
||||
|
||||
case T_rect:
|
||||
item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_RECT );
|
||||
item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_RECT );
|
||||
parseGraphic( item );
|
||||
aLayout->Append( item );
|
||||
break;
|
||||
|
||||
case T_polygon:
|
||||
item = new WORKSHEET_DATAITEM_POLYPOLYGON();
|
||||
parsePolygon( (WORKSHEET_DATAITEM_POLYPOLYGON*) item );
|
||||
item = new WS_DATA_ITEM_POLYGONS();
|
||||
parsePolygon( (WS_DATA_ITEM_POLYGONS*) item );
|
||||
aLayout->Append( item );
|
||||
break;
|
||||
|
||||
case T_bitmap:
|
||||
item = new WORKSHEET_DATAITEM_BITMAP( NULL );
|
||||
parseBitmap( (WORKSHEET_DATAITEM_BITMAP*) item );
|
||||
item = new WS_DATA_ITEM_BITMAP( NULL );
|
||||
parseBitmap( (WS_DATA_ITEM_BITMAP*) item );
|
||||
aLayout->Append( item );
|
||||
break;
|
||||
|
||||
case T_tbtext:
|
||||
NeedSYMBOLorNUMBER();
|
||||
item = new WORKSHEET_DATAITEM_TEXT( FromUTF8() );
|
||||
parseText( (WORKSHEET_DATAITEM_TEXT*) item );
|
||||
item = new WS_DATA_ITEM_TEXT( FromUTF8() );
|
||||
parseText( (WS_DATA_ITEM_TEXT*) item );
|
||||
aLayout->Append( item );
|
||||
break;
|
||||
|
||||
|
@ -170,7 +170,7 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
|
|||
}
|
||||
}
|
||||
|
||||
void PAGE_LAYOUT_READER_PARSER::parseSetup( WORKSHEET_LAYOUT* aLayout )
|
||||
void PAGE_LAYOUT_READER_PARSER::parseSetup( WS_DATA_MODEL* aLayout )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
{
|
||||
|
@ -180,18 +180,18 @@ void PAGE_LAYOUT_READER_PARSER::parseSetup( WORKSHEET_LAYOUT* aLayout )
|
|||
break;
|
||||
|
||||
case T_linewidth:
|
||||
WORKSHEET_DATAITEM::m_DefaultLineWidth = parseDouble();
|
||||
WS_DATA_ITEM::m_DefaultLineWidth = parseDouble();
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_textsize:
|
||||
WORKSHEET_DATAITEM::m_DefaultTextSize.x = parseDouble();
|
||||
WORKSHEET_DATAITEM::m_DefaultTextSize.y = parseDouble();
|
||||
WS_DATA_ITEM::m_DefaultTextSize.x = parseDouble();
|
||||
WS_DATA_ITEM::m_DefaultTextSize.y = parseDouble();
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_textlinewidth:
|
||||
WORKSHEET_DATAITEM::m_DefaultTextThickness = parseDouble();
|
||||
WS_DATA_ITEM::m_DefaultTextThickness = parseDouble();
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
@ -222,7 +222,7 @@ void PAGE_LAYOUT_READER_PARSER::parseSetup( WORKSHEET_LAYOUT* aLayout )
|
|||
}
|
||||
}
|
||||
|
||||
void PAGE_LAYOUT_READER_PARSER::parsePolygon( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
|
||||
void PAGE_LAYOUT_READER_PARSER::parsePolygon( WS_DATA_ITEM_POLYGONS * aItem )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ void PAGE_LAYOUT_READER_PARSER::parsePolygon( WORKSHEET_DATAITEM_POLYPOLYGON * a
|
|||
aItem->SetBoundingBox();
|
||||
}
|
||||
|
||||
void PAGE_LAYOUT_READER_PARSER::parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
|
||||
void PAGE_LAYOUT_READER_PARSER::parsePolyOutline( WS_DATA_ITEM_POLYGONS * aItem )
|
||||
{
|
||||
DPOINT corner;
|
||||
|
||||
|
@ -316,7 +316,7 @@ void PAGE_LAYOUT_READER_PARSER::parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON
|
|||
}
|
||||
|
||||
|
||||
void PAGE_LAYOUT_READER_PARSER::parseBitmap( WORKSHEET_DATAITEM_BITMAP * aItem )
|
||||
void PAGE_LAYOUT_READER_PARSER::parseBitmap( WS_DATA_ITEM_BITMAP * aItem )
|
||||
{
|
||||
BITMAP_BASE* image = new BITMAP_BASE;
|
||||
aItem->m_ImageBitmap = image;
|
||||
|
@ -378,7 +378,7 @@ void PAGE_LAYOUT_READER_PARSER::parseBitmap( WORKSHEET_DATAITEM_BITMAP * aItem )
|
|||
}
|
||||
}
|
||||
|
||||
void PAGE_LAYOUT_READER_PARSER::readPngdata( WORKSHEET_DATAITEM_BITMAP * aItem )
|
||||
void PAGE_LAYOUT_READER_PARSER::readPngdata( WS_DATA_ITEM_BITMAP * aItem )
|
||||
{
|
||||
std::string tmp;
|
||||
|
||||
|
@ -412,7 +412,7 @@ void PAGE_LAYOUT_READER_PARSER::readPngdata( WORKSHEET_DATAITEM_BITMAP * aItem )
|
|||
}
|
||||
|
||||
|
||||
void PAGE_LAYOUT_READER_PARSER::readOption( WORKSHEET_DATAITEM * aItem )
|
||||
void PAGE_LAYOUT_READER_PARSER::readOption( WS_DATA_ITEM * aItem )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
{
|
||||
|
@ -426,7 +426,7 @@ void PAGE_LAYOUT_READER_PARSER::readOption( WORKSHEET_DATAITEM * aItem )
|
|||
}
|
||||
|
||||
|
||||
void PAGE_LAYOUT_READER_PARSER::parseGraphic( WORKSHEET_DATAITEM * aItem )
|
||||
void PAGE_LAYOUT_READER_PARSER::parseGraphic( WS_DATA_ITEM * aItem )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
{
|
||||
|
@ -496,7 +496,7 @@ void PAGE_LAYOUT_READER_PARSER::parseGraphic( WORKSHEET_DATAITEM * aItem )
|
|||
}
|
||||
|
||||
|
||||
void PAGE_LAYOUT_READER_PARSER::parseText( WORKSHEET_DATAITEM_TEXT* aItem )
|
||||
void PAGE_LAYOUT_READER_PARSER::parseText( WS_DATA_ITEM_TEXT* aItem )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
{
|
||||
|
@ -688,13 +688,13 @@ double PAGE_LAYOUT_READER_PARSER::parseDouble()
|
|||
// see page_layout_default_shape.cpp
|
||||
extern const char defaultPageLayout[];
|
||||
|
||||
void WORKSHEET_LAYOUT::SetDefaultLayout()
|
||||
void WS_DATA_MODEL::SetDefaultLayout()
|
||||
{
|
||||
SetPageLayout( defaultPageLayout, false, wxT( "default page" ) );
|
||||
}
|
||||
|
||||
// Returns defaultPageLayout as a string;
|
||||
wxString WORKSHEET_LAYOUT::DefaultLayout()
|
||||
wxString WS_DATA_MODEL::DefaultLayout()
|
||||
{
|
||||
return wxString( defaultPageLayout );
|
||||
}
|
||||
|
@ -705,19 +705,19 @@ wxString WORKSHEET_LAYOUT::DefaultLayout()
|
|||
// see page_layout_empty_description.cpp
|
||||
extern const char emptyPageLayout[];
|
||||
|
||||
void WORKSHEET_LAYOUT::SetEmptyLayout()
|
||||
void WS_DATA_MODEL::SetEmptyLayout()
|
||||
{
|
||||
SetPageLayout( emptyPageLayout, false, wxT( "empty page" ) );
|
||||
}
|
||||
|
||||
|
||||
wxString WORKSHEET_LAYOUT::EmptyLayout()
|
||||
wxString WS_DATA_MODEL::EmptyLayout()
|
||||
{
|
||||
return wxString( emptyPageLayout );
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetPageLayout( const char* aPageLayout, bool Append, const wxString& aSource )
|
||||
void WS_DATA_MODEL::SetPageLayout( const char* aPageLayout, bool Append, const wxString& aSource )
|
||||
{
|
||||
if( ! Append )
|
||||
ClearList();
|
||||
|
@ -735,7 +735,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const char* aPageLayout, bool Append, cons
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append )
|
||||
void WS_DATA_MODEL::SetPageLayout( const wxString& aFullFileName, bool Append )
|
||||
{
|
||||
wxString fullFileName = aFullFileName;
|
||||
|
||||
|
|
|
@ -25,54 +25,54 @@
|
|||
|
||||
|
||||
/*
|
||||
* the class WORKSHEET_DATAITEM (and derived) defines
|
||||
* the class WS_DATA_ITEM (and derived) defines
|
||||
* a basic shape of a page layout ( frame references and title block )
|
||||
* Basic shapes are line, rect and texts
|
||||
* the WORKSHEET_DATAITEM coordinates units is the mm, and are relative to
|
||||
* the WS_DATA_ITEM coordinates units is the mm, and are relative to
|
||||
* one of 4 page corners.
|
||||
*
|
||||
* These items cannot be drawn or plot "as this". they should be converted
|
||||
* to a "draw list" (WS_DRAW_ITEM_BASE and derived items)
|
||||
|
||||
* The list of these items is stored in a WORKSHEET_LAYOUT instance.
|
||||
* The list of these items is stored in a WS_DATA_MODEL instance.
|
||||
*
|
||||
* When building the draw list:
|
||||
* the WORKSHEET_LAYOUT is used to create a WS_DRAW_ITEM_LIST
|
||||
* the WS_DATA_MODEL is used to create a WS_DRAW_ITEM_LIST
|
||||
* coordinates are converted to draw/plot coordinates.
|
||||
* texts are expanded if they contain format symbols.
|
||||
* Items with m_RepeatCount > 1 are created m_RepeatCount times
|
||||
*
|
||||
* the WORKSHEET_LAYOUT is created only once.
|
||||
* the WS_DATA_MODEL is created only once.
|
||||
* the WS_DRAW_ITEM_LIST is created each time the page layout is plot/drawn
|
||||
*
|
||||
* the WORKSHEET_LAYOUT instance is created from a S expression which
|
||||
* the WS_DATA_MODEL instance is created from a S expression which
|
||||
* describes the page layout (can be the default page layout or a custom file).
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <draw_graphic_text.h>
|
||||
#include <eda_rect.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
#include <title_block.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_item.h>
|
||||
#include <view/view.h>
|
||||
|
||||
using KIGFX::COLOR4D;
|
||||
|
||||
|
||||
// Static members of class WORKSHEET_DATAITEM:
|
||||
double WORKSHEET_DATAITEM::m_WSunits2Iu = 1000.0;
|
||||
DPOINT WORKSHEET_DATAITEM::m_RB_Corner;
|
||||
DPOINT WORKSHEET_DATAITEM::m_LT_Corner;
|
||||
double WORKSHEET_DATAITEM::m_DefaultLineWidth = 0.0;
|
||||
DSIZE WORKSHEET_DATAITEM::m_DefaultTextSize( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE );
|
||||
double WORKSHEET_DATAITEM::m_DefaultTextThickness = 0.0;
|
||||
bool WORKSHEET_DATAITEM::m_SpecialMode = false;
|
||||
// Static members of class WS_DATA_ITEM:
|
||||
double WS_DATA_ITEM::m_WSunits2Iu = 1000.0;
|
||||
DPOINT WS_DATA_ITEM::m_RB_Corner;
|
||||
DPOINT WS_DATA_ITEM::m_LT_Corner;
|
||||
double WS_DATA_ITEM::m_DefaultLineWidth = 0.0;
|
||||
DSIZE WS_DATA_ITEM::m_DefaultTextSize( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE );
|
||||
double WS_DATA_ITEM::m_DefaultTextThickness = 0.0;
|
||||
bool WS_DATA_ITEM::m_SpecialMode = false;
|
||||
|
||||
|
||||
// The constructor:
|
||||
WORKSHEET_DATAITEM::WORKSHEET_DATAITEM( WS_ITEM_TYPE aType )
|
||||
WS_DATA_ITEM::WS_DATA_ITEM( WS_ITEM_TYPE aType )
|
||||
{
|
||||
m_pageOption = ALL_PAGES;
|
||||
m_type = aType;
|
||||
|
@ -82,7 +82,7 @@ WORKSHEET_DATAITEM::WORKSHEET_DATAITEM( WS_ITEM_TYPE aType )
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_DATAITEM::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
||||
void WS_DATA_ITEM::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
||||
{
|
||||
int pensize = GetPenSizeUi();
|
||||
|
||||
|
@ -136,7 +136,7 @@ void WORKSHEET_DATAITEM::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VI
|
|||
// (if both coordinates have the same corner reference)
|
||||
// MoveToUi and MoveTo takes the graphic position (i.e relative to the left top
|
||||
// paper corner
|
||||
void WORKSHEET_DATAITEM::MoveToUi( wxPoint aPosition )
|
||||
void WS_DATA_ITEM::MoveToUi( wxPoint aPosition )
|
||||
{
|
||||
DPOINT pos_mm;
|
||||
pos_mm.x = aPosition.x / m_WSunits2Iu;
|
||||
|
@ -146,7 +146,7 @@ void WORKSHEET_DATAITEM::MoveToUi( wxPoint aPosition )
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_DATAITEM::MoveTo( DPOINT aPosition )
|
||||
void WS_DATA_ITEM::MoveTo( DPOINT aPosition )
|
||||
{
|
||||
DPOINT vector = aPosition - GetStartPos();
|
||||
DPOINT endpos = vector + GetEndPos();
|
||||
|
@ -169,7 +169,7 @@ void WORKSHEET_DATAITEM::MoveTo( DPOINT aPosition )
|
|||
/* move the starting point of the item to a new position
|
||||
* aPosition = the new position of the starting point, in mm
|
||||
*/
|
||||
void WORKSHEET_DATAITEM::MoveStartPointTo( DPOINT aPosition )
|
||||
void WS_DATA_ITEM::MoveStartPointTo( DPOINT aPosition )
|
||||
{
|
||||
DPOINT position;
|
||||
|
||||
|
@ -204,7 +204,7 @@ void WORKSHEET_DATAITEM::MoveStartPointTo( DPOINT aPosition )
|
|||
/* move the starting point of the item to a new position
|
||||
* aPosition = the new position of the starting point in graphic units
|
||||
*/
|
||||
void WORKSHEET_DATAITEM::MoveStartPointToUi( wxPoint aPosition )
|
||||
void WS_DATA_ITEM::MoveStartPointToUi( wxPoint aPosition )
|
||||
{
|
||||
DPOINT pos_mm;
|
||||
pos_mm.x = aPosition.x / m_WSunits2Iu;
|
||||
|
@ -220,7 +220,7 @@ void WORKSHEET_DATAITEM::MoveStartPointToUi( wxPoint aPosition )
|
|||
* (segments and rectangles)
|
||||
* aPosition = the new position of the ending point, in mm
|
||||
*/
|
||||
void WORKSHEET_DATAITEM::MoveEndPointTo( DPOINT aPosition )
|
||||
void WS_DATA_ITEM::MoveEndPointTo( DPOINT aPosition )
|
||||
{
|
||||
DPOINT position;
|
||||
|
||||
|
@ -267,7 +267,7 @@ void WORKSHEET_DATAITEM::MoveEndPointTo( DPOINT aPosition )
|
|||
* (segments and rectangles)
|
||||
* aPosition = the new position of the ending point in graphic units
|
||||
*/
|
||||
void WORKSHEET_DATAITEM::MoveEndPointToUi( wxPoint aPosition )
|
||||
void WS_DATA_ITEM::MoveEndPointToUi( wxPoint aPosition )
|
||||
{
|
||||
DPOINT pos_mm;
|
||||
pos_mm.x = aPosition.x / m_WSunits2Iu;
|
||||
|
@ -277,7 +277,7 @@ void WORKSHEET_DATAITEM::MoveEndPointToUi( wxPoint aPosition )
|
|||
}
|
||||
|
||||
|
||||
const DPOINT WORKSHEET_DATAITEM::GetStartPos( int ii ) const
|
||||
const DPOINT WS_DATA_ITEM::GetStartPos( int ii ) const
|
||||
{
|
||||
DPOINT pos;
|
||||
pos.x = m_Pos.m_Pos.x + ( m_IncrementVector.x * ii );
|
||||
|
@ -308,7 +308,7 @@ const DPOINT WORKSHEET_DATAITEM::GetStartPos( int ii ) const
|
|||
}
|
||||
|
||||
|
||||
const wxPoint WORKSHEET_DATAITEM::GetStartPosUi( int ii ) const
|
||||
const wxPoint WS_DATA_ITEM::GetStartPosUi( int ii ) const
|
||||
{
|
||||
DPOINT pos = GetStartPos( ii );
|
||||
pos = pos * m_WSunits2Iu;
|
||||
|
@ -316,7 +316,7 @@ const wxPoint WORKSHEET_DATAITEM::GetStartPosUi( int ii ) const
|
|||
}
|
||||
|
||||
|
||||
const DPOINT WORKSHEET_DATAITEM::GetEndPos( int ii ) const
|
||||
const DPOINT WS_DATA_ITEM::GetEndPos( int ii ) const
|
||||
{
|
||||
DPOINT pos;
|
||||
pos.x = m_End.m_Pos.x + ( m_IncrementVector.x * ii );
|
||||
|
@ -347,7 +347,7 @@ const DPOINT WORKSHEET_DATAITEM::GetEndPos( int ii ) const
|
|||
}
|
||||
|
||||
|
||||
const wxPoint WORKSHEET_DATAITEM::GetEndPosUi( int ii ) const
|
||||
const wxPoint WS_DATA_ITEM::GetEndPosUi( int ii ) const
|
||||
{
|
||||
DPOINT pos = GetEndPos( ii );
|
||||
pos = pos * m_WSunits2Iu;
|
||||
|
@ -355,7 +355,7 @@ const wxPoint WORKSHEET_DATAITEM::GetEndPosUi( int ii ) const
|
|||
}
|
||||
|
||||
|
||||
bool WORKSHEET_DATAITEM::IsInsidePage( int ii ) const
|
||||
bool WS_DATA_ITEM::IsInsidePage( int ii ) const
|
||||
{
|
||||
DPOINT pos = GetStartPos( ii );
|
||||
|
||||
|
@ -374,31 +374,31 @@ bool WORKSHEET_DATAITEM::IsInsidePage( int ii ) const
|
|||
}
|
||||
|
||||
|
||||
const wxString WORKSHEET_DATAITEM::GetClassName() const
|
||||
const wxString WS_DATA_ITEM::GetClassName() const
|
||||
{
|
||||
wxString name;
|
||||
|
||||
switch( GetType() )
|
||||
{
|
||||
case WS_TEXT: name = wxT( "Text" ); break;
|
||||
case WS_SEGMENT: name = wxT( "Line" ); break;
|
||||
case WS_RECT: name = wxT( "Rectangle" ); break;
|
||||
case WS_TEXT: name = wxT( "Text" ); break;
|
||||
case WS_SEGMENT: name = wxT( "Line" ); break;
|
||||
case WS_RECT: name = wxT( "Rectangle" ); break;
|
||||
case WS_POLYPOLYGON: name = wxT( "Imported Shape" ); break;
|
||||
case WS_BITMAP: name = wxT( "Image" ); break;
|
||||
case WS_BITMAP: name = wxT( "Image" ); break;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
WORKSHEET_DATAITEM_POLYPOLYGON::WORKSHEET_DATAITEM_POLYPOLYGON() :
|
||||
WORKSHEET_DATAITEM( WS_POLYPOLYGON )
|
||||
WS_DATA_ITEM_POLYGONS::WS_DATA_ITEM_POLYGONS() :
|
||||
WS_DATA_ITEM( WS_POLYPOLYGON )
|
||||
{
|
||||
m_Orient = 0.0;
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_DATAITEM_POLYPOLYGON::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector,
|
||||
void WS_DATA_ITEM_POLYGONS::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector,
|
||||
KIGFX::VIEW* aView )
|
||||
{
|
||||
std::map<int, STATUS_FLAGS> itemFlags;
|
||||
|
@ -445,13 +445,12 @@ void WORKSHEET_DATAITEM_POLYPOLYGON::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollecto
|
|||
|
||||
while( ist <= iend )
|
||||
poly->m_Corners.push_back( GetCornerPositionUi( ist++, jj ) );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const DPOINT WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPosition( unsigned aIdx, int aRepeat ) const
|
||||
const DPOINT WS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
|
||||
{
|
||||
DPOINT pos = m_Corners[aIdx];
|
||||
|
||||
|
@ -462,7 +461,7 @@ const DPOINT WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPosition( unsigned aIdx, i
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_DATAITEM_POLYPOLYGON::SetBoundingBox()
|
||||
void WS_DATA_ITEM_POLYGONS::SetBoundingBox()
|
||||
{
|
||||
if( m_Corners.size() == 0 )
|
||||
{
|
||||
|
@ -496,7 +495,7 @@ void WORKSHEET_DATAITEM_POLYPOLYGON::SetBoundingBox()
|
|||
}
|
||||
|
||||
|
||||
bool WORKSHEET_DATAITEM_POLYPOLYGON::IsInsidePage( int ii ) const
|
||||
bool WS_DATA_ITEM_POLYGONS::IsInsidePage( int ii ) const
|
||||
{
|
||||
DPOINT pos = GetStartPos( ii );
|
||||
pos += m_minCoord; // left top pos of bounding box
|
||||
|
@ -514,8 +513,7 @@ bool WORKSHEET_DATAITEM_POLYPOLYGON::IsInsidePage( int ii ) const
|
|||
}
|
||||
|
||||
|
||||
const wxPoint WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPositionUi( unsigned aIdx,
|
||||
int aRepeat ) const
|
||||
const wxPoint WS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
|
||||
{
|
||||
DPOINT pos = GetCornerPosition( aIdx, aRepeat );
|
||||
pos = pos * m_WSunits2Iu;
|
||||
|
@ -523,8 +521,8 @@ const wxPoint WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPositionUi( unsigned aIdx
|
|||
}
|
||||
|
||||
|
||||
WORKSHEET_DATAITEM_TEXT::WORKSHEET_DATAITEM_TEXT( const wxString& aTextBase ) :
|
||||
WORKSHEET_DATAITEM( WS_TEXT )
|
||||
WS_DATA_ITEM_TEXT::WS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
|
||||
WS_DATA_ITEM( WS_TEXT )
|
||||
{
|
||||
m_TextBase = aTextBase;
|
||||
m_IncrementLabel = 1;
|
||||
|
@ -537,7 +535,7 @@ WORKSHEET_DATAITEM_TEXT::WORKSHEET_DATAITEM_TEXT( const wxString& aTextBase ) :
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_DATAITEM_TEXT::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
||||
void WS_DATA_ITEM_TEXT::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
||||
{
|
||||
int pensize = GetPenSizeUi();
|
||||
bool multilines = false;
|
||||
|
@ -556,8 +554,8 @@ void WORKSHEET_DATAITEM_TEXT::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGF
|
|||
SetConstrainedTextSize();
|
||||
wxSize textsize;
|
||||
|
||||
textsize.x = KiROUND( m_ConstrainedTextSize.x * WORKSHEET_DATAITEM::m_WSunits2Iu );
|
||||
textsize.y = KiROUND( m_ConstrainedTextSize.y * WORKSHEET_DATAITEM::m_WSunits2Iu );
|
||||
textsize.x = KiROUND( m_ConstrainedTextSize.x * WS_DATA_ITEM::m_WSunits2Iu );
|
||||
textsize.y = KiROUND( m_ConstrainedTextSize.y * WS_DATA_ITEM::m_WSunits2Iu );
|
||||
|
||||
if( m_Bold )
|
||||
pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
|
||||
|
@ -609,7 +607,7 @@ void WORKSHEET_DATAITEM_TEXT::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGF
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_DATAITEM_TEXT::IncrementLabel( int aIncr )
|
||||
void WS_DATA_ITEM_TEXT::IncrementLabel( int aIncr )
|
||||
{
|
||||
int last = m_TextBase.Len() -1;
|
||||
|
||||
|
@ -628,7 +626,7 @@ void WORKSHEET_DATAITEM_TEXT::IncrementLabel( int aIncr )
|
|||
// Replace the '\''n' sequence by EOL
|
||||
// and the sequence '\''\' by only one '\' in m_FullText
|
||||
// if m_FullText is a multiline text (i.e.contains '\n') return true
|
||||
bool WORKSHEET_DATAITEM_TEXT::ReplaceAntiSlashSequence()
|
||||
bool WS_DATA_ITEM_TEXT::ReplaceAntiSlashSequence()
|
||||
{
|
||||
bool multiline = false;
|
||||
|
||||
|
@ -663,7 +661,7 @@ bool WORKSHEET_DATAITEM_TEXT::ReplaceAntiSlashSequence()
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
|
||||
void WS_DATA_ITEM_TEXT::SetConstrainedTextSize()
|
||||
{
|
||||
m_ConstrainedTextSize = m_TextSize;
|
||||
|
||||
|
@ -705,7 +703,7 @@ void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_DATAITEM_BITMAP::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
||||
void WS_DATA_ITEM_BITMAP::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
||||
{
|
||||
std::map<int, STATUS_FLAGS> itemFlags;
|
||||
WS_DRAW_ITEM_BASE* item = nullptr;
|
||||
|
@ -749,7 +747,7 @@ void WORKSHEET_DATAITEM_BITMAP::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KI
|
|||
* and the PPI bitmap factor
|
||||
* the pixel scale factor should be initialized before drawing the bitmap
|
||||
*/
|
||||
void WORKSHEET_DATAITEM_BITMAP::SetPixelScaleFactor()
|
||||
void WS_DATA_ITEM_BITMAP::SetPixelScaleFactor()
|
||||
{
|
||||
if( m_ImageBitmap )
|
||||
{
|
||||
|
@ -764,7 +762,7 @@ void WORKSHEET_DATAITEM_BITMAP::SetPixelScaleFactor()
|
|||
|
||||
/* return the PPI of the bitmap
|
||||
*/
|
||||
int WORKSHEET_DATAITEM_BITMAP::GetPPI() const
|
||||
int WS_DATA_ITEM_BITMAP::GetPPI() const
|
||||
{
|
||||
if( m_ImageBitmap )
|
||||
return m_ImageBitmap->GetPPI() / m_ImageBitmap->GetScale();
|
||||
|
@ -775,7 +773,7 @@ int WORKSHEET_DATAITEM_BITMAP::GetPPI() const
|
|||
|
||||
/*adjust the PPI of the bitmap
|
||||
*/
|
||||
void WORKSHEET_DATAITEM_BITMAP::SetPPI( int aBitmapPPI )
|
||||
void WS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
|
||||
{
|
||||
if( m_ImageBitmap )
|
||||
m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
|
|
@ -1,13 +1,8 @@
|
|||
/**
|
||||
* @file worksheet_layout.cpp
|
||||
* @brief description of graphic items and texts to build a title block
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2018 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -30,40 +25,40 @@
|
|||
|
||||
|
||||
/*
|
||||
* the class WORKSHEET_DATAITEM (and derived ) defines
|
||||
* the class WS_DATA_ITEM (and derived ) defines
|
||||
* a basic shape of a page layout ( frame references and title block )
|
||||
* The list of these items is stored in a WORKSHEET_LAYOUT instance.
|
||||
* The list of these items is stored in a WS_DATA_MODEL instance.
|
||||
*
|
||||
*
|
||||
* These items cannot be drawn or plot "as this". they should be converted
|
||||
* to a "draw list". When building the draw list:
|
||||
* the WORKSHEET_LAYOUT is used to create a WS_DRAW_ITEM_LIST
|
||||
* the WS_DATA_MODEL is used to create a WS_DRAW_ITEM_LIST
|
||||
* coordinates are converted to draw/plot coordinates.
|
||||
* texts are expanded if they contain format symbols.
|
||||
* Items with m_RepeatCount > 1 are created m_RepeatCount times
|
||||
*
|
||||
* the WORKSHEET_LAYOUT is created only once.
|
||||
* the WS_DATA_MODEL is created only once.
|
||||
* the WS_DRAW_ITEM_LIST is created each time the page layout is plot/drawn
|
||||
*
|
||||
* the WORKSHEET_LAYOUT instance is created from a S expression which
|
||||
* the WS_DATA_MODEL instance is created from a S expression which
|
||||
* describes the page layout (can be the default page layout or a custom file).
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <kiface_i.h>
|
||||
#include <draw_graphic_text.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
#include <title_block.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_model.h>
|
||||
|
||||
|
||||
// The layout shape used in the application
|
||||
// It is accessible by WORKSHEET_LAYOUT::GetTheInstance()
|
||||
static WORKSHEET_LAYOUT wksTheInstance;
|
||||
static WORKSHEET_LAYOUT* wksAltInstance;
|
||||
// It is accessible by WS_DATA_MODEL::GetTheInstance()
|
||||
static WS_DATA_MODEL wksTheInstance;
|
||||
static WS_DATA_MODEL* wksAltInstance;
|
||||
|
||||
WORKSHEET_LAYOUT::WORKSHEET_LAYOUT()
|
||||
WS_DATA_MODEL::WS_DATA_MODEL()
|
||||
{
|
||||
m_allowVoidList = false;
|
||||
m_leftMargin = 10.0; // the left page margin in mm
|
||||
|
@ -72,10 +67,10 @@ WORKSHEET_LAYOUT::WORKSHEET_LAYOUT()
|
|||
m_bottomMargin = 10.0; // the bottom page margin in mm
|
||||
}
|
||||
|
||||
/* static function: returns the instance of WORKSHEET_LAYOUT
|
||||
/* static function: returns the instance of WS_DATA_MODEL
|
||||
* used in the application
|
||||
*/
|
||||
WORKSHEET_LAYOUT& WORKSHEET_LAYOUT::GetTheInstance()
|
||||
WS_DATA_MODEL& WS_DATA_MODEL::GetTheInstance()
|
||||
{
|
||||
if( wksAltInstance )
|
||||
return *wksAltInstance;
|
||||
|
@ -84,64 +79,64 @@ WORKSHEET_LAYOUT& WORKSHEET_LAYOUT::GetTheInstance()
|
|||
}
|
||||
|
||||
/**
|
||||
* static function: Set an alternate instance of WORKSHEET_LAYOUT
|
||||
* static function: Set an alternate instance of WS_DATA_MODEL
|
||||
* mainly used in page setting dialog
|
||||
* @param aLayout = the alternate page layout.
|
||||
* if null, restore the basic page layout
|
||||
*/
|
||||
void WORKSHEET_LAYOUT::SetAltInstance( WORKSHEET_LAYOUT* aLayout )
|
||||
void WS_DATA_MODEL::SetAltInstance( WS_DATA_MODEL* aLayout )
|
||||
{
|
||||
wksAltInstance = aLayout;
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetLeftMargin( double aMargin )
|
||||
void WS_DATA_MODEL::SetLeftMargin( double aMargin )
|
||||
{
|
||||
m_leftMargin = aMargin; // the left page margin in mm
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetRightMargin( double aMargin )
|
||||
void WS_DATA_MODEL::SetRightMargin( double aMargin )
|
||||
{
|
||||
m_rightMargin = aMargin; // the right page margin in mm
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetTopMargin( double aMargin )
|
||||
void WS_DATA_MODEL::SetTopMargin( double aMargin )
|
||||
{
|
||||
m_topMargin = aMargin; // the top page margin in mm
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::SetBottomMargin( double aMargin )
|
||||
void WS_DATA_MODEL::SetBottomMargin( double aMargin )
|
||||
{
|
||||
m_bottomMargin = aMargin; // the bottom page margin in mm
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::ClearList()
|
||||
void WS_DATA_MODEL::ClearList()
|
||||
{
|
||||
for( WORKSHEET_DATAITEM* item : m_list )
|
||||
for( WS_DATA_ITEM* item : m_list )
|
||||
delete item;
|
||||
|
||||
m_list.clear();
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::Append( WORKSHEET_DATAITEM* aItem )
|
||||
void WS_DATA_MODEL::Append( WS_DATA_ITEM* aItem )
|
||||
{
|
||||
m_list.push_back( aItem );
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT::Remove( WORKSHEET_DATAITEM* aItem )
|
||||
void WS_DATA_MODEL::Remove( WS_DATA_ITEM* aItem )
|
||||
{
|
||||
auto newEnd = std::remove( m_list.begin(), m_list.end(), aItem );
|
||||
m_list.erase( newEnd, m_list.end() );
|
||||
}
|
||||
|
||||
|
||||
int WORKSHEET_LAYOUT::GetItemIndex( WORKSHEET_DATAITEM* aItem ) const
|
||||
int WS_DATA_MODEL::GetItemIndex( WS_DATA_ITEM* aItem ) const
|
||||
{
|
||||
unsigned idx = 0;
|
||||
while( idx < m_list.size() )
|
||||
|
@ -157,7 +152,7 @@ int WORKSHEET_LAYOUT::GetItemIndex( WORKSHEET_DATAITEM* aItem ) const
|
|||
|
||||
/* return the item from its index aIdx, or NULL if does not exist
|
||||
*/
|
||||
WORKSHEET_DATAITEM* WORKSHEET_LAYOUT::GetItem( unsigned aIdx ) const
|
||||
WS_DATA_ITEM* WS_DATA_MODEL::GetItem( unsigned aIdx ) const
|
||||
{
|
||||
if( aIdx < m_list.size() )
|
||||
return m_list[aIdx];
|
||||
|
@ -166,8 +161,8 @@ WORKSHEET_DATAITEM* WORKSHEET_LAYOUT::GetItem( unsigned aIdx ) const
|
|||
}
|
||||
|
||||
|
||||
const wxString WORKSHEET_LAYOUT::MakeShortFileName( const wxString& aFullFileName,
|
||||
const wxString& aProjectPath )
|
||||
const wxString WS_DATA_MODEL::MakeShortFileName( const wxString& aFullFileName,
|
||||
const wxString& aProjectPath )
|
||||
{
|
||||
wxString shortFileName = aFullFileName;
|
||||
wxFileName fn = aFullFileName;
|
||||
|
@ -195,8 +190,8 @@ const wxString WORKSHEET_LAYOUT::MakeShortFileName( const wxString& aFullFileNam
|
|||
}
|
||||
|
||||
|
||||
const wxString WORKSHEET_LAYOUT::MakeFullFileName( const wxString& aShortFileName,
|
||||
const wxString& aProjectPath )
|
||||
const wxString WS_DATA_MODEL::MakeFullFileName( const wxString& aShortFileName,
|
||||
const wxString& aProjectPath )
|
||||
{
|
||||
wxString fullFileName = ExpandEnvVarSubstitutions( aShortFileName );
|
||||
|
|
@ -24,27 +24,27 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* the class WORKSHEET_DATAITEM (and WORKSHEET_DATAITEM_TEXT) defines
|
||||
* the class WS_DATA_ITEM (and WS_DATA_ITEM_TEXT) defines
|
||||
* a basic shape of a page layout ( frame references and title block )
|
||||
* Basic shapes are line, rect and texts
|
||||
* the WORKSHEET_DATAITEM coordinates units is the mm, and are relative to
|
||||
* the WS_DATA_ITEM coordinates units is the mm, and are relative to
|
||||
* one of 4 page corners.
|
||||
*
|
||||
* These items cannot be drawn or plot "as this". they should be converted
|
||||
* to a "draw list" (WS_DRAW_ITEM_BASE and derived items)
|
||||
|
||||
* The list of these items is stored in a WORKSHEET_LAYOUT instance.
|
||||
* The list of these items is stored in a WS_DATA_MODEL instance.
|
||||
*
|
||||
* When building the draw list:
|
||||
* the WORKSHEET_LAYOUT is used to create a WS_DRAW_ITEM_LIST
|
||||
* the WS_DATA_MODEL is used to create a WS_DRAW_ITEM_LIST
|
||||
* coordinates are converted to draw/plot coordinates.
|
||||
* texts are expanded if they contain format symbols.
|
||||
* Items with m_RepeatCount > 1 are created m_RepeatCount times
|
||||
*
|
||||
* the WORKSHEET_LAYOUT is created only once.
|
||||
* the WS_DATA_MODEL is created only once.
|
||||
* the WS_DRAW_ITEM_LIST is created each time the page layout is plotted/drawn
|
||||
*
|
||||
* the WORKSHEET_LAYOUT instance is created from a S expression which
|
||||
* the WS_DATA_MODEL instance is created from a S expression which
|
||||
* describes the page layout (can be the default page layout or a custom file).
|
||||
*/
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
|||
#include <eda_rect.h>
|
||||
#include <draw_graphic_text.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <base_units.h>
|
||||
#include <page_info.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
|
@ -63,7 +63,7 @@ void WS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
{
|
||||
aCount = 1;
|
||||
|
||||
WORKSHEET_DATAITEM* dataItem = GetPeer();
|
||||
WS_DATA_ITEM* dataItem = GetPeer();
|
||||
|
||||
if( dataItem->GetPage1Option() == FIRST_PAGE_ONLY )
|
||||
aLayers[0] = LAYER_WORKSHEET_PAGE1;
|
||||
|
@ -92,28 +92,28 @@ bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAc
|
|||
void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
|
||||
{
|
||||
wxString msg;
|
||||
WORKSHEET_DATAITEM* dataItem = GetPeer();
|
||||
WS_DATA_ITEM* dataItem = GetPeer();
|
||||
|
||||
switch( dataItem->GetType() )
|
||||
{
|
||||
case WORKSHEET_DATAITEM::WS_SEGMENT:
|
||||
case WS_DATA_ITEM::WS_SEGMENT:
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg, DARKCYAN ) );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_RECT:
|
||||
case WS_DATA_ITEM::WS_RECT:
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg, DARKCYAN ) );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_TEXT:
|
||||
case WS_DATA_ITEM::WS_TEXT:
|
||||
msg = static_cast<WS_DRAW_ITEM_TEXT*>( this )->GetShownText();
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg, DARKCYAN ) );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
|
||||
case WS_DATA_ITEM::WS_POLYPOLYGON:
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg, DARKCYAN ) );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_BITMAP:
|
||||
case WS_DATA_ITEM::WS_BITMAP:
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg, DARKCYAN ) );
|
||||
break;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
|||
void WS_DRAW_ITEM_BITMAP::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
|
||||
GR_DRAWMODE aDrawMode, COLOR4D aColor )
|
||||
{
|
||||
WORKSHEET_DATAITEM_BITMAP* bitmap = (WORKSHEET_DATAITEM_BITMAP*) GetPeer();
|
||||
WS_DATA_ITEM_BITMAP* bitmap = (WS_DATA_ITEM_BITMAP*) GetPeer();
|
||||
|
||||
if( bitmap->m_ImageBitmap )
|
||||
{
|
||||
|
@ -378,7 +378,7 @@ void WS_DRAW_ITEM_BITMAP::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoi
|
|||
|
||||
const EDA_RECT WS_DRAW_ITEM_BITMAP::GetBoundingBox() const
|
||||
{
|
||||
auto* bitmap = static_cast<const WORKSHEET_DATAITEM_BITMAP*>( m_peer );
|
||||
auto* bitmap = static_cast<const WS_DATA_ITEM_BITMAP*>( m_peer );
|
||||
EDA_RECT rect = bitmap->m_ImageBitmap->GetBoundingBox();
|
||||
|
||||
rect.Move( m_pos );
|
||||
|
@ -401,26 +401,26 @@ wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
|||
|
||||
void WS_DRAW_ITEM_LIST::SetupDrawEnvironment( const PAGE_INFO& aPageInfo )
|
||||
{
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
|
||||
// Left top corner position
|
||||
DPOINT lt_corner;
|
||||
lt_corner.x = pglayout.GetLeftMargin();
|
||||
lt_corner.y = pglayout.GetTopMargin();
|
||||
WORKSHEET_DATAITEM::m_LT_Corner = lt_corner;
|
||||
WS_DATA_ITEM::m_LT_Corner = lt_corner;
|
||||
|
||||
// Right bottom corner position
|
||||
DPOINT rb_corner;
|
||||
rb_corner.x = ( aPageInfo.GetSizeMils().x * MILS_TO_MM ) - pglayout.GetRightMargin();
|
||||
rb_corner.y = ( aPageInfo.GetSizeMils().y * MILS_TO_MM ) - pglayout.GetBottomMargin();
|
||||
WORKSHEET_DATAITEM::m_RB_Corner = rb_corner;
|
||||
WS_DATA_ITEM::m_RB_Corner = rb_corner;
|
||||
}
|
||||
|
||||
|
||||
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( const PAGE_INFO& aPageInfo,
|
||||
const TITLE_BLOCK& aTitleBlock )
|
||||
{
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
|
||||
m_titleBlock = &aTitleBlock;
|
||||
m_paperFormat = &aPageInfo.GetType();
|
||||
|
@ -432,11 +432,11 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( const PAGE_INFO& aPageInfo,
|
|||
if( pglayout.GetCount() == 0 && !pglayout.VoidListAllowed() )
|
||||
pglayout.SetPageLayout();
|
||||
|
||||
WORKSHEET_DATAITEM::m_WSunits2Iu = m_milsToIu / MILS_TO_MM;
|
||||
WS_DATA_ITEM::m_WSunits2Iu = m_milsToIu / MILS_TO_MM;
|
||||
|
||||
SetupDrawEnvironment( aPageInfo );
|
||||
|
||||
for( WORKSHEET_DATAITEM* wsItem : pglayout.GetItems() )
|
||||
for( WS_DATA_ITEM* wsItem : pglayout.GetItems() )
|
||||
{
|
||||
// Generate it only if the page option allows this
|
||||
if( wsItem->GetPage1Option() == FIRST_PAGE_ONLY && m_sheetNumber != 1 )
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
#include <ws_draw_item.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
|
||||
#include <worksheet_painter.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_painter.h>
|
||||
#include <ws_data_item.h>
|
||||
|
||||
using namespace KIGFX;
|
||||
|
||||
|
@ -236,7 +236,7 @@ void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
|
|||
}
|
||||
|
||||
|
||||
bool KIGFX::WORKSHEET_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
||||
bool KIGFX::WS_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
||||
{
|
||||
auto item = static_cast<const EDA_ITEM*>( aItem );
|
||||
|
||||
|
@ -254,7 +254,7 @@ bool KIGFX::WORKSHEET_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
|||
}
|
||||
|
||||
|
||||
void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_LINE* aItem, int aLayer ) const
|
||||
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_LINE* aItem, int aLayer ) const
|
||||
{
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetIsFill( false );
|
||||
|
@ -264,7 +264,7 @@ void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_LINE* aItem, int aLayer
|
|||
}
|
||||
|
||||
|
||||
void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_RECT* aItem, int aLayer ) const
|
||||
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_RECT* aItem, int aLayer ) const
|
||||
{
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetIsFill( false );
|
||||
|
@ -274,7 +274,7 @@ void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_RECT* aItem, int aLayer
|
|||
}
|
||||
|
||||
|
||||
void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_POLYGON* aItem, int aLayer ) const
|
||||
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_POLYGON* aItem, int aLayer ) const
|
||||
{
|
||||
std::deque<VECTOR2D> corners;
|
||||
for( wxPoint point : aItem->m_Corners )
|
||||
|
@ -300,7 +300,7 @@ void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_POLYGON* aItem, int aLay
|
|||
}
|
||||
|
||||
|
||||
void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
|
||||
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
|
||||
{
|
||||
VECTOR2D position( aItem->GetTextPos().x, aItem->GetTextPos().y );
|
||||
|
||||
|
@ -315,12 +315,12 @@ void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer
|
|||
}
|
||||
|
||||
|
||||
void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_BITMAP* aItem, int aLayer ) const
|
||||
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_BITMAP* aItem, int aLayer ) const
|
||||
{
|
||||
m_gal->Save();
|
||||
VECTOR2D position = aItem->GetPosition();
|
||||
m_gal->Translate( position );
|
||||
auto* bitmap = static_cast<WORKSHEET_DATAITEM_BITMAP*>( aItem->GetPeer() );
|
||||
auto* bitmap = static_cast<WS_DATA_ITEM_BITMAP*>( aItem->GetPeer() );
|
||||
|
||||
// When the image scale factor is not 1.0, we need to modify the actual scale
|
||||
// as the image scale factor is similar to a local zoom
|
||||
|
@ -334,7 +334,7 @@ void KIGFX::WORKSHEET_PAINTER::draw( const WS_DRAW_ITEM_BITMAP* aItem, int aLaye
|
|||
}
|
||||
|
||||
|
||||
void KIGFX::WORKSHEET_PAINTER::DrawBorder( const PAGE_INFO* aPageInfo, int aScaleFactor ) const
|
||||
void KIGFX::WS_PAINTER::DrawBorder( const PAGE_INFO* aPageInfo, int aScaleFactor ) const
|
||||
{
|
||||
VECTOR2D origin = VECTOR2D( 0.0, 0.0 );
|
||||
VECTOR2D end = VECTOR2D( aPageInfo->GetWidthMils() * aScaleFactor,
|
|
@ -27,38 +27,38 @@
|
|||
* @brief Class that handles properties and drawing of worksheet layout.
|
||||
*/
|
||||
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_item.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <painter.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <page_info.h>
|
||||
#include <view/view.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
|
||||
using namespace KIGFX;
|
||||
|
||||
WORKSHEET_VIEWITEM::WORKSHEET_VIEWITEM( int aMils2IUscalefactor,
|
||||
WS_VIEW_ITEM::WS_VIEW_ITEM( int aMils2IUscalefactor,
|
||||
const PAGE_INFO* aPageInfo, const TITLE_BLOCK* aTitleBlock ) :
|
||||
EDA_ITEM( NOT_USED ), // this item is never added to a BOARD so it needs no type
|
||||
m_mils2IUscalefactor( aMils2IUscalefactor ),
|
||||
m_titleBlock( aTitleBlock ), m_pageInfo( aPageInfo ), m_sheetNumber( 1 ), m_sheetCount( 1 ) {}
|
||||
|
||||
|
||||
void WORKSHEET_VIEWITEM::SetPageInfo( const PAGE_INFO* aPageInfo )
|
||||
void WS_VIEW_ITEM::SetPageInfo( const PAGE_INFO* aPageInfo )
|
||||
{
|
||||
m_pageInfo = aPageInfo;
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_VIEWITEM::SetTitleBlock( const TITLE_BLOCK* aTitleBlock )
|
||||
void WS_VIEW_ITEM::SetTitleBlock( const TITLE_BLOCK* aTitleBlock )
|
||||
{
|
||||
m_titleBlock = aTitleBlock;
|
||||
}
|
||||
|
||||
|
||||
const BOX2I WORKSHEET_VIEWITEM::ViewBBox() const
|
||||
const BOX2I WS_VIEW_ITEM::ViewBBox() const
|
||||
{
|
||||
BOX2I bbox;
|
||||
|
||||
|
@ -77,7 +77,7 @@ const BOX2I WORKSHEET_VIEWITEM::ViewBBox() const
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
|
||||
void WS_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
|
||||
{
|
||||
auto gal = aView->GetGAL();
|
||||
auto settings = aView->GetPainter()->GetSettings();
|
||||
|
@ -107,7 +107,7 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
|
|||
gal->Scale( VECTOR2D( -1.0, 1.0 ) );
|
||||
}
|
||||
|
||||
WORKSHEET_PAINTER ws_painter( gal );
|
||||
WS_PAINTER ws_painter( gal );
|
||||
WS_RENDER_SETTINGS* ws_settings =static_cast<WS_RENDER_SETTINGS*>( ws_painter.GetSettings() );
|
||||
|
||||
ws_settings->SetNormalColor( settings->GetLayerColor( LAYER_WORKSHEET ) );
|
||||
|
@ -127,7 +127,7 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_VIEWITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
void WS_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
aCount = 1;
|
||||
aLayers[0] = LAYER_WORKSHEET;
|
|
@ -25,12 +25,12 @@
|
|||
#include <fctsys.h>
|
||||
#include <base_struct.h>
|
||||
#include <plotter.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
#include <base_screen.h>
|
||||
#include <draw_graphic_text.h>
|
||||
#include <title_block.h>
|
||||
#include "ws_draw_item.h"
|
||||
#include "worksheet_dataitem.h"
|
||||
#include "ws_data_item.h"
|
||||
#include <wx/filename.h>
|
||||
|
||||
|
||||
|
@ -126,7 +126,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
|
|||
case WSG_BITMAP_T:
|
||||
{
|
||||
WS_DRAW_ITEM_BITMAP* drawItem = (WS_DRAW_ITEM_BITMAP*) item;
|
||||
auto* bitmap = (WORKSHEET_DATAITEM_BITMAP*) drawItem->GetPeer();
|
||||
auto* bitmap = (WS_DATA_ITEM_BITMAP*) drawItem->GetPeer();
|
||||
|
||||
if( bitmap->m_ImageBitmap == NULL )
|
||||
break;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <bitmaps.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <dialog_plot_schematic.h>
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <eeschema_config.h>
|
||||
#include <ee_hotkeys.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <class_library.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <dialog_erc.h>
|
||||
|
@ -285,19 +286,17 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
|
|||
|
||||
// Verify some values, because the config file can be edited by hand,
|
||||
// and have bad values:
|
||||
LIB_PART::SetSubpartIdNotation(
|
||||
LIB_PART::GetSubpartIdSeparator(),
|
||||
LIB_PART::GetSubpartFirstId() );
|
||||
LIB_PART::SetSubpartIdNotation( LIB_PART::GetSubpartIdSeparator(),
|
||||
LIB_PART::GetSubpartFirstId() );
|
||||
|
||||
// Load the page layout decr file, from the filename stored in
|
||||
// BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
|
||||
// If empty, or not existing, the default descr is loaded
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
wxString pg_fullfilename = WORKSHEET_LAYOUT::MakeFullFileName(
|
||||
BASE_SCREEN::m_PageLayoutDescrFileName,
|
||||
Prj().GetProjectPath() );
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
wxString filename = WS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
|
||||
Prj().GetProjectPath() );
|
||||
|
||||
pglayout.SetPageLayout( pg_fullfilename );
|
||||
pglayout.SetPageLayout( filename );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -24,10 +24,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file eeschema/files-io.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <sch_draw_panel.h>
|
||||
#include <confirm.h>
|
||||
|
@ -52,7 +48,7 @@
|
|||
#include <symbol_lib_table.h>
|
||||
#include <dialog_symbol_remap.h>
|
||||
#include <dialog_migrate_buses.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <connection_graph.h>
|
||||
|
||||
|
||||
|
@ -804,7 +800,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
|||
g_RootSheet = pi->Load( aFileName, &Kiway() );
|
||||
|
||||
// Eagle sheets do not use a worksheet frame by default, so set it to an empty one
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
pglayout.SetEmptyLayout();
|
||||
|
||||
BASE_SCREEN::m_PageLayoutDescrFileName = "empty.kicad_wks";
|
||||
|
@ -814,7 +810,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
|||
|
||||
if( layoutfile.Create( layoutfn.GetFullPath() ) )
|
||||
{
|
||||
layoutfile.Write( WORKSHEET_LAYOUT::EmptyLayout() );
|
||||
layoutfile.Write( WS_DATA_MODEL::EmptyLayout() );
|
||||
layoutfile.Close();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
|
||||
#include <view/wx_view_controls.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <sch_draw_panel.h>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
#include <view/wx_view_controls.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <view/view_group.h>
|
||||
#include <view/view_rtree.h>
|
||||
#include <view/wx_view_controls.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <class_libentry.h>
|
||||
#include <sch_sheet.h>
|
||||
|
@ -85,7 +85,7 @@ void SCH_VIEW::DisplaySheet( SCH_SCREEN *aScreen )
|
|||
for( auto item = aScreen->GetDrawItems(); item; item = item->Next() )
|
||||
Add( item );
|
||||
|
||||
m_worksheet.reset( new KIGFX::WORKSHEET_VIEWITEM( 1, &aScreen->GetPageSettings(),
|
||||
m_worksheet.reset( new KIGFX::WS_VIEW_ITEM( 1, &aScreen->GetPageSettings(),
|
||||
&aScreen->GetTitleBlock() ) );
|
||||
m_worksheet->SetSheetNumber( aScreen->m_ScreenNumber );
|
||||
m_worksheet->SetSheetCount( aScreen->m_NumberOfScreens );
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <math/box2.h>
|
||||
|
||||
#include <view/wx_view_controls.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
|
||||
class SCH_SHEET;
|
||||
|
@ -61,7 +61,7 @@ static const LAYER_NUM SCH_LAYER_ORDER[] =
|
|||
namespace KIGFX
|
||||
{
|
||||
class VIEW_GROUP;
|
||||
class WORKSHEET_VIEWITEM;
|
||||
class WS_VIEW_ITEM;
|
||||
|
||||
namespace PREVIEW
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
private:
|
||||
SCH_BASE_FRAME* m_frame; // The frame using this view. Can be null. Used mainly
|
||||
// to know the sheet path name when drawing the page layout
|
||||
std::unique_ptr<WORKSHEET_VIEWITEM> m_worksheet;
|
||||
std::unique_ptr<WS_VIEW_ITEM> m_worksheet;
|
||||
std::unique_ptr<KIGFX::PREVIEW::SELECTION_AREA> m_selectionArea;
|
||||
std::unique_ptr<KIGFX::VIEW_GROUP> m_preview;
|
||||
std::vector<EDA_ITEM *> m_ownedItems;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <view/view.h>
|
||||
#include <view/wx_view_controls.h>
|
||||
#include <gerbview_painter.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
|
||||
#include <colors_design_settings.h>
|
||||
#include <gerbview_frame.h>
|
||||
|
@ -179,7 +179,7 @@ void GERBVIEW_DRAW_PANEL_GAL::setDefaultLayerDeps()
|
|||
}
|
||||
|
||||
|
||||
void GERBVIEW_DRAW_PANEL_GAL::SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet )
|
||||
void GERBVIEW_DRAW_PANEL_GAL::SetWorksheet( KIGFX::WS_VIEW_ITEM* aWorksheet )
|
||||
{
|
||||
m_worksheet.reset( aWorksheet );
|
||||
m_view->Add( m_worksheet.get() );
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
#define GERBVIEW_DRAW_PANEL_GAL_H_
|
||||
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
|
||||
namespace KIGFX
|
||||
{
|
||||
class WORKSHEET_VIEWITEM;
|
||||
class WS_VIEW_ITEM;
|
||||
}
|
||||
|
||||
class COLORS_DESIGN_SETTINGS;
|
||||
|
@ -69,14 +69,14 @@ public:
|
|||
* @param aWorksheet is the worksheet to be used.
|
||||
* The object is then owned by GERBVIEW_DRAW_PANEL_GAL.
|
||||
*/
|
||||
void SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet );
|
||||
void SetWorksheet( KIGFX::WS_VIEW_ITEM* aWorksheet );
|
||||
|
||||
protected:
|
||||
///> Sets rendering targets & dependencies for layers.
|
||||
void setDefaultLayerDeps();
|
||||
|
||||
///> Currently used worksheet
|
||||
std::unique_ptr<KIGFX::WORKSHEET_VIEWITEM> m_worksheet;
|
||||
std::unique_ptr<KIGFX::WS_VIEW_ITEM> m_worksheet;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -960,7 +960,7 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
|||
|
||||
// Prepare worksheet template
|
||||
auto worksheet =
|
||||
new KIGFX::WORKSHEET_VIEWITEM( IU_PER_MILS, &GetPageSettings(), &GetTitleBlock() );
|
||||
new KIGFX::WS_VIEW_ITEM( IU_PER_MILS, &GetPageSettings(), &GetTitleBlock() );
|
||||
|
||||
if( screen != NULL )
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
// * poly polygon defined by a coordinate, and a set of list of corners
|
||||
// ( because we use it for logos, there are more than one polygon
|
||||
// in this description
|
||||
class WORKSHEET_DATAITEM
|
||||
class WS_DATA_ITEM
|
||||
{
|
||||
public:
|
||||
enum WS_ITEM_TYPE {
|
||||
|
@ -116,8 +116,12 @@ public:
|
|||
int m_IncrementLabel;
|
||||
|
||||
// These variables are static, because these values are common to all
|
||||
// instances of WORKSHEET_DATAITEM.
|
||||
// instances of WS_DATA_ITEM.
|
||||
// They are default or common values.
|
||||
//==============================================================================
|
||||
// JEY TODO: these globals are death when we try to generate the page setttings preview...
|
||||
// move them to member variables of WS_DATA_MODEL
|
||||
//==============================================================================
|
||||
static double m_WSunits2Iu; // conversion factor between
|
||||
// ws units (mils) and draw/plot units
|
||||
static DPOINT m_RB_Corner; // cordinates of the right bottom corner
|
||||
|
@ -135,9 +139,9 @@ public:
|
|||
// When set to true, base texts
|
||||
// instead of full texts are displayed
|
||||
public:
|
||||
WORKSHEET_DATAITEM( WS_ITEM_TYPE aType );
|
||||
WS_DATA_ITEM( WS_ITEM_TYPE aType );
|
||||
|
||||
virtual ~WORKSHEET_DATAITEM() {}
|
||||
virtual ~WS_DATA_ITEM() {}
|
||||
|
||||
const std::vector<WS_DRAW_ITEM_BASE*>& GetDrawItems() const { return m_drawItems; }
|
||||
|
||||
|
@ -233,7 +237,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class WORKSHEET_DATAITEM_POLYPOLYGON : public WORKSHEET_DATAITEM
|
||||
class WS_DATA_ITEM_POLYGONS : public WS_DATA_ITEM
|
||||
{
|
||||
public:
|
||||
double m_Orient; // Orientation in degrees
|
||||
|
@ -245,7 +249,7 @@ private:
|
|||
DPOINT m_maxCoord; // max coord of corners, relative to m_Pos
|
||||
|
||||
public:
|
||||
WORKSHEET_DATAITEM_POLYPOLYGON( );
|
||||
WS_DATA_ITEM_POLYGONS( );
|
||||
|
||||
void SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
|
||||
|
||||
|
@ -324,7 +328,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class WORKSHEET_DATAITEM_TEXT : public WORKSHEET_DATAITEM
|
||||
class WS_DATA_ITEM_TEXT : public WS_DATA_ITEM
|
||||
{
|
||||
public:
|
||||
wxString m_TextBase; // The basic text, with format symbols
|
||||
|
@ -345,7 +349,7 @@ public:
|
|||
|
||||
|
||||
public:
|
||||
WORKSHEET_DATAITEM_TEXT( const wxString& aTextBase );
|
||||
WS_DATA_ITEM_TEXT( const wxString& aTextBase );
|
||||
|
||||
void SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
|
||||
|
||||
|
@ -400,14 +404,14 @@ public:
|
|||
|
||||
|
||||
class BITMAP_BASE;
|
||||
class WORKSHEET_DATAITEM_BITMAP : public WORKSHEET_DATAITEM
|
||||
class WS_DATA_ITEM_BITMAP : public WS_DATA_ITEM
|
||||
{
|
||||
public:
|
||||
BITMAP_BASE* m_ImageBitmap;
|
||||
|
||||
public:
|
||||
WORKSHEET_DATAITEM_BITMAP(BITMAP_BASE* aImage)
|
||||
: WORKSHEET_DATAITEM( WS_BITMAP )
|
||||
WS_DATA_ITEM_BITMAP(BITMAP_BASE* aImage)
|
||||
: WS_DATA_ITEM( WS_BITMAP )
|
||||
{
|
||||
m_ImageBitmap = aImage;
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef WS_DATA_MODEL_H
|
||||
#define WS_DATA_MODEL_H
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <eda_text.h>
|
||||
#include <eda_text.h>
|
||||
#include <bitmap_base.h>
|
||||
#include <ws_data_item.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block
|
||||
*/
|
||||
class WS_DATA_MODEL
|
||||
{
|
||||
std::vector <WS_DATA_ITEM*> m_list;
|
||||
bool m_allowVoidList; // If false, the default page layout
|
||||
// will be loaded the first time
|
||||
// WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList
|
||||
// is run (useful mainly for page layout editor)
|
||||
double m_leftMargin; // the left page margin in mm
|
||||
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
|
||||
|
||||
public:
|
||||
WS_DATA_MODEL();
|
||||
~WS_DATA_MODEL() {ClearList(); }
|
||||
|
||||
/**
|
||||
* static function: returns the instance of WS_DATA_MODEL used in the application
|
||||
*/
|
||||
static WS_DATA_MODEL& GetTheInstance();
|
||||
|
||||
/**
|
||||
* static function: Set an alternate instance of WS_DATA_MODEL
|
||||
* mainly used in page setting dialog
|
||||
* @param aLayout = the alternate page layout; if null restore the basic page layout
|
||||
*/
|
||||
static void SetAltInstance( WS_DATA_MODEL* aLayout = NULL );
|
||||
|
||||
// Accessors:
|
||||
double GetLeftMargin() { return m_leftMargin; }
|
||||
double GetRightMargin() { return m_rightMargin; }
|
||||
double GetTopMargin() { return m_topMargin; }
|
||||
double GetBottomMargin() { return m_bottomMargin; }
|
||||
|
||||
void SetLeftMargin( double aMargin );
|
||||
void SetRightMargin( double aMargin );
|
||||
void SetTopMargin( double aMargin );
|
||||
void SetBottomMargin( double aMargin );
|
||||
|
||||
/**
|
||||
* In Kicad applications, a page layout description is needed
|
||||
* So if the list is empty, a default description is loaded,
|
||||
* the first time a page layout is drawn.
|
||||
* However, in page layout editor, an empty list is acceptable.
|
||||
* AllowVoidList allows or not the empty list
|
||||
*/
|
||||
void AllowVoidList( bool Allow ) { m_allowVoidList = Allow; }
|
||||
|
||||
/**
|
||||
* @return true if an empty list is allowed
|
||||
* (mainly allowed for page layout editor).
|
||||
*/
|
||||
bool VoidListAllowed() { return m_allowVoidList; }
|
||||
|
||||
/**
|
||||
* erase the list of items
|
||||
*/
|
||||
void ClearList();
|
||||
|
||||
/**
|
||||
* Save the description in a file
|
||||
* @param aFullFileName the filename of the file to created
|
||||
*/
|
||||
void Save( const wxString& aFullFileName );
|
||||
|
||||
/**
|
||||
* Save the description in a buffer
|
||||
* @param aOutputString = a wxString to store the S expr string
|
||||
*/
|
||||
void SaveInString( wxString& aOutputString );
|
||||
|
||||
void Append( WS_DATA_ITEM* aItem );
|
||||
void Remove( WS_DATA_ITEM* aItem );
|
||||
|
||||
/**
|
||||
* @return the index of aItem, or -1 if does not exist
|
||||
*/
|
||||
int GetItemIndex( WS_DATA_ITEM* aItem ) const;
|
||||
|
||||
/**
|
||||
* @return the item from its index aIdx, or NULL if does not exist
|
||||
*/
|
||||
WS_DATA_ITEM* GetItem( unsigned aIdx ) const;
|
||||
|
||||
/**
|
||||
* @return a reference to the items.
|
||||
*/
|
||||
std::vector<WS_DATA_ITEM*>& GetItems() { return m_list; }
|
||||
|
||||
/**
|
||||
* @return the item count
|
||||
*/
|
||||
unsigned GetCount() const { return m_list.size(); }
|
||||
|
||||
void SetDefaultLayout();
|
||||
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
|
||||
* @param aFullFileName = the custom page layout description file.
|
||||
* if empty, loads the file defined by KICAD_WKSFILE
|
||||
* and if its is not defined, uses the default internal description
|
||||
* @param Append = if true: do not delete old layout, and load only
|
||||
aFullFileName.
|
||||
*/
|
||||
void SetPageLayout( const wxString& aFullFileName = wxEmptyString, bool Append = false );
|
||||
|
||||
/**
|
||||
* Populates the list from a S expr description stored in a string
|
||||
* @param aPageLayout = the S expr string
|
||||
* @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 aAppend = false,
|
||||
const wxString& aSource = wxT( "Sexpr_string" ) );
|
||||
|
||||
/**
|
||||
* @return a short filename from a full filename:
|
||||
* if the path is the current project path, or if the path
|
||||
* is the same as kicad.pro (in template), returns the shortname
|
||||
* else do nothing and returns a full filename
|
||||
* @param aFullFileName = the full filename, which can be a relative
|
||||
* @param aProjectPath = the curr project absolute path (can be empty)
|
||||
*/
|
||||
static const wxString MakeShortFileName( const wxString& aFullFileName,
|
||||
const wxString& aProjectPath );
|
||||
|
||||
/**
|
||||
* Static function
|
||||
* @return a full filename from a short filename.
|
||||
* @param aShortFileName = the short filename, which can be a relative
|
||||
* @param aProjectPath = the curr project absolute path (can be empty)
|
||||
* or absolute path, and can include env variable reference ( ${envvar} expression )
|
||||
* if the short filename path is relative, it is expected relative to the project path
|
||||
* or (if aProjectPath is empty or if the file does not exist)
|
||||
* relative to kicad.pro (in template)
|
||||
* If aShortFileName is absolute return aShortFileName
|
||||
*/
|
||||
static const wxString MakeFullFileName( const wxString& aShortFileName,
|
||||
const wxString& aProjectPath );
|
||||
};
|
||||
|
||||
#endif // WS_DATA_MODEL_H
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -31,30 +31,26 @@
|
|||
#include <bitmap_base.h>
|
||||
#include "msgpanel.h"
|
||||
|
||||
class WORKSHEET_DATAITEM;
|
||||
class WS_DATA_ITEM;
|
||||
class TITLE_BLOCK;
|
||||
class PAGE_INFO;
|
||||
|
||||
#define TB_DEFAULT_TEXTSIZE 1.5 // default worksheet text size in mm
|
||||
|
||||
/*
|
||||
* Helper classes to handle basic graphic items used to draw/plot
|
||||
* title blocks and frame references
|
||||
* segments
|
||||
* rect
|
||||
* polygons (for logos)
|
||||
* graphic texts
|
||||
* bitmaps, also for logos, but they cannot be plot by SVG, GERBER or HPGL plotters (in
|
||||
* which case only the bounding box is plotted)
|
||||
* title blocks and frame references
|
||||
* segments
|
||||
* rect
|
||||
* polygons (for logos)
|
||||
* graphic texts
|
||||
* bitmaps (also for logos, but they cannot be plot by SVG, GERBER or HPGL plotters
|
||||
* where we just plot the bounding box)
|
||||
*/
|
||||
class WS_DRAW_ITEM_BASE : public EDA_ITEM // This basic class, not directly usable.
|
||||
{
|
||||
protected:
|
||||
WORKSHEET_DATAITEM* m_peer; // an unique identifier, used as link
|
||||
// to the parent WORKSHEET_DATAITEM item,
|
||||
// in page layout editor
|
||||
WS_DATA_ITEM* m_peer; // the parent WS_DATA_ITEM item in the WS_DATA_MODEL
|
||||
|
||||
WS_DRAW_ITEM_BASE( WORKSHEET_DATAITEM* aPeer, KICAD_T aType ) :
|
||||
WS_DRAW_ITEM_BASE( WS_DATA_ITEM* aPeer, KICAD_T aType ) :
|
||||
EDA_ITEM( aType )
|
||||
{
|
||||
m_peer = aPeer;
|
||||
|
@ -64,7 +60,7 @@ protected:
|
|||
public:
|
||||
virtual ~WS_DRAW_ITEM_BASE() {}
|
||||
|
||||
WORKSHEET_DATAITEM* GetPeer() const { return m_peer; }
|
||||
WS_DATA_ITEM* GetPeer() const { return m_peer; }
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
|
@ -72,19 +68,21 @@ public:
|
|||
virtual void SetPosition( wxPoint aPos ) = 0;
|
||||
virtual void SetEnd( wxPoint aPos ) { /* not all types will need this */ }
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM
|
||||
*/
|
||||
// The function to draw a WS_DRAW_ITEM
|
||||
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, COLOR4D aColor )
|
||||
{
|
||||
wxPoint offset( 0, 0 );
|
||||
DrawWsItem( aClipBox, aDC, offset, UNSPECIFIED_DRAWMODE, aColor );
|
||||
}
|
||||
|
||||
/// More advanced version of DrawWsItem. This is what must be
|
||||
/// defined in the derived type.
|
||||
// More advanced version of DrawWsItem. This is what must be defined in the derived type.
|
||||
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
|
||||
GR_DRAWMODE aDrawMode, COLOR4D aColor ) = 0;
|
||||
|
||||
// Derived types must define GetBoundingBox() as a minimum, and can then override the
|
||||
// two HitTest() functions if they need something more specific.
|
||||
const EDA_RECT GetBoundingBox() const override = 0;
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override
|
||||
{
|
||||
// This is just here to prevent annoying compiler warnings about hidden overloaded
|
||||
|
@ -92,10 +90,6 @@ public:
|
|||
return EDA_ITEM::HitTest( aPosition, aAccuracy );
|
||||
}
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the rect aRect intersects on the item
|
||||
*/
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) override;
|
||||
|
@ -110,7 +104,7 @@ class WS_DRAW_ITEM_LINE : public WS_DRAW_ITEM_BASE
|
|||
int m_penWidth;
|
||||
|
||||
public:
|
||||
WS_DRAW_ITEM_LINE( WORKSHEET_DATAITEM* aPeer, wxPoint aStart, wxPoint aEnd, int aPenWidth ) :
|
||||
WS_DRAW_ITEM_LINE( WS_DATA_ITEM* aPeer, wxPoint aStart, wxPoint aEnd, int aPenWidth ) :
|
||||
WS_DRAW_ITEM_BASE( aPeer, WSG_LINE_T )
|
||||
{
|
||||
m_start = aStart;
|
||||
|
@ -131,15 +125,8 @@ public:
|
|||
void SetPosition( wxPoint aPos ) override { SetStart( aPos ); }
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the point aPosition is on the line
|
||||
*/
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM_LINE
|
||||
*/
|
||||
void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode,
|
||||
COLOR4D aColor ) override;
|
||||
|
||||
|
@ -154,7 +141,7 @@ public:
|
|||
class WS_DRAW_ITEM_POLYGON : public WS_DRAW_ITEM_BASE
|
||||
{
|
||||
wxPoint m_pos; // position of reference point, from the
|
||||
// WORKSHEET_DATAITEM_POLYPOLYGON parent
|
||||
// WS_DATA_ITEM_POLYGONS parent
|
||||
// (used only in page layout editor to draw anchors)
|
||||
int m_penWidth;
|
||||
bool m_fill;
|
||||
|
@ -163,8 +150,8 @@ public:
|
|||
std::vector <wxPoint> m_Corners;
|
||||
|
||||
public:
|
||||
WS_DRAW_ITEM_POLYGON( WORKSHEET_DATAITEM* aPeer, wxPoint aPos, bool aFill, int aPenWidth ) :
|
||||
WS_DRAW_ITEM_BASE( aPeer, WSG_POLY_T )
|
||||
WS_DRAW_ITEM_POLYGON( WS_DATA_ITEM* aPeer, wxPoint aPos, bool aFill, int aPenWidth ) :
|
||||
WS_DRAW_ITEM_BASE( aPeer, WSG_POLY_T )
|
||||
{
|
||||
m_penWidth = aPenWidth;
|
||||
m_fill = aFill;
|
||||
|
@ -180,21 +167,9 @@ public:
|
|||
void SetPosition( wxPoint aPos ) override { m_pos = aPos; }
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the point aPosition is inside one polygon
|
||||
*/
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the rect aRect intersects on the item
|
||||
*/
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM_POLYGON
|
||||
*/
|
||||
void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode,
|
||||
COLOR4D aColor ) override;
|
||||
|
||||
|
@ -213,7 +188,7 @@ class WS_DRAW_ITEM_RECT : public WS_DRAW_ITEM_BASE
|
|||
int m_penWidth;
|
||||
|
||||
public:
|
||||
WS_DRAW_ITEM_RECT( WORKSHEET_DATAITEM* aPeer, wxPoint aStart, wxPoint aEnd, int aPenWidth ) :
|
||||
WS_DRAW_ITEM_RECT( WS_DATA_ITEM* aPeer, wxPoint aStart, wxPoint aEnd, int aPenWidth ) :
|
||||
WS_DRAW_ITEM_BASE( aPeer, WSG_RECT_T )
|
||||
{
|
||||
m_start = aStart;
|
||||
|
@ -233,17 +208,10 @@ public:
|
|||
const wxPoint GetPosition() const override { return GetStart(); }
|
||||
void SetPosition( wxPoint aPos ) override { SetStart( aPos ); }
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM_RECT
|
||||
*/
|
||||
void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode,
|
||||
COLOR4D aColor ) override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the point aPosition is on one edge of the rectangle
|
||||
*/
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
|
||||
|
@ -259,7 +227,7 @@ public:
|
|||
class WS_DRAW_ITEM_TEXT : public WS_DRAW_ITEM_BASE, public EDA_TEXT
|
||||
{
|
||||
public:
|
||||
WS_DRAW_ITEM_TEXT( WORKSHEET_DATAITEM* aPeer, wxString& aText, wxPoint aPos, wxSize aSize,
|
||||
WS_DRAW_ITEM_TEXT( WS_DATA_ITEM* aPeer, wxString& aText, wxPoint aPos, wxSize aSize,
|
||||
int aPenWidth, bool aItalic = false, bool aBold = false ) :
|
||||
WS_DRAW_ITEM_BASE( aPeer, WSG_TEXT_T),
|
||||
EDA_TEXT( aText )
|
||||
|
@ -290,17 +258,7 @@ public:
|
|||
void SetPosition( wxPoint aPos ) override { SetTextPos( aPos ); }
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the point aPosition is inside one polygon
|
||||
*/
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the rect aRect intersects on the item
|
||||
*/
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
|
||||
|
@ -316,7 +274,7 @@ class WS_DRAW_ITEM_BITMAP : public WS_DRAW_ITEM_BASE
|
|||
wxPoint m_pos; // position of reference point
|
||||
|
||||
public:
|
||||
WS_DRAW_ITEM_BITMAP( WORKSHEET_DATAITEM* aPeer, wxPoint aPos ) :
|
||||
WS_DRAW_ITEM_BITMAP( WS_DATA_ITEM* aPeer, wxPoint aPos ) :
|
||||
WS_DRAW_ITEM_BASE( aPeer, WSG_BITMAP_T )
|
||||
{
|
||||
m_pos = aPos;
|
||||
|
@ -334,8 +292,6 @@ public:
|
|||
const wxPoint GetPosition() const override { return m_pos; }
|
||||
void SetPosition( wxPoint aPos ) override { m_pos = aPos; }
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM_BITMAP
|
||||
*/
|
||||
void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode,
|
||||
COLOR4D aColor ) override;
|
||||
|
||||
|
@ -546,162 +502,4 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* WORKSHEET_LAYOUT handles the graphic items list to draw/plot
|
||||
* the title block and other items (page references ...
|
||||
*/
|
||||
class WORKSHEET_LAYOUT
|
||||
{
|
||||
std::vector <WORKSHEET_DATAITEM*> m_list;
|
||||
bool m_allowVoidList; // If false, the default page layout
|
||||
// will be loaded the first time
|
||||
// WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList
|
||||
// is run (useful mainly for page layout editor)
|
||||
double m_leftMargin; // the left page margin in mm
|
||||
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
|
||||
|
||||
public:
|
||||
WORKSHEET_LAYOUT();
|
||||
~WORKSHEET_LAYOUT() {ClearList(); }
|
||||
|
||||
/**
|
||||
* static function: returns the instance of WORKSHEET_LAYOUT used in the application
|
||||
*/
|
||||
static WORKSHEET_LAYOUT& GetTheInstance();
|
||||
|
||||
/**
|
||||
* static function: Set an alternate instance of WORKSHEET_LAYOUT
|
||||
* mainly used in page setting dialog
|
||||
* @param aLayout = the alternate page layout; if null restore the basic page layout
|
||||
*/
|
||||
static void SetAltInstance( WORKSHEET_LAYOUT* aLayout = NULL );
|
||||
|
||||
// Accessors:
|
||||
double GetLeftMargin() { return m_leftMargin; }
|
||||
double GetRightMargin() { return m_rightMargin; }
|
||||
double GetTopMargin() { return m_topMargin; }
|
||||
double GetBottomMargin() { return m_bottomMargin; }
|
||||
|
||||
void SetLeftMargin( double aMargin );
|
||||
void SetRightMargin( double aMargin );
|
||||
void SetTopMargin( double aMargin );
|
||||
void SetBottomMargin( double aMargin );
|
||||
|
||||
/**
|
||||
* In Kicad applications, a page layout description is needed
|
||||
* So if the list is empty, a default description is loaded,
|
||||
* the first time a page layout is drawn.
|
||||
* However, in page layout editor, an empty list is acceptable.
|
||||
* AllowVoidList allows or not the empty list
|
||||
*/
|
||||
void AllowVoidList( bool Allow ) { m_allowVoidList = Allow; }
|
||||
|
||||
/**
|
||||
* @return true if an empty list is allowed
|
||||
* (mainly allowed for page layout editor).
|
||||
*/
|
||||
bool VoidListAllowed() { return m_allowVoidList; }
|
||||
|
||||
/**
|
||||
* erase the list of items
|
||||
*/
|
||||
void ClearList();
|
||||
|
||||
/**
|
||||
* Save the description in a file
|
||||
* @param aFullFileName the filename of the file to created
|
||||
*/
|
||||
void Save( const wxString& aFullFileName );
|
||||
|
||||
/**
|
||||
* Save the description in a buffer
|
||||
* @param aOutputString = a wxString to store the S expr string
|
||||
*/
|
||||
void SaveInString( wxString& aOutputString );
|
||||
|
||||
void Append( WORKSHEET_DATAITEM* aItem );
|
||||
void Remove( WORKSHEET_DATAITEM* aItem );
|
||||
|
||||
/**
|
||||
* @return the index of aItem, or -1 if does not exist
|
||||
*/
|
||||
int GetItemIndex( WORKSHEET_DATAITEM* aItem ) const;
|
||||
|
||||
/**
|
||||
* @return the item from its index aIdx, or NULL if does not exist
|
||||
*/
|
||||
WORKSHEET_DATAITEM* GetItem( unsigned aIdx ) const;
|
||||
|
||||
/**
|
||||
* @return a reference to the items.
|
||||
*/
|
||||
std::vector<WORKSHEET_DATAITEM*>& GetItems() { return m_list; }
|
||||
|
||||
/**
|
||||
* @return the item count
|
||||
*/
|
||||
unsigned GetCount() const { return m_list.size(); }
|
||||
|
||||
void SetDefaultLayout();
|
||||
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
|
||||
* @param aFullFileName = the custom page layout description file.
|
||||
* if empty, loads the file defined by KICAD_WKSFILE
|
||||
* and if its is not defined, uses the default internal description
|
||||
* @param Append = if true: do not delete old layout, and load only
|
||||
aFullFileName.
|
||||
*/
|
||||
void SetPageLayout( const wxString& aFullFileName = wxEmptyString, bool Append = false );
|
||||
|
||||
/**
|
||||
* Populates the list from a S expr description stored in a string
|
||||
* @param aPageLayout = the S expr string
|
||||
* @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 aAppend = false,
|
||||
const wxString& aSource = wxT( "Sexpr_string" ) );
|
||||
|
||||
/**
|
||||
* @return a short filename from a full filename:
|
||||
* if the path is the current project path, or if the path
|
||||
* is the same as kicad.pro (in template), returns the shortname
|
||||
* else do nothing and returns a full filename
|
||||
* @param aFullFileName = the full filename, which can be a relative
|
||||
* @param aProjectPath = the curr project absolute path (can be empty)
|
||||
*/
|
||||
static const wxString MakeShortFileName( const wxString& aFullFileName,
|
||||
const wxString& aProjectPath );
|
||||
|
||||
/**
|
||||
* Static function
|
||||
* @return a full filename from a short filename.
|
||||
* @param aShortFileName = the short filename, which can be a relative
|
||||
* @param aProjectPath = the curr project absolute path (can be empty)
|
||||
* or absolute path, and can include env variable reference ( ${envvar} expression )
|
||||
* if the short filename path is relative, it is expected relative to the project path
|
||||
* or (if aProjectPath is empty or if the file does not exist)
|
||||
* relative to kicad.pro (in template)
|
||||
* If aShortFileName is absolute return aShortFileName
|
||||
*/
|
||||
static const wxString MakeFullFileName( const wxString& aShortFileName,
|
||||
const wxString& aProjectPath );
|
||||
};
|
||||
|
||||
#endif // WS_DRAW_ITEM_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -23,8 +23,8 @@
|
|||
|
||||
// For page and paper size, values are in 1/1000 inch
|
||||
|
||||
#ifndef WORKSHEET_PAINTER_H
|
||||
#define WORKSHEET_PAINTER_H
|
||||
#ifndef WS_PAINTER_H
|
||||
#define WS_PAINTER_H
|
||||
|
||||
#include <gal/color4d.h>
|
||||
#include <painter.h>
|
||||
|
@ -47,7 +47,7 @@ namespace KIGFX
|
|||
class WS_RENDER_SETTINGS : public RENDER_SETTINGS
|
||||
{
|
||||
public:
|
||||
friend class WORKSHEET_PAINTER;
|
||||
friend class WS_PAINTER;
|
||||
|
||||
WS_RENDER_SETTINGS();
|
||||
|
||||
|
@ -90,13 +90,13 @@ private:
|
|||
|
||||
|
||||
/**
|
||||
* Class WORKSHEET_PAINTER
|
||||
* Class WS_PAINTER
|
||||
* Contains methods for drawing worksheet items.
|
||||
*/
|
||||
class WORKSHEET_PAINTER : public PAINTER
|
||||
class WS_PAINTER : public PAINTER
|
||||
{
|
||||
public:
|
||||
WORKSHEET_PAINTER( GAL* aGal ) :
|
||||
WS_PAINTER( GAL* aGal ) :
|
||||
PAINTER( aGal )
|
||||
{ }
|
||||
|
||||
|
@ -164,4 +164,4 @@ void DrawPageLayout( wxDC* aDC,
|
|||
const wxString& aSheetLayer = wxEmptyString );
|
||||
|
||||
|
||||
#endif // WORKSHEET_PAINTER_H
|
||||
#endif // WS_PAINTER_H
|
|
@ -22,13 +22,8 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file worksheet_viewitem.h
|
||||
* @brief Class that handles properties and drawing of worksheet layout.
|
||||
*/
|
||||
|
||||
#ifndef WORKSHEET_VIEWITEM_H
|
||||
#define WORKSHEET_VIEWITEM_H
|
||||
#ifndef WS_VIEW_ITEM_H
|
||||
#define WS_VIEW_ITEM_H
|
||||
|
||||
#include <base_struct.h>
|
||||
|
||||
|
@ -46,11 +41,10 @@ namespace KIGFX
|
|||
class VIEW;
|
||||
class GAL;
|
||||
|
||||
class WORKSHEET_VIEWITEM : public EDA_ITEM
|
||||
class WS_VIEW_ITEM : public EDA_ITEM
|
||||
{
|
||||
public:
|
||||
WORKSHEET_VIEWITEM( int aMils2IUscalefactor,
|
||||
const PAGE_INFO* aPageInfo, const TITLE_BLOCK* aTitleBlock );
|
||||
WS_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const TITLE_BLOCK* aTitleBlock );
|
||||
|
||||
/**
|
||||
* Function SetFileName()
|
||||
|
@ -133,7 +127,7 @@ public:
|
|||
*/
|
||||
virtual wxString GetClass() const override
|
||||
{
|
||||
return wxT( "WORKSHEET_VIEWITEM" );
|
||||
return wxT( "WS_VIEW_ITEM" );
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -161,4 +155,4 @@ protected:
|
|||
};
|
||||
}
|
||||
|
||||
#endif /* WORKSHEET_VIEWITEM_H */
|
||||
#endif /* WS_VIEW_ITEM_H */
|
|
@ -27,16 +27,16 @@
|
|||
#include <class_drawpanel.h>
|
||||
|
||||
#include <pl_editor_frame.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_item.h>
|
||||
#include <dialog_new_dataitem_base.h>
|
||||
|
||||
|
||||
class DIALOG_NEW_DATAITEM : public DIALOG_NEW_DATAITEM_BASE
|
||||
{
|
||||
WORKSHEET_DATAITEM* m_item;
|
||||
WS_DATA_ITEM* m_item;
|
||||
|
||||
public:
|
||||
DIALOG_NEW_DATAITEM( PL_EDITOR_FRAME* aCaller, WORKSHEET_DATAITEM* aItem );
|
||||
DIALOG_NEW_DATAITEM( PL_EDITOR_FRAME* aCaller, WS_DATA_ITEM* aItem );
|
||||
|
||||
private:
|
||||
void OnOKClick( wxCommandEvent& event ) override;
|
||||
|
@ -45,14 +45,14 @@ private:
|
|||
};
|
||||
|
||||
|
||||
int InvokeDialogNewItem( PL_EDITOR_FRAME* aCaller, WORKSHEET_DATAITEM* aItem )
|
||||
int InvokeDialogNewItem( PL_EDITOR_FRAME* aCaller, WS_DATA_ITEM* aItem )
|
||||
{
|
||||
DIALOG_NEW_DATAITEM dlg( aCaller, aItem );
|
||||
return dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_NEW_DATAITEM::DIALOG_NEW_DATAITEM( PL_EDITOR_FRAME* aCaller, WORKSHEET_DATAITEM* aItem )
|
||||
DIALOG_NEW_DATAITEM::DIALOG_NEW_DATAITEM( PL_EDITOR_FRAME* aCaller, WS_DATA_ITEM* aItem )
|
||||
: DIALOG_NEW_DATAITEM_BASE( aCaller )
|
||||
{
|
||||
m_item = aItem;
|
||||
|
@ -65,9 +65,9 @@ DIALOG_NEW_DATAITEM::DIALOG_NEW_DATAITEM( PL_EDITOR_FRAME* aCaller, WORKSHEET_DA
|
|||
|
||||
void DIALOG_NEW_DATAITEM::OnOKClick( wxCommandEvent& event )
|
||||
{
|
||||
if( m_item->GetType() == WORKSHEET_DATAITEM::WS_TEXT )
|
||||
if( m_item->GetType() == WS_DATA_ITEM::WS_TEXT )
|
||||
{
|
||||
WORKSHEET_DATAITEM_TEXT* text = ((WORKSHEET_DATAITEM_TEXT*)m_item);
|
||||
WS_DATA_ITEM_TEXT* text = ((WS_DATA_ITEM_TEXT*)m_item);
|
||||
text->m_TextBase = m_textCtrlText->GetValue();
|
||||
// For multiline texts, replace the '\n' char by the "\\n" sequence",
|
||||
// in internal string
|
||||
|
@ -116,19 +116,19 @@ void DIALOG_NEW_DATAITEM::OnOKClick( wxCommandEvent& event )
|
|||
|
||||
void DIALOG_NEW_DATAITEM::initDlg()
|
||||
{
|
||||
// Disable useless widgets, depending on WORKSHEET_DATAITEM type
|
||||
// Disable useless widgets, depending on WS_DATA_ITEM type
|
||||
switch( m_item->GetType() )
|
||||
{
|
||||
case WORKSHEET_DATAITEM::WS_SEGMENT:
|
||||
case WORKSHEET_DATAITEM::WS_RECT:
|
||||
case WS_DATA_ITEM::WS_SEGMENT:
|
||||
case WS_DATA_ITEM::WS_RECT:
|
||||
m_textCtrlText->Enable( false );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_BITMAP:
|
||||
case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
|
||||
case WS_DATA_ITEM::WS_BITMAP:
|
||||
case WS_DATA_ITEM::WS_POLYPOLYGON:
|
||||
m_textCtrlText->Enable( false );
|
||||
// fall through
|
||||
case WORKSHEET_DATAITEM::WS_TEXT:
|
||||
case WS_DATA_ITEM::WS_TEXT:
|
||||
m_textCtrlEndX->Enable( false );
|
||||
m_textCtrlEndY->Enable( false );
|
||||
m_choiceCornerEnd->Enable( false );
|
||||
|
@ -165,6 +165,6 @@ void DIALOG_NEW_DATAITEM::initDlg()
|
|||
case LT_CORNER: m_choiceCornerEnd->SetSelection( 1 ); break;
|
||||
}
|
||||
|
||||
if( m_item->GetType() == WORKSHEET_DATAITEM::WS_TEXT )
|
||||
m_textCtrlText->SetValue( ((WORKSHEET_DATAITEM_TEXT*)m_item)->m_TextBase );
|
||||
if( m_item->GetType() == WS_DATA_ITEM::WS_TEXT )
|
||||
m_textCtrlText->SetValue( ((WS_DATA_ITEM_TEXT*)m_item)->m_TextBase );
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <pl_editor_id.h>
|
||||
#include <dialog_helpers.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_item.h>
|
||||
#include <dialog_page_settings.h>
|
||||
#include <invoke_pl_editor_dialog.h>
|
||||
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
/**
|
||||
* @file pagelayout_editor/files.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
*
|
||||
|
@ -35,7 +31,7 @@
|
|||
#include <gestfich.h>
|
||||
#include <macros.h>
|
||||
#include <ws_draw_item.h>
|
||||
|
||||
#include <ws_data_model.h>
|
||||
#include <pl_editor_frame.h>
|
||||
#include <properties_frame.h>
|
||||
#include <pl_editor_id.h>
|
||||
|
@ -88,10 +84,10 @@ void PL_EDITOR_FRAME::OnFileHistory( wxCommandEvent& event )
|
|||
/* File commands. */
|
||||
void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
|
||||
{
|
||||
wxString msg;
|
||||
int id = event.GetId();
|
||||
wxString filename = GetCurrFileName();
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
wxString msg;
|
||||
int id = event.GetId();
|
||||
wxString filename = GetCurrFileName();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
|
||||
if( filename.IsEmpty() && id == wxID_SAVE )
|
||||
id = wxID_SAVEAS;
|
||||
|
@ -223,7 +219,7 @@ bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName )
|
|||
{
|
||||
if( wxFileExists( aFullFileName ) )
|
||||
{
|
||||
WORKSHEET_LAYOUT::GetTheInstance().SetPageLayout( aFullFileName );
|
||||
WS_DATA_MODEL::GetTheInstance().SetPageLayout( aFullFileName );
|
||||
SetCurrFileName( aFullFileName );
|
||||
UpdateFileHistory( aFullFileName );
|
||||
GetScreen()->ClrModify();
|
||||
|
@ -240,7 +236,7 @@ bool PL_EDITOR_FRAME::InsertPageLayoutDescrFile( const wxString& aFullFileName )
|
|||
{
|
||||
const bool append = true;
|
||||
SaveCopyInUndoList();
|
||||
WORKSHEET_LAYOUT::GetTheInstance().SetPageLayout( aFullFileName, append );
|
||||
WS_DATA_MODEL::GetTheInstance().SetPageLayout( aFullFileName, append );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -252,7 +248,7 @@ bool PL_EDITOR_FRAME::SavePageLayoutDescrFile( const wxString& aFullFileName )
|
|||
{
|
||||
if( ! aFullFileName.IsEmpty() )
|
||||
{
|
||||
WORKSHEET_LAYOUT::GetTheInstance().Save( aFullFileName );
|
||||
WS_DATA_MODEL::GetTheInstance().Save( aFullFileName );
|
||||
GetScreen()->ClrModify();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include <class_drawpanel.h>
|
||||
#include <pl_editor_frame.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <hotkeys.h>
|
||||
#include <pl_editor_id.h>
|
||||
|
||||
|
|
|
@ -42,14 +42,14 @@
|
|||
// Often this is not used in the prototypes, since wxFrame is good enough and would
|
||||
// represent maximum information hiding.
|
||||
class PL_EDITOR_FRAME;
|
||||
class WORKSHEET_DATAITEM;
|
||||
class WS_DATA_ITEM;
|
||||
class wxPrintData;
|
||||
class wxPageSetupDialogData;
|
||||
|
||||
|
||||
/// Create and show DIALOG_NEW_DATAITEM and return whatever
|
||||
/// DIALOG_NEW_DATAITEM::ShowModal() returns.
|
||||
int InvokeDialogNewItem( PL_EDITOR_FRAME* aCaller, WORKSHEET_DATAITEM* aItem );
|
||||
int InvokeDialogNewItem( PL_EDITOR_FRAME* aCaller, WS_DATA_ITEM* aItem );
|
||||
|
||||
/// Create and show a print dialog
|
||||
/// returns 1 if OK, 0 , there is a problem.
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <base_struct.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <math/vector2d.h>
|
||||
#include <page_layout_reader_lexer.h>
|
||||
#include <macros.h>
|
||||
|
@ -54,41 +54,41 @@ static const char* getTokenName( T aTok )
|
|||
// Not used alone, a file writer or a string writer should be
|
||||
// derived to use it
|
||||
// Therefore the constructor is protected
|
||||
class WORKSHEET_LAYOUT_IO
|
||||
class WS_DATA_MODEL_IO
|
||||
{
|
||||
protected:
|
||||
OUTPUTFORMATTER* m_out;
|
||||
|
||||
WORKSHEET_LAYOUT_IO() { m_out = NULL; }
|
||||
virtual ~WORKSHEET_LAYOUT_IO() {}
|
||||
WS_DATA_MODEL_IO() { m_out = NULL; }
|
||||
virtual ~WS_DATA_MODEL_IO() {}
|
||||
|
||||
public:
|
||||
void Format( WORKSHEET_LAYOUT* aPageLayout ) const;
|
||||
void Format( WS_DATA_MODEL* aPageLayout ) const;
|
||||
|
||||
void Format( WORKSHEET_DATAITEM* aItem, int aNestLevel ) const;
|
||||
void Format( WS_DATA_ITEM* aItem, int aNestLevel ) const;
|
||||
|
||||
private:
|
||||
void format( WORKSHEET_LAYOUT* aPageLayout ) const;
|
||||
void format( WS_DATA_MODEL* aPageLayout ) const;
|
||||
|
||||
void format( WORKSHEET_DATAITEM_TEXT* aItem, int aNestLevel ) const;
|
||||
void format( WORKSHEET_DATAITEM* aItem, int aNestLevel ) const;
|
||||
void format( WORKSHEET_DATAITEM_POLYPOLYGON* aItem, int aNestLevel )
|
||||
void format( WS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const;
|
||||
void format( WS_DATA_ITEM* aItem, int aNestLevel ) const;
|
||||
void format( WS_DATA_ITEM_POLYGONS* aItem, int aNestLevel )
|
||||
const;
|
||||
void format( WORKSHEET_DATAITEM_BITMAP* aItem, int aNestLevel ) const;
|
||||
void format( WS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) const;
|
||||
void formatCoordinate( const char * aToken, POINT_COORD & aCoord ) const;
|
||||
void formatRepeatParameters( WORKSHEET_DATAITEM* aItem ) const;
|
||||
void formatOptions( WORKSHEET_DATAITEM* aItem ) const;
|
||||
void formatRepeatParameters( WS_DATA_ITEM* aItem ) const;
|
||||
void formatOptions( WS_DATA_ITEM* aItem ) const;
|
||||
};
|
||||
|
||||
|
||||
// A helper class to write a page layout description to a file
|
||||
class WORKSHEET_LAYOUT_FILEIO: public WORKSHEET_LAYOUT_IO
|
||||
class WS_DATA_MODEL_FILEIO: public WS_DATA_MODEL_IO
|
||||
{
|
||||
FILE_OUTPUTFORMATTER * m_fileout;
|
||||
|
||||
public:
|
||||
WORKSHEET_LAYOUT_FILEIO( const wxString& aFilename ):
|
||||
WORKSHEET_LAYOUT_IO()
|
||||
WS_DATA_MODEL_FILEIO( const wxString& aFilename ):
|
||||
WS_DATA_MODEL_IO()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~WORKSHEET_LAYOUT_FILEIO()
|
||||
~WS_DATA_MODEL_FILEIO()
|
||||
{
|
||||
delete m_fileout;
|
||||
}
|
||||
|
@ -109,14 +109,14 @@ public:
|
|||
|
||||
|
||||
// A helper class to write a page layout description to a string
|
||||
class WORKSHEET_LAYOUT_STRINGIO: public WORKSHEET_LAYOUT_IO
|
||||
class WS_DATA_MODEL_STRINGIO: public WS_DATA_MODEL_IO
|
||||
{
|
||||
STRING_FORMATTER * m_writer;
|
||||
wxString & m_output;
|
||||
|
||||
public:
|
||||
WORKSHEET_LAYOUT_STRINGIO( wxString& aOutputString ):
|
||||
WORKSHEET_LAYOUT_IO(), m_output( aOutputString )
|
||||
WS_DATA_MODEL_STRINGIO( wxString& aOutputString ):
|
||||
WS_DATA_MODEL_IO(), m_output( aOutputString )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~WORKSHEET_LAYOUT_STRINGIO()
|
||||
~WS_DATA_MODEL_STRINGIO()
|
||||
{
|
||||
m_output = FROM_UTF8( m_writer->GetString().c_str() );
|
||||
delete m_writer;
|
||||
|
@ -140,41 +140,41 @@ public:
|
|||
/*
|
||||
* Save the description in a file
|
||||
*/
|
||||
void WORKSHEET_LAYOUT::Save( const wxString& aFullFileName )
|
||||
void WS_DATA_MODEL::Save( const wxString& aFullFileName )
|
||||
{
|
||||
WORKSHEET_LAYOUT_FILEIO writer( aFullFileName );
|
||||
WS_DATA_MODEL_FILEIO writer( aFullFileName );
|
||||
writer.Format( this );
|
||||
}
|
||||
|
||||
|
||||
/* Save the description in a buffer
|
||||
*/
|
||||
void WORKSHEET_LAYOUT::SaveInString( wxString& aOutputString )
|
||||
void WS_DATA_MODEL::SaveInString( wxString& aOutputString )
|
||||
{
|
||||
WORKSHEET_LAYOUT_STRINGIO writer( aOutputString );
|
||||
WS_DATA_MODEL_STRINGIO writer( aOutputString );
|
||||
writer.Format( this );
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_DATAITEM* aItem, int aNestLevel ) const
|
||||
void WS_DATA_MODEL_IO::Format( WS_DATA_ITEM* aItem, int aNestLevel ) const
|
||||
{
|
||||
switch( aItem->GetType() )
|
||||
{
|
||||
case WORKSHEET_DATAITEM::WS_TEXT:
|
||||
format( (WORKSHEET_DATAITEM_TEXT*) aItem, aNestLevel );
|
||||
case WS_DATA_ITEM::WS_TEXT:
|
||||
format( (WS_DATA_ITEM_TEXT*) aItem, aNestLevel );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_SEGMENT:
|
||||
case WORKSHEET_DATAITEM::WS_RECT:
|
||||
case WS_DATA_ITEM::WS_SEGMENT:
|
||||
case WS_DATA_ITEM::WS_RECT:
|
||||
format( aItem, aNestLevel );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
|
||||
format( (WORKSHEET_DATAITEM_POLYPOLYGON*) aItem, aNestLevel );
|
||||
case WS_DATA_ITEM::WS_POLYPOLYGON:
|
||||
format( (WS_DATA_ITEM_POLYGONS*) aItem, aNestLevel );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_BITMAP:
|
||||
format( (WORKSHEET_DATAITEM_BITMAP*) aItem, aNestLevel );
|
||||
case WS_DATA_ITEM::WS_BITMAP:
|
||||
format( (WS_DATA_ITEM_BITMAP*) aItem, aNestLevel );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -183,7 +183,7 @@ void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_DATAITEM* aItem, int aNestLevel ) co
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const
|
||||
void WS_DATA_MODEL_IO::Format( WS_DATA_MODEL* aPageLayout ) const
|
||||
{
|
||||
LOCALE_IO toggle; // switch on/off the locale "C" notation
|
||||
|
||||
|
@ -194,10 +194,12 @@ void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const
|
|||
// Write default values:
|
||||
m_out->Print( nestLevel, "(%s ", getTokenName( T_setup ) );
|
||||
m_out->Print( 0, "(textsize %s %s)",
|
||||
double2Str( WORKSHEET_DATAITEM::m_DefaultTextSize.x ).c_str(),
|
||||
double2Str( WORKSHEET_DATAITEM::m_DefaultTextSize.y ).c_str() );
|
||||
m_out->Print( 0, "(linewidth %s)", double2Str( WORKSHEET_DATAITEM::m_DefaultLineWidth ).c_str() );
|
||||
m_out->Print( 0, "(textlinewidth %s)", double2Str( WORKSHEET_DATAITEM::m_DefaultTextThickness ).c_str() );
|
||||
double2Str( WS_DATA_ITEM::m_DefaultTextSize.x ).c_str(),
|
||||
double2Str( WS_DATA_ITEM::m_DefaultTextSize.y ).c_str() );
|
||||
m_out->Print( 0, "(linewidth %s)",
|
||||
double2Str( WS_DATA_ITEM::m_DefaultLineWidth ).c_str() );
|
||||
m_out->Print( 0, "(textlinewidth %s)",
|
||||
double2Str( WS_DATA_ITEM::m_DefaultTextThickness ).c_str() );
|
||||
m_out->Print( 0, "\n" );
|
||||
|
||||
// Write margin values
|
||||
|
@ -214,7 +216,7 @@ void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const
|
|||
// Save the graphical items on the page layout
|
||||
for( unsigned ii = 0; ii < aPageLayout->GetCount(); ii++ )
|
||||
{
|
||||
WORKSHEET_DATAITEM* item = aPageLayout->GetItem( ii );
|
||||
WS_DATA_ITEM* item = aPageLayout->GetItem( ii );
|
||||
Format( item, nestLevel );
|
||||
}
|
||||
|
||||
|
@ -222,7 +224,7 @@ void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::format( WORKSHEET_DATAITEM_TEXT* aItem, int aNestLevel ) const
|
||||
void WS_DATA_MODEL_IO::format( WS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const
|
||||
{
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_tbtext ) );
|
||||
m_out->Print( 0, " %s", m_out->Quotew( aItem->m_TextBase ).c_str() );
|
||||
|
@ -302,9 +304,9 @@ void WORKSHEET_LAYOUT_IO::format( WORKSHEET_DATAITEM_TEXT* aItem, int aNestLevel
|
|||
m_out->Print( 0, ")\n" );
|
||||
}
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::format( WORKSHEET_DATAITEM* aItem, int aNestLevel ) const
|
||||
void WS_DATA_MODEL_IO::format( WS_DATA_ITEM* aItem, int aNestLevel ) const
|
||||
{
|
||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_RECT )
|
||||
if( aItem->GetType() == WS_DATA_ITEM::WS_RECT )
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_rect ) );
|
||||
else
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_line ) );
|
||||
|
@ -325,7 +327,7 @@ void WORKSHEET_LAYOUT_IO::format( WORKSHEET_DATAITEM* aItem, int aNestLevel ) co
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::format( WORKSHEET_DATAITEM_POLYPOLYGON* aItem, int aNestLevel ) const
|
||||
void WS_DATA_MODEL_IO::format( WS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) const
|
||||
{
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_polygon ) );
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
|
||||
|
@ -375,7 +377,7 @@ void WORKSHEET_LAYOUT_IO::format( WORKSHEET_DATAITEM_POLYPOLYGON* aItem, int aNe
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::format( WORKSHEET_DATAITEM_BITMAP* aItem, int aNestLevel ) const
|
||||
void WS_DATA_MODEL_IO::format( WS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) const
|
||||
{
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_bitmap ) );
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
|
||||
|
@ -403,7 +405,7 @@ void WORKSHEET_LAYOUT_IO::format( WORKSHEET_DATAITEM_BITMAP* aItem, int aNestLev
|
|||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::formatCoordinate( const char * aToken,
|
||||
void WS_DATA_MODEL_IO::formatCoordinate( const char * aToken,
|
||||
POINT_COORD & aCoord ) const
|
||||
{
|
||||
m_out->Print( 0, " (%s %s %s", aToken,
|
||||
|
@ -412,27 +414,17 @@ void WORKSHEET_LAYOUT_IO::formatCoordinate( const char * aToken,
|
|||
|
||||
switch( aCoord.m_Anchor )
|
||||
{
|
||||
case RB_CORNER:
|
||||
break;
|
||||
|
||||
case LT_CORNER:
|
||||
m_out->Print( 0, " %s", getTokenName( T_ltcorner ) );
|
||||
break;
|
||||
|
||||
case LB_CORNER:
|
||||
m_out->Print( 0, " %s", getTokenName( T_lbcorner ) );
|
||||
break;
|
||||
|
||||
case RT_CORNER:
|
||||
m_out->Print( 0, " %s", getTokenName( T_rtcorner ) );
|
||||
break;
|
||||
case RB_CORNER: break;
|
||||
case LT_CORNER: m_out->Print( 0, " %s", getTokenName( T_ltcorner ) ); break;
|
||||
case LB_CORNER: m_out->Print( 0, " %s", getTokenName( T_lbcorner ) ); break;
|
||||
case RT_CORNER: m_out->Print( 0, " %s", getTokenName( T_rtcorner ) ); break;
|
||||
}
|
||||
|
||||
m_out->Print( 0, ")" );
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::formatRepeatParameters( WORKSHEET_DATAITEM* aItem ) const
|
||||
void WS_DATA_MODEL_IO::formatRepeatParameters( WS_DATA_ITEM* aItem ) const
|
||||
{
|
||||
if( aItem->m_RepeatCount <= 1 )
|
||||
return;
|
||||
|
@ -445,13 +437,12 @@ void WORKSHEET_LAYOUT_IO::formatRepeatParameters( WORKSHEET_DATAITEM* aItem ) co
|
|||
if( aItem->m_IncrementVector.y )
|
||||
m_out->Print( 0, " (incry %s)", double2Str( aItem->m_IncrementVector.y ).c_str() );
|
||||
|
||||
if( aItem->m_IncrementLabel != 1 &&
|
||||
aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT )
|
||||
if( aItem->m_IncrementLabel != 1 && aItem->GetType() == WS_DATA_ITEM::WS_TEXT )
|
||||
m_out->Print( 0, " (incrlabel %d)", aItem->m_IncrementLabel );
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::formatOptions( WORKSHEET_DATAITEM* aItem ) const
|
||||
void WS_DATA_MODEL_IO::formatOptions( WS_DATA_ITEM* aItem ) const
|
||||
{
|
||||
if( aItem->GetPage1Option() == FIRST_PAGE_ONLY )
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_option ), getTokenName(T_page1only ) );
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/pl_actions.h>
|
||||
#include <view/wx_view_controls.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_view_item.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <ws_painter.h>
|
||||
#include <colors_design_settings.h>
|
||||
#include <pl_editor_frame.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
|
@ -45,7 +45,7 @@ PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindo
|
|||
|
||||
GetGAL()->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ );
|
||||
|
||||
m_painter.reset( new KIGFX::WORKSHEET_PAINTER( m_gal ) );
|
||||
m_painter.reset( new KIGFX::WS_PAINTER( m_gal ) );
|
||||
m_view->SetPainter( m_painter.get() );
|
||||
|
||||
setDefaultLayerDeps();
|
||||
|
@ -77,7 +77,7 @@ void PL_DRAW_PANEL_GAL::DisplayWorksheet()
|
|||
|
||||
WS_DRAW_ITEM_LIST::SetupDrawEnvironment( m_edaFrame->GetPageSettings() );
|
||||
|
||||
for( WORKSHEET_DATAITEM* dataItem : WORKSHEET_LAYOUT::GetTheInstance().GetItems() )
|
||||
for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
|
||||
dataItem->SyncDrawItems( nullptr, m_view );
|
||||
|
||||
selTool->RebuildSelection();
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#define PL_DRAW_PANEL_GAL_H
|
||||
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_view_item.h>
|
||||
#include <ws_painter.h>
|
||||
|
||||
|
||||
class PL_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
|
||||
|
@ -49,7 +49,7 @@ protected:
|
|||
void setDefaultLayerDeps();
|
||||
|
||||
///> Currently used worksheet
|
||||
std::unique_ptr<KIGFX::WORKSHEET_VIEWITEM> m_worksheet;
|
||||
std::unique_ptr<KIGFX::WS_VIEW_ITEM> m_worksheet;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <pl_draw_panel_gal.cpp>
|
||||
#include <hotkeys.h>
|
||||
#include <pl_editor_screen.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <properties_frame.h>
|
||||
#include <view/view.h>
|
||||
#include <confirm.h>
|
||||
|
@ -92,7 +92,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_hotkeysDescrList = PlEditorHotkeysDescr;
|
||||
m_originSelectChoice = 0;
|
||||
SetDrawBgColor( WHITE ); // default value, user option (WHITE/BLACK)
|
||||
WORKSHEET_DATAITEM::m_SpecialMode = true;
|
||||
WS_DATA_ITEM::m_SpecialMode = true;
|
||||
SetShowPageLimits( true );
|
||||
m_AboutTitle = "PlEditor";
|
||||
|
||||
|
@ -182,7 +182,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_auimgr.Update();
|
||||
|
||||
// Initialize the current page layout
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
#if 0 //start with empty layout
|
||||
pglayout.AllowVoidList( true );
|
||||
pglayout.ClearList();
|
||||
|
@ -321,7 +321,7 @@ void PL_EDITOR_FRAME::OnSelectCoordOriginCorner( wxCommandEvent& event )
|
|||
|
||||
void PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode( wxCommandEvent& event )
|
||||
{
|
||||
WORKSHEET_DATAITEM::m_SpecialMode = (event.GetId() == ID_SHOW_PL_EDITOR_MODE);
|
||||
WS_DATA_ITEM::m_SpecialMode = (event.GetId() == ID_SHOW_PL_EDITOR_MODE);
|
||||
HardRedraw();
|
||||
}
|
||||
|
||||
|
@ -373,13 +373,13 @@ void PL_EDITOR_FRAME::ToPrinter( bool doPreview )
|
|||
|
||||
void PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Check( WORKSHEET_DATAITEM::m_SpecialMode == false );
|
||||
event.Check( WS_DATA_ITEM::m_SpecialMode == false );
|
||||
}
|
||||
|
||||
|
||||
void PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Check( WORKSHEET_DATAITEM::m_SpecialMode == true );
|
||||
event.Check( WS_DATA_ITEM::m_SpecialMode == true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -512,7 +512,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
|
|||
int Xsign = 1;
|
||||
int Ysign = 1;
|
||||
|
||||
WORKSHEET_DATAITEM dummy( WORKSHEET_DATAITEM::WS_SEGMENT );
|
||||
WS_DATA_ITEM dummy( WS_DATA_ITEM::WS_SEGMENT );
|
||||
|
||||
switch( m_originSelectChoice )
|
||||
{
|
||||
|
@ -609,7 +609,7 @@ void PL_EDITOR_FRAME::HardRedraw()
|
|||
|
||||
PL_SELECTION_TOOL* selTool = m_toolManager->GetTool<PL_SELECTION_TOOL>();
|
||||
SELECTION& selection = selTool->GetSelection();
|
||||
WORKSHEET_DATAITEM* item = nullptr;
|
||||
WS_DATA_ITEM* item = nullptr;
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
item = static_cast<WS_DRAW_ITEM_BASE*>( selection.Front() )->GetPeer();
|
||||
|
@ -620,29 +620,29 @@ void PL_EDITOR_FRAME::HardRedraw()
|
|||
}
|
||||
|
||||
|
||||
WORKSHEET_DATAITEM* PL_EDITOR_FRAME::AddPageLayoutItem( int aType )
|
||||
WS_DATA_ITEM* PL_EDITOR_FRAME::AddPageLayoutItem( int aType )
|
||||
{
|
||||
WORKSHEET_DATAITEM * item = NULL;
|
||||
WS_DATA_ITEM * item = NULL;
|
||||
|
||||
switch( aType )
|
||||
{
|
||||
case WORKSHEET_DATAITEM::WS_TEXT:
|
||||
item = new WORKSHEET_DATAITEM_TEXT( wxT( "Text") );
|
||||
case WS_DATA_ITEM::WS_TEXT:
|
||||
item = new WS_DATA_ITEM_TEXT( wxT( "Text") );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_SEGMENT:
|
||||
item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_SEGMENT );
|
||||
case WS_DATA_ITEM::WS_SEGMENT:
|
||||
item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_SEGMENT );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_RECT:
|
||||
item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_RECT );
|
||||
case WS_DATA_ITEM::WS_RECT:
|
||||
item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_RECT );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
|
||||
item = new WORKSHEET_DATAITEM_POLYPOLYGON();
|
||||
case WS_DATA_ITEM::WS_POLYPOLYGON:
|
||||
item = new WS_DATA_ITEM_POLYGONS();
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_BITMAP:
|
||||
case WS_DATA_ITEM::WS_BITMAP:
|
||||
{
|
||||
wxFileDialog fileDlg( this, _( "Choose Image" ), wxEmptyString, wxEmptyString,
|
||||
_( "Image Files " ) + wxImage::GetImageExtWildcard(), wxFD_OPEN );
|
||||
|
@ -667,7 +667,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::AddPageLayoutItem( int aType )
|
|||
break;
|
||||
}
|
||||
|
||||
item = new WORKSHEET_DATAITEM_BITMAP( image );
|
||||
item = new WS_DATA_ITEM_BITMAP( image );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::AddPageLayoutItem( int aType )
|
|||
if( item == NULL )
|
||||
return NULL;
|
||||
|
||||
WORKSHEET_LAYOUT::GetTheInstance().Append( item );
|
||||
WS_DATA_MODEL::GetTheInstance().Append( item );
|
||||
item->SyncDrawItems( nullptr, GetGalCanvas()->GetView() );
|
||||
|
||||
return item;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <pl_editor_layout.h>
|
||||
|
||||
class PROPERTIES_FRAME;
|
||||
class WORKSHEET_DATAITEM;
|
||||
class WS_DATA_ITEM;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -283,7 +283,7 @@ public:
|
|||
* @param aIdx = the position in list to insert the new item.
|
||||
* @return a reference to the new item
|
||||
*/
|
||||
WORKSHEET_DATAITEM* AddPageLayoutItem( int aType );
|
||||
WS_DATA_ITEM* AddPageLayoutItem( int aType );
|
||||
|
||||
/**
|
||||
* Must be called after a change
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <base_units.h>
|
||||
#include <base_screen.h>
|
||||
|
||||
class WORKSHEET_DATAITEM;
|
||||
class WS_DATA_ITEM;
|
||||
|
||||
|
||||
/* Handle info to display a board */
|
||||
|
@ -62,9 +62,9 @@ public:
|
|||
* BASE_SCREEN::GetCurItem().
|
||||
* @return WORKSHEET_DATAITEM* - the one selected, or NULL.
|
||||
*/
|
||||
WORKSHEET_DATAITEM* GetCurItem() const
|
||||
WS_DATA_ITEM* GetCurItem() const
|
||||
{
|
||||
return (WORKSHEET_DATAITEM*) BASE_SCREEN::GetCurItem();
|
||||
return (WS_DATA_ITEM*) BASE_SCREEN::GetCurItem();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
* sets the currently selected object, m_CurrentItem.
|
||||
* @param aItem Any object derived from WORKSHEET_DATAITEM
|
||||
*/
|
||||
void SetCurItem( WORKSHEET_DATAITEM* aItem ) { BASE_SCREEN::SetCurItem( (EDA_ITEM*)aItem ); }
|
||||
void SetCurItem( WS_DATA_ITEM* aItem ) { BASE_SCREEN::SetCurItem( (EDA_ITEM*)aItem ); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <macros.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <ws_draw_item.h>
|
||||
|
||||
#include <pl_editor_frame.h>
|
||||
|
@ -56,12 +56,12 @@ public:
|
|||
m_selectedDataItem( INT_MAX ),
|
||||
m_selectedDrawItem( INT_MAX )
|
||||
{
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
pglayout.SaveInString( m_serialization );
|
||||
|
||||
for( size_t ii = 0; ii < pglayout.GetItems().size(); ++ii )
|
||||
{
|
||||
WORKSHEET_DATAITEM* dataItem = pglayout.GetItem( ii );
|
||||
WS_DATA_ITEM* dataItem = pglayout.GetItem( ii );
|
||||
|
||||
for( size_t jj = 0; jj < dataItem->GetDrawItems().size(); ++jj )
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
|
||||
void RestoreLayout( PL_EDITOR_FRAME* aFrame )
|
||||
{
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
PL_SELECTION_TOOL* selTool = aFrame->GetToolManager()->GetTool<PL_SELECTION_TOOL>();
|
||||
KIGFX::VIEW* view = aFrame->GetGalCanvas()->GetView();
|
||||
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
|
||||
for( size_t ii = 0; ii < pglayout.GetItems().size(); ++ii )
|
||||
{
|
||||
WORKSHEET_DATAITEM* dataItem = pglayout.GetItem( ii );
|
||||
WS_DATA_ITEM* dataItem = pglayout.GetItem( ii );
|
||||
|
||||
dataItem->SyncDrawItems( nullptr, view );
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <properties_frame.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pl_selection_tool.h>
|
||||
|
@ -73,19 +73,19 @@ void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
|
|||
wxString msg;
|
||||
|
||||
// Set default parameters
|
||||
msg.Printf( wxT("%.3f"), WORKSHEET_DATAITEM::m_DefaultLineWidth );
|
||||
msg.Printf( wxT("%.3f"), WS_DATA_ITEM::m_DefaultLineWidth );
|
||||
m_textCtrlDefaultLineWidth->SetValue( msg );
|
||||
|
||||
msg.Printf( wxT("%.3f"), WORKSHEET_DATAITEM::m_DefaultTextSize.x );
|
||||
msg.Printf( wxT("%.3f"), WS_DATA_ITEM::m_DefaultTextSize.x );
|
||||
m_textCtrlDefaultTextSizeX->SetValue( msg );
|
||||
msg.Printf( wxT("%.3f"), WORKSHEET_DATAITEM::m_DefaultTextSize.y );
|
||||
msg.Printf( wxT("%.3f"), WS_DATA_ITEM::m_DefaultTextSize.y );
|
||||
m_textCtrlDefaultTextSizeY->SetValue( msg );
|
||||
|
||||
msg.Printf( wxT("%.3f"), WORKSHEET_DATAITEM::m_DefaultTextThickness );
|
||||
msg.Printf( wxT("%.3f"), WS_DATA_ITEM::m_DefaultTextThickness );
|
||||
m_textCtrlDefaultTextThickness->SetValue( msg );
|
||||
|
||||
// Set page margins values
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
msg.Printf( wxT("%.3f"), pglayout.GetRightMargin() );
|
||||
m_textCtrlRightMargin->SetValue( msg );
|
||||
msg.Printf( wxT("%.3f"), pglayout.GetBottomMargin() );
|
||||
|
@ -104,18 +104,18 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
|
|||
|
||||
// Import default parameters from widgets
|
||||
msg = m_textCtrlDefaultLineWidth->GetValue();
|
||||
WORKSHEET_DATAITEM::m_DefaultLineWidth = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
WS_DATA_ITEM::m_DefaultLineWidth = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
|
||||
msg = m_textCtrlDefaultTextSizeX->GetValue();
|
||||
WORKSHEET_DATAITEM::m_DefaultTextSize.x = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
WS_DATA_ITEM::m_DefaultTextSize.x = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
msg = m_textCtrlDefaultTextSizeY->GetValue();
|
||||
WORKSHEET_DATAITEM::m_DefaultTextSize.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
WS_DATA_ITEM::m_DefaultTextSize.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
|
||||
msg = m_textCtrlDefaultTextThickness->GetValue();
|
||||
WORKSHEET_DATAITEM::m_DefaultTextThickness = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
WS_DATA_ITEM::m_DefaultTextThickness = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
|
||||
// Get page margins values
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
|
||||
msg = m_textCtrlRightMargin->GetValue();
|
||||
pglayout.SetRightMargin( DoubleValueFromString( UNSCALED_UNITS, msg ) );
|
||||
|
@ -133,7 +133,7 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
|
|||
|
||||
|
||||
// Data transfert from item to widgets in properties frame
|
||||
void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
|
||||
void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
|
||||
{
|
||||
if( !aItem )
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
|
|||
|
||||
wxString msg;
|
||||
|
||||
// Set parameters common to all WORKSHEET_DATAITEM types
|
||||
// Set parameters common to all WS_DATA_ITEM types
|
||||
m_staticTextType->SetLabel( aItem->GetClassName() );
|
||||
m_textCtrlComment->SetValue( aItem->m_Info );
|
||||
|
||||
|
@ -186,12 +186,12 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
|
|||
msg.Printf( wxT("%.3f"), aItem->m_LineWidth );
|
||||
m_textCtrlThickness->SetValue( msg );
|
||||
|
||||
// Now, set prms more specific to WORKSHEET_DATAITEM types
|
||||
// Now, set prms more specific to WS_DATA_ITEM types
|
||||
// For a given type, disable widgets which are not relevant,
|
||||
// and be sure widgets which are relevant are enabled
|
||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT )
|
||||
if( aItem->GetType() == WS_DATA_ITEM::WS_TEXT )
|
||||
{
|
||||
WORKSHEET_DATAITEM_TEXT* item = (WORKSHEET_DATAITEM_TEXT*) aItem;
|
||||
WS_DATA_ITEM_TEXT* item = (WS_DATA_ITEM_TEXT*) aItem;
|
||||
item->m_FullText = item->m_TextBase;
|
||||
// Replace our '\' 'n' sequence by the EOL char
|
||||
item->ReplaceAntiSlashSequence();
|
||||
|
@ -235,17 +235,17 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
|
|||
m_textCtrlTextSizeY->SetValue( msg );
|
||||
}
|
||||
|
||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_POLYPOLYGON )
|
||||
if( aItem->GetType() == WS_DATA_ITEM::WS_POLYPOLYGON )
|
||||
{
|
||||
WORKSHEET_DATAITEM_POLYPOLYGON* item = (WORKSHEET_DATAITEM_POLYPOLYGON*) aItem;
|
||||
WS_DATA_ITEM_POLYGONS* item = (WS_DATA_ITEM_POLYGONS*) aItem;
|
||||
// Rotation (poly and text)
|
||||
msg.Printf( wxT("%.3f"), item->m_Orient );
|
||||
m_textCtrlRotation->SetValue( msg );
|
||||
}
|
||||
|
||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_BITMAP )
|
||||
if( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP )
|
||||
{
|
||||
WORKSHEET_DATAITEM_BITMAP* item = (WORKSHEET_DATAITEM_BITMAP*) aItem;
|
||||
WS_DATA_ITEM_BITMAP* item = (WS_DATA_ITEM_BITMAP*) aItem;
|
||||
// select definition in PPI
|
||||
msg.Printf( wxT("%d"), item->GetPPI() );
|
||||
m_textCtrlBitmapPPI->SetValue( msg );
|
||||
|
@ -253,22 +253,22 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
|
|||
|
||||
m_SizerItemProperties->Show( true );
|
||||
|
||||
m_SizerTextOptions->Show( aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT );
|
||||
m_SizerTextOptions->Show( aItem->GetType() == WS_DATA_ITEM::WS_TEXT );
|
||||
|
||||
m_SizerEndPosition->Show( aItem->GetType() == WORKSHEET_DATAITEM::WS_SEGMENT
|
||||
|| aItem->GetType() == WORKSHEET_DATAITEM::WS_RECT );
|
||||
m_SizerEndPosition->Show( aItem->GetType() == WS_DATA_ITEM::WS_SEGMENT
|
||||
|| aItem->GetType() == WS_DATA_ITEM::WS_RECT );
|
||||
|
||||
m_SizerLineThickness->Show( aItem->GetType() != WORKSHEET_DATAITEM::WS_BITMAP );
|
||||
m_SizerLineThickness->Show( aItem->GetType() != WS_DATA_ITEM::WS_BITMAP );
|
||||
// Polygons have no defaut value for line width
|
||||
m_staticTextInfoThickness->Show( aItem->GetType() != WORKSHEET_DATAITEM::WS_POLYPOLYGON );
|
||||
m_staticTextInfoThickness->Show( aItem->GetType() != WS_DATA_ITEM::WS_POLYPOLYGON );
|
||||
|
||||
m_SizerRotation->Show( aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT
|
||||
|| aItem->GetType() == WORKSHEET_DATAITEM::WS_POLYPOLYGON );
|
||||
m_SizerRotation->Show( aItem->GetType() == WS_DATA_ITEM::WS_TEXT
|
||||
|| aItem->GetType() == WS_DATA_ITEM::WS_POLYPOLYGON );
|
||||
|
||||
m_SizerPPI->Show( aItem->GetType() == WORKSHEET_DATAITEM::WS_BITMAP );
|
||||
m_SizerPPI->Show( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP );
|
||||
|
||||
m_staticTextInclabel->Show( aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT );
|
||||
m_textCtrlTextIncrement->Show( aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT );
|
||||
m_staticTextInclabel->Show( aItem->GetType() == WS_DATA_ITEM::WS_TEXT );
|
||||
m_textCtrlTextIncrement->Show( aItem->GetType() == WS_DATA_ITEM::WS_TEXT );
|
||||
|
||||
// Repeat parameters
|
||||
msg.Printf( wxT("%d"), aItem->m_RepeatCount );
|
||||
|
@ -296,7 +296,7 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
|||
|
||||
if( drawItem )
|
||||
{
|
||||
WORKSHEET_DATAITEM* dataItem = drawItem->GetPeer();
|
||||
WS_DATA_ITEM* dataItem = drawItem->GetPeer();
|
||||
CopyPrmsFromPanelToItem( dataItem );
|
||||
// Be sure what is displayed is what is set for item
|
||||
// (mainly, texts can be modified if they contain "\n")
|
||||
|
@ -316,11 +316,11 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
|||
|
||||
void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
|
||||
{
|
||||
WORKSHEET_DATAITEM::m_DefaultTextSize =
|
||||
WS_DATA_ITEM::m_DefaultTextSize =
|
||||
DSIZE( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE );
|
||||
// default thickness in mm
|
||||
WORKSHEET_DATAITEM::m_DefaultLineWidth = 0.15;
|
||||
WORKSHEET_DATAITEM::m_DefaultTextThickness = 0.15;
|
||||
WS_DATA_ITEM::m_DefaultLineWidth = 0.15;
|
||||
WS_DATA_ITEM::m_DefaultTextThickness = 0.15;
|
||||
|
||||
CopyPrmsFromGeneralToPanel();
|
||||
m_parent->GetCanvas()->Refresh();
|
||||
|
@ -328,7 +328,7 @@ void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
|
|||
|
||||
|
||||
// Data transfert from properties frame to item parameters
|
||||
bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
||||
bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem )
|
||||
{
|
||||
if( aItem == NULL )
|
||||
return false;
|
||||
|
@ -392,9 +392,9 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
|||
msg = m_textCtrlStepY->GetValue();
|
||||
aItem->m_IncrementVector.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
|
||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT )
|
||||
if( aItem->GetType() == WS_DATA_ITEM::WS_TEXT )
|
||||
{
|
||||
WORKSHEET_DATAITEM_TEXT* item = (WORKSHEET_DATAITEM_TEXT*) aItem;
|
||||
WS_DATA_ITEM_TEXT* item = (WS_DATA_ITEM_TEXT*) aItem;
|
||||
|
||||
item->m_TextBase = m_textCtrlText->GetValue();
|
||||
|
||||
|
@ -437,17 +437,17 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
|||
item->m_BoundingBoxSize.y = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
}
|
||||
|
||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_POLYPOLYGON )
|
||||
if( aItem->GetType() == WS_DATA_ITEM::WS_POLYPOLYGON )
|
||||
{
|
||||
WORKSHEET_DATAITEM_POLYPOLYGON* item = (WORKSHEET_DATAITEM_POLYPOLYGON*) aItem;
|
||||
WS_DATA_ITEM_POLYGONS* item = (WS_DATA_ITEM_POLYGONS*) aItem;
|
||||
|
||||
msg = m_textCtrlRotation->GetValue();
|
||||
item->m_Orient = DoubleValueFromString( UNSCALED_UNITS, msg );
|
||||
}
|
||||
|
||||
if( aItem->GetType() == WORKSHEET_DATAITEM::WS_BITMAP )
|
||||
if( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP )
|
||||
{
|
||||
WORKSHEET_DATAITEM_BITMAP* item = (WORKSHEET_DATAITEM_BITMAP*) aItem;
|
||||
WS_DATA_ITEM_BITMAP* item = (WS_DATA_ITEM_BITMAP*) aItem;
|
||||
// Set definition in PPI
|
||||
long value;
|
||||
msg = m_textCtrlBitmapPPI->GetValue();
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <pl_editor_frame.h>
|
||||
#include <dialogs/properties_frame_base.h>
|
||||
|
||||
class WORKSHEET_DATAITEM;
|
||||
class WS_DATA_ITEM;
|
||||
|
||||
/**
|
||||
* Class PROPERTIES_FRAME display properties of the current item.
|
||||
|
@ -59,10 +59,10 @@ public:
|
|||
bool CopyPrmsFromPanelToGeneral();
|
||||
|
||||
// Data transfert from item to widgets in properties frame
|
||||
void CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem );
|
||||
void CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem );
|
||||
|
||||
// Data transfert from widgets in properties frame to item
|
||||
bool CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem );
|
||||
bool CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem );
|
||||
|
||||
wxSize GetMinSize() const override;
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <tools/pl_drawing_tools.h>
|
||||
#include <bitmaps.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_item.h>
|
||||
#include <invoke_pl_editor_dialog.h>
|
||||
|
||||
|
||||
|
@ -182,9 +182,9 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
|
||||
WORKSHEET_DATAITEM* dataItem;
|
||||
dataItem = m_frame->AddPageLayoutItem( isText ? WORKSHEET_DATAITEM::WS_TEXT
|
||||
: WORKSHEET_DATAITEM::WS_BITMAP );
|
||||
WS_DATA_ITEM* dataItem;
|
||||
dataItem = m_frame->AddPageLayoutItem( isText ? WS_DATA_ITEM::WS_TEXT
|
||||
: WS_DATA_ITEM::WS_BITMAP );
|
||||
item = dataItem->GetDrawItems()[0];
|
||||
item->SetFlags( IS_NEW | IS_MOVED );
|
||||
m_selectionTool->AddItemToSel( item );
|
||||
|
@ -300,14 +300,14 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
m_frame->SaveCopyInUndoList();
|
||||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
|
||||
WORKSHEET_DATAITEM::WS_ITEM_TYPE dataType;
|
||||
WS_DATA_ITEM::WS_ITEM_TYPE dataType;
|
||||
|
||||
if( isDrawLine )
|
||||
dataType = WORKSHEET_DATAITEM::WS_SEGMENT;
|
||||
dataType = WS_DATA_ITEM::WS_SEGMENT;
|
||||
else
|
||||
dataType = WORKSHEET_DATAITEM::WS_RECT;
|
||||
dataType = WS_DATA_ITEM::WS_RECT;
|
||||
|
||||
WORKSHEET_DATAITEM* dataItem = m_frame->AddPageLayoutItem( dataType );
|
||||
WS_DATA_ITEM* dataItem = m_frame->AddPageLayoutItem( dataType );
|
||||
dataItem->MoveToUi( (wxPoint) cursorPos );
|
||||
|
||||
item = dataItem->GetDrawItems()[0];
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <tools/pl_actions.h>
|
||||
#include <tools/pl_edit_tool.h>
|
||||
#include <tools/pl_picker_tool.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <hotkeys.h>
|
||||
#include <bitmaps.h>
|
||||
|
@ -270,7 +270,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
void PL_EDIT_TOOL::moveItem( EDA_ITEM* aItem, VECTOR2I aDelta )
|
||||
{
|
||||
WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( aItem );
|
||||
WORKSHEET_DATAITEM* dataItem = drawItem->GetPeer();
|
||||
WS_DATA_ITEM* dataItem = drawItem->GetPeer();
|
||||
|
||||
dataItem->MoveToUi( dataItem->GetStartPosUi() + (wxPoint) aDelta );
|
||||
|
||||
|
@ -329,8 +329,8 @@ int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
while( selection.Front() )
|
||||
{
|
||||
WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( selection.Front() );
|
||||
WORKSHEET_DATAITEM* dataItem = drawItem->GetPeer();
|
||||
WORKSHEET_LAYOUT::GetTheInstance().Remove( dataItem );
|
||||
WS_DATA_ITEM* dataItem = drawItem->GetPeer();
|
||||
WS_DATA_MODEL::GetTheInstance().Remove( dataItem );
|
||||
|
||||
for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <tools/pl_editor_control.h>
|
||||
#include <tools/pl_selection_tool.h>
|
||||
#include <pl_editor_frame.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
#include <confirm.h>
|
||||
#include <bitmaps.h>
|
||||
#include <properties_frame.h>
|
||||
|
@ -144,7 +144,7 @@ int PL_EDITOR_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
|
|||
item->GetMsgPanelInfo( m_frame->GetUserUnits(), msgItems );
|
||||
m_frame->SetMsgPanel( msgItems );
|
||||
|
||||
WORKSHEET_DATAITEM* dataItem = static_cast<WS_DRAW_ITEM_BASE*>( item )->GetPeer();
|
||||
WS_DATA_ITEM* dataItem = static_cast<WS_DRAW_ITEM_BASE*>( item )->GetPeer();
|
||||
m_frame->GetPropertiesFrame()->CopyPrmsFromItemToPanel( dataItem );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tool/selection.h>
|
||||
#include <tools/pl_actions.h>
|
||||
#include <worksheet_dataitem.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <ws_painter.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <collector.h>
|
||||
#include "pl_selection_tool.h"
|
||||
|
@ -242,7 +242,7 @@ EDA_ITEM* PL_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, bool* aSelecti
|
|||
// locate items.
|
||||
COLLECTOR collector;
|
||||
|
||||
for( WORKSHEET_DATAITEM* dataItem : WORKSHEET_LAYOUT::GetTheInstance().GetItems() )
|
||||
for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
|
||||
{
|
||||
for( WS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ bool PL_SELECTION_TOOL::selectMultiple()
|
|||
|
||||
selectionRect.Normalize();
|
||||
|
||||
for( WORKSHEET_DATAITEM* dataItem : WORKSHEET_LAYOUT::GetTheInstance().GetItems() )
|
||||
for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
|
||||
{
|
||||
for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
|
||||
{
|
||||
|
@ -505,7 +505,7 @@ void PL_SELECTION_TOOL::RebuildSelection()
|
|||
{
|
||||
m_selection.Clear();
|
||||
|
||||
for( WORKSHEET_DATAITEM* dataItem : WORKSHEET_LAYOUT::GetTheInstance().GetItems() )
|
||||
for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
|
||||
{
|
||||
for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include <base_units.h>
|
||||
#include <ratsnest_data.h>
|
||||
#include <ratsnest_viewitem.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <collectors.h>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <pcb_view.h>
|
||||
#include <view/wx_view_controls.h>
|
||||
#include <pcb_painter.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
#include <ratsnest_viewitem.h>
|
||||
#include <ratsnest_data.h>
|
||||
#include <connectivity/connectivity_data.h>
|
||||
|
@ -197,7 +197,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
|
|||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet )
|
||||
void PCB_DRAW_PANEL_GAL::SetWorksheet( KIGFX::WS_VIEW_ITEM* aWorksheet )
|
||||
{
|
||||
m_worksheet.reset( aWorksheet );
|
||||
m_view->Add( m_worksheet.get() );
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
namespace KIGFX
|
||||
{
|
||||
class WORKSHEET_VIEWITEM;
|
||||
class WS_VIEW_ITEM;
|
||||
class RATSNEST_VIEWITEM;
|
||||
class PCB_VIEW;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
* @param aWorksheet is the worksheet to be used.
|
||||
* The object is then owned by PCB_DRAW_PANEL_GAL.
|
||||
*/
|
||||
void SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet );
|
||||
void SetWorksheet( KIGFX::WS_VIEW_ITEM* aWorksheet );
|
||||
|
||||
/**
|
||||
* Function UseColorScheme
|
||||
|
@ -118,7 +118,7 @@ protected:
|
|||
void setDefaultLayerDeps();
|
||||
|
||||
///> Currently used worksheet
|
||||
std::unique_ptr<KIGFX::WORKSHEET_VIEWITEM> m_worksheet;
|
||||
std::unique_ptr<KIGFX::WS_VIEW_ITEM> m_worksheet;
|
||||
|
||||
///> Ratsnest view item
|
||||
std::unique_ptr<KIGFX::RATSNEST_VIEWITEM> m_ratsnest;
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include <class_track.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ws_view_item.h>
|
||||
#include <connectivity/connectivity_data.h>
|
||||
#include <ratsnest_viewitem.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
@ -487,8 +487,8 @@ void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
|||
PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
||||
|
||||
// Prepare worksheet template
|
||||
KIGFX::WORKSHEET_VIEWITEM* worksheet;
|
||||
worksheet = new KIGFX::WORKSHEET_VIEWITEM( IU_PER_MILS ,&m_Pcb->GetPageSettings(),
|
||||
KIGFX::WS_VIEW_ITEM* worksheet;
|
||||
worksheet = new KIGFX::WS_VIEW_ITEM( IU_PER_MILS ,&m_Pcb->GetPageSettings(),
|
||||
&m_Pcb->GetTitleBlock() );
|
||||
worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
|
||||
|
||||
|
|
|
@ -41,13 +41,14 @@
|
|||
#include <pcb_edit_frame.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <plotter.h>
|
||||
#include <worksheet_painter.h>
|
||||
#include <ws_painter.h>
|
||||
#include <panel_hotkeys_editor.h>
|
||||
#include <panel_pcbnew_settings.h>
|
||||
#include <panel_pcbnew_display_options.h>
|
||||
#include <panel_pcbnew_action_plugins.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <pcbplot.h>
|
||||
|
@ -114,12 +115,11 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
|
|||
// Load the page layout decr file, from the filename stored in
|
||||
// BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
|
||||
// If empty, or not existing, the default descr is loaded
|
||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
wxString pg_fullfilename = WORKSHEET_LAYOUT::MakeFullFileName(
|
||||
BASE_SCREEN::m_PageLayoutDescrFileName,
|
||||
Prj().GetProjectPath() );
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
wxString filename = WS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
|
||||
Prj().GetProjectPath() );
|
||||
|
||||
pglayout.SetPageLayout( pg_fullfilename );
|
||||
pglayout.SetPageLayout( filename );
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue