Round 2 of Worksheet -> Drawing Sheet.

This commit is contained in:
Jeff Young 2021-02-22 23:47:17 +00:00
parent 507ca9bc73
commit a3b9e8ddb4
88 changed files with 939 additions and 1202 deletions

2
.gitignore vendored
View File

@ -9,7 +9,7 @@ common/drc_rules_lexer.h
common/netlist_keywords.*
common/netlist_lexer.h
common/pcb_plot_params_lexer.h
common/page_layout/page_layout_reader_keywords.cpp
common/drawing_sheet/drawing_sheet_reader_keywords.cpp
common/lib_table_keywords.*
common/gal/opengl/shader_src.h
include/fp_lib_table_lexer.h

View File

@ -246,15 +246,15 @@ set( COMMON_WIDGET_SRCS
widgets/wx_aui_dock_art.cpp
)
set( COMMON_PAGE_LAYOUT_SRCS
page_layout/ws_data_item.cpp
page_layout/ws_data_model.cpp
page_layout/ws_data_model_io.cpp
page_layout/page_layout_default_description.cpp
page_layout/ws_draw_item.cpp
page_layout/ws_proxy_undo_item.cpp
page_layout/ws_proxy_view_item.cpp
page_layout/page_layout_reader.cpp
set( COMMON_DRAWING_SHEET_SRCS
drawing_sheet/ds_data_item.cpp
drawing_sheet/ds_data_model.cpp
drawing_sheet/ds_data_model_io.cpp
drawing_sheet/drawing_sheet_default_description.cpp
drawing_sheet/ds_draw_item.cpp
drawing_sheet/ds_proxy_undo_item.cpp
drawing_sheet/ds_proxy_view_item.cpp
drawing_sheet/drawing_sheet_reader.cpp
)
set( COMMON_PREVIEW_ITEMS_SRCS
@ -300,7 +300,7 @@ set( COMMON_SRCS
${COMMON_ABOUT_DLG_SRCS}
${COMMON_DLG_SRCS}
${COMMON_WIDGET_SRCS}
${COMMON_PAGE_LAYOUT_SRCS}
${COMMON_DRAWING_SHEET_SRCS}
${COMMON_PREVIEW_ITEMS_SRCS}
${PLOTTERS_CONTROL_SRCS}
${PLUGINS_ALTIUM_SRCS}
@ -392,7 +392,7 @@ set( COMMON_SRCS
utf8.cpp
validators.cpp
wildcards_and_files_ext.cpp
page_layout/ws_painter.cpp
drawing_sheet/ds_painter.cpp
wxdataviewctrl_helpers.cpp
wx_filename.cpp
xnode.cpp
@ -559,7 +559,7 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/pcbnew_settings.cpp
${CMAKE_SOURCE_DIR}/pcbnew/plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/ratsnest/ratsnest_data.cpp
${CMAKE_SOURCE_DIR}/pcbnew/ratsnest/ratsnest_viewitem.cpp
${CMAKE_SOURCE_DIR}/pcbnew/ratsnest/ratsnest_view_item.cpp
${CMAKE_SOURCE_DIR}/pcbnew/sel_layer.cpp
${CMAKE_SOURCE_DIR}/pcbnew/zone_settings.cpp
@ -667,9 +667,9 @@ make_lexer(
# and title_block_reader_keywords.cpp.
make_lexer(
common
page_layout/page_layout_reader.keywords
page_layout/page_layout_reader_lexer.h
page_layout/page_layout_reader_keywords.cpp
drawing_sheet/drawing_sheet_reader.keywords
drawing_sheet/drawing_sheet_reader_lexer.h
drawing_sheet/drawing_sheet_reader_keywords.cpp
TB_READER_T
)

View File

@ -31,8 +31,8 @@
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <wildcards_and_files_ext.h>
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_painter.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_painter.h>
#include <wx/valgen.h>
#include <wx/tokenzr.h>
@ -83,10 +83,10 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aI
m_customFmt = false;
m_localPrjConfigChanged = false;
m_pagelayout = new WS_DATA_MODEL;
m_drawingSheet = new DS_DATA_MODEL;
wxString serialization;
WS_DATA_MODEL::GetTheInstance().SaveInString( serialization );
m_pagelayout->SetPageLayout( TO_UTF8( serialization ) );
DS_DATA_MODEL::GetTheInstance().SaveInString( serialization );
m_drawingSheet->SetPageLayout(TO_UTF8( serialization ) );
m_PickDate->SetValue( wxDateTime::Now() );
@ -110,7 +110,7 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aI
DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
{
delete m_pageBitmap;
delete m_pagelayout;
delete m_drawingSheet;
}
@ -455,7 +455,7 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
if( fileName != BASE_SCREEN::m_PageLayoutDescrFileName )
{
wxString fullFileName = WS_DATA_MODEL::MakeFullFileName( fileName, m_projectPath );
wxString fullFileName = DS_DATA_MODEL::MakeFullFileName( fileName, m_projectPath );
if( !fullFileName.IsEmpty() && !wxFileExists( fullFileName ) )
{
@ -466,8 +466,7 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
}
BASE_SCREEN::m_PageLayoutDescrFileName = fileName;
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
pglayout.SetPageLayout( fullFileName );
DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( fullFileName );
m_localPrjConfigChanged = true;
}
@ -641,12 +640,12 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
}
// Draw layout preview.
KIGFX::WS_RENDER_SETTINGS renderSettings;
KIGFX::DS_RENDER_SETTINGS renderSettings;
COLOR_SETTINGS* colorSettings = m_parent->GetColorSettings();
COLOR4D bgColor = m_parent->GetDrawBgColor();
wxString emptyString;
WS_DATA_MODEL::SetAltInstance( m_pagelayout );
DS_DATA_MODEL::SetAltInstance( m_drawingSheet );
{
GRResetPenAndBrush( &memDC );
renderSettings.SetDefaultPenWidth( 1 );
@ -664,14 +663,14 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
GRFilledRect( NULL, &memDC, 0, 0, m_layout_size.x, m_layout_size.y, bgColor, bgColor );
PrintPageLayout( &renderSettings, pageDUMMY, emptyString, emptyString, m_tb,
PrintDrawingSheet( &renderSettings, pageDUMMY, emptyString, emptyString, m_tb,
m_screen->GetPageCount(), m_screen->GetPageNumber(), 1, &Prj(),
wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
memDC.SelectObject( wxNullBitmap );
m_PageLayoutExampleBitmap->SetBitmap( *m_pageBitmap );
}
WS_DATA_MODEL::SetAltInstance( NULL );
DS_DATA_MODEL::SetAltInstance( NULL );
// Refresh the dialog.
Layout();
@ -787,7 +786,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 = WS_DATA_MODEL::MakeShortFileName( fileName, m_projectPath );
wxString shortFileName = DS_DATA_MODEL::MakeShortFileName( fileName, m_projectPath );
// For Win/Linux/macOS compatibility, a relative path is a good idea
if( shortFileName != GetWksFileName() && shortFileName != fileName )
@ -806,10 +805,10 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
SetWksFileName( shortFileName );
if( m_pagelayout == NULL )
m_pagelayout = new WS_DATA_MODEL;
if( m_drawingSheet == NULL )
m_drawingSheet = new DS_DATA_MODEL;
m_pagelayout->SetPageLayout( fileName );
m_drawingSheet->LoadDrawingSheet( fileName );
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();

View File

@ -1,12 +1,8 @@
/**
* @file common/page_layout/page_layout_default_description.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
@ -28,7 +24,7 @@
*/
/* keyword used in page layout description are listed
* in page_layout_reader.keywords file
* in drawing_sheet_reader.keywords file
*/
/*
@ -116,15 +112,15 @@
*/
// height of the band reference grid 2.0 mm
// drawing sheet frame reference text size 1.3 mm
// height of the coordinates band 2.0 mm
// coordinates text size 1.3 mm
// default text size 1.5 mm
// default line width 0.15 mm
// frame ref pitch 50 mm
// Default page layout (sizes are in mm)
extern const char defaultPageLayout[] =
"(page_layout\n"
extern const char defaultDrawingSheet[] =
"(drawing_sheet\n"
"(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15)\n"
"(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
"(rect (comment \"rect around the title block\") (linewidth 0.15) (start 110 34) (end 2 2) )\n"
@ -158,8 +154,8 @@ extern const char defaultPageLayout[] =
"(line (start 26 8.5) (end 26 2) )\n"
")\n";
extern const char emptyPageLayout[] =
"(page_layout\n"
extern const char emptyDrawingSheet[] =
"(drawing_sheet\n"
"(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)\n"
"(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
"(line (name segm1:Line) (start 0 0) (end 0 0))\n"

View File

@ -1,14 +1,8 @@
/**
* @file common/page_layout/page_layout_reader.cpp
* @brief read an S expression of description of graphic items and texts
* to build a title block and page layout
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
@ -31,11 +25,11 @@
#include <eda_item.h>
#include <locale_io.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_painter.h>
#include <page_layout/page_layout_reader_lexer.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_painter.h>
#include <drawing_sheet/drawing_sheet_reader_lexer.h>
#include <wx/ffile.h>
#include <wx/file.h>
@ -45,15 +39,15 @@
using namespace TB_READER_T;
/**
* PAGE_LAYOUT_READER_PARSER
* DRAWING_SHEET_READER_PARSER
* holds data and functions pertinent to parsing a S-expression file
* for a WS_DATA_MODEL.
* for a DS_DATA_MODEL.
*/
class PAGE_LAYOUT_READER_PARSER : public PAGE_LAYOUT_READER_LEXER
class DRAWING_SHEET_READER_PARSER : public DRAWING_SHEET_READER_LEXER
{
public:
PAGE_LAYOUT_READER_PARSER( const char* aLine, const wxString& aSource );
void Parse( WS_DATA_MODEL* aLayout );
DRAWING_SHEET_READER_PARSER( const char* aLine, const wxString& aSource );
void Parse( DS_DATA_MODEL* aLayout );
private:
@ -73,44 +67,45 @@ private:
*/
double parseDouble();
void parseSetup( WS_DATA_MODEL* aLayout );
void parseSetup( DS_DATA_MODEL* aLayout );
/**
* parse a graphic item starting by "(line" or "(rect" and read parameters.
*/
void parseGraphic( WS_DATA_ITEM * aItem );
void parseGraphic( DS_DATA_ITEM * aItem );
/**
* parse a text item starting by "(tbtext" and read parameters.
*/
void parseText( WS_DATA_ITEM_TEXT * aItem );
void parseText( DS_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( WS_DATA_ITEM_POLYGONS * aItem );
void parsePolygon( DS_DATA_ITEM_POLYGONS * aItem );
/**
* parse a list of corners starting by "( pts" and read coordinates.
*/
void parsePolyOutline( WS_DATA_ITEM_POLYGONS * aItem );
void parsePolyOutline( DS_DATA_ITEM_POLYGONS * aItem );
/**
* parse a bitmap item starting by "( bitmap" and read parameters.
*/
void parseBitmap( WS_DATA_ITEM_BITMAP * aItem );
void parseBitmap( DS_DATA_ITEM_BITMAP * aItem );
void parseCoordinate( POINT_COORD& aCoord);
void readOption( WS_DATA_ITEM * aItem );
void readPngdata( WS_DATA_ITEM_BITMAP * aItem );
void readOption( DS_DATA_ITEM * aItem );
void readPngdata( DS_DATA_ITEM_BITMAP * aItem );
};
// PCB_PLOT_PARAMS_PARSER
PAGE_LAYOUT_READER_PARSER::PAGE_LAYOUT_READER_PARSER( const char* aLine, const wxString& aSource ) :
PAGE_LAYOUT_READER_LEXER( aLine, aSource )
DRAWING_SHEET_READER_PARSER::DRAWING_SHEET_READER_PARSER( const char* aLine,
const wxString& aSource ) :
DRAWING_SHEET_READER_LEXER( aLine, aSource )
{
}
@ -189,9 +184,9 @@ wxString convertLegacyVariableRefs( const wxString& aTextbase )
}
void PAGE_LAYOUT_READER_PARSER::Parse( WS_DATA_MODEL* aLayout )
void DRAWING_SHEET_READER_PARSER::Parse( DS_DATA_MODEL* aLayout )
{
WS_DATA_ITEM* item;
DS_DATA_ITEM* item;
LOCALE_IO toggle;
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
@ -199,7 +194,7 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WS_DATA_MODEL* aLayout )
if( token == T_LEFT )
token = NextTok();
if( token == T_page_layout )
if( token == T_page_layout || token == T_drawing_sheet )
continue;
switch( token )
@ -209,33 +204,33 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WS_DATA_MODEL* aLayout )
break;
case T_line:
item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_SEGMENT );
item = new DS_DATA_ITEM( DS_DATA_ITEM::DS_SEGMENT );
parseGraphic( item );
aLayout->Append( item );
break;
case T_rect:
item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_RECT );
item = new DS_DATA_ITEM( DS_DATA_ITEM::DS_RECT );
parseGraphic( item );
aLayout->Append( item );
break;
case T_polygon:
item = new WS_DATA_ITEM_POLYGONS();
parsePolygon( (WS_DATA_ITEM_POLYGONS*) item );
item = new DS_DATA_ITEM_POLYGONS();
parsePolygon( (DS_DATA_ITEM_POLYGONS*) item );
aLayout->Append( item );
break;
case T_bitmap:
item = new WS_DATA_ITEM_BITMAP( NULL );
parseBitmap( (WS_DATA_ITEM_BITMAP*) item );
item = new DS_DATA_ITEM_BITMAP( NULL );
parseBitmap( (DS_DATA_ITEM_BITMAP*) item );
aLayout->Append( item );
break;
case T_tbtext:
NeedSYMBOLorNUMBER();
item = new WS_DATA_ITEM_TEXT( convertLegacyVariableRefs( FromUTF8() ) );
parseText( (WS_DATA_ITEM_TEXT*) item );
item = new DS_DATA_ITEM_TEXT( convertLegacyVariableRefs( FromUTF8() ) );
parseText( (DS_DATA_ITEM_TEXT*) item );
aLayout->Append( item );
break;
@ -247,7 +242,7 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WS_DATA_MODEL* aLayout )
}
void PAGE_LAYOUT_READER_PARSER::parseSetup( WS_DATA_MODEL* aLayout )
void DRAWING_SHEET_READER_PARSER::parseSetup( DS_DATA_MODEL* aLayout )
{
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
{
@ -304,7 +299,7 @@ void PAGE_LAYOUT_READER_PARSER::parseSetup( WS_DATA_MODEL* aLayout )
}
void PAGE_LAYOUT_READER_PARSER::parsePolygon( WS_DATA_ITEM_POLYGONS * aItem )
void DRAWING_SHEET_READER_PARSER::parsePolygon( DS_DATA_ITEM_POLYGONS * aItem )
{
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
{
@ -372,7 +367,7 @@ void PAGE_LAYOUT_READER_PARSER::parsePolygon( WS_DATA_ITEM_POLYGONS * aItem )
aItem->SetBoundingBox();
}
void PAGE_LAYOUT_READER_PARSER::parsePolyOutline( WS_DATA_ITEM_POLYGONS * aItem )
void DRAWING_SHEET_READER_PARSER::parsePolyOutline( DS_DATA_ITEM_POLYGONS * aItem )
{
DPOINT corner;
@ -398,7 +393,7 @@ void PAGE_LAYOUT_READER_PARSER::parsePolyOutline( WS_DATA_ITEM_POLYGONS * aItem
}
void PAGE_LAYOUT_READER_PARSER::parseBitmap( WS_DATA_ITEM_BITMAP * aItem )
void DRAWING_SHEET_READER_PARSER::parseBitmap( DS_DATA_ITEM_BITMAP * aItem )
{
BITMAP_BASE* image = new BITMAP_BASE;
aItem->m_ImageBitmap = image;
@ -460,7 +455,7 @@ void PAGE_LAYOUT_READER_PARSER::parseBitmap( WS_DATA_ITEM_BITMAP * aItem )
}
}
void PAGE_LAYOUT_READER_PARSER::readPngdata( WS_DATA_ITEM_BITMAP * aItem )
void DRAWING_SHEET_READER_PARSER::readPngdata( DS_DATA_ITEM_BITMAP * aItem )
{
std::string tmp;
@ -494,7 +489,7 @@ void PAGE_LAYOUT_READER_PARSER::readPngdata( WS_DATA_ITEM_BITMAP * aItem )
}
void PAGE_LAYOUT_READER_PARSER::readOption( WS_DATA_ITEM * aItem )
void DRAWING_SHEET_READER_PARSER::readOption( DS_DATA_ITEM * aItem )
{
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
{
@ -508,7 +503,7 @@ void PAGE_LAYOUT_READER_PARSER::readOption( WS_DATA_ITEM * aItem )
}
void PAGE_LAYOUT_READER_PARSER::parseGraphic( WS_DATA_ITEM * aItem )
void DRAWING_SHEET_READER_PARSER::parseGraphic( DS_DATA_ITEM * aItem )
{
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
{
@ -578,7 +573,7 @@ void PAGE_LAYOUT_READER_PARSER::parseGraphic( WS_DATA_ITEM * aItem )
}
void PAGE_LAYOUT_READER_PARSER::parseText( WS_DATA_ITEM_TEXT* aItem )
void DRAWING_SHEET_READER_PARSER::parseText( DS_DATA_ITEM_TEXT* aItem )
{
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
{
@ -717,7 +712,7 @@ void PAGE_LAYOUT_READER_PARSER::parseText( WS_DATA_ITEM_TEXT* aItem )
}
// parse an expression like " 25 1 ltcorner)"
void PAGE_LAYOUT_READER_PARSER::parseCoordinate( POINT_COORD& aCoord)
void DRAWING_SHEET_READER_PARSER::parseCoordinate( POINT_COORD& aCoord)
{
aCoord.m_Pos.x = parseDouble();
aCoord.m_Pos.y = parseDouble();
@ -735,7 +730,7 @@ void PAGE_LAYOUT_READER_PARSER::parseCoordinate( POINT_COORD& aCoord)
}
}
int PAGE_LAYOUT_READER_PARSER::parseInt( int aMin, int aMax )
int DRAWING_SHEET_READER_PARSER::parseInt( int aMin, int aMax )
{
T token = NextTok();
@ -753,7 +748,7 @@ int PAGE_LAYOUT_READER_PARSER::parseInt( int aMin, int aMax )
}
double PAGE_LAYOUT_READER_PARSER::parseDouble()
double DRAWING_SHEET_READER_PARSER::parseDouble()
{
T token = NextTok();
@ -765,46 +760,42 @@ double PAGE_LAYOUT_READER_PARSER::parseDouble()
return val;
}
// defaultPageLayout is the default page layout description
// using the S expr.
// see page_layout_default_shape.cpp
extern const char defaultPageLayout[];
// defaultDrawingSheet is the default page layout description using the S expr.
extern const char defaultDrawingSheet[];
void WS_DATA_MODEL::SetDefaultLayout()
void DS_DATA_MODEL::SetDefaultLayout()
{
SetPageLayout( defaultPageLayout, false, wxT( "default page" ) );
SetPageLayout( defaultDrawingSheet, false, wxT( "default page" ) );
}
// Returns defaultPageLayout as a string;
wxString WS_DATA_MODEL::DefaultLayout()
// Returns defaultDrawingSheet as a string;
wxString DS_DATA_MODEL::DefaultLayout()
{
return wxString( defaultPageLayout );
return wxString( defaultDrawingSheet );
}
// emptyPageLayout is a "empty" page layout description
// emptyDrawingSheet is a "empty" page layout description using the S expr.
// there is a 0 length line to fool something somewhere.
// using the S expr.
// see page_layout_empty_description.cpp
extern const char emptyPageLayout[];
extern const char emptyDrawingSheet[];
void WS_DATA_MODEL::SetEmptyLayout()
void DS_DATA_MODEL::SetEmptyLayout()
{
SetPageLayout( emptyPageLayout, false, wxT( "empty page" ) );
SetPageLayout( emptyDrawingSheet, false, wxT( "empty page" ) );
}
wxString WS_DATA_MODEL::EmptyLayout()
wxString DS_DATA_MODEL::EmptyLayout()
{
return wxString( emptyPageLayout );
return wxString( emptyDrawingSheet );
}
void WS_DATA_MODEL::SetPageLayout( const char* aPageLayout, bool Append, const wxString& aSource )
void DS_DATA_MODEL::SetPageLayout( const char* aPageLayout, bool Append, const wxString& aSource )
{
if( ! Append )
ClearList();
PAGE_LAYOUT_READER_PARSER lp_parser( aPageLayout, wxT( "Sexpr_string" ) );
DRAWING_SHEET_READER_PARSER lp_parser( aPageLayout, wxT( "Sexpr_string" ) );
try
{
@ -817,7 +808,7 @@ void WS_DATA_MODEL::SetPageLayout( const char* aPageLayout, bool Append, const w
}
void WS_DATA_MODEL::SetPageLayout( const wxString& aFullFileName, bool Append )
void DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append )
{
wxString fullFileName = aFullFileName;
@ -830,7 +821,7 @@ void WS_DATA_MODEL::SetPageLayout( const wxString& aFullFileName, bool Append )
{
#if 0
if( !fullFileName.IsEmpty() )
wxLogMessage( wxT( "Page layout file <%s> not found" ), fullFileName.GetData() );
wxLogMessage( wxT( "Drawing sheet file <%s> not found" ), fullFileName.GetData() );
#endif
SetDefaultLayout();
return;
@ -858,7 +849,7 @@ void WS_DATA_MODEL::SetPageLayout( const wxString& aFullFileName, bool Append )
if( ! Append )
ClearList();
PAGE_LAYOUT_READER_PARSER pl_parser( buffer, fullFileName );
DRAWING_SHEET_READER_PARSER pl_parser( buffer, fullFileName );
try
{

View File

@ -1,4 +1,5 @@
page_layout
drawing_sheet
setup
left_margin
right_margin

View File

@ -24,27 +24,27 @@
/*
* the class WS_DATA_ITEM (and derived) defines
* the class DS_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 WS_DATA_ITEM coordinates units is the mm, and are relative to
* the DS_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)
* to a "draw list" (DS_DRAW_ITEM_BASE and derived items)
* The list of these items is stored in a WS_DATA_MODEL instance.
* The list of these items is stored in a DS_DATA_MODEL instance.
*
* When building the draw list:
* the WS_DATA_MODEL is used to create a WS_DRAW_ITEM_LIST
* the DS_DATA_MODEL is used to create a DS_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 WS_DATA_MODEL is created only once.
* the WS_DRAW_ITEM_LIST is created each time the page layout is plot/drawn
* the DS_DATA_MODEL is created only once.
* the DS_DRAW_ITEM_LIST is created each time the page layout is plot/drawn
*
* the WS_DATA_MODEL instance is created from a S expression which
* the DS_DATA_MODEL instance is created from a S expression which
* describes the page layout (can be the default page layout or a custom file).
*/
@ -53,17 +53,17 @@
#include <math/util.h> // for KiROUND
#include <view/view.h>
#include <title_block.h>
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_painter.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_painter.h>
#include <trigo.h>
using KIGFX::COLOR4D;
// The constructor:
WS_DATA_ITEM::WS_DATA_ITEM( WS_ITEM_TYPE aType )
DS_DATA_ITEM::DS_DATA_ITEM( DS_ITEM_TYPE aType )
{
m_pageOption = ALL_PAGES;
m_type = aType;
@ -73,14 +73,14 @@ WS_DATA_ITEM::WS_DATA_ITEM( WS_ITEM_TYPE aType )
}
WS_DATA_ITEM::~WS_DATA_ITEM()
DS_DATA_ITEM::~DS_DATA_ITEM()
{
for( WS_DRAW_ITEM_BASE* item : m_drawItems )
for( DS_DRAW_ITEM_BASE* item : m_drawItems )
delete item;
}
void WS_DATA_ITEM::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
void DS_DATA_ITEM::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
{
int pensize = GetPenSizeUi();
@ -88,7 +88,7 @@ void WS_DATA_ITEM::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aV
pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
std::map<int, STATUS_FLAGS> itemFlags;
WS_DRAW_ITEM_BASE* item = nullptr;
DS_DRAW_ITEM_BASE* item = nullptr;
for( size_t i = 0; i < m_drawItems.size(); ++i )
{
@ -111,10 +111,10 @@ void WS_DATA_ITEM::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aV
if( j && ! IsInsidePage( j ) )
continue;
if( m_type == WS_SEGMENT )
item = new WS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
else if( m_type == WS_RECT )
item = new WS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
if( m_type == DS_SEGMENT )
item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
else if( m_type == DS_RECT )
item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
else
{
wxFAIL_MSG( "Unknown drawing sheet item type" );
@ -133,9 +133,9 @@ void WS_DATA_ITEM::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aV
}
int WS_DATA_ITEM::GetPenSizeUi()
int DS_DATA_ITEM::GetPenSizeUi()
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
if( m_LineWidth != 0 )
return KiROUND( m_LineWidth * model.m_WSunits2Iu );
@ -150,17 +150,17 @@ int WS_DATA_ITEM::GetPenSizeUi()
// (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 WS_DATA_ITEM::MoveToUi( wxPoint aPosition )
void DS_DATA_ITEM::MoveToUi( wxPoint aPosition )
{
DPOINT pos_mm;
pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
MoveTo( pos_mm );
}
void WS_DATA_ITEM::MoveTo( DPOINT aPosition )
void DS_DATA_ITEM::MoveTo( DPOINT aPosition )
{
DPOINT vector = aPosition - GetStartPos();
DPOINT endpos = vector + GetEndPos();
@ -168,7 +168,7 @@ void WS_DATA_ITEM::MoveTo( DPOINT aPosition )
MoveStartPointTo( aPosition );
MoveEndPointTo( endpos );
for( WS_DRAW_ITEM_BASE* drawItem : m_drawItems )
for( DS_DRAW_ITEM_BASE* drawItem : m_drawItems )
{
drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
drawItem->SetEnd( GetEndPosUi( drawItem->GetIndexInPeer() ) );
@ -179,9 +179,9 @@ void WS_DATA_ITEM::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 WS_DATA_ITEM::MoveStartPointTo( DPOINT aPosition )
void DS_DATA_ITEM::MoveStartPointTo( DPOINT aPosition )
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT position;
// Calculate the position of the starting point
@ -215,10 +215,10 @@ void WS_DATA_ITEM::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 WS_DATA_ITEM::MoveStartPointToUi( wxPoint aPosition )
void DS_DATA_ITEM::MoveStartPointToUi( wxPoint aPosition )
{
DPOINT pos_mm( aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
DPOINT pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
MoveStartPointTo( pos_mm );
}
@ -230,9 +230,9 @@ void WS_DATA_ITEM::MoveStartPointToUi( wxPoint aPosition )
* (segments and rectangles)
* aPosition = the new position of the ending point, in mm
*/
void WS_DATA_ITEM::MoveEndPointTo( DPOINT aPosition )
void DS_DATA_ITEM::MoveEndPointTo( DPOINT aPosition )
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT position;
// Calculate the position of the starting point
@ -262,8 +262,8 @@ void WS_DATA_ITEM::MoveEndPointTo( DPOINT aPosition )
// Modify m_End only for items having 2 coordinates
switch( GetType() )
{
case WS_SEGMENT:
case WS_RECT:
case DS_SEGMENT:
case DS_RECT:
m_End.m_Pos = position;
break;
@ -278,19 +278,19 @@ void WS_DATA_ITEM::MoveEndPointTo( DPOINT aPosition )
* (segments and rectangles)
* aPosition = the new position of the ending point in graphic units
*/
void WS_DATA_ITEM::MoveEndPointToUi( wxPoint aPosition )
void DS_DATA_ITEM::MoveEndPointToUi( wxPoint aPosition )
{
DPOINT pos_mm;
pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
MoveEndPointTo( pos_mm );
}
const DPOINT WS_DATA_ITEM::GetStartPos( int ii ) const
const DPOINT DS_DATA_ITEM::GetStartPos( int ii ) const
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
@ -319,14 +319,14 @@ const DPOINT WS_DATA_ITEM::GetStartPos( int ii ) const
}
const wxPoint WS_DATA_ITEM::GetStartPosUi( int ii ) const
const wxPoint DS_DATA_ITEM::GetStartPosUi( int ii ) const
{
DPOINT pos = GetStartPos( ii ) * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
DPOINT pos = GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
}
const DPOINT WS_DATA_ITEM::GetEndPos( int ii ) const
const DPOINT DS_DATA_ITEM::GetEndPos( int ii ) const
{
DPOINT pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
@ -334,21 +334,21 @@ const DPOINT WS_DATA_ITEM::GetEndPos( int ii ) const
switch( m_End.m_Anchor )
{
case RB_CORNER: // right bottom corner
pos = WS_DATA_MODEL::GetTheInstance().m_RB_Corner - pos;
pos = DS_DATA_MODEL::GetTheInstance().m_RB_Corner - pos;
break;
case RT_CORNER: // right top corner
pos.x = WS_DATA_MODEL::GetTheInstance().m_RB_Corner.x - pos.x;
pos.y = WS_DATA_MODEL::GetTheInstance().m_LT_Corner.y + pos.y;
pos.x = DS_DATA_MODEL::GetTheInstance().m_RB_Corner.x - pos.x;
pos.y = DS_DATA_MODEL::GetTheInstance().m_LT_Corner.y + pos.y;
break;
case LB_CORNER: // left bottom corner
pos.x = WS_DATA_MODEL::GetTheInstance().m_LT_Corner.x + pos.x;
pos.y = WS_DATA_MODEL::GetTheInstance().m_RB_Corner.y - pos.y;
pos.x = DS_DATA_MODEL::GetTheInstance().m_LT_Corner.x + pos.x;
pos.y = DS_DATA_MODEL::GetTheInstance().m_RB_Corner.y - pos.y;
break;
case LT_CORNER: // left top corner
pos = WS_DATA_MODEL::GetTheInstance().m_LT_Corner + pos;
pos = DS_DATA_MODEL::GetTheInstance().m_LT_Corner + pos;
break;
}
@ -356,17 +356,17 @@ const DPOINT WS_DATA_ITEM::GetEndPos( int ii ) const
}
const wxPoint WS_DATA_ITEM::GetEndPosUi( int ii ) const
const wxPoint DS_DATA_ITEM::GetEndPosUi( int ii ) const
{
DPOINT pos = GetEndPos( ii );
pos = pos * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
}
bool WS_DATA_ITEM::IsInsidePage( int ii ) const
bool DS_DATA_ITEM::IsInsidePage( int ii ) const
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT pos = GetStartPos( ii );
@ -385,34 +385,34 @@ bool WS_DATA_ITEM::IsInsidePage( int ii ) const
}
const wxString WS_DATA_ITEM::GetClassName() const
const wxString DS_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_POLYPOLYGON: name = wxT( "Imported Shape" ); break;
case WS_BITMAP: name = wxT( "Image" ); break;
case DS_TEXT: name = wxT( "Text" ); break;
case DS_SEGMENT: name = wxT( "Line" ); break;
case DS_RECT: name = wxT( "Rectangle" ); break;
case DS_POLYPOLYGON: name = wxT( "Imported Shape" ); break;
case DS_BITMAP: name = wxT( "Image" ); break;
}
return name;
}
WS_DATA_ITEM_POLYGONS::WS_DATA_ITEM_POLYGONS() :
WS_DATA_ITEM( WS_POLYPOLYGON )
DS_DATA_ITEM_POLYGONS::DS_DATA_ITEM_POLYGONS() :
DS_DATA_ITEM( DS_POLYPOLYGON )
{
m_Orient = 0.0;
}
void WS_DATA_ITEM_POLYGONS::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
void DS_DATA_ITEM_POLYGONS::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
{
std::map<int, STATUS_FLAGS> itemFlags;
WS_DRAW_ITEM_BASE* item = nullptr;
DS_DRAW_ITEM_BASE* item = nullptr;
for( size_t i = 0; i < m_drawItems.size(); ++i )
{
@ -436,7 +436,7 @@ void WS_DATA_ITEM_POLYGONS::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX:
continue;
int pensize = GetPenSizeUi();
auto poly_shape = new WS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosUi( j ), pensize );
auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosUi( j ), pensize );
poly_shape->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( poly_shape );
@ -463,13 +463,13 @@ void WS_DATA_ITEM_POLYGONS::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX:
}
int WS_DATA_ITEM_POLYGONS::GetPenSizeUi()
int DS_DATA_ITEM_POLYGONS::GetPenSizeUi()
{
return KiROUND( m_LineWidth * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
return KiROUND( m_LineWidth * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
}
const DPOINT WS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
const DPOINT DS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
{
DPOINT pos = m_Corners[aIdx];
@ -480,7 +480,7 @@ const DPOINT WS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepea
}
void WS_DATA_ITEM_POLYGONS::SetBoundingBox()
void DS_DATA_ITEM_POLYGONS::SetBoundingBox()
{
if( m_Corners.size() == 0 )
{
@ -514,9 +514,9 @@ void WS_DATA_ITEM_POLYGONS::SetBoundingBox()
}
bool WS_DATA_ITEM_POLYGONS::IsInsidePage( int ii ) const
bool DS_DATA_ITEM_POLYGONS::IsInsidePage( int ii ) const
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT pos = GetStartPos( ii );
pos += m_minCoord; // left top pos of bounding box
@ -534,16 +534,16 @@ bool WS_DATA_ITEM_POLYGONS::IsInsidePage( int ii ) const
}
const wxPoint WS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
const wxPoint DS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
{
DPOINT pos = GetCornerPosition( aIdx, aRepeat );
pos = pos * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return wxPoint( int(pos.x), int(pos.y) );
}
WS_DATA_ITEM_TEXT::WS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
WS_DATA_ITEM( WS_TEXT )
DS_DATA_ITEM_TEXT::DS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
DS_DATA_ITEM( DS_TEXT )
{
m_TextBase = aTextBase;
m_IncrementLabel = 1;
@ -556,13 +556,15 @@ WS_DATA_ITEM_TEXT::WS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
}
void WS_DATA_ITEM_TEXT::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
{
int pensize = GetPenSizeUi();
bool multilines = false;
if( WS_DATA_MODEL::GetTheInstance().m_EditMode )
if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
{
m_FullText = m_TextBase;
}
else
{
m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString();
@ -575,18 +577,18 @@ void WS_DATA_ITEM_TEXT::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
SetConstrainedTextSize();
wxSize textsize;
textsize.x = KiROUND( m_ConstrainedTextSize.x * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
textsize.y = KiROUND( m_ConstrainedTextSize.y * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
textsize.x = KiROUND( m_ConstrainedTextSize.x * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
textsize.y = KiROUND( m_ConstrainedTextSize.y * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
if( m_Bold )
pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
std::map<int, STATUS_FLAGS> itemFlags;
WS_DRAW_ITEM_TEXT* text = nullptr;
DS_DRAW_ITEM_TEXT* text = nullptr;
for( size_t i = 0; i < m_drawItems.size(); ++i )
{
text = (WS_DRAW_ITEM_TEXT*) m_drawItems[ i ];
text = (DS_DRAW_ITEM_TEXT*) m_drawItems[ i ];
itemFlags[ i ] = text->GetFlags();
if( aCollector )
@ -605,7 +607,7 @@ void WS_DATA_ITEM_TEXT::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
if( j > 0 && !IsInsidePage( j ) )
continue;
text = new WS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosUi( j ), textsize, pensize,
text = new DS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosUi( j ), textsize, pensize,
m_Italic, m_Bold );
text->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( text );
@ -628,9 +630,9 @@ void WS_DATA_ITEM_TEXT::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
}
int WS_DATA_ITEM_TEXT::GetPenSizeUi()
int DS_DATA_ITEM_TEXT::GetPenSizeUi()
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
if( m_LineWidth != 0 )
return KiROUND( m_LineWidth * model.m_WSunits2Iu );
@ -639,7 +641,7 @@ int WS_DATA_ITEM_TEXT::GetPenSizeUi()
}
void WS_DATA_ITEM_TEXT::IncrementLabel( int aIncr )
void DS_DATA_ITEM_TEXT::IncrementLabel( int aIncr )
{
int last = m_TextBase.Len() -1;
@ -658,7 +660,7 @@ void WS_DATA_ITEM_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 WS_DATA_ITEM_TEXT::ReplaceAntiSlashSequence()
bool DS_DATA_ITEM_TEXT::ReplaceAntiSlashSequence()
{
bool multiline = false;
@ -693,15 +695,15 @@ bool WS_DATA_ITEM_TEXT::ReplaceAntiSlashSequence()
}
void WS_DATA_ITEM_TEXT::SetConstrainedTextSize()
void DS_DATA_ITEM_TEXT::SetConstrainedTextSize()
{
m_ConstrainedTextSize = m_TextSize;
if( m_ConstrainedTextSize.x == 0 )
m_ConstrainedTextSize.x = WS_DATA_MODEL::GetTheInstance().m_DefaultTextSize.x;
m_ConstrainedTextSize.x = DS_DATA_MODEL::GetTheInstance().m_DefaultTextSize.x;
if( m_ConstrainedTextSize.y == 0 )
m_ConstrainedTextSize.y = WS_DATA_MODEL::GetTheInstance().m_DefaultTextSize.y;
m_ConstrainedTextSize.y = DS_DATA_MODEL::GetTheInstance().m_DefaultTextSize.y;
if( m_BoundingBoxSize.x || m_BoundingBoxSize.y )
{
@ -714,7 +716,7 @@ void WS_DATA_ITEM_TEXT::SetConstrainedTextSize()
int linewidth = 0;
size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
WS_DRAW_ITEM_TEXT dummy( WS_DRAW_ITEM_TEXT( this, 0, m_FullText, wxPoint( 0, 0 ),
DS_DRAW_ITEM_TEXT dummy( DS_DRAW_ITEM_TEXT( this, 0, m_FullText, wxPoint( 0, 0 ),
size_micron, linewidth, m_Italic, m_Bold ) );
dummy.SetMultilineAllowed( true );
dummy.SetHorizJustify( m_Hjustify ) ;
@ -735,10 +737,10 @@ void WS_DATA_ITEM_TEXT::SetConstrainedTextSize()
}
void WS_DATA_ITEM_BITMAP::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
void DS_DATA_ITEM_BITMAP::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
{
std::map<int, STATUS_FLAGS> itemFlags;
WS_DRAW_ITEM_BASE* item = nullptr;
DS_DRAW_ITEM_BASE* item = nullptr;
for( size_t i = 0; i < m_drawItems.size(); ++i )
{
@ -767,7 +769,7 @@ void WS_DATA_ITEM_BITMAP::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::V
if( j && !IsInsidePage( j ) )
continue;
WS_DRAW_ITEM_BITMAP* bitmap = new WS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
bitmap->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( bitmap );
@ -781,7 +783,7 @@ void WS_DATA_ITEM_BITMAP::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::V
}
int WS_DATA_ITEM_BITMAP::GetPPI() const
int DS_DATA_ITEM_BITMAP::GetPPI() const
{
if( m_ImageBitmap )
return m_ImageBitmap->GetPPI() / m_ImageBitmap->GetScale();
@ -790,7 +792,7 @@ int WS_DATA_ITEM_BITMAP::GetPPI() const
}
void WS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
void DS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
{
if( m_ImageBitmap )
m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );

View File

@ -26,40 +26,39 @@
/*
* The WS_DATA_ITEM_* classes define the basic shapes of a drawing sheet (frame references
* and title block). The list of these items is stored in a WS_DATA_MODEL instance.
* and title block). The list of these items is stored in a DS_DATA_MODEL instance.
*
* These items cannot be drawn or plotetd "as is". They must be converted to WS_DRAW_*
* types. When building the draw list:
* - the WS_DATA_MODEL is used to create a WS_DRAW_ITEM_LIST
* - the DS_DATA_MODEL is used to create a DS_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 WS_DATA_MODEL is created only once.
* The DS_DATA_MODEL is created only once.
* The WS_DRAW_ITEM_*s are created and maintained by the PlEditor, but are created each time
* they're needed for drawing by the clients (Eeschema, Pcbnew, etc.)
*
* The WS_DATA_MODEL instance is created from a S expression which describes the page
* The DS_DATA_MODEL instance is created from a S expression which describes the page
* layout (can be the default page layout or a custom file). This format is also used
* for undo/redo storage (wrapped in a WS_PROXY_UNDO_ITEM).
* for undo/redo storage (wrapped in a DS_PROXY_UNDO_ITEM).
*/
#include <kiface_i.h>
#include <title_block.h>
#include <common.h>
#include <eda_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_painter.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_painter.h>
// The layout shape used in the application
// It is accessible by WS_DATA_MODEL::GetTheInstance()
static WS_DATA_MODEL wksTheInstance;
static WS_DATA_MODEL* wksAltInstance;
// It is accessible by DS_DATA_MODEL::GetTheInstance()
static DS_DATA_MODEL wksTheInstance;
static DS_DATA_MODEL* wksAltInstance;
WS_DATA_MODEL::WS_DATA_MODEL() :
DS_DATA_MODEL::DS_DATA_MODEL() :
m_WSunits2Iu( 1000.0 ),
m_DefaultLineWidth( 0.0 ),
m_DefaultTextSize( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE ),
@ -73,10 +72,10 @@ WS_DATA_MODEL::WS_DATA_MODEL() :
m_bottomMargin = 10.0; // the bottom page margin in mm
}
/* static function: returns the instance of WS_DATA_MODEL
* used in the application
/*
* static function: returns the instance of DS_DATA_MODEL used in the application
*/
WS_DATA_MODEL& WS_DATA_MODEL::GetTheInstance()
DS_DATA_MODEL& DS_DATA_MODEL::GetTheInstance()
{
if( wksAltInstance )
return *wksAltInstance;
@ -85,18 +84,18 @@ WS_DATA_MODEL& WS_DATA_MODEL::GetTheInstance()
}
/**
* static function: Set an alternate instance of WS_DATA_MODEL
* static function: Set an alternate instance of DS_DATA_MODEL
* mainly used in page setting dialog
* @param aLayout = the alternate page layout.
* if null, restore the basic page layout
*/
void WS_DATA_MODEL::SetAltInstance( WS_DATA_MODEL* aLayout )
void DS_DATA_MODEL::SetAltInstance( DS_DATA_MODEL* aLayout )
{
wksAltInstance = aLayout;
}
void WS_DATA_MODEL::SetupDrawEnvironment( const PAGE_INFO& aPageInfo, double aMilsToIU )
void DS_DATA_MODEL::SetupDrawEnvironment( const PAGE_INFO& aPageInfo, double aMilsToIU )
{
#define MILS_TO_MM (25.4/1000)
@ -116,29 +115,29 @@ void WS_DATA_MODEL::SetupDrawEnvironment( const PAGE_INFO& aPageInfo, double aMi
}
void WS_DATA_MODEL::ClearList()
void DS_DATA_MODEL::ClearList()
{
for( WS_DATA_ITEM* item : m_list )
for( DS_DATA_ITEM* item : m_list )
delete item;
m_list.clear();
}
void WS_DATA_MODEL::Append( WS_DATA_ITEM* aItem )
void DS_DATA_MODEL::Append( DS_DATA_ITEM* aItem )
{
m_list.push_back( aItem );
}
void WS_DATA_MODEL::Remove( WS_DATA_ITEM* aItem )
void DS_DATA_MODEL::Remove( DS_DATA_ITEM* aItem )
{
auto newEnd = std::remove( m_list.begin(), m_list.end(), aItem );
m_list.erase( newEnd, m_list.end() );
}
int WS_DATA_MODEL::GetItemIndex( WS_DATA_ITEM* aItem ) const
int DS_DATA_MODEL::GetItemIndex( DS_DATA_ITEM* aItem ) const
{
unsigned idx = 0;
while( idx < m_list.size() )
@ -154,7 +153,7 @@ int WS_DATA_MODEL::GetItemIndex( WS_DATA_ITEM* aItem ) const
/* return the item from its index aIdx, or NULL if does not exist
*/
WS_DATA_ITEM* WS_DATA_MODEL::GetItem( unsigned aIdx ) const
DS_DATA_ITEM* DS_DATA_MODEL::GetItem( unsigned aIdx ) const
{
if( aIdx < m_list.size() )
return m_list[aIdx];
@ -163,7 +162,7 @@ WS_DATA_ITEM* WS_DATA_MODEL::GetItem( unsigned aIdx ) const
}
const wxString WS_DATA_MODEL::MakeShortFileName( const wxString& aFullFileName,
const wxString DS_DATA_MODEL::MakeShortFileName( const wxString& aFullFileName,
const wxString& aProjectPath )
{
wxString shortFileName = aFullFileName;
@ -192,7 +191,7 @@ const wxString WS_DATA_MODEL::MakeShortFileName( const wxString& aFullFileName,
}
const wxString WS_DATA_MODEL::MakeFullFileName( const wxString& aShortFileName,
const wxString DS_DATA_MODEL::MakeFullFileName( const wxString& aShortFileName,
const wxString& aProjectPath )
{
wxString fullFileName = ExpandEnvVarSubstitutions( aShortFileName, nullptr );

View File

@ -1,9 +1,3 @@
/**
* @file page_layout_writer.cpp
* @brief write an S expression of description of graphic items and texts
* to build a title block and page layout
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
@ -33,12 +27,12 @@
#include <eda_item.h>
#include <locale_io.h>
#include <macros.h>
#include <page_layout/ws_painter.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_painter.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <math/vector2d.h>
#include <page_layout/page_layout_reader_lexer.h>
#include <drawing_sheet/drawing_sheet_reader_lexer.h>
#include <convert_to_biu.h>
#include <wx/msgdlg.h>
@ -50,46 +44,45 @@ using namespace TB_READER_T;
// A helper function to write tokens:
static const char* getTokenName( T aTok )
{
return PAGE_LAYOUT_READER_LEXER::TokenName( aTok );
return DRAWING_SHEET_READER_LEXER::TokenName( aTok );
}
// A basic helper class to write a page layout description
// Not used alone, a file writer or a string writer should be
// derived to use it
// Therefore the constructor is protected
class WS_DATA_MODEL_IO
// Not used alone, a file writer or a string writer should be derived to use it.
// Therefore the constructor is protected.
class DS_DATA_MODEL_IO
{
protected:
OUTPUTFORMATTER* m_out;
WS_DATA_MODEL_IO() { m_out = NULL; }
virtual ~WS_DATA_MODEL_IO() {}
DS_DATA_MODEL_IO() { m_out = NULL; }
virtual ~DS_DATA_MODEL_IO() {}
public:
void Format( WS_DATA_MODEL* aModel ) const;
void Format( DS_DATA_MODEL* aModel ) const;
void Format( WS_DATA_MODEL* aModel, WS_DATA_ITEM* aItem, int aNestLevel ) const;
void Format( DS_DATA_MODEL* aModel, DS_DATA_ITEM* aItem, int aNestLevel ) const;
private:
void format( WS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const;
void format( WS_DATA_MODEL* aModel, WS_DATA_ITEM* aItem, int aNestLevel ) const;
void format( WS_DATA_ITEM_POLYGONS* aItem, int aNestLevel )
void format( DS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const;
void format( DS_DATA_MODEL* aModel, DS_DATA_ITEM* aItem, int aNestLevel ) const;
void format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel )
const;
void format( WS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) const;
void format( DS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) const;
void formatCoordinate( const char * aToken, POINT_COORD & aCoord ) const;
void formatRepeatParameters( WS_DATA_ITEM* aItem ) const;
void formatOptions( WS_DATA_ITEM* aItem ) const;
void formatRepeatParameters( DS_DATA_ITEM* aItem ) const;
void formatOptions( DS_DATA_ITEM* aItem ) const;
};
// A helper class to write a page layout description to a file
class WS_DATA_MODEL_FILEIO: public WS_DATA_MODEL_IO
class DS_DATA_MODEL_FILEIO : public DS_DATA_MODEL_IO
{
FILE_OUTPUTFORMATTER * m_fileout;
public:
WS_DATA_MODEL_FILEIO( const wxString& aFilename ):
WS_DATA_MODEL_IO()
DS_DATA_MODEL_FILEIO( const wxString& aFilename ) :
DS_DATA_MODEL_IO()
{
try
{
@ -102,7 +95,7 @@ public:
}
}
~WS_DATA_MODEL_FILEIO()
~DS_DATA_MODEL_FILEIO()
{
delete m_fileout;
}
@ -110,14 +103,14 @@ public:
// A helper class to write a page layout description to a string
class WS_DATA_MODEL_STRINGIO: public WS_DATA_MODEL_IO
class DS_DATA_MODEL_STRINGIO : public DS_DATA_MODEL_IO
{
STRING_FORMATTER * m_writer;
wxString & m_output;
public:
WS_DATA_MODEL_STRINGIO( wxString& aOutputString ):
WS_DATA_MODEL_IO(), m_output( aOutputString )
DS_DATA_MODEL_STRINGIO( wxString& aOutputString ) :
DS_DATA_MODEL_IO(), m_output( aOutputString )
{
try
{
@ -130,7 +123,7 @@ public:
}
}
~WS_DATA_MODEL_STRINGIO()
~DS_DATA_MODEL_STRINGIO()
{
m_output = FROM_UTF8( m_writer->GetString().c_str() );
delete m_writer;
@ -141,52 +134,52 @@ public:
/*
* Save the description in a file
*/
void WS_DATA_MODEL::Save( const wxString& aFullFileName )
void DS_DATA_MODEL::Save( const wxString& aFullFileName )
{
WS_DATA_MODEL_FILEIO writer( aFullFileName );
DS_DATA_MODEL_FILEIO writer( aFullFileName );
writer.Format( this );
}
/* Save the description in a buffer
*/
void WS_DATA_MODEL::SaveInString( wxString& aOutputString )
void DS_DATA_MODEL::SaveInString( wxString& aOutputString )
{
WS_DATA_MODEL_STRINGIO writer( aOutputString );
DS_DATA_MODEL_STRINGIO writer( aOutputString );
writer.Format( this );
}
void WS_DATA_MODEL::SaveInString( std::vector<WS_DATA_ITEM*> aItemsList, wxString& aOutputString )
void DS_DATA_MODEL::SaveInString( std::vector<DS_DATA_ITEM*> aItemsList, wxString& aOutputString )
{
WS_DATA_MODEL_STRINGIO writer( aOutputString );
DS_DATA_MODEL_STRINGIO writer( aOutputString );
LOCALE_IO toggle; // switch on/off the locale "C" notation
for( WS_DATA_ITEM* item : aItemsList )
for( DS_DATA_ITEM* item : aItemsList )
writer.Format( this, item, 0 );
}
void WS_DATA_MODEL_IO::Format( WS_DATA_MODEL* aModel, WS_DATA_ITEM* aItem, int aNestLevel ) const
void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aModel, DS_DATA_ITEM* aItem, int aNestLevel ) const
{
switch( aItem->GetType() )
{
case WS_DATA_ITEM::WS_TEXT:
format( (WS_DATA_ITEM_TEXT*) aItem, aNestLevel );
case DS_DATA_ITEM::DS_TEXT:
format( (DS_DATA_ITEM_TEXT*) aItem, aNestLevel );
break;
case WS_DATA_ITEM::WS_SEGMENT:
case WS_DATA_ITEM::WS_RECT:
case DS_DATA_ITEM::DS_SEGMENT:
case DS_DATA_ITEM::DS_RECT:
format( aModel, aItem, aNestLevel );
break;
case WS_DATA_ITEM::WS_POLYPOLYGON:
format( (WS_DATA_ITEM_POLYGONS*) aItem, aNestLevel );
case DS_DATA_ITEM::DS_POLYPOLYGON:
format( (DS_DATA_ITEM_POLYGONS*) aItem, aNestLevel );
break;
case WS_DATA_ITEM::WS_BITMAP:
format( (WS_DATA_ITEM_BITMAP*) aItem, aNestLevel );
case DS_DATA_ITEM::DS_BITMAP:
format( (DS_DATA_ITEM_BITMAP*) aItem, aNestLevel );
break;
default:
@ -195,11 +188,11 @@ void WS_DATA_MODEL_IO::Format( WS_DATA_MODEL* aModel, WS_DATA_ITEM* aItem, int a
}
void WS_DATA_MODEL_IO::Format( WS_DATA_MODEL* aPageLayout ) const
void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aPageLayout ) const
{
LOCALE_IO toggle; // switch on/off the locale "C" notation
m_out->Print( 0, "(page_layout\n" );
m_out->Print( 0, "(drawing_sheet\n" );
// Setup
int nestLevel = 1;
@ -228,7 +221,7 @@ void WS_DATA_MODEL_IO::Format( WS_DATA_MODEL* aPageLayout ) const
// Save the graphical items on the page layout
for( unsigned ii = 0; ii < aPageLayout->GetCount(); ii++ )
{
WS_DATA_ITEM* item = aPageLayout->GetItem( ii );
DS_DATA_ITEM* item = aPageLayout->GetItem( ii );
Format( aPageLayout, item, nestLevel );
}
@ -236,7 +229,7 @@ void WS_DATA_MODEL_IO::Format( WS_DATA_MODEL* aPageLayout ) const
}
void WS_DATA_MODEL_IO::format( WS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const
void DS_DATA_MODEL_IO::format( DS_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() );
@ -316,9 +309,9 @@ void WS_DATA_MODEL_IO::format( WS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const
m_out->Print( 0, ")\n" );
}
void WS_DATA_MODEL_IO::format( WS_DATA_MODEL* aModel, WS_DATA_ITEM* aItem, int aNestLevel ) const
void DS_DATA_MODEL_IO::format( DS_DATA_MODEL* aModel, DS_DATA_ITEM* aItem, int aNestLevel ) const
{
if( aItem->GetType() == WS_DATA_ITEM::WS_RECT )
if( aItem->GetType() == DS_DATA_ITEM::DS_RECT )
m_out->Print( aNestLevel, "(%s", getTokenName( T_rect ) );
else
m_out->Print( aNestLevel, "(%s", getTokenName( T_line ) );
@ -339,7 +332,7 @@ void WS_DATA_MODEL_IO::format( WS_DATA_MODEL* aModel, WS_DATA_ITEM* aItem, int a
}
void WS_DATA_MODEL_IO::format( WS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) const
void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) const
{
m_out->Print( aNestLevel, "(%s", getTokenName( T_polygon ) );
m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
@ -389,7 +382,7 @@ void WS_DATA_MODEL_IO::format( WS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) co
}
void WS_DATA_MODEL_IO::format( WS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) const
void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) const
{
m_out->Print( aNestLevel, "(%s", getTokenName( T_bitmap ) );
m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
@ -417,7 +410,7 @@ void WS_DATA_MODEL_IO::format( WS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) cons
}
void WS_DATA_MODEL_IO::formatCoordinate( const char * aToken,
void DS_DATA_MODEL_IO::formatCoordinate( const char * aToken,
POINT_COORD & aCoord ) const
{
m_out->Print( 0, " (%s %s %s", aToken,
@ -436,7 +429,7 @@ void WS_DATA_MODEL_IO::formatCoordinate( const char * aToken,
}
void WS_DATA_MODEL_IO::formatRepeatParameters( WS_DATA_ITEM* aItem ) const
void DS_DATA_MODEL_IO::formatRepeatParameters( DS_DATA_ITEM* aItem ) const
{
if( aItem->m_RepeatCount <= 1 )
return;
@ -449,12 +442,12 @@ void WS_DATA_MODEL_IO::formatRepeatParameters( WS_DATA_ITEM* aItem ) const
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() == WS_DATA_ITEM::WS_TEXT )
if( aItem->m_IncrementLabel != 1 && aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
m_out->Print( 0, " (incrlabel %d)", aItem->m_IncrementLabel );
}
void WS_DATA_MODEL_IO::formatOptions( WS_DATA_ITEM* aItem ) const
void DS_DATA_MODEL_IO::formatOptions( DS_DATA_ITEM* aItem ) const
{
if( aItem->GetPage1Option() == FIRST_PAGE_ONLY )
m_out->Print( 0, " (%s %s)", getTokenName( T_option ), getTokenName(T_page1only ) );

View File

@ -24,36 +24,35 @@
*/
/*
* the class WS_DATA_ITEM (and WS_DATA_ITEM_TEXT) defines
* the class DS_DATA_ITEM (and DS_DATA_ITEM_TEXT) defines
* a basic shape of a page layout ( frame references and title block )
* Basic shapes are line, rect and texts
* the WS_DATA_ITEM coordinates units is the mm, and are relative to
* the DS_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)
* to a "draw list" (DS_DRAW_ITEM_BASE and derived items)
* The list of these items is stored in a WS_DATA_MODEL instance.
* The list of these items is stored in a DS_DATA_MODEL instance.
*
* When building the draw list:
* the WS_DATA_MODEL is used to create a WS_DRAW_ITEM_LIST
* the DS_DATA_MODEL is used to create a DS_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 WS_DATA_MODEL is created only once.
* the WS_DRAW_ITEM_LIST is created each time the page layout is plotted/drawn
* the DS_DATA_MODEL is created only once.
* the DS_DRAW_ITEM_LIST is created each time the page layout is plotted/drawn
*
* the WS_DATA_MODEL instance is created from a S expression which
* the DS_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 <eda_rect.h>
#include <eda_draw_frame.h>
#include <fill_type.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <base_units.h>
#include <page_info.h>
#include <layers_id_colors_and_visibility.h>
@ -63,13 +62,13 @@
// ============================ BASE CLASS ==============================
void WS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
void DS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
WS_DATA_ITEM* dataItem = GetPeer();
DS_DATA_ITEM* dataItem = GetPeer();
if( !dataItem ) // No peer: this item is like a WS_DRAW_ITEM_PAGE
if( !dataItem ) // No peer: this item is like a DS_DRAW_ITEM_PAGE
{
aLayers[0] = LAYER_DRAWINGSHEET;
return;
@ -85,7 +84,7 @@ void WS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
// A generic HitTest that can be used by some, but not all, sub-classes.
bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
bool DS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT sel = aRect;
@ -99,10 +98,10 @@ bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAc
}
void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
WS_DATA_ITEM* dataItem = GetPeer();
DS_DATA_ITEM* dataItem = GetPeer();
if( dataItem == nullptr ) // Is only a pure graphic item used in drawing sheet editor to
// handle the page limits
@ -110,24 +109,24 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS
switch( dataItem->GetType() )
{
case WS_DATA_ITEM::WS_SEGMENT:
case DS_DATA_ITEM::DS_SEGMENT:
aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg ) );
break;
case WS_DATA_ITEM::WS_RECT:
case DS_DATA_ITEM::DS_RECT:
aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg ) );
break;
case WS_DATA_ITEM::WS_TEXT:
msg = static_cast<WS_DRAW_ITEM_TEXT*>( this )->GetShownText();
case DS_DATA_ITEM::DS_TEXT:
msg = static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText();
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg ) );
break;
case WS_DATA_ITEM::WS_POLYPOLYGON:
case DS_DATA_ITEM::DS_POLYPOLYGON:
aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg ) );
break;
case WS_DATA_ITEM::WS_BITMAP:
case DS_DATA_ITEM::DS_BITMAP:
aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg ) );
break;
}
@ -159,45 +158,46 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS
// ============================ TEXT ==============================
void WS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_DRAWINGSHEET ), FILLED );
}
const EDA_RECT WS_DRAW_ITEM_TEXT::GetBoundingBox() const
const EDA_RECT DS_DRAW_ITEM_TEXT::GetBoundingBox() const
{
return EDA_TEXT::GetTextBox();
}
bool WS_DRAW_ITEM_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool DS_DRAW_ITEM_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
return EDA_TEXT::TextHitTest( aPosition, aAccuracy );
}
bool WS_DRAW_ITEM_TEXT::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
bool DS_DRAW_ITEM_TEXT::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
{
return EDA_TEXT::TextHitTest( aRect, aContains, aAccuracy );
}
wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString DS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "Text '%s'" ),
GetShownText() );
}
void WS_DRAW_ITEM_TEXT::SetTextAngle( double aAngle )
void DS_DRAW_ITEM_TEXT::SetTextAngle( double aAngle )
{
EDA_TEXT::SetTextAngle( NormalizeAngle360Min( aAngle ) );
}
// ============================ POLYGON =================================
void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( const RENDER_SETTINGS* aSettings,
const wxPoint& aOffset )
{
wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET );
@ -222,7 +222,7 @@ void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( const RENDER_SETTINGS* aSettings, c
}
void WS_DRAW_ITEM_POLYPOLYGONS::SetPosition( const wxPoint& aPos )
void DS_DRAW_ITEM_POLYPOLYGONS::SetPosition( const wxPoint& aPos )
{
// Note: m_pos is the anchor point of the shape.
wxPoint move_vect = aPos - m_pos;
@ -233,7 +233,7 @@ void WS_DRAW_ITEM_POLYPOLYGONS::SetPosition( const wxPoint& aPos )
}
const EDA_RECT WS_DRAW_ITEM_POLYPOLYGONS::GetBoundingBox() const
const EDA_RECT DS_DRAW_ITEM_POLYPOLYGONS::GetBoundingBox() const
{
EDA_RECT rect;
BOX2I box = m_Polygons.BBox();
@ -247,13 +247,13 @@ const EDA_RECT WS_DRAW_ITEM_POLYPOLYGONS::GetBoundingBox() const
}
bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
return m_Polygons.Collide( aPosition, aAccuracy );
}
bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained,
bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained,
int aAccuracy ) const
{
EDA_RECT sel = aRect;
@ -293,7 +293,7 @@ bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained,
}
wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString DS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "Imported Shape" ) );
}
@ -301,7 +301,7 @@ wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============================ RECT ==============================
void WS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void DS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET );
@ -312,13 +312,13 @@ void WS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxP
}
const EDA_RECT WS_DRAW_ITEM_RECT::GetBoundingBox() const
const EDA_RECT DS_DRAW_ITEM_RECT::GetBoundingBox() const
{
return EDA_RECT( GetStart(), wxSize( GetEnd().x - GetStart().x, GetEnd().y - GetStart().y ) );
}
bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool DS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
int dist = aAccuracy + ( GetPenWidth() / 2 );
wxPoint start = GetStart();
@ -352,7 +352,7 @@ bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
}
bool WS_DRAW_ITEM_RECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
bool DS_DRAW_ITEM_RECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT sel = aRect;
@ -363,7 +363,7 @@ bool WS_DRAW_ITEM_RECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAc
return sel.Contains( GetBoundingBox() );
// For greedy we need to check each side of the rect as we're pretty much always inside the
// rect which defines the drawing sheet frame.
// rect which defines the drawing-sheet frame.
EDA_RECT side = GetBoundingBox();
side.SetHeight( 0 );
@ -390,7 +390,7 @@ bool WS_DRAW_ITEM_RECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAc
}
wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString DS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "Rectangle, width %s height %s" ),
MessageTextFromValue( aUnits, std::abs( GetStart().x - GetEnd().x ) ),
@ -400,7 +400,7 @@ wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============================ LINE ==============================
void WS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void DS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET );
@ -410,20 +410,20 @@ void WS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxP
}
const EDA_RECT WS_DRAW_ITEM_LINE::GetBoundingBox() const
const EDA_RECT DS_DRAW_ITEM_LINE::GetBoundingBox() const
{
return EDA_RECT( GetStart(), wxSize( GetEnd().x - GetStart().x, GetEnd().y - GetStart().y ) );
}
bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool DS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1;
return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist );
}
wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString DS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "Line, length %s" ),
MessageTextFromValue( aUnits, EuclideanNorm( GetStart() - GetEnd() ) ) );
@ -432,9 +432,9 @@ wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============== BITMAP ================
void WS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void DS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
WS_DATA_ITEM_BITMAP* bitmap = (WS_DATA_ITEM_BITMAP*) GetPeer();
DS_DATA_ITEM_BITMAP* bitmap = (DS_DATA_ITEM_BITMAP*) GetPeer();
if( !bitmap->m_ImageBitmap )
return;
@ -443,9 +443,9 @@ void WS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const w
}
const EDA_RECT WS_DRAW_ITEM_BITMAP::GetBoundingBox() const
const EDA_RECT DS_DRAW_ITEM_BITMAP::GetBoundingBox() const
{
auto* bitmap = static_cast<const WS_DATA_ITEM_BITMAP*>( m_peer );
auto* bitmap = static_cast<const DS_DATA_ITEM_BITMAP*>( m_peer );
wxSize bm_size = bitmap->m_ImageBitmap->GetSize();
EDA_RECT bbox;
@ -456,7 +456,7 @@ const EDA_RECT WS_DRAW_ITEM_BITMAP::GetBoundingBox() const
}
bool WS_DRAW_ITEM_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool DS_DRAW_ITEM_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
EDA_RECT bbox = GetBoundingBox();
bbox.Inflate( aAccuracy );
@ -465,25 +465,25 @@ bool WS_DRAW_ITEM_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) con
}
bool WS_DRAW_ITEM_BITMAP::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
bool DS_DRAW_ITEM_BITMAP::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
{
return WS_DRAW_ITEM_BASE::HitTest( aRect, aContains, aAccuracy );
return DS_DRAW_ITEM_BASE::HitTest( aRect, aContains, aAccuracy );
}
wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString DS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return _( "Image" );
}
wxString WS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString DS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return _( "Page Limits" );
}
const EDA_RECT WS_DRAW_ITEM_PAGE::GetBoundingBox() const
const EDA_RECT DS_DRAW_ITEM_PAGE::GetBoundingBox() const
{
EDA_RECT dummy;
@ -494,23 +494,23 @@ const EDA_RECT WS_DRAW_ITEM_PAGE::GetBoundingBox() const
}
// ====================== WS_DRAW_ITEM_LIST ==============================
// ====================== DS_DRAW_ITEM_LIST ==============================
void WS_DRAW_ITEM_LIST::BuildDrawItemsList( const PAGE_INFO& aPageInfo,
void DS_DRAW_ITEM_LIST::BuildDrawItemsList( const PAGE_INFO& aPageInfo,
const TITLE_BLOCK& aTitleBlock )
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
m_titleBlock = &aTitleBlock;
m_paperFormat = &aPageInfo.GetType();
// Build the basic layout shape, if the layout list is empty
if( model.GetCount() == 0 && !model.VoidListAllowed() )
model.SetPageLayout();
model.LoadDrawingSheet();
model.SetupDrawEnvironment( aPageInfo, m_milsToIu );
for( WS_DATA_ITEM* wsItem : model.GetItems() )
for( DS_DATA_ITEM* wsItem : model.GetItems() )
{
// Generate it only if the page option allows this
if( wsItem->GetPage1Option() == FIRST_PAGE_ONLY && !m_isFirstPage )
@ -529,11 +529,11 @@ void WS_DRAW_ITEM_LIST::BuildDrawItemsList( const PAGE_INFO& aPageInfo,
* The selected items are drawn after (usually 0 or 1)
* to be sure they are seen, even for overlapping items
*/
void WS_DRAW_ITEM_LIST::Print( const RENDER_SETTINGS* aSettings )
void DS_DRAW_ITEM_LIST::Print( const RENDER_SETTINGS* aSettings )
{
std::vector<WS_DRAW_ITEM_BASE*> second_items;
std::vector<DS_DRAW_ITEM_BASE*> second_items;
for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
for( DS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
{
if( item->Type() == WSG_BITMAP_T )
item->PrintWsItem( aSettings );

View File

@ -29,11 +29,11 @@
#include <title_block.h>
#include <build_version.h>
#include <settings/color_settings.h>
#include <page_layout/ws_draw_item.h>
#include <drawing_sheet/ds_draw_item.h>
#include <gal/graphics_abstraction_layer.h>
#include <page_layout/ws_painter.h>
#include <page_layout/ws_data_item.h>
#include <drawing_sheet/ds_painter.h>
#include <drawing_sheet/ds_data_item.h>
#include <wx/app.h>
@ -41,7 +41,7 @@ using namespace KIGFX;
static const wxString productName = wxT( "KiCad E.D.A. " );
WS_RENDER_SETTINGS::WS_RENDER_SETTINGS()
DS_RENDER_SETTINGS::DS_RENDER_SETTINGS()
{
m_backgroundColor = COLOR4D( 1.0, 1.0, 1.0, 1.0 );
m_normalColor = RED;
@ -53,7 +53,7 @@ WS_RENDER_SETTINGS::WS_RENDER_SETTINGS()
}
void WS_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
void DS_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
{
for( int layer = SCH_LAYER_ID_START; layer < SCH_LAYER_ID_END; layer ++)
m_layerColors[ layer ] = aSettings->GetColor( layer );
@ -67,7 +67,7 @@ void WS_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
}
COLOR4D WS_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
COLOR4D DS_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
{
const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
@ -85,7 +85,7 @@ COLOR4D WS_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
}
void WS_DRAW_ITEM_LIST::GetTextVars( wxArrayString* aVars )
void DS_DRAW_ITEM_LIST::GetTextVars( wxArrayString* aVars )
{
aVars->push_back( wxT( "KICAD_VERSION" ) );
aVars->push_back( wxT( "#" ) );
@ -100,7 +100,7 @@ void WS_DRAW_ITEM_LIST::GetTextVars( wxArrayString* aVars )
// returns the full text corresponding to the aTextbase,
// after replacing format symbols by the corresponding value
wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
{
std::function<bool( wxString* )> wsResolver =
[ this ]( wxString* token ) -> bool
@ -169,7 +169,7 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
}
bool KIGFX::WS_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
bool KIGFX::DS_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
{
auto item = dynamic_cast<const EDA_ITEM*>( aItem );
@ -178,12 +178,12 @@ bool KIGFX::WS_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
switch( item->Type() )
{
case WSG_LINE_T: draw( (WS_DRAW_ITEM_LINE*) item, aLayer ); break;
case WSG_POLY_T: draw( (WS_DRAW_ITEM_POLYPOLYGONS*) item, aLayer ); break;
case WSG_RECT_T: draw( (WS_DRAW_ITEM_RECT*) item, aLayer ); break;
case WSG_TEXT_T: draw( (WS_DRAW_ITEM_TEXT*) item, aLayer ); break;
case WSG_BITMAP_T: draw( (WS_DRAW_ITEM_BITMAP*) item, aLayer ); break;
case WSG_PAGE_T: draw( (WS_DRAW_ITEM_PAGE*) item, aLayer ); break;
case WSG_LINE_T: draw( (DS_DRAW_ITEM_LINE*) item, aLayer ); break;
case WSG_POLY_T: draw( (DS_DRAW_ITEM_POLYPOLYGONS*) item, aLayer ); break;
case WSG_RECT_T: draw( (DS_DRAW_ITEM_RECT*) item, aLayer ); break;
case WSG_TEXT_T: draw( (DS_DRAW_ITEM_TEXT*) item, aLayer ); break;
case WSG_BITMAP_T: draw( (DS_DRAW_ITEM_BITMAP*) item, aLayer ); break;
case WSG_PAGE_T: draw( (DS_DRAW_ITEM_PAGE*) item, aLayer ); break;
default: return false;
}
@ -191,7 +191,7 @@ bool KIGFX::WS_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
}
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_LINE* aItem, int aLayer ) const
void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_LINE* aItem, int aLayer ) const
{
m_gal->SetIsStroke( true );
m_gal->SetIsFill( false );
@ -201,7 +201,7 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_LINE* aItem, int aLayer ) const
}
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_RECT* aItem, int aLayer ) const
void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_RECT* aItem, int aLayer ) const
{
m_gal->SetIsStroke( true );
m_gal->SetIsFill( false );
@ -211,13 +211,13 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_RECT* aItem, int aLayer ) const
}
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_POLYPOLYGONS* aItem, int aLayer ) const
void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_POLYPOLYGONS* aItem, int aLayer ) const
{
m_gal->SetFillColor( m_renderSettings.GetColor( aItem, aLayer ) );
m_gal->SetIsFill( true );
m_gal->SetIsStroke( false );
WS_DRAW_ITEM_POLYPOLYGONS* item = (WS_DRAW_ITEM_POLYPOLYGONS*)aItem;
DS_DRAW_ITEM_POLYPOLYGONS* item = (DS_DRAW_ITEM_POLYPOLYGONS*)aItem;
for( int idx = 0; idx < item->GetPolygons().OutlineCount(); ++idx )
{
@ -227,7 +227,7 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_POLYPOLYGONS* aItem, int aLayer
}
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
{
VECTOR2D position( aItem->GetTextPos().x, aItem->GetTextPos().y );
int penWidth = std::max( aItem->GetEffectiveTextPenWidth(),
@ -246,10 +246,10 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
}
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_BITMAP* aItem, int aLayer ) const
void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_BITMAP* aItem, int aLayer ) const
{
m_gal->Save();
auto* bitmap = static_cast<WS_DATA_ITEM_BITMAP*>( aItem->GetPeer() );
auto* bitmap = static_cast<DS_DATA_ITEM_BITMAP*>( aItem->GetPeer() );
VECTOR2D position = aItem->GetPosition();
m_gal->Translate( position );
@ -281,7 +281,7 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_BITMAP* aItem, int aLayer ) con
}
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_PAGE* aItem, int aLayer ) const
void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_PAGE* aItem, int aLayer ) const
{
VECTOR2D origin = VECTOR2D( 0.0, 0.0 );
VECTOR2D end = VECTOR2D( aItem->GetPageSize().x,
@ -309,7 +309,7 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_PAGE* aItem, int aLayer ) const
}
void KIGFX::WS_PAINTER::DrawBorder( const PAGE_INFO* aPageInfo, int aScaleFactor ) const
void KIGFX::DS_PAINTER::DrawBorder( const PAGE_INFO* aPageInfo, int aScaleFactor ) const
{
VECTOR2D origin = VECTOR2D( 0.0, 0.0 );
VECTOR2D end = VECTOR2D( aPageInfo->GetWidthMils() * aScaleFactor,

View File

@ -21,16 +21,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <page_layout/ws_proxy_undo_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <view/view.h>
#include <eda_draw_frame.h>
#include <macros.h>
using namespace KIGFX;
WS_PROXY_UNDO_ITEM::WS_PROXY_UNDO_ITEM( const EDA_DRAW_FRAME* aFrame ) :
DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM( const EDA_DRAW_FRAME* aFrame ) :
EDA_ITEM( aFrame ? WS_PROXY_UNDO_ITEM_PLUS_T : WS_PROXY_UNDO_ITEM_T ),
m_selectedDataItem( INT_MAX ),
m_selectedDrawItem( INT_MAX )
@ -41,16 +41,16 @@ WS_PROXY_UNDO_ITEM::WS_PROXY_UNDO_ITEM( const EDA_DRAW_FRAME* aFrame ) :
m_titleBlock = aFrame->GetTitleBlock();
}
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
model.SaveInString( m_layoutSerialization );
for( size_t ii = 0; ii < model.GetItems().size(); ++ii )
{
WS_DATA_ITEM* dataItem = model.GetItem( ii );
DS_DATA_ITEM* dataItem = model.GetItem( ii );
for( size_t jj = 0; jj < dataItem->GetDrawItems().size(); ++jj )
{
WS_DRAW_ITEM_BASE* drawItem = dataItem->GetDrawItems()[ jj ];
DS_DRAW_ITEM_BASE* drawItem = dataItem->GetDrawItems()[ jj ];
if( drawItem->IsSelected() )
{
@ -63,7 +63,7 @@ WS_PROXY_UNDO_ITEM::WS_PROXY_UNDO_ITEM( const EDA_DRAW_FRAME* aFrame ) :
}
void WS_PROXY_UNDO_ITEM::Restore( EDA_DRAW_FRAME* aFrame, KIGFX::VIEW* aView )
void DS_PROXY_UNDO_ITEM::Restore( EDA_DRAW_FRAME* aFrame, KIGFX::VIEW* aView )
{
if( Type() == WS_PROXY_UNDO_ITEM_PLUS_T )
{
@ -71,21 +71,21 @@ void WS_PROXY_UNDO_ITEM::Restore( EDA_DRAW_FRAME* aFrame, KIGFX::VIEW* aView )
aFrame->SetTitleBlock( m_titleBlock );
}
WS_DATA_MODEL::GetTheInstance().SetPageLayout( TO_UTF8( m_layoutSerialization ) );
DS_DATA_MODEL::GetTheInstance().SetPageLayout(TO_UTF8( m_layoutSerialization ) );
if( aView )
{
aView->Clear();
for( int ii = 0; ii < (int)WS_DATA_MODEL::GetTheInstance().GetItems().size(); ++ii )
for( int ii = 0; ii < (int)DS_DATA_MODEL::GetTheInstance().GetItems().size(); ++ii )
{
WS_DATA_ITEM* dataItem = WS_DATA_MODEL::GetTheInstance().GetItem( ii );
DS_DATA_ITEM* dataItem = DS_DATA_MODEL::GetTheInstance().GetItem( ii );
dataItem->SyncDrawItems( nullptr, aView );
if( ii == m_selectedDataItem && m_selectedDrawItem < (int)dataItem->GetDrawItems().size() )
{
WS_DRAW_ITEM_BASE* drawItem = dataItem->GetDrawItems()[ m_selectedDrawItem ];
DS_DRAW_ITEM_BASE* drawItem = dataItem->GetDrawItems()[ m_selectedDrawItem ];
drawItem->SetSelected();
}
}

View File

@ -24,16 +24,16 @@
#include <layers_id_colors_and_visibility.h>
#include <page_info.h>
#include <page_layout/ws_proxy_view_item.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_painter.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_painter.h>
#include <project.h>
#include <view/view.h>
using namespace KIGFX;
WS_PROXY_VIEW_ITEM::WS_PROXY_VIEW_ITEM( int aMils2IUscalefactor, const PAGE_INFO* aPageInfo,
DS_PROXY_VIEW_ITEM::DS_PROXY_VIEW_ITEM( int aMils2IUscalefactor, const PAGE_INFO* aPageInfo,
const PROJECT* aProject, const TITLE_BLOCK* aTitleBlock ) :
EDA_ITEM( NOT_USED ), // this item is never added to a BOARD so it needs no type
m_mils2IUscalefactor( aMils2IUscalefactor ),
@ -49,7 +49,7 @@ WS_PROXY_VIEW_ITEM::WS_PROXY_VIEW_ITEM( int aMils2IUscalefactor, const PAGE_INFO
}
const BOX2I WS_PROXY_VIEW_ITEM::ViewBBox() const
const BOX2I DS_PROXY_VIEW_ITEM::ViewBBox() const
{
BOX2I bbox;
@ -68,7 +68,7 @@ const BOX2I WS_PROXY_VIEW_ITEM::ViewBBox() const
}
void WS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, WS_DRAW_ITEM_LIST* aDrawList ) const
void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, DS_DRAW_ITEM_LIST* aDrawList ) const
{
RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings();
wxString fileName( m_fileName.c_str(), wxConvUTF8 );
@ -89,11 +89,11 @@ void WS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, WS_DRAW_ITEM_LIST* aDrawLis
}
void WS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
{
GAL* gal = aView->GetGAL();
RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings();
WS_DRAW_ITEM_LIST drawList;
DS_DRAW_ITEM_LIST drawList;
buildDrawList( aView, &drawList );
@ -107,8 +107,8 @@ void WS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
gal->Scale( VECTOR2D( -1.0, 1.0 ) );
}
WS_PAINTER ws_painter( gal );
auto ws_settings = static_cast<WS_RENDER_SETTINGS*>( ws_painter.GetSettings() );
DS_PAINTER ws_painter( gal );
auto ws_settings = static_cast<DS_RENDER_SETTINGS*>( ws_painter.GetSettings() );
ws_settings->SetNormalColor( settings->GetLayerColor( m_colorLayer ) );
ws_settings->SetSelectedColor( settings->GetLayerColor( LAYER_SELECT_OVERLAY ) );
@ -116,7 +116,7 @@ void WS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
ws_settings->SetPageBorderColor( settings->GetLayerColor( m_pageBorderColorLayer ) );
// Draw all the components that make the page layout
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
ws_painter.Draw( item, LAYER_DRAWINGSHEET );
// Draw gray line that outlines the sheet size
@ -128,21 +128,21 @@ void WS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
}
void WS_PROXY_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
void DS_PROXY_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
aLayers[0] = LAYER_DRAWINGSHEET;
}
bool WS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems( VIEW* aView, const wxPoint& aPosition )
bool DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems( VIEW* aView, const wxPoint& aPosition )
{
int accuracy = (int) aView->ToWorld( 5.0 ); // five pixels at current zoom
WS_DRAW_ITEM_LIST drawList;
DS_DRAW_ITEM_LIST drawList;
buildDrawList( aView, &drawList );
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
{
if( item->HitTest( aPosition, accuracy ) )
return true;

View File

@ -53,12 +53,11 @@
#include <tool/zoom_menu.h>
#include <trace_helpers.h>
#include <view/view.h>
#include <page_layout/ws_draw_item.h>
#include <drawing_sheet/ds_draw_item.h>
#include <widgets/msgpanel.h>
#include <wx/snglinst.h>
#include <dialogs/dialog_grid_settings.h>
#include <widgets/ui_common.h>
#include <zoom_defines.h>
#define FR_HISTORY_LIST_CNT 10 ///< Maximum size of the find/replace history stacks.
@ -831,13 +830,13 @@ void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos )
static const wxString productName = wxT( "KiCad E.D.A. " );
void PrintPageLayout( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
const wxString& aFullSheetName, const wxString& aFileName,
const TITLE_BLOCK& aTitleBlock, int aSheetCount, const wxString& aPageNumber,
double aMils2Iu, const PROJECT* aProject, const wxString& aSheetLayer,
bool aIsFirstPage )
const TITLE_BLOCK& aTitleBlock, int aSheetCount,
const wxString& aPageNumber, double aMils2Iu, const PROJECT* aProject,
const wxString& aSheetLayer, bool aIsFirstPage )
{
WS_DRAW_ITEM_LIST drawList;
DS_DRAW_ITEM_LIST drawList;
drawList.SetDefaultPenSize( aSettings->GetDefaultPenWidth() );
drawList.SetMilsToIUfactor( aMils2Iu );
@ -872,7 +871,7 @@ void EDA_DRAW_FRAME::PrintDrawingSheet( const RENDER_SETTINGS* aSettings, BASE_S
DC->SetAxisOrientation( true, false );
}
PrintPageLayout( aSettings, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
::PrintDrawingSheet( aSettings, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
aScreen->GetPageCount(), aScreen->GetPageNumber(), aMils2Iu, &Prj(),
aSheetLayer, aScreen->GetVirtualPageNumber() == 1 );

View File

@ -24,9 +24,9 @@
#include <eda_item.h>
#include <plotters_specific.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_painter.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_painter.h>
#include <title_block.h>
#include <wx/filename.h>
@ -69,7 +69,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
plotColor = COLOR4D( RED );
plotter->SetColor( plotColor );
WS_DRAW_ITEM_LIST drawList;
DS_DRAW_ITEM_LIST drawList;
// Print only a short filename, if aFilename is the full filename
wxFileName fn( aFilename );
@ -87,7 +87,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
drawList.BuildDrawItemsList( aPageInfo, aTitleBlock );
// Draw item list
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
{
plotter->SetCurrentLineWidth( PLOTTER::USE_DEFAULT_LINE_WIDTH );
@ -95,7 +95,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
{
case WSG_LINE_T:
{
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
DS_DRAW_ITEM_LINE* line = (DS_DRAW_ITEM_LINE*) item;
plotter->SetCurrentLineWidth( std::max( line->GetPenWidth(), defaultPenWidth ) );
plotter->MoveTo( line->GetStart() );
plotter->FinishTo( line->GetEnd() );
@ -104,7 +104,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
case WSG_RECT_T:
{
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
DS_DRAW_ITEM_RECT* rect = (DS_DRAW_ITEM_RECT*) item;
int penWidth = std::max( rect->GetPenWidth(), defaultPenWidth );
plotter->Rect( rect->GetStart(), rect->GetEnd(), FILL_TYPE::NO_FILL, penWidth );
}
@ -112,7 +112,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
case WSG_TEXT_T:
{
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
DS_DRAW_ITEM_TEXT* text = (DS_DRAW_ITEM_TEXT*) item;
int penWidth = std::max( text->GetEffectiveTextPenWidth(), defaultPenWidth );
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
@ -123,7 +123,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
case WSG_POLY_T:
{
WS_DRAW_ITEM_POLYPOLYGONS* poly = (WS_DRAW_ITEM_POLYPOLYGONS*) item;
DS_DRAW_ITEM_POLYPOLYGONS* poly = (DS_DRAW_ITEM_POLYPOLYGONS*) item;
int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
std::vector<wxPoint> points;
@ -142,8 +142,8 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
case WSG_BITMAP_T:
{
WS_DRAW_ITEM_BITMAP* drawItem = (WS_DRAW_ITEM_BITMAP*) item;
auto* bitmap = (WS_DATA_ITEM_BITMAP*) drawItem->GetPeer();
DS_DRAW_ITEM_BITMAP* drawItem = (DS_DRAW_ITEM_BITMAP*) item;
DS_DATA_ITEM_BITMAP* bitmap = (DS_DATA_ITEM_BITMAP*) drawItem->GetPeer();
if( bitmap->m_ImageBitmap == NULL )
break;

View File

@ -22,7 +22,6 @@
#include <dialogs/dialog_page_settings.h>
class WS_DATA_MODEL;
class DIALOG_EESCHEMA_PAGE_SETTINGS : public DIALOG_PAGES_SETTINGS
{

View File

@ -30,7 +30,7 @@
#include <kiface_i.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <page_layout/ws_painter.h>
#include <drawing_sheet/ds_painter.h>
#include <sch_painter.h>
#include <schematic.h>

View File

@ -486,7 +486,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
if( cfg->m_Printing.use_theme && theme )
renderSettings.LoadColors( theme );
// The drawing sheet item print code is shared between PCBNew and EESchema, so it's easier
// The drawing-sheet-item print code is shared between PCBNew and EESchema, so it's easier
// if they just use the PCB layer.
renderSettings.SetLayerColor( LAYER_DRAWINGSHEET,
renderSettings.GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );

View File

@ -40,7 +40,7 @@
#include <settings/settings_manager.h>
#include <title_block.h>
#include <view/view.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <sch_base_frame.h>
#include <widgets/color_swatch.h>
@ -52,7 +52,7 @@ PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS( SCH_BASE_FRAME* aF
m_preview( nullptr ),
m_page( nullptr ),
m_titleBlock( nullptr ),
m_ws( nullptr ),
m_drawingSheet( nullptr ),
m_previewItems()
{
m_colorNamespace = "schematic";
@ -107,7 +107,7 @@ PANEL_EESCHEMA_COLOR_SETTINGS::~PANEL_EESCHEMA_COLOR_SETTINGS()
{
delete m_page;
delete m_titleBlock;
delete m_ws;
delete m_drawingSheet;
delete m_currentSettings;
for( EDA_ITEM* item : m_previewItems )
@ -244,9 +244,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
m_page->SetHeightMils( 5000 );
m_page->SetWidthMils( 6000 );
m_ws = new KIGFX::WS_PROXY_VIEW_ITEM( (int) IU_PER_MILS, m_page, nullptr, m_titleBlock );
m_ws->SetColorLayer( LAYER_SCHEMATIC_DRAWINGSHEET );
view->Add( m_ws );
m_drawingSheet = new DS_PROXY_VIEW_ITEM((int) IU_PER_MILS, m_page, nullptr, m_titleBlock );
m_drawingSheet->SetColorLayer( LAYER_SCHEMATIC_DRAWINGSHEET );
view->Add( m_drawingSheet );
// NOTE: It would be nice to parse a schematic file here.
// This is created from the color_settings.sch file in demos folder
@ -453,7 +453,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview()
fabs( psize.y / screenSize.y ) );
view->SetScale( scale * 1.1 );
view->SetCenter( m_ws->ViewBBox().Centre() );
view->SetCenter( m_drawingSheet->ViewBBox().Centre() );
m_preview->ForceRefresh();
}

View File

@ -33,11 +33,8 @@ class PAGE_INFO;
class SCH_ITEM;
class SCH_PREVIEW_PANEL;
class TITLE_BLOCK;
class DS_PROXY_VIEW_ITEM;
namespace KIGFX
{
class WS_PROXY_VIEW_ITEM;
}
class PANEL_EESCHEMA_COLOR_SETTINGS : public PANEL_COLOR_SETTINGS
{
@ -68,7 +65,7 @@ private:
SCH_PREVIEW_PANEL* m_preview;
PAGE_INFO* m_page;
TITLE_BLOCK* m_titleBlock;
KIGFX::WS_PROXY_VIEW_ITEM* m_ws;
DS_PROXY_VIEW_ITEM* m_drawingSheet;
std::vector<EDA_ITEM*> m_previewItems;
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;

View File

@ -45,7 +45,7 @@
#include <symbol_lib_table.h>
#include <widgets/paged_dialog.h>
#include <wildcards_and_files_ext.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_data_model.h>
#include <zoom_defines.h>
@ -86,14 +86,13 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
LIB_PART::SetSubpartIdNotation( LIB_PART::GetSubpartIdSeparator(),
LIB_PART::GetSubpartFirstId() );
// Load the page layout decr file, from the filename stored in
// Load the drawing sheet description 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
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
wxString filename = WS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
wxString filename = DS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
Prj().GetProjectPath() );
pglayout.SetPageLayout( filename );
DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename );
return true;
}

View File

@ -32,8 +32,8 @@
#include <sch_reference_list.h>
#include <sch_sheet.h>
#include <schematic.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <wx/ffile.h>
@ -159,9 +159,9 @@ int ERC_TESTER::TestDuplicateSheetNames( bool aCreateMarker )
}
void ERC_TESTER::TestTextVars( KIGFX::WS_PROXY_VIEW_ITEM* aDrawingSheet )
void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{
WS_DRAW_ITEM_LIST wsItems;
DS_DRAW_ITEM_LIST wsItems;
auto unresolved = [this]( wxString str )
{
@ -252,9 +252,9 @@ void ERC_TESTER::TestTextVars( KIGFX::WS_PROXY_VIEW_ITEM* aDrawingSheet )
}
}
for( WS_DRAW_ITEM_BASE* item = wsItems.GetFirst(); item; item = wsItems.GetNext() )
for( DS_DRAW_ITEM_BASE* item = wsItems.GetFirst(); item; item = wsItems.GetNext() )
{
if( WS_DRAW_ITEM_TEXT* text = dynamic_cast<WS_DRAW_ITEM_TEXT*>( item ) )
if( DS_DRAW_ITEM_TEXT* text = dynamic_cast<DS_DRAW_ITEM_TEXT*>( item ) )
{
if( text->GetShownText().Matches( wxT( "*${*}*" ) ) )
{

View File

@ -37,11 +37,7 @@ class NETLIST_OBJECT;
class NETLIST_OBJECT_LIST;
class SCH_SHEET_LIST;
class SCHEMATIC;
namespace KIGFX
{
class WS_PROXY_VIEW_ITEM;
}
class DS_PROXY_VIEW_ITEM;
extern const wxString CommentERC_H[];
@ -83,7 +79,7 @@ public:
/**
* Check for any unresolved text variable references.
*/
void TestTextVars( KIGFX::WS_PROXY_VIEW_ITEM* aDrawingSheet );
void TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet );
/**
* Check that there are no conflicting bus alias definitions in the schematic.

View File

@ -41,25 +41,21 @@
#include <project_rescue.h>
#include <reporter.h>
#include <richio.h>
#include <sch_component.h>
#include <sch_edit_frame.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <sch_file_versions.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <schematic.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <symbol_lib_table.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <tools/sch_editor_control.h>
#include <trace_helpers.h>
#include <widgets/infobar.h>
#include <wildcards_and_files_ext.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_data_model.h>
#include <wx/ffile.h>
#include <wx/stdpaths.h>
#include <tools/ee_inspection_tool.h>
#include <paths.h>
@ -920,9 +916,9 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
SCH_IO_MGR::FindPlugin( (SCH_IO_MGR::SCH_FILE_T) aFileType ) );
Schematic().SetRoot( pi->Load( aFileName, &Schematic() ) );
// Eagle sheets do not use a drawing sheet frame by default, so set it to an empty one
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
pglayout.SetEmptyLayout();
// Eagle sheets do not use a drawing-sheet frame by default, so set it to an empty one
DS_DATA_MODEL& drawingSheet = DS_DATA_MODEL::GetTheInstance();
drawingSheet.SetEmptyLayout();
BASE_SCREEN::m_PageLayoutDescrFileName = "empty.kicad_wks";
wxFileName layoutfn( Prj().GetProjectPath(), BASE_SCREEN::m_PageLayoutDescrFileName );
@ -930,7 +926,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
if( layoutfile.Open( layoutfn.GetFullPath(), "wb" ) )
{
layoutfile.Write( WS_DATA_MODEL::EmptyLayout() );
layoutfile.Write( DS_DATA_MODEL::EmptyLayout() );
layoutfile.Close();
}

View File

@ -317,5 +317,5 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
TOOL_EVENT dummy;
editTool->UpdateNetHighlighting( dummy );
HardRedraw(); // Ensure any item has its view updated, especially the worksheet items
HardRedraw(); // Ensure all items are redrawn (especially the drawing-sheet items)
}

View File

@ -77,7 +77,7 @@
#include <wildcards_and_files_ext.h>
#include <wx/cmdline.h>
#include <gal/graphics_abstraction_layer.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
// non-member so it can be moved easily, and kept REALLY private.
// Do NOT Clear() in here.
@ -1466,8 +1466,8 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
}
else
{
// Get current drawing sheet in a form we can compare to an EDA_ITEM
KIGFX::WS_PROXY_VIEW_ITEM* ds = SCH_BASE_FRAME::GetCanvas()->GetView()->GetDrawingSheet();
// Get current drawing-sheet in a form we can compare to an EDA_ITEM
DS_PROXY_VIEW_ITEM* ds = SCH_BASE_FRAME::GetCanvas()->GetView()->GetDrawingSheet();
EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
// Need an EDA_RECT so the first ".Merge" sees it's uninitialized
@ -1476,7 +1476,7 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
// Calc the bounding box of all items on screen except the page border
for( EDA_ITEM* item : GetScreen()->Items() )
{
if( item != dsAsItem ) // Ignore the worksheet itself
if( item != dsAsItem ) // Ignore the drawing-sheet itself
{
if( item->Type() == SCH_COMPONENT_T )
{

View File

@ -57,7 +57,6 @@
#include <schematic.h>
#include <symbol_lib_table.h>
#include <wildcards_and_files_ext.h>
#include <page_layout/ws_draw_item.h>
// Eagle schematic axes are aligned with x increasing left to right and Y increasing bottom to top

View File

@ -23,7 +23,7 @@
#include <view/wx_view_controls.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <gal/graphics_abstraction_layer.h>

View File

@ -31,7 +31,7 @@
#include <view/view_group.h>
#include <view/view_rtree.h>
#include <view/wx_view_controls.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <layers_id_colors_and_visibility.h>
#include <sch_screen.h>
#include <schematic.h>
@ -47,12 +47,9 @@ SCH_VIEW::SCH_VIEW( bool aIsDynamic, SCH_BASE_FRAME* aFrame ) :
VIEW( aIsDynamic )
{
m_frame = aFrame;
// Set m_boundary to define the max working area size. The default value
// is acceptable for Pcbnew and Gerbview, but too large for Eeschema due to
// very different internal units.
// So we have to use a smaller value.
// A full size = 3 * MAX_PAGE_SIZE_MILS size allows a wide margin
// around the worksheet.
// Set m_boundary to define the max working area size. The default value is acceptable for
// Pcbnew and Gerbview, but too large for Eeschema due to very different internal units.
// A full size = 3 * MAX_PAGE_SIZE_MILS size allows a wide margin around the drawing-sheet.
double max_size = Mils2iu( MAX_PAGE_SIZE_MILS ) * 3.0;
m_boundary.SetOrigin( -max_size/4, -max_size/4 );
m_boundary.SetSize( max_size, max_size );
@ -97,7 +94,7 @@ void SCH_VIEW::DisplaySheet( const SCH_SCREEN *aScreen )
for( SCH_ITEM* item : aScreen->Items() )
Add( item );
m_drawingSheet.reset( new KIGFX::WS_PROXY_VIEW_ITEM( static_cast< int >( IU_PER_MILS ),
m_drawingSheet.reset( new DS_PROXY_VIEW_ITEM( static_cast<int>( IU_PER_MILS ),
&aScreen->GetPageSettings(),
&aScreen->Schematic()->Prj(),
&aScreen->GetTitleBlock() ) );

View File

@ -37,6 +37,8 @@ class SCH_SCREEN;
class LIB_PART;
class LIB_PIN;
class SCH_BASE_FRAME;
class DS_PROXY_VIEW_ITEM;
// Eeschema 100nm as the internal units
constexpr double SCH_WORLD_UNIT ( 1e-7 / 0.0254 );
@ -62,7 +64,6 @@ static const LAYER_NUM SCH_LAYER_ORDER[] =
namespace KIGFX
{
class VIEW_GROUP;
class WS_PROXY_VIEW_ITEM;
namespace PREVIEW
{
@ -94,13 +95,13 @@ public:
void HideDrawingSheet();
WS_PROXY_VIEW_ITEM* GetDrawingSheet() const { return m_drawingSheet.get(); }
DS_PROXY_VIEW_ITEM* GetDrawingSheet() const { return m_drawingSheet.get(); }
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<WS_PROXY_VIEW_ITEM> m_drawingSheet;
std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
};
}; // namespace

View File

@ -30,7 +30,7 @@
#include <sch_line.h>
#include <sch_bitmap.h>
#include <tools/ee_selection_tool.h>
#include <page_layout/ws_proxy_undo_item.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <tool/actions.h>
@ -292,8 +292,8 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
else if( status == UNDO_REDO::PAGESETTINGS )
{
// swap current settings with stored settings
WS_PROXY_UNDO_ITEM alt_item( this );
WS_PROXY_UNDO_ITEM* item = (WS_PROXY_UNDO_ITEM*) eda_item;
DS_PROXY_UNDO_ITEM alt_item( this );
DS_PROXY_UNDO_ITEM* item = static_cast<DS_PROXY_UNDO_ITEM*>( eda_item );
item->Restore( this );
*item = alt_item;
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );

View File

@ -46,8 +46,8 @@
#include <sch_junction.h>
#include <sch_edit_frame.h>
#include <schematic.h>
#include <page_layout/ws_proxy_view_item.h>
#include <page_layout/ws_proxy_undo_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <eeschema_id.h>
#include <status_popup.h>
#include <wx/gdicmn.h>
@ -207,7 +207,7 @@ bool SCH_EDIT_TOOL::Init()
[]( const SELECTION& aSel )
{
if( aSel.GetSize() == 0 )
return true; // Show worksheet properties
return true; // Show drawing-sheet properties
SCH_ITEM* firstItem = dynamic_cast<SCH_ITEM*>( aSel.Front() );
const EE_SELECTION* eeSelection = dynamic_cast<const EE_SELECTION*>( &aSel );
@ -1335,7 +1335,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
if( getView()->IsLayerVisible( LAYER_SCHEMATIC_DRAWINGSHEET ) )
{
KIGFX::WS_PROXY_VIEW_ITEM* ds = m_frame->GetCanvas()->GetView()->GetDrawingSheet();
DS_PROXY_VIEW_ITEM* ds = m_frame->GetCanvas()->GetView()->GetDrawingSheet();
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursorPos ) )

View File

@ -56,7 +56,7 @@
#include <tools/ee_selection.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_editor_control.h>
#include <page_layout/ws_proxy_undo_item.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <dialog_update_from_pcb.h>
#include <dialog_helpers.h>
@ -99,7 +99,7 @@ int SCH_EDITOR_CONTROL::ShowSchematicSetup( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
{
PICKED_ITEMS_LIST undoCmd;
WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame );
DS_PROXY_UNDO_ITEM* undoItem = new DS_PROXY_UNDO_ITEM( m_frame );
ITEM_PICKER wrapper( m_frame->GetScreen(), undoItem, UNDO_REDO::PAGESETTINGS );
undoCmd.PushItem( wrapper );

View File

@ -55,7 +55,7 @@ bool GERBVIEW_FRAME::Clear_DrawLayers( bool query )
GetCanvas()->GetView()->Clear();
// Reinit the worksheet view, cleared by GetView()->Clear():
// Reinit the drawing-sheet view, cleared by GetView()->Clear():
SetPageSettings( GetPageSettings() );
}

View File

@ -21,7 +21,7 @@
#include <view/view.h>
#include <view/wx_view_controls.h>
#include <gerbview_painter.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <zoom_defines.h>
#include <gerbview_frame.h>
@ -30,7 +30,6 @@
#include <gerber_file_image.h>
#include <gerber_file_image_list.h>
#include <zoom_defines.h>
#include <functional>
#include <memory>
@ -177,7 +176,7 @@ void GERBVIEW_DRAW_PANEL_GAL::setDefaultLayerDeps()
}
void GERBVIEW_DRAW_PANEL_GAL::SetDrawingSheet( KIGFX::WS_PROXY_VIEW_ITEM* aDrawingSheet )
void GERBVIEW_DRAW_PANEL_GAL::SetDrawingSheet( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{
m_drawingSheet.reset( aDrawingSheet );
m_view->Add( m_drawingSheet.get() );

View File

@ -22,10 +22,7 @@
#include <class_draw_panel_gal.h>
namespace KIGFX
{
class WS_PROXY_VIEW_ITEM;
}
class DS_PROXY_VIEW_ITEM;
class GERBVIEW_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
@ -56,24 +53,24 @@ public:
BOX2I GetDefaultViewBBox() const override;
/**
* Set or update worksheet used by the draw panel.
* Set or update the drawing-sheet (borders and title block) used by the draw panel.
*
* @param aDrawingSheet is the worksheet to be used.
* @param aDrawingSheet is the drawing-sheet to be used.
* The object is then owned by GERBVIEW_DRAW_PANEL_GAL.
*/
void SetDrawingSheet( KIGFX::WS_PROXY_VIEW_ITEM* aDrawingSheet );
void SetDrawingSheet( DS_PROXY_VIEW_ITEM* aDrawingSheet );
/**
* @return the current worksheet
* @return the current drawing-sheet
*/
KIGFX::WS_PROXY_VIEW_ITEM* GetWorksheet() const { return m_drawingSheet.get(); }
DS_PROXY_VIEW_ITEM* GetDrawingSheet() const { return m_drawingSheet.get(); }
protected:
///< Set rendering targets & dependencies for layers.
void setDefaultLayerDeps();
///< Currently used worksheet
std::unique_ptr<KIGFX::WS_PROXY_VIEW_ITEM> m_drawingSheet;
///< Currently used drawing-sheet (borders and title block)
std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
};

View File

@ -32,7 +32,7 @@
#include <gerbview_draw_panel_gal.h>
#include <gerbview_settings.h>
#include <gal/graphics_abstraction_layer.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <tool/tool_manager.h>
@ -750,9 +750,9 @@ void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, COLOR4D aColor )
case LAYER_GERBVIEW_DRAWINGSHEET:
settings->SetColor( LAYER_GERBVIEW_DRAWINGSHEET, aColor );
// LAYER_DRAWINGSHEET color is also used to draw the worksheet
// LAYER_DRAWINGSHEET color is also used to draw the drawing-sheet
// FIX ME: why LAYER_DRAWINGSHEET must be set, although LAYER_GERBVIEW_DRAWINGSHEET
// is used to initialize the worksheet color layer.
// is used to initialize the drawing-sheet color layer.
settings->SetColor( LAYER_DRAWINGSHEET, aColor );
break;
@ -819,22 +819,22 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
auto drawPanel = static_cast<GERBVIEW_DRAW_PANEL_GAL*>( GetCanvas() );
GERBVIEW_DRAW_PANEL_GAL* drawPanel = static_cast<GERBVIEW_DRAW_PANEL_GAL*>( GetCanvas() );
// Prepare worksheet template
auto worksheet = new KIGFX::WS_PROXY_VIEW_ITEM( IU_PER_MILS, &GetPageSettings(),
// Prepare drawing-sheet template
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( IU_PER_MILS, &GetPageSettings(),
&Prj(), &GetTitleBlock() );
if( GetScreen() )
{
worksheet->SetPageNumber( "1" );
worksheet->SetSheetCount( 1 );
drawingSheet->SetPageNumber( "1" );
drawingSheet->SetSheetCount( 1 );
}
worksheet->SetColorLayer( LAYER_GERBVIEW_DRAWINGSHEET );
drawingSheet->SetColorLayer( LAYER_GERBVIEW_DRAWINGSHEET );
// Draw panel takes ownership of the worksheet
drawPanel->SetDrawingSheet( worksheet );
// Draw panel takes ownership of the drawing-sheet
drawPanel->SetDrawingSheet( drawingSheet );
}

View File

@ -46,15 +46,12 @@ bool GERBVIEW_PRINTOUT::OnPrintPage( int aPage )
// Store the layerset, as it is going to be modified below and the original settings are needed
LSET lset = m_settings.m_LayerSet;
// The gerber filename of the page to print will be printed to the worksheet.
// Find this filename:
// Find the graphic layer number for the page to print
LSEQ seq = lset.UIOrder();
wxCHECK( unsigned( aPage - 1 ) < seq.size(), false );
auto layerId = seq[aPage - 1];
// In gerbview, draw layers are always printed on separate pages
// because handling negative objects when using only one page is tricky
// In gerbview, draw layers are always printed on separate pages because handling negative
// objects when using only one page is tricky
// Enable only one layer to create a printout
m_settings.m_LayerSet = LSET( layerId );

View File

@ -43,7 +43,7 @@ class PLOTTER;
* This class handle bitmap images in KiCad.
*
* It is not intended to be used alone, but inside another class so all methods are protected
* or private. It is used in #SCH_BITMAP class, #WS_DRAW_ITEM_BITMAP, and possibly others in
* or private. It is used in #SCH_BITMAP class, #DS_DRAW_ITEM_BITMAP, and possibly others in
* the future.
*
* @warning Not all plotters are able to plot a bitmap. Mainly GERBER plotters cannot.

View File

@ -108,7 +108,7 @@ protected:
///< Configures GAL object for a printout
virtual void setupGal( KIGFX::GAL* aGal );
///< Returns bounding box of the printed objects (excluding worksheet frame)
///< Returns bounding box of the printed objects (excluding drawing-sheet frame)
virtual EDA_RECT getBoundingBox() = 0;
///< Returns a PAINTER instance used to draw the items.

View File

@ -25,7 +25,7 @@
#include <widgets/unit_binder.h>
#include <dialog_page_settings_base.h>
class WS_DATA_MODEL;
class DS_DATA_MODEL;
/*!
* DIALOG_PAGES_SETTINGS class declaration
@ -123,7 +123,7 @@ protected:
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).
WS_DATA_MODEL* m_pagelayout; // the alternate and temporary page layout shown by the dialog
DS_DATA_MODEL* m_drawingSheet; // the alternate and temporary page layout shown by the dialog
// when the initial one is replaced by a new one
double m_iuPerMils;

View File

@ -22,20 +22,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file worksheet_dataitem.h
* @brief description of graphic items and texts to build a title block
*/
#ifndef WORKSHEET_DATA_ITEM_H
#define WORKSHEET_DATA_ITEM_H
#ifndef DS_DATA_ITEM_H
#define DS_DATA_ITEM_H
#include <math/vector2d.h>
#include <eda_text.h>
#include <bitmap_base.h>
#include "page_layout/ws_draw_item.h"
#include "drawing_sheet/ds_draw_item.h"
class WS_DRAW_ITEM_TEXT; // Forward declaration
class DS_DRAW_ITEM_TEXT; // Forward declaration
#define TB_DEFAULT_TEXTSIZE 1.5 // default worksheet text size in mm
@ -88,7 +83,7 @@ public:
/**
* Work sheet structure type definitions.
* Drawing sheet structure type definitions.
*
* Basic items are:
* * segment and rect (defined by 2 points)
@ -97,25 +92,25 @@ public:
* ( because we use it for logos, there are more than one polygon
* in this description
*/
class WS_DATA_ITEM
class DS_DATA_ITEM
{
public:
enum WS_ITEM_TYPE {
WS_TEXT,
WS_SEGMENT,
WS_RECT,
WS_POLYPOLYGON,
WS_BITMAP
enum DS_ITEM_TYPE {
DS_TEXT,
DS_SEGMENT,
DS_RECT,
DS_POLYPOLYGON,
DS_BITMAP
};
public:
WS_DATA_ITEM( WS_ITEM_TYPE aType );
DS_DATA_ITEM( DS_ITEM_TYPE aType );
virtual ~WS_DATA_ITEM();
virtual ~DS_DATA_ITEM();
const std::vector<WS_DRAW_ITEM_BASE*>& GetDrawItems() const { return m_drawItems; }
const std::vector<DS_DRAW_ITEM_BASE*>& GetDrawItems() const { return m_drawItems; }
virtual void SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView );
virtual void SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView );
void SetStart( double aPosx, double aPosy, enum CORNER_ANCHOR aAnchor = RB_CORNER )
{
@ -131,7 +126,7 @@ public:
m_End.m_Anchor = aAnchor;
}
WS_ITEM_TYPE GetType() const { return m_type; }
DS_ITEM_TYPE GetType() const { return m_type; }
/**
* @return true if the item has a end point (segment; rect) of false (text, polygon).
@ -202,10 +197,10 @@ public:
const wxString GetClassName() const;
protected:
WS_ITEM_TYPE m_type;
DS_ITEM_TYPE m_type;
PAGE_OPTION m_pageOption;
std::vector<WS_DRAW_ITEM_BASE*> m_drawItems;
std::vector<DS_DRAW_ITEM_BASE*> m_drawItems;
public:
wxString m_Name; // a item name used in page layout
@ -221,12 +216,12 @@ public:
};
class WS_DATA_ITEM_POLYGONS : public WS_DATA_ITEM
class DS_DATA_ITEM_POLYGONS : public DS_DATA_ITEM
{
public:
WS_DATA_ITEM_POLYGONS( );
DS_DATA_ITEM_POLYGONS( );
void SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
void SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
virtual int GetPenSizeUi() override;
@ -303,12 +298,12 @@ private:
};
class WS_DATA_ITEM_TEXT : public WS_DATA_ITEM
class DS_DATA_ITEM_TEXT : public DS_DATA_ITEM
{
public:
WS_DATA_ITEM_TEXT( const wxString& aTextBase );
DS_DATA_ITEM_TEXT( const wxString& aTextBase );
void SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
void SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
virtual int GetPenSizeUi() override;
@ -360,16 +355,16 @@ public:
class BITMAP_BASE;
class WS_DATA_ITEM_BITMAP : public WS_DATA_ITEM
class DS_DATA_ITEM_BITMAP : public DS_DATA_ITEM
{
public:
WS_DATA_ITEM_BITMAP( BITMAP_BASE* aImage ) :
WS_DATA_ITEM( WS_BITMAP )
DS_DATA_ITEM_BITMAP( BITMAP_BASE* aImage ) :
DS_DATA_ITEM( DS_BITMAP )
{
m_ImageBitmap = aImage;
}
void SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
void SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
int GetPPI() const;
void SetPPI( int aBitmapPPI );
@ -379,4 +374,4 @@ public:
};
#endif // WORKSHEET_DATA_ITEM_H
#endif // DS_DATA_ITEM_H

View File

@ -22,39 +22,40 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef WS_DATA_MODEL_H
#define WS_DATA_MODEL_H
#ifndef DS_DATA_MODEL_H
#define DS_DATA_MODEL_H
#include <math/vector2d.h>
#include <eda_text.h>
#include <bitmap_base.h>
class WS_DATA_ITEM;
class DS_DATA_ITEM;
class PAGE_INFO;
/**
* Handle the graphic items list to draw/plot the frame and title block.
*/
class WS_DATA_MODEL
class DS_DATA_MODEL
{
public:
WS_DATA_MODEL();
~WS_DATA_MODEL()
DS_DATA_MODEL();
~DS_DATA_MODEL()
{
ClearList();
}
/**
* static function: returns the instance of WS_DATA_MODEL used in the application
* static function: returns the instance of DS_DATA_MODEL used in the application
*/
static WS_DATA_MODEL& GetTheInstance();
static DS_DATA_MODEL& GetTheInstance();
/**
* Set an alternate instance of WS_DATA_MODEL.
* Set an alternate instance of DS_DATA_MODEL.
*
* @param aLayout the alternate page layout; if null restore the basic page layout
*/
static void SetAltInstance( WS_DATA_MODEL* aLayout = NULL );
static void SetAltInstance( DS_DATA_MODEL* aLayout = NULL );
double GetLeftMargin() { return m_leftMargin; }
void SetLeftMargin( double aMargin ) { m_leftMargin = aMargin; }
@ -106,25 +107,25 @@ public:
/**
* Fill the given string with an S-expr serialization of the WS_DATA_ITEMs.
*/
void SaveInString( std::vector<WS_DATA_ITEM*> aItemsList, wxString& aOutputString );
void SaveInString( std::vector<DS_DATA_ITEM*> aItemsList, wxString& aOutputString );
void Append( WS_DATA_ITEM* aItem );
void Remove( WS_DATA_ITEM* aItem );
void Append( DS_DATA_ITEM* aItem );
void Remove( DS_DATA_ITEM* aItem );
/**
* @return the index of aItem, or -1 if does not exist.
*/
int GetItemIndex( WS_DATA_ITEM* aItem ) const;
int GetItemIndex( DS_DATA_ITEM* aItem ) const;
/**
* @return is the item from it's index \a aIdx, or NULL if does not exist.
*/
WS_DATA_ITEM* GetItem( unsigned aIdx ) const;
DS_DATA_ITEM* GetItem( unsigned aIdx ) const;
/**
* @return a reference to the items.
*/
std::vector<WS_DATA_ITEM*>& GetItems() { return m_list; }
std::vector<DS_DATA_ITEM*>& GetItems() { return m_list; }
/**
* @return the item count.
@ -153,7 +154,7 @@ public:
* default internal description.
* @param Append if true: do not delete old layout, and load only \a aFullFileName.
*/
void SetPageLayout( const wxString& aFullFileName = wxEmptyString, bool Append = false );
void LoadDrawingSheet( const wxString& aFullFileName = wxEmptyString, bool Append = false );
/**
* Populate the list from a S expr description stored in a string.
@ -204,9 +205,9 @@ public:
// displayed "as this"
private:
std::vector <WS_DATA_ITEM*> m_list;
std::vector <DS_DATA_ITEM*> m_list;
bool m_allowVoidList; // If false, the default page layout will be loaded the
// first time WS_DRAW_ITEM_LIST::BuildDrawItemsList
// first time DS_DRAW_ITEM_LIST::BuildDrawItemsList
// is run (useful mainly for drawing sheet editor)
double m_leftMargin; // the left page margin in mm
double m_rightMargin; // the right page margin in mm
@ -216,4 +217,4 @@ private:
};
#endif // WS_DATA_MODEL_H
#endif // DS_DATA_MODEL_H

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef WS_DRAW_ITEM_H
#define WS_DRAW_ITEM_H
#ifndef DS_DRAW_ITEM_H
#define DS_DRAW_ITEM_H
#include <core/typeinfo.h>
#include <math/vector2d.h>
@ -36,7 +36,7 @@
#include <algorithm>
#include <vector>
class WS_DATA_ITEM;
class DS_DATA_ITEM;
class TITLE_BLOCK;
class PAGE_INFO;
class EDA_ITEM;
@ -55,12 +55,12 @@ class PROJECT;
* - 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
class DS_DRAW_ITEM_BASE : public EDA_ITEM
{
public:
virtual ~WS_DRAW_ITEM_BASE() {}
virtual ~DS_DRAW_ITEM_BASE() {}
WS_DATA_ITEM* GetPeer() const { return m_peer; }
DS_DATA_ITEM* GetPeer() const { return m_peer; }
int GetIndexInPeer() const { return m_index; }
void ViewGetLayers( int aLayers[], int& aCount ) const override;
@ -100,7 +100,7 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) override;
protected:
WS_DRAW_ITEM_BASE( WS_DATA_ITEM* aPeer, int aIndex, KICAD_T aType ) :
DS_DRAW_ITEM_BASE( DS_DATA_ITEM* aPeer, int aIndex, KICAD_T aType ) :
EDA_ITEM( aType )
{
m_peer = aPeer;
@ -109,26 +109,26 @@ protected:
m_flags = 0;
}
WS_DATA_ITEM* m_peer; // the parent WS_DATA_ITEM item in the WS_DATA_MODEL
DS_DATA_ITEM* m_peer; // the parent DS_DATA_ITEM item in the DS_DATA_MODEL
int m_index; // the index in the parent's repeat count
int m_penWidth;
};
// This class draws a thick segment
class WS_DRAW_ITEM_LINE : public WS_DRAW_ITEM_BASE
class DS_DRAW_ITEM_LINE : public DS_DRAW_ITEM_BASE
{
public:
WS_DRAW_ITEM_LINE( WS_DATA_ITEM* aPeer, int aIndex, wxPoint aStart, wxPoint aEnd,
DS_DRAW_ITEM_LINE( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aStart, wxPoint aEnd,
int aPenWidth ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_LINE_T )
DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_LINE_T )
{
m_start = aStart;
m_end = aEnd;
m_penWidth = aPenWidth;
}
virtual wxString GetClass() const override { return wxT( "WS_DRAW_ITEM_LINE" ); }
virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_LINE" ); }
const wxPoint& GetStart() const { return m_start; }
void SetStart( wxPoint aPos ) { m_start = aPos; }
@ -155,17 +155,17 @@ private:
};
class WS_DRAW_ITEM_POLYPOLYGONS : public WS_DRAW_ITEM_BASE
class DS_DRAW_ITEM_POLYPOLYGONS : public DS_DRAW_ITEM_BASE
{
public:
WS_DRAW_ITEM_POLYPOLYGONS( WS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos, int aPenWidth ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_POLY_T )
DS_DRAW_ITEM_POLYPOLYGONS( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos, int aPenWidth ) :
DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_POLY_T )
{
m_penWidth = aPenWidth;
m_pos = aPos;
}
virtual wxString GetClass() const override { return wxT( "WS_DRAW_ITEM_POLYPOLYGONS" ); }
virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_POLYPOLYGONS" ); }
SHAPE_POLY_SET& GetPolygons() { return m_Polygons; }
wxPoint GetPosition() const override { return m_pos; }
@ -194,7 +194,7 @@ public:
private:
wxPoint m_pos; // position of reference point, from the WS_DATA_ITEM_POLYGONS parent
wxPoint m_pos; // position of reference point, from the DS_DATA_ITEM_POLYGONS parent
// (used only in drawing sheet editor to draw anchors)
};
@ -202,19 +202,19 @@ private:
/**
* Non filled rectangle with thick segment.
*/
class WS_DRAW_ITEM_RECT : public WS_DRAW_ITEM_BASE
class DS_DRAW_ITEM_RECT : public DS_DRAW_ITEM_BASE
{
public:
WS_DRAW_ITEM_RECT( WS_DATA_ITEM* aPeer, int aIndex, wxPoint aStart, wxPoint aEnd,
DS_DRAW_ITEM_RECT( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aStart, wxPoint aEnd,
int aPenWidth ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_RECT_T )
DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_RECT_T )
{
m_start = aStart;
m_end = aEnd;
m_penWidth = aPenWidth;
}
virtual wxString GetClass() const override { return wxT( "WS_DRAW_ITEM_RECT" ); }
virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_RECT" ); }
const wxPoint& GetStart() const { return m_start; }
void SetStart( wxPoint aPos ) { m_start = aPos; }
@ -246,20 +246,20 @@ private:
* A rectangle with thick segment showing the page limits and a marker showing the coordinate
* origin.
*
* This only a draw item only. Therefore m_peer ( the parent WS_DATA_ITEM item in the
* WS_DATA_MODEL) is always a nullptr.
* This only a draw item only. Therefore m_peer ( the parent DS_DATA_ITEM item in the
* DS_DATA_MODEL) is always a nullptr.
*/
class WS_DRAW_ITEM_PAGE : public WS_DRAW_ITEM_BASE
class DS_DRAW_ITEM_PAGE : public DS_DRAW_ITEM_BASE
{
public:
WS_DRAW_ITEM_PAGE( int aPenWidth, double aMarkerSize ) :
WS_DRAW_ITEM_BASE( nullptr, 0, WSG_PAGE_T )
DS_DRAW_ITEM_PAGE( int aPenWidth, double aMarkerSize ) :
DS_DRAW_ITEM_BASE( nullptr, 0, WSG_PAGE_T )
{
m_penWidth = aPenWidth;
m_markerSize = aMarkerSize;
}
virtual wxString GetClass() const override { return wxT( "WS_DRAW_ITEM_PAGE" ); }
virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_PAGE" ); }
void SetPageSize( wxSize aSize ) { m_pageSize = aSize; }
wxSize GetPageSize() const { return m_pageSize; }
@ -294,13 +294,13 @@ private:
* It is derived from an #EDA_TEXT, so it handle all characteristics of this graphic text
* (justification, rotation ... ).
*/
class WS_DRAW_ITEM_TEXT : public WS_DRAW_ITEM_BASE, public EDA_TEXT
class DS_DRAW_ITEM_TEXT : public DS_DRAW_ITEM_BASE, public EDA_TEXT
{
public:
WS_DRAW_ITEM_TEXT( WS_DATA_ITEM* aPeer, int aIndex, wxString& aText, wxPoint aPos,
DS_DRAW_ITEM_TEXT( DS_DATA_ITEM* aPeer, int aIndex, wxString& aText, wxPoint aPos,
wxSize aSize, int aPenWidth, bool aItalic = false,
bool aBold = false ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_TEXT_T),
DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_TEXT_T),
EDA_TEXT( aText )
{
SetTextPos( aPos );
@ -310,7 +310,7 @@ public:
SetBold( aBold );
}
virtual wxString GetClass() const override { return wxT( "WS_DRAW_ITEM_TEXT" ); }
virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_TEXT" ); }
void PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
@ -334,18 +334,18 @@ public:
/**
* A bitmap.
*/
class WS_DRAW_ITEM_BITMAP : public WS_DRAW_ITEM_BASE
class DS_DRAW_ITEM_BITMAP : public DS_DRAW_ITEM_BASE
{
public:
WS_DRAW_ITEM_BITMAP( WS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_BITMAP_T )
DS_DRAW_ITEM_BITMAP( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos ) :
DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_BITMAP_T )
{
m_pos = aPos;
}
~WS_DRAW_ITEM_BITMAP() {}
~DS_DRAW_ITEM_BITMAP() {}
virtual wxString GetClass() const override { return wxT( "WS_DRAW_ITEM_BITMAP" ); }
virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_BITMAP" ); }
wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPos ) override { m_pos = aPos; }
@ -373,10 +373,10 @@ private:
* the title block and frame references, and parameters to
* draw/plot them
*/
class WS_DRAW_ITEM_LIST
class DS_DRAW_ITEM_LIST
{
public:
WS_DRAW_ITEM_LIST()
DS_DRAW_ITEM_LIST()
{
m_idx = 0;
m_milsToIu = 1.0;
@ -390,10 +390,10 @@ public:
m_isFirstPage = true;
}
~WS_DRAW_ITEM_LIST()
~DS_DRAW_ITEM_LIST()
{
// Items in the m_graphicList are owned by their respective WORKSHEET_DATAITEMs.
// for( WS_DRAW_ITEM_BASE* item : m_graphicList )
// for( DS_DRAW_ITEM_BASE* item : m_graphicList )
// delete item;
}
@ -470,18 +470,18 @@ public:
m_sheetCount = aSheetCount;
}
void Append( WS_DRAW_ITEM_BASE* aItem )
void Append( DS_DRAW_ITEM_BASE* aItem )
{
m_graphicList.push_back( aItem );
}
void Remove( WS_DRAW_ITEM_BASE* aItem )
void Remove( DS_DRAW_ITEM_BASE* aItem )
{
auto newEnd = std::remove( m_graphicList.begin(), m_graphicList.end(), aItem );
m_graphicList.erase( newEnd, m_graphicList.end() );
}
WS_DRAW_ITEM_BASE* GetFirst()
DS_DRAW_ITEM_BASE* GetFirst()
{
m_idx = 0;
@ -491,7 +491,7 @@ public:
return NULL;
}
WS_DRAW_ITEM_BASE* GetNext()
DS_DRAW_ITEM_BASE* GetNext()
{
m_idx++;
@ -501,7 +501,7 @@ public:
return NULL;
}
void GetAllItems( std::vector<WS_DRAW_ITEM_BASE*>* aList )
void GetAllItems( std::vector<DS_DRAW_ITEM_BASE*>* aList )
{
*aList = m_graphicList;
}
@ -561,7 +561,7 @@ public:
wxString BuildFullText( const wxString& aTextbase );
protected:
std::vector <WS_DRAW_ITEM_BASE*> m_graphicList; // Items to draw/plot
std::vector <DS_DRAW_ITEM_BASE*> m_graphicList; // Items to draw/plot
unsigned m_idx; // for GetFirst, GetNext functions
double m_milsToIu; // the scalar to convert pages units ( mils)
// to draw/plot units.
@ -580,4 +580,4 @@ protected:
};
#endif // WS_DRAW_ITEM_H
#endif // DS_DRAW_ITEM_H

View File

@ -23,13 +23,13 @@
// For page and paper size, values are in 1/1000 inch
#ifndef WS_PAINTER_H
#define WS_PAINTER_H
#ifndef DS_PAINTER_H
#define DS_PAINTER_H
#include <gal/color4d.h>
#include <painter.h>
#include <page_info.h>
#include <page_layout/ws_draw_item.h>
#include <drawing_sheet/ds_draw_item.h>
// Forward declarations:
class EDA_RECT;
@ -43,12 +43,12 @@ namespace KIGFX
/**
* Store page-layout-specific render settings.
*/
class WS_RENDER_SETTINGS : public RENDER_SETTINGS
class DS_RENDER_SETTINGS : public RENDER_SETTINGS
{
public:
friend class WS_PAINTER;
friend class DS_PAINTER;
WS_RENDER_SETTINGS();
DS_RENDER_SETTINGS();
void LoadColors( const COLOR_SETTINGS* aSettings ) override;
@ -95,10 +95,10 @@ private:
/**
* Methods for drawing worksheet items.
*/
class WS_PAINTER : public PAINTER
class DS_PAINTER : public PAINTER
{
public:
WS_PAINTER( GAL* aGal ) :
DS_PAINTER( GAL* aGal ) :
PAINTER( aGal )
{ }
@ -111,15 +111,15 @@ public:
virtual RENDER_SETTINGS* GetSettings() override { return &m_renderSettings; }
private:
void draw( const WS_DRAW_ITEM_LINE* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_RECT* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_POLYPOLYGONS* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_BITMAP* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_PAGE* aItem, int aLayer ) const;
void draw( const DS_DRAW_ITEM_LINE* aItem, int aLayer ) const;
void draw( const DS_DRAW_ITEM_RECT* aItem, int aLayer ) const;
void draw( const DS_DRAW_ITEM_POLYPOLYGONS* aItem, int aLayer ) const;
void draw( const DS_DRAW_ITEM_TEXT* aItem, int aLayer ) const;
void draw( const DS_DRAW_ITEM_BITMAP* aItem, int aLayer ) const;
void draw( const DS_DRAW_ITEM_PAGE* aItem, int aLayer ) const;
private:
WS_RENDER_SETTINGS m_renderSettings;
DS_RENDER_SETTINGS m_renderSettings;
};
} // namespace KIGFX
@ -144,10 +144,10 @@ private:
* - the LTmargin The left top margin of the page layout.
* - the RBmargin The right bottom margin of the page layout.
*/
void PrintPageLayout( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
const wxString& aFullSheetName, const wxString& aFileName,
const TITLE_BLOCK& aTitleBlock, int aSheetCount, const wxString& aPageNumber,
double aScalar, const PROJECT* aProject,
const TITLE_BLOCK& aTitleBlock, int aSheetCount,
const wxString& aPageNumber, double aScalar, const PROJECT* aProject,
const wxString& aSheetLayer = wxEmptyString, bool aIsFirstPage = true );
#endif // WS_PAINTER_H
#endif // DS_PAINTER_H

View File

@ -22,18 +22,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef WS_PROXY_UNDO_ITEM_H
#define WS_PROXY_UNDO_ITEM_H
#ifndef DS_PROXY_UNDO_ITEM_H
#define DS_PROXY_UNDO_ITEM_H
#include <eda_item.h>
#include <title_block.h>
#include <page_info.h>
class WS_PROXY_UNDO_ITEM : public EDA_ITEM
class DS_PROXY_UNDO_ITEM : public EDA_ITEM
{
public:
WS_PROXY_UNDO_ITEM( const EDA_DRAW_FRAME* aFrame );
DS_PROXY_UNDO_ITEM( const EDA_DRAW_FRAME* aFrame );
/*
* Restores the saved worksheet layout to the global worksheet record, and the saved
@ -49,7 +49,7 @@ public:
wxString GetClass() const override
{
return wxT( "WS_PROXY_UNDO_ITEM" );
return wxT( "DS_PROXY_UNDO_ITEM" );
}
protected:
@ -60,4 +60,4 @@ protected:
int m_selectedDrawItem;
};
#endif /* WS_PROXY_UNDO_ITEM_H */
#endif /* DS_PROXY_UNDO_ITEM_H */

View File

@ -23,8 +23,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef WS_PROXY_VIEW_ITEM_H
#define WS_PROXY_VIEW_ITEM_H
#ifndef DS_PROXY_VIEW_ITEM_H
#define DS_PROXY_VIEW_ITEM_H
#include <eda_item.h>
@ -32,21 +32,22 @@ class BOARD;
class PAGE_INFO;
class PROJECT;
class TITLE_BLOCK;
class WS_DRAW_ITEM_LINE;
class WS_DRAW_ITEM_RECT;
class WS_DRAW_ITEM_TEXT;
class WS_DRAW_ITEM_BITMAP;
class WS_DRAW_ITEM_LIST;
class DS_DRAW_ITEM_LINE;
class DS_DRAW_ITEM_RECT;
class DS_DRAW_ITEM_TEXT;
class DS_DRAW_ITEM_BITMAP;
class DS_DRAW_ITEM_LIST;
namespace KIGFX
{
class VIEW;
class GAL;
}
class WS_PROXY_VIEW_ITEM : public EDA_ITEM
class DS_PROXY_VIEW_ITEM : public EDA_ITEM
{
public:
WS_PROXY_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const PROJECT* aProject,
DS_PROXY_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const PROJECT* aProject,
const TITLE_BLOCK* aTitleBlock );
/**
@ -65,7 +66,7 @@ public:
void SetPageNumber( const std::string& aPageNumber ) { m_pageNumber = aPageNumber; }
/**
* Change the sheets count number displayed in the title block.
* Changes the sheet-count number displayed in the title block.
*/
void SetSheetCount( int aSheetCount ) { m_sheetCount = aSheetCount; }
@ -102,7 +103,7 @@ public:
const BOX2I ViewBBox() const override;
/// @copydoc VIEW_ITEM::ViewDraw()
void ViewDraw( int aLayer, VIEW* aView ) const override;
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
/// @copydoc VIEW_ITEM::ViewGetLayers()
void ViewGetLayers( int aLayers[], int& aCount ) const override;
@ -117,13 +118,13 @@ public:
*/
virtual wxString GetClass() const override
{
return wxT( "WS_PROXY_VIEW_ITEM" );
return wxT( "DS_PROXY_VIEW_ITEM" );
}
bool HitTestDrawingSheetItems( VIEW* aView, const wxPoint& aPosition );
bool HitTestDrawingSheetItems( KIGFX::VIEW* aView, const wxPoint& aPosition );
protected:
void buildDrawList( VIEW* aView, WS_DRAW_ITEM_LIST* aDrawList ) const;
void buildDrawList( KIGFX::VIEW* aView, DS_DRAW_ITEM_LIST* aDrawList ) const;
/// the factor between mils (units used in worksheet and internal units)
/// it is the value IU_PER_MILS used in the caller
@ -144,6 +145,5 @@ protected:
/// Layer that is used for page border color
int m_pageBorderColorLayer;
};
}
#endif /* WS_PROXY_VIEW_ITEM_H */
#endif /* DS_PROXY_VIEW_ITEM_H */

View File

@ -302,7 +302,7 @@ public:
void AddStandardSubMenus( TOOL_MENU& aMenu );
/**
* Prints the drawing sheet with the frame and title block.
* Prints the drawing-sheet (frame and title block).
*
* @param aScreen screen to draw.
* @param aMils2Iu The mils to Iu conversion factor.

View File

@ -18,7 +18,6 @@ set( DIALOGS_SRCS
dialogs/properties_frame_base.cpp
dialogs/dialogs_for_printing.cpp
dialogs/dialog_new_dataitem_base.cpp
dialogs/dialog_new_dataitem.cpp
dialogs/dialog_design_inspector_base.cpp
dialogs/design_inspector.cpp
dialogs/panel_pl_editor_color_settings.cpp

View File

@ -26,9 +26,9 @@
#include <wx/wupdlock.h>
#include <eda_item.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <tool/tool_manager.h>
#include "dialogs/dialog_design_inspector_base.h"
@ -209,7 +209,7 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
m_itemsList.clear();
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& drawingSheet = DS_DATA_MODEL::GetTheInstance();
wxFileName fn( static_cast<PL_EDITOR_FRAME*>( GetParent() )->GetCurrentFileName() );
if( fn.GetName().IsEmpty() )
@ -227,33 +227,33 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
Iu2Millimeter( page_sizeIU.x ), Iu2Millimeter( page_sizeIU.y ) ) );
GetGridList()->SetCellRenderer (row, COL_BITMAP, new BitmapGridCellRenderer( root_xpm ) );
GetGridList()->SetReadOnly( row, COL_BITMAP );
m_itemsList.push_back( nullptr ); // this item is not a WS_DATA_ITEM, just a pseudo item
m_itemsList.push_back( nullptr ); // this item is not a DS_DATA_ITEM, just a pseudo item
// Now adding all current items
row++;
for( WS_DATA_ITEM* item : pglayout.GetItems() )
for( DS_DATA_ITEM* item : drawingSheet.GetItems() )
{
const char** img = nullptr;
switch( item->GetType() )
{
case WS_DATA_ITEM::WS_SEGMENT:
case DS_DATA_ITEM::DS_SEGMENT:
img = line_xpm;
break;
case WS_DATA_ITEM::WS_RECT:
case DS_DATA_ITEM::DS_RECT:
img = rect_xpm;
break;
case WS_DATA_ITEM::WS_TEXT:
case DS_DATA_ITEM::DS_TEXT:
img = text_xpm;
break;
case WS_DATA_ITEM::WS_POLYPOLYGON:
case DS_DATA_ITEM::DS_POLYPOLYGON:
img = poly_xpm;
break;
case WS_DATA_ITEM::WS_BITMAP:
case DS_DATA_ITEM::DS_BITMAP:
img = img_xpm;
break;
}
@ -266,9 +266,9 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
wxString::Format( "%d", item->m_RepeatCount ) );
GetGridList()->SetCellValue( row, COL_COMMENT, item->m_Info );
if( item->GetType() == WS_DATA_ITEM::WS_TEXT )
if( item->GetType() == DS_DATA_ITEM::DS_TEXT )
{
WS_DATA_ITEM_TEXT* t_item = static_cast<WS_DATA_ITEM_TEXT*>( item );
DS_DATA_ITEM_TEXT* t_item = static_cast<DS_DATA_ITEM_TEXT*>( item );
GetGridList()->SetCellValue( row, COL_TEXTSTRING, t_item->m_TextBase );
}
@ -303,10 +303,10 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
}
// Select the row corresponding to the WS_DATA_ITEM aItem
void DIALOG_INSPECTOR::SelectRow( WS_DATA_ITEM* aItem )
// Select the row corresponding to the DS_DATA_ITEM aItem
void DIALOG_INSPECTOR::SelectRow( DS_DATA_ITEM* aItem )
{
// m_itemsList[0] is not a true WS_DATA_ITEM
// m_itemsList[0] is not a true DS_DATA_ITEM
for( unsigned row = 1; row < m_itemsList.size(); ++row )
{
if( m_itemsList[row] == aItem )
@ -319,29 +319,20 @@ void DIALOG_INSPECTOR::SelectRow( WS_DATA_ITEM* aItem )
}
//return the page layout item managed by the cell
WS_DATA_ITEM* DIALOG_INSPECTOR::GetWsDataItem( int aRow ) const
DS_DATA_ITEM* DIALOG_INSPECTOR::GetDrawingSheetDataItem( int aRow ) const
{
return ( aRow >= 0 && aRow < (int)m_itemsList.size() ) ? m_itemsList[aRow]: nullptr;
}
/* return the page layout item managed by the selected cell (or NULL)
*/
WS_DATA_ITEM* DIALOG_INSPECTOR::GetSelectedWsDataItem() const
{
int idx = GetGridList()->GetGridCursorRow();
return GetWsDataItem( idx );
}
void DIALOG_INSPECTOR::onCellClicked( wxGridEvent& event )
{
int row = event.GetRow();
GetGridList()->SelectRow( row );
WS_DATA_ITEM* item = GetWsDataItem( row );
DS_DATA_ITEM* item = GetDrawingSheetDataItem( row );
if( !item ) // only WS_DATA_ITEM are returned.
if( !item ) // only DS_DATA_ITEM are returned.
return;
// Select this item in drawing sheet editor, and update the properties panel:

View File

@ -43,8 +43,8 @@ private:
wxGrid* GetGridList() const { return m_gridListItems; }
void onCellClicked( wxGridEvent& event ) override;
// The list of WS_DATA_ITEM found in page layout
std::vector<WS_DATA_ITEM*> m_itemsList;
// The list of DS_DATA_ITEM found in page layout
std::vector<DS_DATA_ITEM*> m_itemsList;
PL_EDITOR_FRAME* m_editorFrame;
public:
@ -53,16 +53,13 @@ public:
void ReCreateDesignList();
/** @return the WS_DATA_ITEM item managed by the grid row
/**
* @return the DS_DATA_ITEM item managed by the grid row
*/
WS_DATA_ITEM* GetWsDataItem( int aRow ) const;
DS_DATA_ITEM* GetDrawingSheetDataItem( int aRow ) const;
/** @return the page layout item managed by the selected row (or NULL)
*/
WS_DATA_ITEM* GetSelectedWsDataItem() const;
// Select the tree item corresponding to the WS_DATA_ITEM aItem
void SelectRow( WS_DATA_ITEM* aItem );
// Select the tree item corresponding to the DS_DATA_ITEM aItem
void SelectRow( DS_DATA_ITEM* aItem );
};
#endif /* _DESIGN_INSPECTOR_H */

View File

@ -1,168 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
*
* 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
*/
#include <eda_item.h>
#include <page_layout/ws_data_item.h>
#include "dialog_new_dataitem_base.h"
#include "pl_editor_frame.h"
class DIALOG_NEW_DATAITEM : public DIALOG_NEW_DATAITEM_BASE
{
WS_DATA_ITEM* m_item;
public:
DIALOG_NEW_DATAITEM( PL_EDITOR_FRAME* aCaller, WS_DATA_ITEM* aItem );
private:
void OnOKClick( wxCommandEvent& event ) override;
void initDlg();
};
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, WS_DATA_ITEM* aItem )
: DIALOG_NEW_DATAITEM_BASE( aCaller )
{
m_item = aItem;
initDlg();
GetSizer()->SetSizeHints( this );
Centre();
}
void DIALOG_NEW_DATAITEM::OnOKClick( wxCommandEvent& event )
{
if( m_item->GetType() == WS_DATA_ITEM::WS_TEXT )
{
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
text->m_TextBase.Replace( wxT("\n"), wxT("\\n") );
}
wxString msg;
// Import Start point
double dtmp;
msg = m_textCtrlPosX->GetValue();
msg.ToDouble( &dtmp );
m_item->m_Pos.m_Pos.x = dtmp;
msg = m_textCtrlPosY->GetValue();
msg.ToDouble( &dtmp );
m_item->m_Pos.m_Pos.y = dtmp;
switch( m_choiceCornerPos->GetSelection() )
{
case 2: m_item->m_Pos.m_Anchor = RB_CORNER; break;
case 0: m_item->m_Pos.m_Anchor = RT_CORNER; break;
case 3: m_item->m_Pos.m_Anchor = LB_CORNER; break;
case 1: m_item->m_Pos.m_Anchor = LT_CORNER; break;
}
// Import End point
msg = m_textCtrlEndX->GetValue();
msg.ToDouble( &dtmp );
m_item->m_End.m_Pos.x = dtmp;
msg = m_textCtrlEndY->GetValue();
msg.ToDouble( &dtmp );
m_item->m_End.m_Pos.y = dtmp;
switch( m_choiceCornerEnd->GetSelection() )
{
case 2: m_item->m_End.m_Anchor = RB_CORNER; break;
case 0: m_item->m_End.m_Anchor = RT_CORNER; break;
case 3: m_item->m_End.m_Anchor = LB_CORNER; break;
case 1: m_item->m_End.m_Anchor = LT_CORNER; break;
}
EndModal( wxID_OK);
}
void DIALOG_NEW_DATAITEM::initDlg()
{
// Disable useless widgets, depending on WS_DATA_ITEM type
switch( m_item->GetType() )
{
case WS_DATA_ITEM::WS_SEGMENT:
case WS_DATA_ITEM::WS_RECT:
m_textCtrlText->Enable( false );
break;
case WS_DATA_ITEM::WS_BITMAP:
case WS_DATA_ITEM::WS_POLYPOLYGON:
m_textCtrlText->Enable( false );
KI_FALLTHROUGH;
case WS_DATA_ITEM::WS_TEXT:
m_textCtrlEndX->Enable( false );
m_textCtrlEndY->Enable( false );
m_choiceCornerEnd->Enable( false );
break;
}
wxString msg;
// Position/ start point
msg.Printf( wxT("%.3f"), m_item->m_Pos.m_Pos.x );
m_textCtrlPosX->SetValue( msg );
msg.Printf( wxT("%.3f"), m_item->m_Pos.m_Pos.y );
m_textCtrlPosY->SetValue( msg );
switch( m_item->m_Pos.m_Anchor )
{
case RB_CORNER: m_choiceCornerPos->SetSelection( 2 ); break;
case RT_CORNER: m_choiceCornerPos->SetSelection( 0 ); break;
case LB_CORNER: m_choiceCornerPos->SetSelection( 3 ); break;
case LT_CORNER: m_choiceCornerPos->SetSelection( 1 ); break;
}
// End point
msg.Printf( wxT("%.3f"), m_item->m_End.m_Pos.x );
m_textCtrlEndX->SetValue( msg );
msg.Printf( wxT("%.3f"), m_item->m_End.m_Pos.y );
m_textCtrlEndY->SetValue( msg );
switch( m_item->m_End.m_Anchor )
{
case RB_CORNER: m_choiceCornerEnd->SetSelection( 2 ); break;
case RT_CORNER: m_choiceCornerEnd->SetSelection( 0 ); break;
case LB_CORNER: m_choiceCornerEnd->SetSelection( 3 ); break;
case LT_CORNER: m_choiceCornerEnd->SetSelection( 1 ); break;
}
if( m_item->GetType() == WS_DATA_ITEM::WS_TEXT )
m_textCtrlText->SetValue( ((WS_DATA_ITEM_TEXT*)m_item)->m_TextBase );
}

View File

@ -32,10 +32,10 @@
#include <dialog_helpers.h>
#include <eda_item.h>
#include <gr_basic.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_painter.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_painter.h>
#include <dialogs/dialog_page_settings.h>
#include "invoke_pl_editor_dialog.h"
@ -188,19 +188,19 @@ void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
screen->SetVirtualPageNumber( aPageNum );
KIGFX::WS_RENDER_SETTINGS renderSettings;
KIGFX::DS_RENDER_SETTINGS renderSettings;
renderSettings.SetDefaultPenWidth( 1 );
renderSettings.SetLayerColor( LAYER_DRAWINGSHEET, COLOR4D( RED ) );
renderSettings.SetPrintDC( dc );
// Ensure the scaling factor (used only in printing) of bitmaps is up to date
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
for( WS_DATA_ITEM* dataItem : model.GetItems() )
for( DS_DATA_ITEM* dataItem : model.GetItems() )
{
if( dataItem->GetType() == WS_DATA_ITEM::WS_BITMAP )
if( dataItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
{
BITMAP_BASE* bitmap = static_cast<WS_DATA_ITEM_BITMAP*>( dataItem )->m_ImageBitmap;
BITMAP_BASE* bitmap = static_cast<DS_DATA_ITEM_BITMAP*>( dataItem )->m_ImageBitmap;
bitmap->SetPixelSizeIu( IU_PER_MILS * 1000 / bitmap->GetPPI() );
}
}

View File

@ -26,13 +26,12 @@
#include <project.h>
#include <scintilla_tricks.h>
#include <tool/tool_manager.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <view/view.h>
#include "properties_frame.h"
#include "pl_draw_panel_gal.h"
#include "pl_editor_frame.h"
#include "tools/pl_selection_tool.h"
@ -101,7 +100,7 @@ wxSize PROPERTIES_FRAME::GetMinSize() const
// Data transfert from general properties to widgets
void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
// Set default parameters
m_textCtrlDefaultLineWidthBinder.SetDoubleValue(
@ -125,7 +124,7 @@ void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
// Data transfert from widgets to general properties
bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
// Import default parameters from widgets
model.m_DefaultLineWidth =
@ -156,7 +155,7 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
// Data transfert from item to widgets in properties frame
void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
{
if( !aItem )
{
@ -166,7 +165,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
wxString msg;
// Set parameters common to all WS_DATA_ITEM types
// Set parameters common to all DS_DATA_ITEM types
m_staticTextType->SetLabel( aItem->GetClassName() );
m_textCtrlComment->SetValue( aItem->m_Info );
@ -210,12 +209,12 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
m_textCtrlThicknessBinder.SetDoubleValue(
From_User_Unit( EDA_UNITS::MILLIMETRES, aItem->m_LineWidth ) );
// Now, set prms more specific to WS_DATA_ITEM types
// Now, set prms more specific to DS_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() == WS_DATA_ITEM::WS_TEXT )
if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
{
WS_DATA_ITEM_TEXT* item = (WS_DATA_ITEM_TEXT*) aItem;
DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
item->m_FullText = item->m_TextBase;
// Replace our '\' 'n' sequence by the EOL char
item->ReplaceAntiSlashSequence();
@ -259,17 +258,17 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
From_User_Unit( EDA_UNITS::MILLIMETRES, item->m_TextSize.y ) );
}
if( aItem->GetType() == WS_DATA_ITEM::WS_POLYPOLYGON )
if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
{
WS_DATA_ITEM_POLYGONS* item = (WS_DATA_ITEM_POLYGONS*) aItem;
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
// Rotation (poly and text)
msg.Printf( wxT("%.3f"), item->m_Orient );
m_textCtrlRotation->SetValue( msg );
}
if( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP )
if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
{
WS_DATA_ITEM_BITMAP* item = (WS_DATA_ITEM_BITMAP*) aItem;
DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
// select definition in PPI
msg.Printf( wxT("%d"), item->GetPPI() );
m_textCtrlBitmapDPI->SetValue( msg );
@ -277,15 +276,15 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
m_SizerItemProperties->Show( true );
m_SizerTextOptions->Show( aItem->GetType() == WS_DATA_ITEM::WS_TEXT );
m_SizerTextOptions->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
m_sbSizerEndPosition->Show( aItem->GetType() == WS_DATA_ITEM::WS_SEGMENT
|| aItem->GetType() == WS_DATA_ITEM::WS_RECT );
m_sbSizerEndPosition->Show( aItem->GetType() == DS_DATA_ITEM::DS_SEGMENT
|| aItem->GetType() == DS_DATA_ITEM::DS_RECT );
m_textCtrlThicknessBinder.Show( aItem->GetType() != WS_DATA_ITEM::WS_BITMAP );
m_textCtrlThicknessBinder.Show( aItem->GetType() != DS_DATA_ITEM::DS_BITMAP );
if( aItem->GetType() == WS_DATA_ITEM::WS_TEXT
|| aItem->GetType() == WS_DATA_ITEM::WS_POLYPOLYGON )
if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT
|| aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
{
m_staticTextRot->Show( true );
m_textCtrlRotation->Show( true );
@ -296,11 +295,11 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
m_textCtrlRotation->Show( false );
}
m_staticTextBitmapDPI->Show( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP );
m_textCtrlBitmapDPI->Show( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP );
m_staticTextBitmapDPI->Show( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP );
m_textCtrlBitmapDPI->Show( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP );
m_staticTextInclabel->Show( aItem->GetType() == WS_DATA_ITEM::WS_TEXT );
m_textCtrlTextIncrement->Show( aItem->GetType() == WS_DATA_ITEM::WS_TEXT );
m_staticTextInclabel->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
m_textCtrlTextIncrement->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
// Repeat parameters
msg.Printf( wxT("%d"), aItem->m_RepeatCount );
@ -334,11 +333,11 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
m_parent->SaveCopyInUndoList();
WS_DRAW_ITEM_BASE* drawItem = (WS_DRAW_ITEM_BASE*) selection.Front();
DS_DRAW_ITEM_BASE* drawItem = (DS_DRAW_ITEM_BASE*) selection.Front();
if( drawItem )
{
WS_DATA_ITEM* dataItem = drawItem->GetPeer();
DS_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")
@ -361,7 +360,7 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
{
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
model.m_DefaultTextSize = DSIZE( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE );
model.m_DefaultLineWidth = 0.15;
@ -376,7 +375,7 @@ void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
// Data transfert from properties frame to item parameters
bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem )
bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
{
if( aItem == NULL )
return false;
@ -430,9 +429,9 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem )
aItem->m_IncrementVector.x = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlStepXBinder.GetValue() );
aItem->m_IncrementVector.y = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlStepYBinder.GetValue() );
if( aItem->GetType() == WS_DATA_ITEM::WS_TEXT )
if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
{
WS_DATA_ITEM_TEXT* item = (WS_DATA_ITEM_TEXT*) aItem;
DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
item->m_TextBase = m_stcText->GetValue();
@ -473,17 +472,17 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem )
To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlConstraintYBinder.GetValue() );
}
if( aItem->GetType() == WS_DATA_ITEM::WS_POLYPOLYGON )
if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
{
WS_DATA_ITEM_POLYGONS* item = (WS_DATA_ITEM_POLYGONS*) aItem;
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
msg = m_textCtrlRotation->GetValue();
item->m_Orient = DoubleValueFromString( EDA_UNITS::UNSCALED, msg );
}
if( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP )
if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
{
WS_DATA_ITEM_BITMAP* item = (WS_DATA_ITEM_BITMAP*) aItem;
DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
long value;
msg = m_textCtrlBitmapDPI->GetValue();
@ -507,7 +506,7 @@ void PROPERTIES_FRAME::onScintillaCharAdded( wxStyledTextEvent &aEvent )
&& m_stcText->GetCharAt( start-2 ) == '$'
&& m_stcText->GetCharAt( start-1 ) == '{' )
{
WS_DRAW_ITEM_LIST::GetTextVars( &autocompleteTokens );
DS_DRAW_ITEM_LIST::GetTextVars( &autocompleteTokens );
partial = m_stcText->GetTextRange( start, pos );

View File

@ -32,7 +32,7 @@
#include "dialogs/properties_frame_base.h"
#include <widgets/unit_binder.h>
class WS_DATA_ITEM;
class DS_DATA_ITEM;
class PL_EDITOR_FRAME;
class SCINTILLA_TRICKS;
@ -91,10 +91,10 @@ public:
bool CopyPrmsFromPanelToGeneral();
// Data transfert from item to widgets in properties frame
void CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem );
void CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem );
// Data transfert from widgets in properties frame to item
bool CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem );
bool CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem );
wxSize GetMinSize() const override;
};

View File

@ -26,7 +26,7 @@
#include <confirm.h>
#include <gestfich.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_data_model.h>
#include <paths.h>
#include <widgets/infobar.h>
#include <wildcards_and_files_ext.h>
@ -89,7 +89,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
wxString msg;
int id = event.GetId();
wxString filename = GetCurrentFileName();
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& pglayout = DS_DATA_MODEL::GetTheInstance();
if( filename.IsEmpty() && id == wxID_SAVE )
id = wxID_SAVEAS;
@ -223,7 +223,7 @@ bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName )
{
if( wxFileExists( aFullFileName ) )
{
WS_DATA_MODEL::GetTheInstance().SetPageLayout( aFullFileName );
DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( aFullFileName );
SetCurrentFileName( aFullFileName );
UpdateFileHistory( aFullFileName );
GetScreen()->ClrModify();
@ -251,7 +251,7 @@ bool PL_EDITOR_FRAME::InsertPageLayoutDescrFile( const wxString& aFullFileName )
{
const bool append = true;
SaveCopyInUndoList();
WS_DATA_MODEL::GetTheInstance().SetPageLayout( aFullFileName, append );
DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( aFullFileName, append );
return true;
}
@ -269,7 +269,7 @@ bool PL_EDITOR_FRAME::SavePageLayoutDescrFile( const wxString& aFullFileName )
try
{
WS_DATA_MODEL::GetTheInstance().Save( tempFile.GetFullPath() );
DS_DATA_MODEL::GetTheInstance().Save( tempFile.GetFullPath() );
}
catch( const IO_ERROR& )
{

View File

@ -42,15 +42,11 @@
// Often this is not used in the prototypes, since wxFrame is good enough and would
// represent maximum information hiding.
class PL_EDITOR_FRAME;
class WS_DATA_ITEM;
class DS_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, WS_DATA_ITEM* aItem );
/// Create and show a print dialog
/// returns 1 if OK, 0 , there is a problem.
int InvokeDialogPrint( PL_EDITOR_FRAME* aCaller, wxPrintData* aPrintData,

View File

@ -23,10 +23,10 @@
#include <view/view.h>
#include <tool/tool_manager.h>
#include <view/wx_view_controls.h>
#include <page_layout/ws_proxy_view_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_painter.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_painter.h>
#include <pgm_base.h>
#include <kiway.h>
#include <settings/settings_manager.h>
@ -52,7 +52,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 = std::make_unique<KIGFX::WS_PAINTER>( m_gal );
m_painter = std::make_unique<KIGFX::DS_PAINTER>( m_gal );
SETTINGS_MANAGER& settingsManager = Pgm().GetSettingsManager();
PL_EDITOR_SETTINGS* cfg = settingsManager.GetAppSettings<PL_EDITOR_SETTINGS>();
@ -86,7 +86,7 @@ void PL_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
void PL_DRAW_PANEL_GAL::DisplayWorksheet()
{
PL_SELECTION_TOOL* selTool = m_edaFrame->GetToolManager()->GetTool<PL_SELECTION_TOOL>();
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
selTool->GetSelection().Clear();
m_view->Clear();
@ -102,22 +102,22 @@ void PL_DRAW_PANEL_GAL::DisplayWorksheet()
model.SetupDrawEnvironment( m_edaFrame->GetPageSettings(), Mils2iu( 1 ) );
// To show the formatted texts instead of raw texts in drawing sheet editor, we need
// a dummy WS_DRAW_ITEM_LIST.
WS_DRAW_ITEM_LIST dummy;
// a dummy DS_DRAW_ITEM_LIST.
DS_DRAW_ITEM_LIST dummy;
dummy.SetPaperFormat( &m_edaFrame->GetPageSettings().GetType() );
dummy.SetTitleBlock( &m_edaFrame->GetTitleBlock() );
dummy.SetProject( &m_edaFrame->Prj() );
dummy.SetMilsToIUfactor( IU_PER_MILS );
for( WS_DATA_ITEM* dataItem : model.GetItems() )
for( DS_DATA_ITEM* dataItem : model.GetItems() )
dataItem->SyncDrawItems( &dummy, m_view );
// Build and add a WS_DRAW_ITEM_PAGE to show the page limits and the corner position
// Build and add a DS_DRAW_ITEM_PAGE to show the page limits and the corner position
// of the selected corner for coord origin of new items
// Not also this item has no peer in WS_DATA_MODEL list.
// Not also this item has no peer in DS_DATA_MODEL list.
const int penWidth = 0; // This value is to use the default thickness line
constexpr double markerSize = Millimeter2iu( 5 );
m_pageDrawItem = std::make_unique<WS_DRAW_ITEM_PAGE>( penWidth, markerSize );
m_pageDrawItem = std::make_unique<DS_DRAW_ITEM_PAGE>( penWidth, markerSize );
m_view->Add( m_pageDrawItem.get() );
selTool->RebuildSelection();

View File

@ -22,12 +22,9 @@
#include <class_draw_panel_gal.h>
namespace KIGFX
{
class WS_PROXY_VIEW_ITEM;
}
class DS_PROXY_VIEW_ITEM;
class DS_DRAW_ITEM_PAGE;
class WS_DRAW_ITEM_PAGE;
class PL_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
{
@ -57,9 +54,9 @@ protected:
void setDefaultLayerDeps();
///< Currently used worksheet
std::unique_ptr<KIGFX::WS_PROXY_VIEW_ITEM> m_worksheet;
std::unique_ptr<DS_PROXY_VIEW_ITEM> m_worksheet;
std::unique_ptr<WS_DRAW_ITEM_PAGE> m_pageDrawItem;
std::unique_ptr<DS_DRAW_ITEM_PAGE> m_pageDrawItem;
};

View File

@ -28,8 +28,8 @@
#include <bitmaps.h>
#include <core/arraydim.h>
#include <eda_item.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <widgets/paged_dialog.h>
#include <dialogs/panel_gal_display_options.h>
#include <panel_hotkeys_editor.h>
@ -91,7 +91,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_userUnits = EDA_UNITS::MILLIMETRES;
m_showBorderAndTitleBlock = true; // true for reference drawings.
WS_DATA_MODEL::GetTheInstance().m_EditMode = true;
DS_DATA_MODEL::GetTheInstance().m_EditMode = true;
SetShowPageLimits( true );
m_aboutTitle = _( "KiCad Drawing Sheet Editor" );
@ -195,12 +195,11 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetGridOrigin( originCoord );
// Initialize the current page layout
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
#if 0 //start with empty layout
pglayout.AllowVoidList( true );
pglayout.ClearList();
DS_DATA_MODEL::GetTheInstance().AllowVoidList( true );
DS_DATA_MODEL::GetTheInstance().ClearList();
#else // start with the default Kicad layout
pglayout.SetPageLayout();
DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet();
#endif
OnNewPageLayout();
@ -287,13 +286,13 @@ void PL_EDITOR_FRAME::setupUIConditions()
auto titleBlockNormalMode =
[] ( const SELECTION& )
{
return WS_DATA_MODEL::GetTheInstance().m_EditMode == false;
return DS_DATA_MODEL::GetTheInstance().m_EditMode == false;
};
auto titleBlockEditMode =
[] ( const SELECTION& )
{
return WS_DATA_MODEL::GetTheInstance().m_EditMode == true;
return DS_DATA_MODEL::GetTheInstance().m_EditMode == true;
};
mgr->SetConditions( PL_ACTIONS::layoutNormalMode, CHECK( titleBlockNormalMode ) );
@ -372,7 +371,7 @@ void PL_EDITOR_FRAME::doCloseWindow()
Show( false );
// clean up the data before the view is destroyed
WS_DATA_MODEL::GetTheInstance().ClearList();
DS_DATA_MODEL::GetTheInstance().ClearList();
// On Linux, m_propertiesPagelayout must be destroyed
// before deleting the main frame to avoid a crash when closing
@ -609,7 +608,7 @@ wxPoint PL_EDITOR_FRAME::ReturnCoordOriginCorner() const
wxPoint originCoord;
// To avoid duplicate code, we use a dummy segment starting at 0,0 in relative coord
WS_DATA_ITEM dummy( WS_DATA_ITEM::WS_SEGMENT );
DS_DATA_ITEM dummy( DS_DATA_ITEM::DS_SEGMENT );
switch( m_originSelectChoice )
{
@ -749,14 +748,14 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
void PL_EDITOR_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
{
GetScreen()->SetVirtualPageNumber( GetPageNumberOption() ? 1 : 2 );
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
for( WS_DATA_ITEM* dataItem : model.GetItems() )
for( DS_DATA_ITEM* dataItem : model.GetItems() )
{
// Ensure the scaling factor (used only in printing) of bitmaps is up to date
if( dataItem->GetType() == WS_DATA_ITEM::WS_BITMAP )
if( dataItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
{
BITMAP_BASE* bitmap = static_cast<WS_DATA_ITEM_BITMAP*>( dataItem )->m_ImageBitmap;
BITMAP_BASE* bitmap = static_cast<DS_DATA_ITEM_BITMAP*>( dataItem )->m_ImageBitmap;
bitmap->SetPixelSizeIu( IU_PER_MILS * 1000 / bitmap->GetPPI() );
}
}
@ -786,10 +785,10 @@ void PL_EDITOR_FRAME::HardRedraw()
PL_SELECTION_TOOL* selTool = m_toolManager->GetTool<PL_SELECTION_TOOL>();
PL_SELECTION& selection = selTool->GetSelection();
WS_DATA_ITEM* item = nullptr;
DS_DATA_ITEM* item = nullptr;
if( selection.GetSize() == 1 )
item = static_cast<WS_DRAW_ITEM_BASE*>( selection.Front() )->GetPeer();
item = static_cast<DS_DRAW_ITEM_BASE*>( selection.Front() )->GetPeer();
m_propertiesPagelayout->CopyPrmsFromItemToPanel( item );
m_propertiesPagelayout->CopyPrmsFromGeneralToPanel();
@ -797,29 +796,29 @@ void PL_EDITOR_FRAME::HardRedraw()
}
WS_DATA_ITEM* PL_EDITOR_FRAME::AddPageLayoutItem( int aType )
DS_DATA_ITEM* PL_EDITOR_FRAME::AddPageLayoutItem( int aType )
{
WS_DATA_ITEM * item = NULL;
DS_DATA_ITEM * item = NULL;
switch( aType )
{
case WS_DATA_ITEM::WS_TEXT:
item = new WS_DATA_ITEM_TEXT( wxT( "Text") );
case DS_DATA_ITEM::DS_TEXT:
item = new DS_DATA_ITEM_TEXT( wxT( "Text") );
break;
case WS_DATA_ITEM::WS_SEGMENT:
item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_SEGMENT );
case DS_DATA_ITEM::DS_SEGMENT:
item = new DS_DATA_ITEM( DS_DATA_ITEM::DS_SEGMENT );
break;
case WS_DATA_ITEM::WS_RECT:
item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_RECT );
case DS_DATA_ITEM::DS_RECT:
item = new DS_DATA_ITEM( DS_DATA_ITEM::DS_RECT );
break;
case WS_DATA_ITEM::WS_POLYPOLYGON:
item = new WS_DATA_ITEM_POLYGONS();
case DS_DATA_ITEM::DS_POLYPOLYGON:
item = new DS_DATA_ITEM_POLYGONS();
break;
case WS_DATA_ITEM::WS_BITMAP:
case DS_DATA_ITEM::DS_BITMAP:
{
wxFileDialog fileDlg( this, _( "Choose Image" ), wxEmptyString, wxEmptyString,
_( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
@ -847,7 +846,7 @@ WS_DATA_ITEM* PL_EDITOR_FRAME::AddPageLayoutItem( int aType )
// Set the scale factor for pl_editor (it is set for eeschema by default)
image->SetPixelSizeIu( IU_PER_MILS * 1000.0 / image->GetPPI() );
item = new WS_DATA_ITEM_BITMAP( image );
item = new DS_DATA_ITEM_BITMAP( image );
}
break;
}
@ -855,7 +854,7 @@ WS_DATA_ITEM* PL_EDITOR_FRAME::AddPageLayoutItem( int aType )
if( item == NULL )
return NULL;
WS_DATA_MODEL::GetTheInstance().Append( item );
DS_DATA_MODEL::GetTheInstance().Append( item );
item->SyncDrawItems( nullptr, GetCanvas()->GetView() );
return item;

View File

@ -35,7 +35,7 @@
class PL_DRAW_PANEL_GAL;
class PROPERTIES_FRAME;
class WS_DATA_ITEM;
class DS_DATA_ITEM;
/**
@ -69,7 +69,7 @@ public:
PROPERTIES_FRAME* GetPropertiesFrame() { return m_propertiesPagelayout; }
/**
* Show the dialog displaying the list of WS_DATA_ITEM items in the page layout
* Show the dialog displaying the list of DS_DATA_ITEM items in the page layout
*/
void ShowDesignInspector();
@ -243,11 +243,11 @@ public:
* Function AddPageLayoutItem
* Add a new item to the page layout item list.
* @param aType = the type of item:
* WS_TEXT, WS_SEGMENT, WS_RECT, WS_POLYPOLYGON
* DS_TEXT, DS_SEGMENT, DS_RECT, DS_POLYPOLYGON
* @param aIdx = the position in list to insert the new item.
* @return a reference to the new item
*/
WS_DATA_ITEM* AddPageLayoutItem( int aType );
DS_DATA_ITEM* AddPageLayoutItem( int aType );
/**
* Must be called after a change in order to set the "modify" flag

View File

@ -30,7 +30,7 @@
#include <page_info.h>
#include <title_block.h>
#include <page_layout/ws_draw_item.h>
#include <drawing_sheet/ds_draw_item.h>
/**
@ -43,7 +43,7 @@ private:
PAGE_INFO m_paper;
TITLE_BLOCK m_titles;
WS_DRAW_ITEM_LIST m_drawItemList;
DS_DRAW_ITEM_LIST m_drawItemList;
public:
PL_EDITOR_LAYOUT();
@ -63,7 +63,7 @@ public:
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
WS_DRAW_ITEM_LIST& GetDrawItems()
DS_DRAW_ITEM_LIST& GetDrawItems()
{
return m_drawItemList;
}

View File

@ -23,8 +23,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_proxy_undo_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <tool/tool_manager.h>
#include <tool/actions.h>
@ -34,7 +34,7 @@
void PL_EDITOR_FRAME::SaveCopyInUndoList()
{
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
WS_PROXY_UNDO_ITEM* copyItem = new WS_PROXY_UNDO_ITEM( this );
DS_PROXY_UNDO_ITEM* copyItem = new DS_PROXY_UNDO_ITEM( this );
ITEM_PICKER wrapper( GetScreen(), copyItem, UNDO_REDO::LIBEDIT );
lastcmd->PushItem( wrapper );
@ -57,11 +57,11 @@ void PL_EDITOR_FRAME::GetLayoutFromRedoList()
return;
ITEM_PICKER redoWrapper = PopCommandFromRedoList()->PopItem();
WS_PROXY_UNDO_ITEM* redoItem = static_cast<WS_PROXY_UNDO_ITEM*>( redoWrapper.GetItem() );
DS_PROXY_UNDO_ITEM* redoItem = static_cast<DS_PROXY_UNDO_ITEM*>( redoWrapper.GetItem() );
bool pageSettingsAndTitleBlock = redoItem->Type() == WS_PROXY_UNDO_ITEM_PLUS_T;
PICKED_ITEMS_LIST* undoCmd = new PICKED_ITEMS_LIST();
WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( pageSettingsAndTitleBlock ? this : nullptr );
DS_PROXY_UNDO_ITEM* undoItem = new DS_PROXY_UNDO_ITEM( pageSettingsAndTitleBlock ? this : nullptr );
ITEM_PICKER undoWrapper( GetScreen(), undoItem );
undoCmd->PushItem( undoWrapper );
@ -94,11 +94,11 @@ void PL_EDITOR_FRAME::GetLayoutFromUndoList()
return;
ITEM_PICKER undoWrapper = PopCommandFromUndoList()->PopItem();
WS_PROXY_UNDO_ITEM* undoItem = static_cast<WS_PROXY_UNDO_ITEM*>( undoWrapper.GetItem() );
DS_PROXY_UNDO_ITEM* undoItem = static_cast<DS_PROXY_UNDO_ITEM*>( undoWrapper.GetItem() );
bool pageSettingsAndTitleBlock = undoItem->Type() == WS_PROXY_UNDO_ITEM_PLUS_T;
PICKED_ITEMS_LIST* redoCmd = new PICKED_ITEMS_LIST();
WS_PROXY_UNDO_ITEM* redoItem = new WS_PROXY_UNDO_ITEM( pageSettingsAndTitleBlock ? this : nullptr );
DS_PROXY_UNDO_ITEM* redoItem = new DS_PROXY_UNDO_ITEM( pageSettingsAndTitleBlock ? this : nullptr );
ITEM_PICKER redoWrapper( GetScreen(), redoItem );
redoCmd->PushItem( redoWrapper );
@ -130,7 +130,7 @@ void PL_EDITOR_FRAME::RollbackFromUndo()
return;
ITEM_PICKER undoWrapper = PopCommandFromUndoList()->PopItem();
WS_PROXY_UNDO_ITEM* undoItem = static_cast<WS_PROXY_UNDO_ITEM*>( undoWrapper.GetItem() );
DS_PROXY_UNDO_ITEM* undoItem = static_cast<DS_PROXY_UNDO_ITEM*>( undoWrapper.GetItem() );
bool pageSettingsAndTitleBlock = undoItem->Type() == WS_PROXY_UNDO_ITEM_PLUS_T;
selTool->ClearSelection();

View File

@ -25,7 +25,7 @@
#include <tool/tool_action.h>
#include <bitmaps.h>
#include <eda_item.h>
#include <page_layout/ws_data_item.h>
#include <drawing_sheet/ds_data_item.h>
#include "tools/pl_actions.h"
@ -42,22 +42,22 @@
TOOL_ACTION PL_ACTIONS::drawLine( "plEditor.InteractiveDrawing.drawLine",
AS_GLOBAL, 0, "",
_( "Add Line" ), _( "Add a line" ),
add_graphical_segments_xpm, AF_ACTIVATE, (void*) WS_DATA_ITEM::WS_SEGMENT );
add_graphical_segments_xpm, AF_ACTIVATE, (void*) DS_DATA_ITEM::DS_SEGMENT );
TOOL_ACTION PL_ACTIONS::drawRectangle( "plEditor.InteractiveDrawing.drawRectangle",
AS_GLOBAL, 0, "",
_( "Add Rectangle" ), _( "Add a rectangle" ),
add_rectangle_xpm, AF_ACTIVATE, (void*) WS_DATA_ITEM::WS_RECT );
add_rectangle_xpm, AF_ACTIVATE, (void*) DS_DATA_ITEM::DS_RECT );
TOOL_ACTION PL_ACTIONS::placeText( "plEditor.InteractiveDrawing.placeText",
AS_GLOBAL, 0, "",
_( "Add Text" ), _( "Add a text item" ),
text_xpm, AF_ACTIVATE, (void*) WS_DATA_ITEM::WS_TEXT );
text_xpm, AF_ACTIVATE, (void*) DS_DATA_ITEM::DS_TEXT );
TOOL_ACTION PL_ACTIONS::placeImage( "plEditor.InteractiveDrawing.placeImage",
AS_GLOBAL, 0, "",
_( "Add Bitmap" ), _( "Add a bitmap image" ),
image_xpm, AF_ACTIVATE, (void*) WS_DATA_ITEM::WS_BITMAP );
image_xpm, AF_ACTIVATE, (void*) DS_DATA_ITEM::DS_BITMAP );
// PL_EDIT_TOOL

View File

@ -29,8 +29,8 @@
#include <view/view.h>
#include <tool/tool_manager.h>
#include <bitmaps.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_data_item.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include "invoke_pl_editor_dialog.h"
#include "pl_editor_frame.h"
@ -75,9 +75,9 @@ void PL_DRAWING_TOOLS::Reset( RESET_REASON aReason )
int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
{
WS_DATA_ITEM::WS_ITEM_TYPE type = aEvent.Parameter<WS_DATA_ITEM::WS_ITEM_TYPE>();
DS_DATA_ITEM::DS_ITEM_TYPE type = aEvent.Parameter<DS_DATA_ITEM::DS_ITEM_TYPE>();
VECTOR2I cursorPos;
WS_DRAW_ITEM_BASE* item = nullptr;
DS_DRAW_ITEM_BASE* item = nullptr;
bool isText = aEvent.IsAction( &PL_ACTIONS::placeText );
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
@ -151,7 +151,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
// First click creates...
if( !item )
{
WS_DATA_ITEM* dataItem = m_frame->AddPageLayoutItem( type );
DS_DATA_ITEM* dataItem = m_frame->AddPageLayoutItem( type );
if( dataItem ) // dataItem = nullptr can happens if the command was cancelled
{
@ -219,8 +219,8 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
{
WS_DATA_ITEM::WS_ITEM_TYPE type = aEvent.Parameter<WS_DATA_ITEM::WS_ITEM_TYPE>();
WS_DRAW_ITEM_BASE* item = nullptr;
DS_DATA_ITEM::DS_ITEM_TYPE type = aEvent.Parameter<DS_DATA_ITEM::DS_ITEM_TYPE>();
DS_DRAW_ITEM_BASE* item = nullptr;
// We might be running as the same shape in another co-routine. Make sure that one
// gets whacked.
@ -279,7 +279,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
m_frame->SaveCopyInUndoList();
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
WS_DATA_ITEM* dataItem = m_frame->AddPageLayoutItem( type );
DS_DATA_ITEM* dataItem = m_frame->AddPageLayoutItem( type );
dataItem->MoveToUi( (wxPoint) cursorPos );
item = dataItem->GetDrawItems()[0];

View File

@ -24,9 +24,9 @@
#include <tool/tool_manager.h>
#include <tool/picker_tool.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_draw_item.h>
#include <bitmaps.h>
#include <confirm.h>
#include <eda_item.h>
@ -108,11 +108,11 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
if( selection.Empty() || m_moveInProgress )
return 0;
std::set<WS_DATA_ITEM*> unique_peers;
std::set<DS_DATA_ITEM*> unique_peers;
for( EDA_ITEM* item : selection )
{
WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( item );
DS_DRAW_ITEM_BASE* drawItem = static_cast<DS_DRAW_ITEM_BASE*>( item );
unique_peers.insert( drawItem->GetPeer() );
}
@ -146,7 +146,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
{
// Apply any initial offset in case we're coming from a previous command.
//
for( WS_DATA_ITEM* item : unique_peers )
for( DS_DATA_ITEM* item : unique_peers )
moveItem( item, m_moveOffset );
// Set up the starting position and move/drag offset
@ -158,7 +158,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
VECTOR2I delta = m_cursor - selection.GetReferencePoint();
// Drag items to the current cursor position
for( WS_DATA_ITEM* item : unique_peers )
for( DS_DATA_ITEM* item : unique_peers )
moveItem( item, delta );
selection.SetReferencePoint( m_cursor );
@ -192,7 +192,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
m_moveOffset += delta;
prevPos = m_cursor;
for( WS_DATA_ITEM* item : unique_peers )
for( DS_DATA_ITEM* item : unique_peers )
moveItem( item, delta );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
@ -271,11 +271,11 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
}
void PL_EDIT_TOOL::moveItem( WS_DATA_ITEM* aItem, VECTOR2I aDelta )
void PL_EDIT_TOOL::moveItem( DS_DATA_ITEM* aItem, VECTOR2I aDelta )
{
aItem->MoveToUi( aItem->GetStartPosUi() + (wxPoint) aDelta );
for( WS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() )
for( DS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() )
{
getView()->Update( item );
item->SetFlags( IS_MOVED );
@ -326,11 +326,11 @@ 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() );
WS_DATA_ITEM* dataItem = drawItem->GetPeer();
WS_DATA_MODEL::GetTheInstance().Remove( dataItem );
DS_DRAW_ITEM_BASE* drawItem = static_cast<DS_DRAW_ITEM_BASE*>( selection.Front() );
DS_DATA_ITEM* dataItem = drawItem->GetPeer();
DS_DATA_MODEL::GetTheInstance().Remove( dataItem );
for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
{
// Note: repeat items won't be selected but must be removed & deleted
@ -384,9 +384,9 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
EDA_ITEM* item = nullptr;
for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
{
for( WS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
{
if( drawItem->HitTest( (wxPoint) aPos, threshold ) )
{
@ -454,15 +454,15 @@ int PL_EDIT_TOOL::Cut( const TOOL_EVENT& aEvent )
int PL_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
{
PL_SELECTION& selection = m_selectionTool->RequestSelection();
std::vector<WS_DATA_ITEM*> items;
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
std::vector<DS_DATA_ITEM*> items;
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
wxString sexpr;
if( selection.GetSize() == 0 )
return 0;
for( EDA_ITEM* item : selection.GetItems() )
items.push_back( static_cast<WS_DRAW_ITEM_BASE*>( item )->GetPeer() );
items.push_back( static_cast<DS_DRAW_ITEM_BASE*>( item )->GetPeer() );
try
{
@ -483,7 +483,7 @@ int PL_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
int PL_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
{
PL_SELECTION& selection = m_selectionTool->GetSelection();
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance();
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
std::string sexpr = m_toolMgr->GetClipboardUTF8();
m_selectionTool->ClearSelection();
@ -491,7 +491,7 @@ int PL_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
model.SetPageLayout( sexpr.c_str(), true, wxT( "clipboard" ) );
// Build out draw items and select the first of each data item
for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
for( DS_DATA_ITEM* dataItem : model.GetItems() )
{
if( dataItem->GetDrawItems().empty() )
{

View File

@ -66,7 +66,7 @@ public:
int DeleteItemCursor( const TOOL_EVENT& aEvent );
private:
void moveItem( WS_DATA_ITEM* aItem, VECTOR2I aDelta );
void moveItem( DS_DATA_ITEM* aItem, VECTOR2I aDelta );
///< Return the right modification point (e.g. for rotation), depending on the number of
///< selected items.

View File

@ -28,8 +28,8 @@
#include <confirm.h>
#include <bitmaps.h>
#include <dialogs/dialog_page_settings.h>
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_painter.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_painter.h>
#include "pl_editor_frame.h"
#include "pl_editor_id.h"
@ -130,9 +130,9 @@ int PL_EDITOR_CONTROL::ShowInspector( const TOOL_EVENT& aEvent )
int PL_EDITOR_CONTROL::TitleBlockDisplayMode( const TOOL_EVENT& aEvent )
{
if( aEvent.IsAction( &PL_ACTIONS::layoutEditMode ) )
WS_DATA_MODEL::GetTheInstance().m_EditMode = true;
DS_DATA_MODEL::GetTheInstance().m_EditMode = true;
else
WS_DATA_MODEL::GetTheInstance().m_EditMode = false;
DS_DATA_MODEL::GetTheInstance().m_EditMode = false;
m_frame->HardRedraw();
return 0;
@ -155,7 +155,7 @@ int PL_EDITOR_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
item->GetMsgPanelInfo( m_frame, msgItems );
m_frame->SetMsgPanel( msgItems );
WS_DATA_ITEM* dataItem = static_cast<WS_DRAW_ITEM_BASE*>( item )->GetPeer();
DS_DATA_ITEM* dataItem = static_cast<DS_DRAW_ITEM_BASE*>( item )->GetPeer();
m_frame->GetPropertiesFrame()->CopyPrmsFromItemToPanel( dataItem );
}
else

View File

@ -34,8 +34,8 @@ using namespace std::placeholders;
#include <bitmaps.h>
#include <status_popup.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_data_item.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <widgets/progress_reporter.h>
#include "pl_editor_frame.h"
@ -71,14 +71,14 @@ public:
{
case WSG_LINE_T:
{
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) aItem;
DS_DRAW_ITEM_LINE* line = static_cast<DS_DRAW_ITEM_LINE*>( aItem );
points->AddPoint( line->GetStart() );
points->AddPoint( line->GetEnd() );
break;
}
case WSG_RECT_T:
{
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) aItem;
DS_DRAW_ITEM_RECT* rect = static_cast<DS_DRAW_ITEM_RECT*>( aItem );
wxPoint topLeft = rect->GetStart();
wxPoint botRight = rect->GetEnd();
@ -317,7 +317,7 @@ void PL_POINT_EDITOR::updateItem() const
if( !item )
return;
WS_DATA_ITEM* dataItem = static_cast<WS_DRAW_ITEM_BASE*>( item )->GetPeer();
DS_DATA_ITEM* dataItem = static_cast<DS_DRAW_ITEM_BASE*>( item )->GetPeer();
// the current item is perhaps not the main item if we have a set of
// repeated items.
@ -328,7 +328,7 @@ void PL_POINT_EDITOR::updateItem() const
{
case WSG_LINE_T:
{
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
DS_DRAW_ITEM_LINE* line = static_cast<DS_DRAW_ITEM_LINE*>( item );
wxPoint move_startpoint = (wxPoint) m_editPoints->Point( LINE_START ).GetPosition()
- line->GetStart();
@ -338,9 +338,9 @@ void PL_POINT_EDITOR::updateItem() const
dataItem->MoveStartPointToUi( dataItem->GetStartPosUi() + move_startpoint );
dataItem->MoveEndPointToUi( dataItem->GetEndPosUi() + move_endpoint );
for( WS_DRAW_ITEM_BASE* draw_item : dataItem->GetDrawItems() )
for( DS_DRAW_ITEM_BASE* draw_item : dataItem->GetDrawItems() )
{
WS_DRAW_ITEM_LINE* draw_line = static_cast<WS_DRAW_ITEM_LINE*>( draw_item );
DS_DRAW_ITEM_LINE* draw_line = static_cast<DS_DRAW_ITEM_LINE*>( draw_item );
draw_line->SetStart( draw_line->GetStart() + move_startpoint );
draw_line->SetEnd( draw_line->GetEnd() + move_endpoint );
@ -352,7 +352,7 @@ void PL_POINT_EDITOR::updateItem() const
case WSG_RECT_T:
{
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
DS_DRAW_ITEM_RECT* rect = static_cast<DS_DRAW_ITEM_RECT*>( item );
VECTOR2I topLeft = m_editPoints->Point( RECT_TOPLEFT ).GetPosition();
VECTOR2I topRight = m_editPoints->Point( RECT_TOPRIGHT ).GetPosition();
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
@ -366,10 +366,9 @@ void PL_POINT_EDITOR::updateItem() const
dataItem->MoveStartPointToUi( dataItem->GetStartPosUi() + move_startpoint );
dataItem->MoveEndPointToUi( dataItem->GetEndPosUi() + move_endpoint );
for( WS_DRAW_ITEM_BASE* draw_item : dataItem->GetDrawItems() )
for( DS_DRAW_ITEM_BASE* draw_item : dataItem->GetDrawItems() )
{
WS_DRAW_ITEM_RECT* draw_rect = (WS_DRAW_ITEM_RECT*) draw_item;
DS_DRAW_ITEM_RECT* draw_rect = static_cast<DS_DRAW_ITEM_RECT*>( draw_item );
draw_rect->SetStart( draw_rect->GetStart() + move_startpoint );
draw_rect->SetEnd( draw_rect->GetEnd() + move_endpoint );
@ -406,7 +405,7 @@ void PL_POINT_EDITOR::updatePoints()
{
case WSG_LINE_T:
{
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
DS_DRAW_ITEM_LINE* line = static_cast<DS_DRAW_ITEM_LINE*>( item );
m_editPoints->Point( LINE_START ).SetPosition( line->GetStart() );
m_editPoints->Point( LINE_END ).SetPosition( line->GetEnd() );
@ -415,7 +414,7 @@ void PL_POINT_EDITOR::updatePoints()
case WSG_RECT_T:
{
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
DS_DRAW_ITEM_RECT* rect = static_cast<DS_DRAW_ITEM_RECT*>( item );
wxPoint topLeft = rect->GetPosition();
wxPoint botRight = rect->GetEnd();

View File

@ -30,9 +30,9 @@
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
#include <tool/selection.h>
#include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h>
#include <page_layout/ws_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_draw_item.h>
#include <collector.h>
#include <math/util.h> // for KiROUND
@ -232,9 +232,9 @@ void PL_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, bool* aSelectionCan
// locate items.
COLLECTOR collector;
for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
{
for( WS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
{
if( drawItem->HitTest( (wxPoint) aWhere, threshold ) )
collector.Append( drawItem );
@ -389,9 +389,9 @@ bool PL_SELECTION_TOOL::selectMultiple()
selectionRect.Normalize();
for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
{
for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
{
if( item->HitTest( selectionRect, windowSelection ) )
{
@ -538,9 +538,9 @@ void PL_SELECTION_TOOL::RebuildSelection()
{
m_selection.Clear();
for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
{
for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
{
if( item->IsSelected() )
select( item );

View File

@ -29,7 +29,6 @@
#include <iterator>
#include <pcb_base_frame.h>
#include <reporter.h>
#include <page_layout/ws_proxy_view_item.h>
#include <board_commit.h>
#include <board.h>
#include <footprint.h>
@ -49,7 +48,6 @@
#include <project/project_file.h>
#include <project/project_local_settings.h>
#include <ratsnest/ratsnest_data.h>
#include <ratsnest/ratsnest_viewitem.h>
#include <tool/selection_conditions.h>
#include <convert_drawsegment_list_to_polygon.h>

View File

@ -29,11 +29,8 @@ class COLOR_SETTINGS;
class PAGE_INFO;
class FOOTPRINT_EDIT_FRAME;
class TITLE_BLOCK;
class DS_PROXY_VIEW_ITEM;
namespace KIGFX
{
class WS_PROXY_VIEW_ITEM;
}
class PANEL_FP_EDITOR_COLOR_SETTINGS : public PANEL_COLOR_SETTINGS
{

View File

@ -30,7 +30,7 @@
#include <settings/settings_manager.h>
#include <footprint_preview_panel.h>
#include <widgets/appearance_controls.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <pcb_painter.h>
#include <track.h>
#include <plugins/kicad/kicad_plugin.h>
@ -512,10 +512,10 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems()
m_preview->UpdateColors();
m_preview->DisplayBoard( m_preview->GetBoard() );
auto worksheet = new KIGFX::WS_PROXY_VIEW_ITEM( (int) IU_PER_MILS, m_page, nullptr,
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( (int) IU_PER_MILS, m_page, nullptr,
m_titleBlock );
worksheet->SetColorLayer( LAYER_DRAWINGSHEET );
m_preview->SetDrawingSheet( worksheet );
drawingSheet->SetColorLayer( LAYER_DRAWINGSHEET );
m_preview->SetDrawingSheet( drawingSheet );
zoomFitPreview();
}

View File

@ -30,11 +30,8 @@ class PAGE_INFO;
class PCB_EDIT_FRAME;
class FOOTPRINT_PREVIEW_PANEL;
class TITLE_BLOCK;
class DS_PROXY_VIEW_ITEM;
namespace KIGFX
{
class WS_PROXY_VIEW_ITEM;
}
class PANEL_PCBNEW_COLOR_SETTINGS : public PANEL_COLOR_SETTINGS
{

View File

@ -56,7 +56,7 @@ void drcPrintDebugMessage( int level, const wxString& msg, const char *function,
DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings ) :
m_designSettings ( aSettings ),
m_board( aBoard ),
m_worksheet( nullptr ),
m_drawingSheet( nullptr ),
m_schematicNetlist( nullptr ),
m_rulesValid( false ),
m_userUnits( EDA_UNITS::MILLIMETRES ),

View File

@ -36,6 +36,7 @@
class BOARD_DESIGN_SETTINGS;
class DRC_TEST_PROVIDER;
class PCB_EDIT_FRAME;
class DS_PROXY_VIEW_ITEM;
class BOARD_ITEM;
class BOARD;
class PCB_MARKER;
@ -48,7 +49,6 @@ class wxFileName;
namespace KIGFX
{
class WS_PROXY_VIEW_ITEM;
class VIEW_OVERLAY;
};
@ -92,8 +92,8 @@ public:
void SetSchematicNetlist( NETLIST* aNetlist ) { m_schematicNetlist = aNetlist; }
NETLIST* GetSchematicNetlist() const { return m_schematicNetlist; }
void SetWorksheet( KIGFX::WS_PROXY_VIEW_ITEM* aWorksheet ) { m_worksheet = aWorksheet; }
KIGFX::WS_PROXY_VIEW_ITEM* GetDrawingSheet() const { return m_worksheet; }
void SetDrawingSheet( DS_PROXY_VIEW_ITEM* aDrawingSheet ) { m_drawingSheet = aDrawingSheet; }
DS_PROXY_VIEW_ITEM* GetDrawingSheet() const { return m_drawingSheet; }
void SetDebugOverlay( std::shared_ptr<KIGFX::VIEW_OVERLAY> aOverlay ) { m_debugOverlay = aOverlay; }
std::shared_ptr<KIGFX::VIEW_OVERLAY> GetDebugOverlay() const { return m_debugOverlay; }
@ -200,7 +200,7 @@ private:
protected:
BOARD_DESIGN_SETTINGS* m_designSettings;
BOARD* m_board;
KIGFX::WS_PROXY_VIEW_ITEM* m_worksheet;
DS_PROXY_VIEW_ITEM* m_drawingSheet;
NETLIST* m_schematicNetlist;
std::vector<DRC_RULE*> m_rules;

View File

@ -26,8 +26,8 @@
#include <drc/drc_rule.h>
#include <drc/drc_test_provider.h>
#include <page_layout/ws_draw_item.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
/*
Miscellaneous tests:
@ -176,8 +176,8 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
forEachGeometryItem( { PCB_FP_TEXT_T, PCB_TEXT_T }, LSET::AllLayersMask(),
checkUnresolvedTextVar );
KIGFX::WS_PROXY_VIEW_ITEM* drawingSheet = m_drcEngine->GetDrawingSheet();
WS_DRAW_ITEM_LIST drawItems;
DS_PROXY_VIEW_ITEM* drawingSheet = m_drcEngine->GetDrawingSheet();
DS_DRAW_ITEM_LIST drawItems;
if( !drawingSheet || m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
return;
@ -191,12 +191,12 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
drawItems.SetProject( m_board->GetProject() );
drawItems.BuildDrawItemsList( drawingSheet->GetPageInfo(), drawingSheet->GetTitleBlock() );
for( WS_DRAW_ITEM_BASE* item = drawItems.GetFirst(); item; item = drawItems.GetNext() )
for( DS_DRAW_ITEM_BASE* item = drawItems.GetFirst(); item; item = drawItems.GetNext() )
{
if( m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
break;
WS_DRAW_ITEM_TEXT* text = dynamic_cast<WS_DRAW_ITEM_TEXT*>( item );
DS_DRAW_ITEM_TEXT* text = dynamic_cast<DS_DRAW_ITEM_TEXT*>( item );
if( text && text->GetShownText().Matches( wxT( "*${*}*" ) ) )
{

View File

@ -26,7 +26,7 @@
#include <pcb_view.h>
#include <view/wx_view_controls.h>
#include <pcb_painter.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <connectivity/connectivity_data.h>
#include <board.h>
@ -36,7 +36,7 @@
#include <pcb_base_frame.h>
#include <pcbnew_settings.h>
#include <ratsnest/ratsnest_data.h>
#include <ratsnest/ratsnest_viewitem.h>
#include <ratsnest/ratsnest_view_item.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
@ -198,8 +198,8 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
t.detach();
}
if( m_worksheet )
m_worksheet->SetFileName( TO_UTF8( aBoard->GetFileName() ) );
if( m_drawingSheet )
m_drawingSheet->SetFileName( TO_UTF8( aBoard->GetFileName() ) );
// Load drawings
for( BOARD_ITEM* drawing : aBoard->Drawings() )
@ -226,15 +226,15 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
m_view->Add( zone );
// Ratsnest
m_ratsnest = std::make_unique<KIGFX::RATSNEST_VIEWITEM>( aBoard->GetConnectivity() );
m_ratsnest = std::make_unique<RATSNEST_VIEW_ITEM>( aBoard->GetConnectivity() );
m_view->Add( m_ratsnest.get() );
}
void PCB_DRAW_PANEL_GAL::SetDrawingSheet( KIGFX::WS_PROXY_VIEW_ITEM* aWorksheet )
void PCB_DRAW_PANEL_GAL::SetDrawingSheet( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{
m_worksheet.reset( aWorksheet );
m_view->Add( m_worksheet.get() );
m_drawingSheet.reset( aDrawingSheet );
m_view->Add( m_drawingSheet.get() );
}
@ -535,8 +535,8 @@ void PCB_DRAW_PANEL_GAL::RedrawRatsnest()
BOX2I PCB_DRAW_PANEL_GAL::GetDefaultViewBBox() const
{
if( m_worksheet && m_view->IsLayerVisible( LAYER_DRAWINGSHEET ) )
return m_worksheet->ViewBBox();
if( m_drawingSheet && m_view->IsLayerVisible( LAYER_DRAWINGSHEET ) )
return m_drawingSheet->ViewBBox();
return BOX2I();
}

View File

@ -31,11 +31,8 @@
#include <layers_id_colors_and_visibility.h>
#include <pcb_view.h>
namespace KIGFX
{
class WS_PROXY_VIEW_ITEM;
class RATSNEST_VIEWITEM;
}
class DS_PROXY_VIEW_ITEM;
class RATSNEST_VIEW_ITEM;
class PCB_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
{
@ -54,14 +51,14 @@ public:
void DisplayBoard( BOARD* aBoard );
/**
* Set (or updates) worksheet used by the draw panel.
* Sets (or updates) drawing-sheet used by the draw panel.
*
* @param aWorksheet is the worksheet to be used. The object is then owned by
* @param aDrawingSheet is the drawing-sheet to be used. The object is then owned by
* #PCB_DRAW_PANEL_GAL.
*/
void SetDrawingSheet( KIGFX::WS_PROXY_VIEW_ITEM* aWorksheet );
void SetDrawingSheet( DS_PROXY_VIEW_ITEM* aDrawingSheet );
KIGFX::WS_PROXY_VIEW_ITEM* GetWorksheet() const { return m_worksheet.get(); }
DS_PROXY_VIEW_ITEM* GetDrawingSheet() const { return m_drawingSheet.get(); }
// TODO(JE) Look at optimizing this out
/**
@ -117,11 +114,11 @@ protected:
///< Set rendering targets & dependencies for layers.
void setDefaultLayerDeps();
///< Currently used worksheet.
std::unique_ptr<KIGFX::WS_PROXY_VIEW_ITEM> m_worksheet;
///< Currently used drawing-sheet.
std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
///< Ratsnest view item
std::unique_ptr<KIGFX::RATSNEST_VIEWITEM> m_ratsnest;
std::unique_ptr<RATSNEST_VIEW_ITEM> m_ratsnest;
};
#endif /* PCB_DRAW_PANEL_GAL_H_ */

View File

@ -40,7 +40,7 @@
#include <invoke_pcb_dialog.h>
#include <board.h>
#include <footprint.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <connectivity/connectivity_data.h>
#include <wildcards_and_files_ext.h>
#include <pcb_draw_panel_gal.h>
@ -88,7 +88,7 @@
#include <netlist_reader/pcb_netlist.h>
#include <wx/wupdlock.h>
#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
#include <ratsnest/ratsnest_viewitem.h>
#include <ratsnest/ratsnest_view_item.h>
#include <widgets/appearance_controls.h>
#include <widgets/panel_selection_filter.h>
#include <kiplatform/app.h>
@ -396,7 +396,7 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
aBoard->SetProject( &Prj() );
aBoard->GetConnectivity()->Build( aBoard );
// reload the drawing sheet
// reload the drawing-sheet
SetPageSettings( aBoard->GetPageSettings() );
}
@ -411,10 +411,11 @@ void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
PCB_BASE_FRAME::SetPageSettings( aPageSettings );
// Prepare drawingSheet template
KIGFX::WS_PROXY_VIEW_ITEM* drawingSheet;
drawingSheet = new KIGFX::WS_PROXY_VIEW_ITEM( IU_PER_MILS, &m_pcb->GetPageSettings(),
m_pcb->GetProject(), &m_pcb->GetTitleBlock() );
// Prepare drawing-sheet template
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( IU_PER_MILS,
&m_pcb->GetPageSettings(),
m_pcb->GetProject(),
&m_pcb->GetTitleBlock() );
drawingSheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
BASE_SCREEN* screen = GetScreen();
@ -428,7 +429,7 @@ void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
if( BOARD* board = GetBoard() )
drawingSheet->SetFileName( TO_UTF8( board->GetFileName() ) );
// PCB_DRAW_PANEL_GAL takes ownership of the drawing sheet
// PCB_DRAW_PANEL_GAL takes ownership of the drawing-sheet
GetCanvas()->SetDrawingSheet( drawingSheet );
}

View File

@ -38,11 +38,10 @@ namespace KIGFX {
PCB_VIEW::PCB_VIEW( bool aIsDynamic ) :
VIEW( aIsDynamic )
{
// Set m_boundary to define the max area size. The default value
// is acceptable for Pcbnew and Gerbview.
// However, ensure this area has the right size (max size allowed by integer coordinates)
// in case of the default value is changed.
// Could be a size depending on the worksheet size.
// Set m_boundary to define the max area size. The default value is acceptable for Pcbnew
// and Gerbview.
// However, ensure this area has the right size (max size allowed by integer coordinates) in
// case of the default value is changed. Could be a size depending on the drawing-sheet size.
typedef std::numeric_limits<int> coord_limits;
double pos = coord_limits::lowest() / 2 + coord_limits::epsilon();
double size = coord_limits::max() - coord_limits::epsilon();

View File

@ -33,7 +33,7 @@
#include <panel_pcbnew_display_origin.h>
#include <tool/tool_manager.h>
#include <tools/pcb_selection_tool.h>
#include <page_layout/ws_data_model.h>
#include <drawing_sheet/ds_data_model.h>
#include <pcbplot.h>
#include <pcb_painter.h>
#include <invoke_pcb_dialog.h>
@ -71,14 +71,13 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
BASE_SCREEN::m_PageLayoutDescrFileName = project.m_BoardPageLayoutDescrFile;
// Load the page layout decr file, from the filename stored in
// Load the drawing sheet description 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
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
wxString filename = WS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
wxString filename = DS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
Prj().GetProjectPath() );
pglayout.SetPageLayout( filename );
DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename );
// Load render settings that aren't stored in PCB_DISPLAY_OPTIONS

View File

@ -25,11 +25,10 @@
*/
/**
* @file ratsnest_viewitem.cpp
* @brief Class that draws missing connections on a PCB.
*/
#include <ratsnest/ratsnest_viewitem.h>
#include <ratsnest/ratsnest_view_item.h>
#include <gal/graphics_abstraction_layer.h>
#include <pcb_painter.h>
@ -43,15 +42,13 @@
#include <view/view.h>
namespace KIGFX {
RATSNEST_VIEWITEM::RATSNEST_VIEWITEM( std::shared_ptr<CONNECTIVITY_DATA> aData ) :
RATSNEST_VIEW_ITEM::RATSNEST_VIEW_ITEM( std::shared_ptr<CONNECTIVITY_DATA> aData ) :
EDA_ITEM( NOT_USED ), m_data( std::move(aData) )
{
}
const BOX2I RATSNEST_VIEWITEM::ViewBBox() const
const BOX2I RATSNEST_VIEW_ITEM::ViewBBox() const
{
// Make it always visible
BOX2I bbox;
@ -61,7 +58,7 @@ const BOX2I RATSNEST_VIEWITEM::ViewBBox() const
}
void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
void RATSNEST_VIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
{
std::unique_lock<KISPINLOCK> lock( m_data->GetLock(), std::try_to_lock );
@ -74,7 +71,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
gal->SetIsStroke( true );
gal->SetIsFill( false );
gal->SetLineWidth( 1.0 );
auto rs = static_cast<PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() );
auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() );
COLOR4D defaultColor = rs->GetColor( nullptr, LAYER_RATSNEST );
COLOR4D color = defaultColor;
@ -234,10 +231,9 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
}
void RATSNEST_VIEWITEM::ViewGetLayers( int aLayers[], int& aCount ) const
void RATSNEST_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
aLayers[0] = LAYER_RATSNEST;
}
}

View File

@ -25,12 +25,11 @@
*/
/**
* @file ratsnest_viewitem.h
* @brief Class that draws missing connections on a PCB.
*/
#ifndef RATSNEST_VIEWITEM_H
#define RATSNEST_VIEWITEM_H
#ifndef RATSNEST_VIEW_ITEM_H
#define RATSNEST_VIEW_ITEM_H
#include <memory>
#include <eda_item.h>
@ -39,12 +38,11 @@
class GAL;
class CONNECTIVITY_DATA;
namespace KIGFX
{
class RATSNEST_VIEWITEM : public EDA_ITEM
class RATSNEST_VIEW_ITEM : public EDA_ITEM
{
public:
RATSNEST_VIEWITEM( std::shared_ptr<CONNECTIVITY_DATA> aData );
RATSNEST_VIEW_ITEM( std::shared_ptr<CONNECTIVITY_DATA> aData );
/// @copydoc VIEW_ITEM::ViewBBox()
const BOX2I ViewBBox() const override;
@ -65,21 +63,14 @@ public:
void Show( int x, std::ostream& st ) const override { }
#endif
/**
* Get class name.
*
* @return string "RATSNEST_VIEWITEM"
*/
virtual wxString GetClass() const override
{
return wxT( "RATSNEST_VIEWITEM" );
return wxT( "RATSNEST_VIEW_ITEM" );
}
protected:
///< Object containing ratsnest data.
std::shared_ptr<CONNECTIVITY_DATA> m_data;
std::shared_ptr<CONNECTIVITY_DATA> m_data; ///< Object containing ratsnest data.
};
} // namespace KIGFX
#endif /* RATSNEST_VIEWITEM_H */
#endif /* RATSNEST_VIEW_ITEM_H */

View File

@ -62,7 +62,7 @@
#include <view/view_controls.h>
#include <view/view_group.h>
#include <wildcards_and_files_ext.h>
#include <page_layout/ws_proxy_undo_item.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <footprint_edit_frame.h>
using namespace std::placeholders;
@ -271,7 +271,7 @@ int BOARD_EDITOR_CONTROL::SaveCopyAs( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
{
PICKED_ITEMS_LIST undoCmd;
WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame );
DS_PROXY_UNDO_ITEM* undoItem = new DS_PROXY_UNDO_ITEM( m_frame );
ITEM_PICKER wrapper( nullptr, undoItem, UNDO_REDO::PAGESETTINGS );
undoCmd.PushItem( wrapper );

View File

@ -150,7 +150,7 @@ void DRC_TOOL::RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones
zoneFiller->FillAllZones( m_drcDialog, aProgressReporter );
}
m_drcEngine->SetWorksheet( m_editFrame->GetCanvas()->GetWorksheet() );
m_drcEngine->SetDrawingSheet( m_editFrame->GetCanvas()->GetDrawingSheet());
if( aTestFootprints && !Kiface().IsSingle() )
{

View File

@ -30,7 +30,7 @@
#include <fp_shape.h>
#include <collectors.h>
#include <pcb_edit_frame.h>
#include <page_layout/ws_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <kiway.h>
#include <array_creator.h>
#include <pcbnew_settings.h>
@ -1236,10 +1236,10 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
}
else if( selection.Size() == 0 && getView()->IsLayerVisible( LAYER_DRAWINGSHEET ) )
{
KIGFX::WS_PROXY_VIEW_ITEM* worksheet = editFrame->GetCanvas()->GetWorksheet();
DS_PROXY_VIEW_ITEM* ds = editFrame->GetCanvas()->GetDrawingSheet();
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
if( worksheet && worksheet->HitTestDrawingSheetItems( getView(), (wxPoint) cursorPos ) )
if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursorPos ) )
m_toolMgr->RunAction( ACTIONS::pageSettings );
}

View File

@ -42,7 +42,7 @@ using namespace std::placeholders;
#include <tools/pcb_selection_tool.h>
#include <tools/pcb_control.h>
#include <tools/board_editor_control.h>
#include <page_layout/ws_proxy_undo_item.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
/* Functions to undo and redo edit commands.
* commands to undo are stored in CurrentScreen->m_UndoList
@ -518,8 +518,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
case UNDO_REDO::PAGESETTINGS:
{
// swap current settings with stored settings
WS_PROXY_UNDO_ITEM alt_item( this );
WS_PROXY_UNDO_ITEM* item = (WS_PROXY_UNDO_ITEM*) eda_item;
DS_PROXY_UNDO_ITEM alt_item( this );
DS_PROXY_UNDO_ITEM* item = static_cast<DS_PROXY_UNDO_ITEM*>( eda_item );
item->Restore( this );
*item = alt_item;
}