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_keywords.*
common/netlist_lexer.h common/netlist_lexer.h
common/pcb_plot_params_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/lib_table_keywords.*
common/gal/opengl/shader_src.h common/gal/opengl/shader_src.h
include/fp_lib_table_lexer.h include/fp_lib_table_lexer.h

View File

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

View File

@ -31,8 +31,8 @@
#include <tool/actions.h> #include <tool/actions.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <page_layout/ws_painter.h> #include <drawing_sheet/ds_painter.h>
#include <wx/valgen.h> #include <wx/valgen.h>
#include <wx/tokenzr.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_customFmt = false;
m_localPrjConfigChanged = false; m_localPrjConfigChanged = false;
m_pagelayout = new WS_DATA_MODEL; m_drawingSheet = new DS_DATA_MODEL;
wxString serialization; wxString serialization;
WS_DATA_MODEL::GetTheInstance().SaveInString( serialization ); DS_DATA_MODEL::GetTheInstance().SaveInString( serialization );
m_pagelayout->SetPageLayout( TO_UTF8( serialization ) ); m_drawingSheet->SetPageLayout(TO_UTF8( serialization ) );
m_PickDate->SetValue( wxDateTime::Now() ); 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() DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
{ {
delete m_pageBitmap; delete m_pageBitmap;
delete m_pagelayout; delete m_drawingSheet;
} }
@ -455,7 +455,7 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
if( fileName != BASE_SCREEN::m_PageLayoutDescrFileName ) 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 ) ) if( !fullFileName.IsEmpty() && !wxFileExists( fullFileName ) )
{ {
@ -466,8 +466,7 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
} }
BASE_SCREEN::m_PageLayoutDescrFileName = fileName; BASE_SCREEN::m_PageLayoutDescrFileName = fileName;
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance(); DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( fullFileName );
pglayout.SetPageLayout( fullFileName );
m_localPrjConfigChanged = true; m_localPrjConfigChanged = true;
} }
@ -641,12 +640,12 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
} }
// Draw layout preview. // Draw layout preview.
KIGFX::WS_RENDER_SETTINGS renderSettings; KIGFX::DS_RENDER_SETTINGS renderSettings;
COLOR_SETTINGS* colorSettings = m_parent->GetColorSettings(); COLOR_SETTINGS* colorSettings = m_parent->GetColorSettings();
COLOR4D bgColor = m_parent->GetDrawBgColor(); COLOR4D bgColor = m_parent->GetDrawBgColor();
wxString emptyString; wxString emptyString;
WS_DATA_MODEL::SetAltInstance( m_pagelayout ); DS_DATA_MODEL::SetAltInstance( m_drawingSheet );
{ {
GRResetPenAndBrush( &memDC ); GRResetPenAndBrush( &memDC );
renderSettings.SetDefaultPenWidth( 1 ); 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 ); 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(), m_screen->GetPageCount(), m_screen->GetPageNumber(), 1, &Prj(),
wxEmptyString, m_screen->GetVirtualPageNumber() == 1 ); wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
memDC.SelectObject( wxNullBitmap ); memDC.SelectObject( wxNullBitmap );
m_PageLayoutExampleBitmap->SetBitmap( *m_pageBitmap ); m_PageLayoutExampleBitmap->SetBitmap( *m_pageBitmap );
} }
WS_DATA_MODEL::SetAltInstance( NULL ); DS_DATA_MODEL::SetAltInstance( NULL );
// Refresh the dialog. // Refresh the dialog.
Layout(); 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, // 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 // 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 // For Win/Linux/macOS compatibility, a relative path is a good idea
if( shortFileName != GetWksFileName() && shortFileName != fileName ) if( shortFileName != GetWksFileName() && shortFileName != fileName )
@ -806,10 +805,10 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
SetWksFileName( shortFileName ); SetWksFileName( shortFileName );
if( m_pagelayout == NULL ) if( m_drawingSheet == NULL )
m_pagelayout = new WS_DATA_MODEL; m_drawingSheet = new DS_DATA_MODEL;
m_pagelayout->SetPageLayout( fileName ); m_drawingSheet->LoadDrawingSheet( fileName );
GetPageLayoutInfoFromDialog(); GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample(); 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. * 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 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 * This program is free software; you can redistribute it and/or
@ -28,7 +24,7 @@
*/ */
/* keyword used in page layout description are listed /* 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 // height of the coordinates band 2.0 mm
// drawing sheet frame reference text size 1.3 mm // coordinates text size 1.3 mm
// default text size 1.5 mm // default text size 1.5 mm
// default line width 0.15 mm // default line width 0.15 mm
// frame ref pitch 50 mm // frame ref pitch 50 mm
// Default page layout (sizes are in mm) // Default page layout (sizes are in mm)
extern const char defaultPageLayout[] = extern const char defaultDrawingSheet[] =
"(page_layout\n" "(drawing_sheet\n"
"(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15)\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" "(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" "(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" "(line (start 26 8.5) (end 26 2) )\n"
")\n"; ")\n";
extern const char emptyPageLayout[] = extern const char emptyDrawingSheet[] =
"(page_layout\n" "(drawing_sheet\n"
"(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)\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" "(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
"(line (name segm1:Line) (start 0 0) (end 0 0))\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. * 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 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 * This program is free software; you can redistribute it and/or
@ -31,11 +25,11 @@
#include <eda_item.h> #include <eda_item.h>
#include <locale_io.h> #include <locale_io.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_painter.h> #include <drawing_sheet/ds_painter.h>
#include <page_layout/page_layout_reader_lexer.h> #include <drawing_sheet/drawing_sheet_reader_lexer.h>
#include <wx/ffile.h> #include <wx/ffile.h>
#include <wx/file.h> #include <wx/file.h>
@ -45,15 +39,15 @@
using namespace TB_READER_T; using namespace TB_READER_T;
/** /**
* PAGE_LAYOUT_READER_PARSER * DRAWING_SHEET_READER_PARSER
* holds data and functions pertinent to parsing a S-expression file * 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: public:
PAGE_LAYOUT_READER_PARSER( const char* aLine, const wxString& aSource ); DRAWING_SHEET_READER_PARSER( const char* aLine, const wxString& aSource );
void Parse( WS_DATA_MODEL* aLayout ); void Parse( DS_DATA_MODEL* aLayout );
private: private:
@ -73,44 +67,45 @@ private:
*/ */
double parseDouble(); 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. * 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. * 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. * parse a polygon item starting by "( polygon" and read parameters.
* the list of corners included in this description is read by parsePolyOutline * 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. * 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. * 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 parseCoordinate( POINT_COORD& aCoord);
void readOption( WS_DATA_ITEM * aItem ); void readOption( DS_DATA_ITEM * aItem );
void readPngdata( WS_DATA_ITEM_BITMAP * aItem ); void readPngdata( DS_DATA_ITEM_BITMAP * aItem );
}; };
// PCB_PLOT_PARAMS_PARSER // PCB_PLOT_PARAMS_PARSER
PAGE_LAYOUT_READER_PARSER::PAGE_LAYOUT_READER_PARSER( const char* aLine, const wxString& aSource ) : DRAWING_SHEET_READER_PARSER::DRAWING_SHEET_READER_PARSER( const char* aLine,
PAGE_LAYOUT_READER_LEXER( aLine, aSource ) 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; LOCALE_IO toggle;
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() ) 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 ) if( token == T_LEFT )
token = NextTok(); token = NextTok();
if( token == T_page_layout ) if( token == T_page_layout || token == T_drawing_sheet )
continue; continue;
switch( token ) switch( token )
@ -209,33 +204,33 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WS_DATA_MODEL* aLayout )
break; break;
case T_line: 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 ); parseGraphic( item );
aLayout->Append( item ); aLayout->Append( item );
break; break;
case T_rect: 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 ); parseGraphic( item );
aLayout->Append( item ); aLayout->Append( item );
break; break;
case T_polygon: case T_polygon:
item = new WS_DATA_ITEM_POLYGONS(); item = new DS_DATA_ITEM_POLYGONS();
parsePolygon( (WS_DATA_ITEM_POLYGONS*) item ); parsePolygon( (DS_DATA_ITEM_POLYGONS*) item );
aLayout->Append( item ); aLayout->Append( item );
break; break;
case T_bitmap: case T_bitmap:
item = new WS_DATA_ITEM_BITMAP( NULL ); item = new DS_DATA_ITEM_BITMAP( NULL );
parseBitmap( (WS_DATA_ITEM_BITMAP*) item ); parseBitmap( (DS_DATA_ITEM_BITMAP*) item );
aLayout->Append( item ); aLayout->Append( item );
break; break;
case T_tbtext: case T_tbtext:
NeedSYMBOLorNUMBER(); NeedSYMBOLorNUMBER();
item = new WS_DATA_ITEM_TEXT( convertLegacyVariableRefs( FromUTF8() ) ); item = new DS_DATA_ITEM_TEXT( convertLegacyVariableRefs( FromUTF8() ) );
parseText( (WS_DATA_ITEM_TEXT*) item ); parseText( (DS_DATA_ITEM_TEXT*) item );
aLayout->Append( item ); aLayout->Append( item );
break; 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() ) 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() ) 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(); 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; 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; BITMAP_BASE* image = new BITMAP_BASE;
aItem->m_ImageBitmap = image; 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; 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() ) 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() ) 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() ) 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)" // 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.x = parseDouble();
aCoord.m_Pos.y = 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(); 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(); T token = NextTok();
@ -765,46 +760,42 @@ double PAGE_LAYOUT_READER_PARSER::parseDouble()
return val; return val;
} }
// defaultPageLayout is the default page layout description // defaultDrawingSheet is the default page layout description using the S expr.
// using the S expr. extern const char defaultDrawingSheet[];
// see page_layout_default_shape.cpp
extern const char defaultPageLayout[];
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; // Returns defaultDrawingSheet as a string;
wxString WS_DATA_MODEL::DefaultLayout() 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. // there is a 0 length line to fool something somewhere.
// using the S expr. extern const char emptyDrawingSheet[];
// see page_layout_empty_description.cpp
extern const char emptyPageLayout[];
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 ) if( ! Append )
ClearList(); ClearList();
PAGE_LAYOUT_READER_PARSER lp_parser( aPageLayout, wxT( "Sexpr_string" ) ); DRAWING_SHEET_READER_PARSER lp_parser( aPageLayout, wxT( "Sexpr_string" ) );
try 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; wxString fullFileName = aFullFileName;
@ -830,7 +821,7 @@ void WS_DATA_MODEL::SetPageLayout( const wxString& aFullFileName, bool Append )
{ {
#if 0 #if 0
if( !fullFileName.IsEmpty() ) if( !fullFileName.IsEmpty() )
wxLogMessage( wxT( "Page layout file <%s> not found" ), fullFileName.GetData() ); wxLogMessage( wxT( "Drawing sheet file <%s> not found" ), fullFileName.GetData() );
#endif #endif
SetDefaultLayout(); SetDefaultLayout();
return; return;
@ -858,7 +849,7 @@ void WS_DATA_MODEL::SetPageLayout( const wxString& aFullFileName, bool Append )
if( ! Append ) if( ! Append )
ClearList(); ClearList();
PAGE_LAYOUT_READER_PARSER pl_parser( buffer, fullFileName ); DRAWING_SHEET_READER_PARSER pl_parser( buffer, fullFileName );
try try
{ {

View File

@ -1,4 +1,5 @@
page_layout page_layout
drawing_sheet
setup setup
left_margin left_margin
right_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 ) * a basic shape of a page layout ( frame references and title block )
* Basic shapes are line, rect and texts * 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. * one of 4 page corners.
* *
* These items cannot be drawn or plot "as this". they should be converted * 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: * 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. * coordinates are converted to draw/plot coordinates.
* texts are expanded if they contain format symbols. * texts are expanded if they contain format symbols.
* Items with m_RepeatCount > 1 are created m_RepeatCount times * 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_LIST is created each time the page layout is plot/drawn * 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). * 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 <math/util.h> // for KiROUND
#include <view/view.h> #include <view/view.h>
#include <title_block.h> #include <title_block.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_painter.h> #include <drawing_sheet/ds_painter.h>
#include <trigo.h> #include <trigo.h>
using KIGFX::COLOR4D; using KIGFX::COLOR4D;
// The constructor: // 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_pageOption = ALL_PAGES;
m_type = aType; 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; 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(); 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; pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
std::map<int, STATUS_FLAGS> itemFlags; 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 ) 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 ) ) if( j && ! IsInsidePage( j ) )
continue; continue;
if( m_type == WS_SEGMENT ) if( m_type == DS_SEGMENT )
item = new WS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize ); item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
else if( m_type == WS_RECT ) else if( m_type == DS_RECT )
item = new WS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize ); item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
else else
{ {
wxFAIL_MSG( "Unknown drawing sheet item type" ); 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 ) if( m_LineWidth != 0 )
return KiROUND( m_LineWidth * model.m_WSunits2Iu ); return KiROUND( m_LineWidth * model.m_WSunits2Iu );
@ -150,17 +150,17 @@ int WS_DATA_ITEM::GetPenSizeUi()
// (if both coordinates have the same corner reference) // (if both coordinates have the same corner reference)
// MoveToUi and MoveTo takes the graphic position (i.e relative to the left top // MoveToUi and MoveTo takes the graphic position (i.e relative to the left top
// paper corner // paper corner
void WS_DATA_ITEM::MoveToUi( wxPoint aPosition ) void DS_DATA_ITEM::MoveToUi( wxPoint aPosition )
{ {
DPOINT pos_mm; DPOINT pos_mm;
pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
MoveTo( pos_mm ); MoveTo( pos_mm );
} }
void WS_DATA_ITEM::MoveTo( DPOINT aPosition ) void DS_DATA_ITEM::MoveTo( DPOINT aPosition )
{ {
DPOINT vector = aPosition - GetStartPos(); DPOINT vector = aPosition - GetStartPos();
DPOINT endpos = vector + GetEndPos(); DPOINT endpos = vector + GetEndPos();
@ -168,7 +168,7 @@ void WS_DATA_ITEM::MoveTo( DPOINT aPosition )
MoveStartPointTo( aPosition ); MoveStartPointTo( aPosition );
MoveEndPointTo( endpos ); MoveEndPointTo( endpos );
for( WS_DRAW_ITEM_BASE* drawItem : m_drawItems ) for( DS_DRAW_ITEM_BASE* drawItem : m_drawItems )
{ {
drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) ); drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
drawItem->SetEnd( GetEndPosUi( 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 /* move the starting point of the item to a new position
* aPosition = the new position of the starting point, in mm * 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; DPOINT position;
// Calculate the position of the starting point // 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 /* move the starting point of the item to a new position
* aPosition = the new position of the starting point in graphic units * 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, DPOINT pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu ); aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
MoveStartPointTo( pos_mm ); MoveStartPointTo( pos_mm );
} }
@ -230,9 +230,9 @@ void WS_DATA_ITEM::MoveStartPointToUi( wxPoint aPosition )
* (segments and rectangles) * (segments and rectangles)
* aPosition = the new position of the ending point, in mm * 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; DPOINT position;
// Calculate the position of the starting point // 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 // Modify m_End only for items having 2 coordinates
switch( GetType() ) switch( GetType() )
{ {
case WS_SEGMENT: case DS_SEGMENT:
case WS_RECT: case DS_RECT:
m_End.m_Pos = position; m_End.m_Pos = position;
break; break;
@ -278,19 +278,19 @@ void WS_DATA_ITEM::MoveEndPointTo( DPOINT aPosition )
* (segments and rectangles) * (segments and rectangles)
* aPosition = the new position of the ending point in graphic units * 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; DPOINT pos_mm;
pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
MoveEndPointTo( pos_mm ); 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 ), DPOINT pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
m_Pos.m_Pos.y + ( m_IncrementVector.y * 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 ) ); 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 ), DPOINT pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
m_End.m_Pos.y + ( m_IncrementVector.y * 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 ) switch( m_End.m_Anchor )
{ {
case RB_CORNER: // right bottom corner 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; break;
case RT_CORNER: // right top corner case RT_CORNER: // right top corner
pos.x = WS_DATA_MODEL::GetTheInstance().m_RB_Corner.x - pos.x; pos.x = DS_DATA_MODEL::GetTheInstance().m_RB_Corner.x - pos.x;
pos.y = WS_DATA_MODEL::GetTheInstance().m_LT_Corner.y + pos.y; pos.y = DS_DATA_MODEL::GetTheInstance().m_LT_Corner.y + pos.y;
break; break;
case LB_CORNER: // left bottom corner case LB_CORNER: // left bottom corner
pos.x = WS_DATA_MODEL::GetTheInstance().m_LT_Corner.x + pos.x; pos.x = DS_DATA_MODEL::GetTheInstance().m_LT_Corner.x + pos.x;
pos.y = WS_DATA_MODEL::GetTheInstance().m_RB_Corner.y - pos.y; pos.y = DS_DATA_MODEL::GetTheInstance().m_RB_Corner.y - pos.y;
break; break;
case LT_CORNER: // left top corner 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; 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 ); 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 ) ); 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 ); 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; wxString name;
switch( GetType() ) switch( GetType() )
{ {
case WS_TEXT: name = wxT( "Text" ); break; case DS_TEXT: name = wxT( "Text" ); break;
case WS_SEGMENT: name = wxT( "Line" ); break; case DS_SEGMENT: name = wxT( "Line" ); break;
case WS_RECT: name = wxT( "Rectangle" ); break; case DS_RECT: name = wxT( "Rectangle" ); break;
case WS_POLYPOLYGON: name = wxT( "Imported Shape" ); break; case DS_POLYPOLYGON: name = wxT( "Imported Shape" ); break;
case WS_BITMAP: name = wxT( "Image" ); break; case DS_BITMAP: name = wxT( "Image" ); break;
} }
return name; return name;
} }
WS_DATA_ITEM_POLYGONS::WS_DATA_ITEM_POLYGONS() : DS_DATA_ITEM_POLYGONS::DS_DATA_ITEM_POLYGONS() :
WS_DATA_ITEM( WS_POLYPOLYGON ) DS_DATA_ITEM( DS_POLYPOLYGON )
{ {
m_Orient = 0.0; 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; 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 ) 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; continue;
int pensize = GetPenSizeUi(); 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 ] ); poly_shape->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( poly_shape ); 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]; 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 ) 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 ); DPOINT pos = GetStartPos( ii );
pos += m_minCoord; // left top pos of bounding box 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 ); 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) ); return wxPoint( int(pos.x), int(pos.y) );
} }
WS_DATA_ITEM_TEXT::WS_DATA_ITEM_TEXT( const wxString& aTextBase ) : DS_DATA_ITEM_TEXT::DS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
WS_DATA_ITEM( WS_TEXT ) DS_DATA_ITEM( DS_TEXT )
{ {
m_TextBase = aTextBase; m_TextBase = aTextBase;
m_IncrementLabel = 1; 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(); int pensize = GetPenSizeUi();
bool multilines = false; bool multilines = false;
if( WS_DATA_MODEL::GetTheInstance().m_EditMode ) if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
{
m_FullText = m_TextBase; m_FullText = m_TextBase;
}
else else
{ {
m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString(); 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(); SetConstrainedTextSize();
wxSize textsize; wxSize textsize;
textsize.x = KiROUND( m_ConstrainedTextSize.x * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu ); textsize.x = KiROUND( m_ConstrainedTextSize.x * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
textsize.y = KiROUND( m_ConstrainedTextSize.y * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu ); textsize.y = KiROUND( m_ConstrainedTextSize.y * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
if( m_Bold ) if( m_Bold )
pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) ); pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
std::map<int, STATUS_FLAGS> itemFlags; 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 ) 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(); itemFlags[ i ] = text->GetFlags();
if( aCollector ) if( aCollector )
@ -605,7 +607,7 @@ void WS_DATA_ITEM_TEXT::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
if( j > 0 && !IsInsidePage( j ) ) if( j > 0 && !IsInsidePage( j ) )
continue; 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 ); m_Italic, m_Bold );
text->SetFlags( itemFlags[ j ] ); text->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( text ); 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 ) if( m_LineWidth != 0 )
return KiROUND( m_LineWidth * model.m_WSunits2Iu ); 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; int last = m_TextBase.Len() -1;
@ -658,7 +660,7 @@ void WS_DATA_ITEM_TEXT::IncrementLabel( int aIncr )
// Replace the '\''n' sequence by EOL // Replace the '\''n' sequence by EOL
// and the sequence '\''\' by only one '\' in m_FullText // and the sequence '\''\' by only one '\' in m_FullText
// if m_FullText is a multiline text (i.e.contains '\n') return true // 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; 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; m_ConstrainedTextSize = m_TextSize;
if( m_ConstrainedTextSize.x == 0 ) 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 ) 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 ) if( m_BoundingBoxSize.x || m_BoundingBoxSize.y )
{ {
@ -714,8 +716,8 @@ void WS_DATA_ITEM_TEXT::SetConstrainedTextSize()
int linewidth = 0; int linewidth = 0;
size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE ); size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
size_micron.y = KiROUND( m_ConstrainedTextSize.y * 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 ) ); size_micron, linewidth, m_Italic, m_Bold ) );
dummy.SetMultilineAllowed( true ); dummy.SetMultilineAllowed( true );
dummy.SetHorizJustify( m_Hjustify ) ; dummy.SetHorizJustify( m_Hjustify ) ;
dummy.SetVertJustify( m_Vjustify ); dummy.SetVertJustify( m_Vjustify );
@ -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; 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 ) 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 ) ) if( j && !IsInsidePage( j ) )
continue; 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 ] ); bitmap->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( bitmap ); 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 ) if( m_ImageBitmap )
return m_ImageBitmap->GetPPI() / m_ImageBitmap->GetScale(); 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 ) if( m_ImageBitmap )
m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI ); 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 * 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_* * These items cannot be drawn or plotetd "as is". They must be converted to WS_DRAW_*
* types. When building the draw list: * 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. * - coordinates are converted to draw/plot coordinates.
* - texts are expanded if they contain format symbols. * - texts are expanded if they contain format symbols.
* - items with m_RepeatCount > 1 are created m_RepeatCount times. * - 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 * 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.) * 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 * 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 <kiface_i.h>
#include <title_block.h> #include <title_block.h>
#include <common.h> #include <common.h>
#include <eda_item.h> #include <eda_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_painter.h>
#include <page_layout/ws_painter.h>
// The layout shape used in the application // The layout shape used in the application
// It is accessible by WS_DATA_MODEL::GetTheInstance() // It is accessible by DS_DATA_MODEL::GetTheInstance()
static WS_DATA_MODEL wksTheInstance; static DS_DATA_MODEL wksTheInstance;
static WS_DATA_MODEL* wksAltInstance; static DS_DATA_MODEL* wksAltInstance;
WS_DATA_MODEL::WS_DATA_MODEL() : DS_DATA_MODEL::DS_DATA_MODEL() :
m_WSunits2Iu( 1000.0 ), m_WSunits2Iu( 1000.0 ),
m_DefaultLineWidth( 0.0 ), m_DefaultLineWidth( 0.0 ),
m_DefaultTextSize( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE ), 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 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 ) if( wksAltInstance )
return *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 * mainly used in page setting dialog
* @param aLayout = the alternate page layout. * @param aLayout = the alternate page layout.
* if null, restore the basic 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; 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) #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; delete item;
m_list.clear(); 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 ); 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 ); auto newEnd = std::remove( m_list.begin(), m_list.end(), aItem );
m_list.erase( newEnd, m_list.end() ); 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; unsigned idx = 0;
while( idx < m_list.size() ) 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 /* 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() ) if( aIdx < m_list.size() )
return m_list[aIdx]; 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 ) const wxString& aProjectPath )
{ {
wxString shortFileName = aFullFileName; 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 ) const wxString& aProjectPath )
{ {
wxString fullFileName = ExpandEnvVarSubstitutions( aShortFileName, nullptr ); 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. * This program source code file is part of KiCad, a free EDA CAD application.
* *
@ -33,12 +27,12 @@
#include <eda_item.h> #include <eda_item.h>
#include <locale_io.h> #include <locale_io.h>
#include <macros.h> #include <macros.h>
#include <page_layout/ws_painter.h> #include <drawing_sheet/ds_painter.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <math/vector2d.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 <convert_to_biu.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
@ -50,46 +44,45 @@ using namespace TB_READER_T;
// A helper function to write tokens: // A helper function to write tokens:
static const char* getTokenName( T aTok ) 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 // A basic helper class to write a page layout description
// Not used alone, a file writer or a string writer should be // Not used alone, a file writer or a string writer should be derived to use it.
// derived to use it // Therefore the constructor is protected.
// Therefore the constructor is protected class DS_DATA_MODEL_IO
class WS_DATA_MODEL_IO
{ {
protected: protected:
OUTPUTFORMATTER* m_out; OUTPUTFORMATTER* m_out;
WS_DATA_MODEL_IO() { m_out = NULL; } DS_DATA_MODEL_IO() { m_out = NULL; }
virtual ~WS_DATA_MODEL_IO() {} virtual ~DS_DATA_MODEL_IO() {}
public: 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: private:
void format( WS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const; void format( DS_DATA_ITEM_TEXT* aItem, int aNestLevel ) 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;
void format( WS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) void format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel )
const; 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 formatCoordinate( const char * aToken, POINT_COORD & aCoord ) const;
void formatRepeatParameters( WS_DATA_ITEM* aItem ) const; void formatRepeatParameters( DS_DATA_ITEM* aItem ) const;
void formatOptions( WS_DATA_ITEM* aItem ) const; void formatOptions( DS_DATA_ITEM* aItem ) const;
}; };
// A helper class to write a page layout description to a file // 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; FILE_OUTPUTFORMATTER * m_fileout;
public: public:
WS_DATA_MODEL_FILEIO( const wxString& aFilename ): DS_DATA_MODEL_FILEIO( const wxString& aFilename ) :
WS_DATA_MODEL_IO() DS_DATA_MODEL_IO()
{ {
try try
{ {
@ -102,7 +95,7 @@ public:
} }
} }
~WS_DATA_MODEL_FILEIO() ~DS_DATA_MODEL_FILEIO()
{ {
delete m_fileout; delete m_fileout;
} }
@ -110,14 +103,14 @@ public:
// A helper class to write a page layout description to a string // 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; STRING_FORMATTER * m_writer;
wxString & m_output; wxString & m_output;
public: public:
WS_DATA_MODEL_STRINGIO( wxString& aOutputString ): DS_DATA_MODEL_STRINGIO( wxString& aOutputString ) :
WS_DATA_MODEL_IO(), m_output( aOutputString ) DS_DATA_MODEL_IO(), m_output( aOutputString )
{ {
try try
{ {
@ -130,7 +123,7 @@ public:
} }
} }
~WS_DATA_MODEL_STRINGIO() ~DS_DATA_MODEL_STRINGIO()
{ {
m_output = FROM_UTF8( m_writer->GetString().c_str() ); m_output = FROM_UTF8( m_writer->GetString().c_str() );
delete m_writer; delete m_writer;
@ -141,52 +134,52 @@ public:
/* /*
* Save the description in a file * 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 ); writer.Format( this );
} }
/* Save the description in a buffer /* 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 ); 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 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 ); 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() ) switch( aItem->GetType() )
{ {
case WS_DATA_ITEM::WS_TEXT: case DS_DATA_ITEM::DS_TEXT:
format( (WS_DATA_ITEM_TEXT*) aItem, aNestLevel ); format( (DS_DATA_ITEM_TEXT*) aItem, aNestLevel );
break; break;
case WS_DATA_ITEM::WS_SEGMENT: case DS_DATA_ITEM::DS_SEGMENT:
case WS_DATA_ITEM::WS_RECT: case DS_DATA_ITEM::DS_RECT:
format( aModel, aItem, aNestLevel ); format( aModel, aItem, aNestLevel );
break; break;
case WS_DATA_ITEM::WS_POLYPOLYGON: case DS_DATA_ITEM::DS_POLYPOLYGON:
format( (WS_DATA_ITEM_POLYGONS*) aItem, aNestLevel ); format( (DS_DATA_ITEM_POLYGONS*) aItem, aNestLevel );
break; break;
case WS_DATA_ITEM::WS_BITMAP: case DS_DATA_ITEM::DS_BITMAP:
format( (WS_DATA_ITEM_BITMAP*) aItem, aNestLevel ); format( (DS_DATA_ITEM_BITMAP*) aItem, aNestLevel );
break; break;
default: 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 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 // Setup
int nestLevel = 1; 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 // Save the graphical items on the page layout
for( unsigned ii = 0; ii < aPageLayout->GetCount(); ii++ ) 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 ); 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( aNestLevel, "(%s", getTokenName( T_tbtext ) );
m_out->Print( 0, " %s", m_out->Quotew( aItem->m_TextBase ).c_str() ); 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" ); 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 ) ); m_out->Print( aNestLevel, "(%s", getTokenName( T_rect ) );
else else
m_out->Print( aNestLevel, "(%s", getTokenName( T_line ) ); 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( aNestLevel, "(%s", getTokenName( T_polygon ) );
m_out->Print( 0, " (%s %s)", getTokenName( T_name ), 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( aNestLevel, "(%s", getTokenName( T_bitmap ) );
m_out->Print( 0, " (%s %s)", getTokenName( T_name ), m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
@ -417,8 +410,8 @@ 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 POINT_COORD & aCoord ) const
{ {
m_out->Print( 0, " (%s %s %s", aToken, m_out->Print( 0, " (%s %s %s", aToken,
double2Str( aCoord.m_Pos.x ).c_str(), double2Str( aCoord.m_Pos.x ).c_str(),
@ -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 ) if( aItem->m_RepeatCount <= 1 )
return; return;
@ -449,12 +442,12 @@ void WS_DATA_MODEL_IO::formatRepeatParameters( WS_DATA_ITEM* aItem ) const
if( aItem->m_IncrementVector.y ) if( aItem->m_IncrementVector.y )
m_out->Print( 0, " (incry %s)", double2Str( aItem->m_IncrementVector.y ).c_str() ); 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 ); 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 ) if( aItem->GetPage1Option() == FIRST_PAGE_ONLY )
m_out->Print( 0, " (%s %s)", getTokenName( T_option ), getTokenName(T_page1only ) ); 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 ) * a basic shape of a page layout ( frame references and title block )
* Basic shapes are line, rect and texts * 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. * one of 4 page corners.
* *
* These items cannot be drawn or plot "as this". they should be converted * 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: * 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. * coordinates are converted to draw/plot coordinates.
* texts are expanded if they contain format symbols. * texts are expanded if they contain format symbols.
* Items with m_RepeatCount > 1 are created m_RepeatCount times * 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_LIST is created each time the page layout is plotted/drawn * 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). * describes the page layout (can be the default page layout or a custom file).
*/ */
#include <eda_rect.h> #include <eda_rect.h>
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
#include <fill_type.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_model.h>
#include <page_layout/ws_data_model.h>
#include <base_units.h> #include <base_units.h>
#include <page_info.h> #include <page_info.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
@ -63,13 +62,13 @@
// ============================ BASE CLASS ============================== // ============================ 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; 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; aLayers[0] = LAYER_DRAWINGSHEET;
return; 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. // 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; 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; 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 if( dataItem == nullptr ) // Is only a pure graphic item used in drawing sheet editor to
// handle the page limits // handle the page limits
@ -110,24 +109,24 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS
switch( dataItem->GetType() ) switch( dataItem->GetType() )
{ {
case WS_DATA_ITEM::WS_SEGMENT: case DS_DATA_ITEM::DS_SEGMENT:
aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg ) );
break; break;
case WS_DATA_ITEM::WS_RECT: case DS_DATA_ITEM::DS_RECT:
aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg ) ); aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg ) );
break; break;
case WS_DATA_ITEM::WS_TEXT: case DS_DATA_ITEM::DS_TEXT:
msg = static_cast<WS_DRAW_ITEM_TEXT*>( this )->GetShownText(); msg = static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText();
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg ) ); aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg ) );
break; break;
case WS_DATA_ITEM::WS_POLYPOLYGON: case DS_DATA_ITEM::DS_POLYPOLYGON:
aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg ) ); aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg ) );
break; break;
case WS_DATA_ITEM::WS_BITMAP: case DS_DATA_ITEM::DS_BITMAP:
aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg ) ); aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg ) );
break; break;
} }
@ -159,45 +158,46 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS
// ============================ TEXT ============================== // ============================ 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 ); 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(); 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 ); 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 ); 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'" ), return wxString::Format( _( "Text '%s'" ),
GetShownText() ); GetShownText() );
} }
void WS_DRAW_ITEM_TEXT::SetTextAngle( double aAngle ) void DS_DRAW_ITEM_TEXT::SetTextAngle( double aAngle )
{ {
EDA_TEXT::SetTextAngle( NormalizeAngle360Min( aAngle ) ); EDA_TEXT::SetTextAngle( NormalizeAngle360Min( aAngle ) );
} }
// ============================ POLYGON ================================= // ============================ 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(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); 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. // Note: m_pos is the anchor point of the shape.
wxPoint move_vect = aPos - m_pos; 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; EDA_RECT rect;
BOX2I box = m_Polygons.BBox(); 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 ); 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 int aAccuracy ) const
{ {
EDA_RECT sel = aRect; 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" ) ); return wxString::Format( _( "Imported Shape" ) );
} }
@ -301,7 +301,7 @@ wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============================ RECT ============================== // ============================ 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(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); 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 ) ); 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 ); int dist = aAccuracy + ( GetPenWidth() / 2 );
wxPoint start = GetStart(); 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; 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() ); return sel.Contains( GetBoundingBox() );
// For greedy we need to check each side of the rect as we're pretty much always inside the // 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(); EDA_RECT side = GetBoundingBox();
side.SetHeight( 0 ); 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" ), return wxString::Format( _( "Rectangle, width %s height %s" ),
MessageTextFromValue( aUnits, std::abs( GetStart().x - GetEnd().x ) ), MessageTextFromValue( aUnits, std::abs( GetStart().x - GetEnd().x ) ),
@ -400,7 +400,7 @@ wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============================ LINE ============================== // ============================ 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(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); 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 ) ); 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; int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1;
return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist ); 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" ), return wxString::Format( _( "Line, length %s" ),
MessageTextFromValue( aUnits, EuclideanNorm( GetStart() - GetEnd() ) ) ); MessageTextFromValue( aUnits, EuclideanNorm( GetStart() - GetEnd() ) ) );
@ -432,9 +432,9 @@ wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============== BITMAP ================ // ============== 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 ) if( !bitmap->m_ImageBitmap )
return; 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(); wxSize bm_size = bitmap->m_ImageBitmap->GetSize();
EDA_RECT bbox; 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(); EDA_RECT bbox = GetBoundingBox();
bbox.Inflate( aAccuracy ); 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" ); 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" ); return _( "Page Limits" );
} }
const EDA_RECT WS_DRAW_ITEM_PAGE::GetBoundingBox() const const EDA_RECT DS_DRAW_ITEM_PAGE::GetBoundingBox() const
{ {
EDA_RECT dummy; 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 ) const TITLE_BLOCK& aTitleBlock )
{ {
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance(); DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
m_titleBlock = &aTitleBlock; m_titleBlock = &aTitleBlock;
m_paperFormat = &aPageInfo.GetType(); m_paperFormat = &aPageInfo.GetType();
// Build the basic layout shape, if the layout list is empty // Build the basic layout shape, if the layout list is empty
if( model.GetCount() == 0 && !model.VoidListAllowed() ) if( model.GetCount() == 0 && !model.VoidListAllowed() )
model.SetPageLayout(); model.LoadDrawingSheet();
model.SetupDrawEnvironment( aPageInfo, m_milsToIu ); 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 // Generate it only if the page option allows this
if( wsItem->GetPage1Option() == FIRST_PAGE_ONLY && !m_isFirstPage ) 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) * The selected items are drawn after (usually 0 or 1)
* to be sure they are seen, even for overlapping items * 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 ) if( item->Type() == WSG_BITMAP_T )
item->PrintWsItem( aSettings ); item->PrintWsItem( aSettings );

View File

@ -29,11 +29,11 @@
#include <title_block.h> #include <title_block.h>
#include <build_version.h> #include <build_version.h>
#include <settings/color_settings.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 <gal/graphics_abstraction_layer.h>
#include <page_layout/ws_painter.h> #include <drawing_sheet/ds_painter.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <wx/app.h> #include <wx/app.h>
@ -41,7 +41,7 @@ using namespace KIGFX;
static const wxString productName = wxT( "KiCad E.D.A. " ); 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_backgroundColor = COLOR4D( 1.0, 1.0, 1.0, 1.0 );
m_normalColor = RED; 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 ++) for( int layer = SCH_LAYER_ID_START; layer < SCH_LAYER_ID_END; layer ++)
m_layerColors[ layer ] = aSettings->GetColor( 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 ); 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( "KICAD_VERSION" ) );
aVars->push_back( wxT( "#" ) ); aVars->push_back( wxT( "#" ) );
@ -100,7 +100,7 @@ void WS_DRAW_ITEM_LIST::GetTextVars( wxArrayString* aVars )
// returns the full text corresponding to the aTextbase, // returns the full text corresponding to the aTextbase,
// after replacing format symbols by the corresponding value // 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 = std::function<bool( wxString* )> wsResolver =
[ this ]( wxString* token ) -> bool [ 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 ); 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() ) switch( item->Type() )
{ {
case WSG_LINE_T: draw( (WS_DRAW_ITEM_LINE*) item, aLayer ); break; case WSG_LINE_T: draw( (DS_DRAW_ITEM_LINE*) item, aLayer ); break;
case WSG_POLY_T: draw( (WS_DRAW_ITEM_POLYPOLYGONS*) item, aLayer ); break; case WSG_POLY_T: draw( (DS_DRAW_ITEM_POLYPOLYGONS*) item, aLayer ); break;
case WSG_RECT_T: draw( (WS_DRAW_ITEM_RECT*) item, aLayer ); break; case WSG_RECT_T: draw( (DS_DRAW_ITEM_RECT*) item, aLayer ); break;
case WSG_TEXT_T: draw( (WS_DRAW_ITEM_TEXT*) item, aLayer ); break; case WSG_TEXT_T: draw( (DS_DRAW_ITEM_TEXT*) item, aLayer ); break;
case WSG_BITMAP_T: draw( (WS_DRAW_ITEM_BITMAP*) item, aLayer ); break; case WSG_BITMAP_T: draw( (DS_DRAW_ITEM_BITMAP*) item, aLayer ); break;
case WSG_PAGE_T: draw( (WS_DRAW_ITEM_PAGE*) item, aLayer ); break; case WSG_PAGE_T: draw( (DS_DRAW_ITEM_PAGE*) item, aLayer ); break;
default: return false; 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->SetIsStroke( true );
m_gal->SetIsFill( false ); 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->SetIsStroke( true );
m_gal->SetIsFill( false ); 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->SetFillColor( m_renderSettings.GetColor( aItem, aLayer ) );
m_gal->SetIsFill( true ); m_gal->SetIsFill( true );
m_gal->SetIsStroke( false ); 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 ) 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 ); VECTOR2D position( aItem->GetTextPos().x, aItem->GetTextPos().y );
int penWidth = std::max( aItem->GetEffectiveTextPenWidth(), 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(); 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(); VECTOR2D position = aItem->GetPosition();
m_gal->Translate( position ); 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 origin = VECTOR2D( 0.0, 0.0 );
VECTOR2D end = VECTOR2D( aItem->GetPageSize().x, 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 origin = VECTOR2D( 0.0, 0.0 );
VECTOR2D end = VECTOR2D( aPageInfo->GetWidthMils() * aScaleFactor, VECTOR2D end = VECTOR2D( aPageInfo->GetWidthMils() * aScaleFactor,

View File

@ -21,16 +21,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <page_layout/ws_proxy_undo_item.h> #include <drawing_sheet/ds_proxy_undo_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <view/view.h> #include <view/view.h>
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
#include <macros.h> #include <macros.h>
using namespace KIGFX; 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 ), EDA_ITEM( aFrame ? WS_PROXY_UNDO_ITEM_PLUS_T : WS_PROXY_UNDO_ITEM_T ),
m_selectedDataItem( INT_MAX ), m_selectedDataItem( INT_MAX ),
m_selectedDrawItem( 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(); m_titleBlock = aFrame->GetTitleBlock();
} }
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance(); DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
model.SaveInString( m_layoutSerialization ); model.SaveInString( m_layoutSerialization );
for( size_t ii = 0; ii < model.GetItems().size(); ++ii ) 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 ) 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() ) 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 ) 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 ); aFrame->SetTitleBlock( m_titleBlock );
} }
WS_DATA_MODEL::GetTheInstance().SetPageLayout( TO_UTF8( m_layoutSerialization ) ); DS_DATA_MODEL::GetTheInstance().SetPageLayout(TO_UTF8( m_layoutSerialization ) );
if( aView ) if( aView )
{ {
aView->Clear(); 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 ); dataItem->SyncDrawItems( nullptr, aView );
if( ii == m_selectedDataItem && m_selectedDrawItem < (int)dataItem->GetDrawItems().size() ) 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(); drawItem->SetSelected();
} }
} }

View File

@ -24,16 +24,16 @@
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#include <page_info.h> #include <page_info.h>
#include <page_layout/ws_proxy_view_item.h> #include <drawing_sheet/ds_proxy_view_item.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_painter.h> #include <drawing_sheet/ds_painter.h>
#include <project.h> #include <project.h>
#include <view/view.h> #include <view/view.h>
using namespace KIGFX; 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 ) : const PROJECT* aProject, const TITLE_BLOCK* aTitleBlock ) :
EDA_ITEM( NOT_USED ), // this item is never added to a BOARD so it needs no type EDA_ITEM( NOT_USED ), // this item is never added to a BOARD so it needs no type
m_mils2IUscalefactor( aMils2IUscalefactor ), 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; 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(); RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings();
wxString fileName( m_fileName.c_str(), wxConvUTF8 ); 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(); GAL* gal = aView->GetGAL();
RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings(); RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings();
WS_DRAW_ITEM_LIST drawList; DS_DRAW_ITEM_LIST drawList;
buildDrawList( aView, &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 ) ); gal->Scale( VECTOR2D( -1.0, 1.0 ) );
} }
WS_PAINTER ws_painter( gal ); DS_PAINTER ws_painter( gal );
auto ws_settings = static_cast<WS_RENDER_SETTINGS*>( ws_painter.GetSettings() ); auto ws_settings = static_cast<DS_RENDER_SETTINGS*>( ws_painter.GetSettings() );
ws_settings->SetNormalColor( settings->GetLayerColor( m_colorLayer ) ); ws_settings->SetNormalColor( settings->GetLayerColor( m_colorLayer ) );
ws_settings->SetSelectedColor( settings->GetLayerColor( LAYER_SELECT_OVERLAY ) ); 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 ) ); ws_settings->SetPageBorderColor( settings->GetLayerColor( m_pageBorderColorLayer ) );
// Draw all the components that make the page layout // 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 ); ws_painter.Draw( item, LAYER_DRAWINGSHEET );
// Draw gray line that outlines the sheet size // 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; aCount = 1;
aLayers[0] = LAYER_DRAWINGSHEET; 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 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 ); 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 ) ) if( item->HitTest( aPosition, accuracy ) )
return true; return true;

View File

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

View File

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

View File

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

View File

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

View File

@ -486,7 +486,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
if( cfg->m_Printing.use_theme && theme ) if( cfg->m_Printing.use_theme && theme )
renderSettings.LoadColors( 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. // if they just use the PCB layer.
renderSettings.SetLayerColor( LAYER_DRAWINGSHEET, renderSettings.SetLayerColor( LAYER_DRAWINGSHEET,
renderSettings.GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) ); renderSettings.GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );

View File

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

View File

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

View File

@ -45,7 +45,7 @@
#include <symbol_lib_table.h> #include <symbol_lib_table.h>
#include <widgets/paged_dialog.h> #include <widgets/paged_dialog.h>
#include <wildcards_and_files_ext.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> #include <zoom_defines.h>
@ -86,14 +86,13 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
LIB_PART::SetSubpartIdNotation( LIB_PART::GetSubpartIdSeparator(), LIB_PART::SetSubpartIdNotation( LIB_PART::GetSubpartIdSeparator(),
LIB_PART::GetSubpartFirstId() ); 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 // BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
// If empty, or not existing, the default descr is loaded // If empty, or not existing, the default descr is loaded
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance(); wxString filename = DS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
wxString filename = WS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
Prj().GetProjectPath() ); Prj().GetProjectPath() );
pglayout.SetPageLayout( filename ); DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename );
return true; return true;
} }

View File

@ -32,8 +32,8 @@
#include <sch_reference_list.h> #include <sch_reference_list.h>
#include <sch_sheet.h> #include <sch_sheet.h>
#include <schematic.h> #include <schematic.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_proxy_view_item.h> #include <drawing_sheet/ds_proxy_view_item.h>
#include <wx/ffile.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 ) 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( "*${*}*" ) ) ) if( text->GetShownText().Matches( wxT( "*${*}*" ) ) )
{ {

View File

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

View File

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

View File

@ -317,5 +317,5 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
TOOL_EVENT dummy; TOOL_EVENT dummy;
editTool->UpdateNetHighlighting( 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 <wildcards_and_files_ext.h>
#include <wx/cmdline.h> #include <wx/cmdline.h>
#include <gal/graphics_abstraction_layer.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. // non-member so it can be moved easily, and kept REALLY private.
// Do NOT Clear() in here. // Do NOT Clear() in here.
@ -1466,9 +1466,9 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
} }
else else
{ {
// Get current drawing sheet in a form we can compare to an EDA_ITEM // 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(); DS_PROXY_VIEW_ITEM* ds = SCH_BASE_FRAME::GetCanvas()->GetView()->GetDrawingSheet();
EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds ); EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
// Need an EDA_RECT so the first ".Merge" sees it's uninitialized // Need an EDA_RECT so the first ".Merge" sees it's uninitialized
EDA_RECT bBoxItems; EDA_RECT bBoxItems;
@ -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 // Calc the bounding box of all items on screen except the page border
for( EDA_ITEM* item : GetScreen()->Items() ) 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 ) if( item->Type() == SCH_COMPONENT_T )
{ {

View File

@ -57,7 +57,6 @@
#include <schematic.h> #include <schematic.h>
#include <symbol_lib_table.h> #include <symbol_lib_table.h>
#include <wildcards_and_files_ext.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 // 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 <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> #include <gal/graphics_abstraction_layer.h>

View File

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

View File

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

View File

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

View File

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

View File

@ -56,7 +56,7 @@
#include <tools/ee_selection.h> #include <tools/ee_selection.h>
#include <tools/ee_selection_tool.h> #include <tools/ee_selection_tool.h>
#include <tools/sch_editor_control.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_update_from_pcb.h>
#include <dialog_helpers.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 ) int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
{ {
PICKED_ITEMS_LIST undoCmd; 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 ); ITEM_PICKER wrapper( m_frame->GetScreen(), undoItem, UNDO_REDO::PAGESETTINGS );
undoCmd.PushItem( wrapper ); undoCmd.PushItem( wrapper );

View File

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

View File

@ -21,7 +21,7 @@
#include <view/view.h> #include <view/view.h>
#include <view/wx_view_controls.h> #include <view/wx_view_controls.h>
#include <gerbview_painter.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 <zoom_defines.h>
#include <gerbview_frame.h> #include <gerbview_frame.h>
@ -30,7 +30,6 @@
#include <gerber_file_image.h> #include <gerber_file_image.h>
#include <gerber_file_image_list.h> #include <gerber_file_image_list.h>
#include <zoom_defines.h>
#include <functional> #include <functional>
#include <memory> #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_drawingSheet.reset( aDrawingSheet );
m_view->Add( m_drawingSheet.get() ); m_view->Add( m_drawingSheet.get() );

View File

@ -22,10 +22,7 @@
#include <class_draw_panel_gal.h> #include <class_draw_panel_gal.h>
namespace KIGFX class DS_PROXY_VIEW_ITEM;
{
class WS_PROXY_VIEW_ITEM;
}
class GERBVIEW_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL class GERBVIEW_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
@ -56,24 +53,24 @@ public:
BOX2I GetDefaultViewBBox() const override; 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. * 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: protected:
///< Set rendering targets & dependencies for layers. ///< Set rendering targets & dependencies for layers.
void setDefaultLayerDeps(); void setDefaultLayerDeps();
///< Currently used worksheet ///< Currently used drawing-sheet (borders and title block)
std::unique_ptr<KIGFX::WS_PROXY_VIEW_ITEM> m_drawingSheet; std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
}; };

View File

@ -32,7 +32,7 @@
#include <gerbview_draw_panel_gal.h> #include <gerbview_draw_panel_gal.h>
#include <gerbview_settings.h> #include <gerbview_settings.h>
#include <gal/graphics_abstraction_layer.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/common_settings.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
@ -750,9 +750,9 @@ void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, COLOR4D aColor )
case LAYER_GERBVIEW_DRAWINGSHEET: case LAYER_GERBVIEW_DRAWINGSHEET:
settings->SetColor( LAYER_GERBVIEW_DRAWINGSHEET, aColor ); 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 // 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 ); settings->SetColor( LAYER_DRAWINGSHEET, aColor );
break; break;
@ -819,22 +819,22 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
if( GetScreen() ) if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() ); 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 // Prepare drawing-sheet template
auto worksheet = new KIGFX::WS_PROXY_VIEW_ITEM( IU_PER_MILS, &GetPageSettings(), DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( IU_PER_MILS, &GetPageSettings(),
&Prj(), &GetTitleBlock() ); &Prj(), &GetTitleBlock() );
if( GetScreen() ) if( GetScreen() )
{ {
worksheet->SetPageNumber( "1" ); drawingSheet->SetPageNumber( "1" );
worksheet->SetSheetCount( 1 ); drawingSheet->SetSheetCount( 1 );
} }
worksheet->SetColorLayer( LAYER_GERBVIEW_DRAWINGSHEET ); drawingSheet->SetColorLayer( LAYER_GERBVIEW_DRAWINGSHEET );
// Draw panel takes ownership of the worksheet // Draw panel takes ownership of the drawing-sheet
drawPanel->SetDrawingSheet( worksheet ); drawPanel->SetDrawingSheet( drawingSheet );
} }

View File

@ -46,22 +46,19 @@ bool GERBVIEW_PRINTOUT::OnPrintPage( int aPage )
// Store the layerset, as it is going to be modified below and the original settings are needed // Store the layerset, as it is going to be modified below and the original settings are needed
LSET lset = m_settings.m_LayerSet; 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(); LSEQ seq = lset.UIOrder();
wxCHECK( unsigned( aPage - 1 ) < seq.size(), false ); wxCHECK( unsigned( aPage - 1 ) < seq.size(), false );
auto layerId = seq[aPage - 1]; auto layerId = seq[aPage - 1];
// In gerbview, draw layers are always printed on separate pages // In gerbview, draw layers are always printed on separate pages because handling negative
// because handling negative objects when using only one page is tricky // objects when using only one page is tricky
// Enable only one layer to create a printout // Enable only one layer to create a printout
m_settings.m_LayerSet = LSET( layerId ); m_settings.m_LayerSet = LSET( layerId );
GERBER_FILE_IMAGE_LIST& gbrImgList = GERBER_FILE_IMAGE_LIST::GetImagesList(); GERBER_FILE_IMAGE_LIST& gbrImgList = GERBER_FILE_IMAGE_LIST::GetImagesList();
GERBER_FILE_IMAGE* gbrImage = gbrImgList.GetGbrImage( layerId ); GERBER_FILE_IMAGE* gbrImage = gbrImgList.GetGbrImage( layerId );
wxString gbr_filename; wxString gbr_filename;
if( gbrImage ) if( gbrImage )
gbr_filename = gbrImage->m_FileName; gbr_filename = gbrImage->m_FileName;

View File

@ -43,7 +43,7 @@ class PLOTTER;
* This class handle bitmap images in KiCad. * This class handle bitmap images in KiCad.
* *
* It is not intended to be used alone, but inside another class so all methods are protected * 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. * the future.
* *
* @warning Not all plotters are able to plot a bitmap. Mainly GERBER plotters cannot. * @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 ///< Configures GAL object for a printout
virtual void setupGal( KIGFX::GAL* aGal ); 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; virtual EDA_RECT getBoundingBox() = 0;
///< Returns a PAINTER instance used to draw the items. ///< Returns a PAINTER instance used to draw the items.

View File

@ -25,7 +25,7 @@
#include <widgets/unit_binder.h> #include <widgets/unit_binder.h>
#include <dialog_page_settings_base.h> #include <dialog_page_settings_base.h>
class WS_DATA_MODEL; class DS_DATA_MODEL;
/*! /*!
* DIALOG_PAGES_SETTINGS class declaration * DIALOG_PAGES_SETTINGS class declaration
@ -123,8 +123,8 @@ protected:
PAGE_INFO m_pageInfo; /// Temporary page info. PAGE_INFO m_pageInfo; /// Temporary page info.
bool m_customFmt; /// true if the page selection is custom bool m_customFmt; /// true if the page selection is custom
TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions). 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 // when the initial one is replaced by a new one
double m_iuPerMils; double m_iuPerMils;
private: private:

View File

@ -22,20 +22,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** #ifndef DS_DATA_ITEM_H
* @file worksheet_dataitem.h #define DS_DATA_ITEM_H
* @brief description of graphic items and texts to build a title block
*/
#ifndef WORKSHEET_DATA_ITEM_H
#define WORKSHEET_DATA_ITEM_H
#include <math/vector2d.h> #include <math/vector2d.h>
#include <eda_text.h> #include <eda_text.h>
#include <bitmap_base.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 #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: * Basic items are:
* * segment and rect (defined by 2 points) * * segment and rect (defined by 2 points)
@ -97,25 +92,25 @@ public:
* ( because we use it for logos, there are more than one polygon * ( because we use it for logos, there are more than one polygon
* in this description * in this description
*/ */
class WS_DATA_ITEM class DS_DATA_ITEM
{ {
public: public:
enum WS_ITEM_TYPE { enum DS_ITEM_TYPE {
WS_TEXT, DS_TEXT,
WS_SEGMENT, DS_SEGMENT,
WS_RECT, DS_RECT,
WS_POLYPOLYGON, DS_POLYPOLYGON,
WS_BITMAP DS_BITMAP
}; };
public: 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 ) void SetStart( double aPosx, double aPosy, enum CORNER_ANCHOR aAnchor = RB_CORNER )
{ {
@ -131,7 +126,7 @@ public:
m_End.m_Anchor = aAnchor; 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). * @return true if the item has a end point (segment; rect) of false (text, polygon).
@ -202,10 +197,10 @@ public:
const wxString GetClassName() const; const wxString GetClassName() const;
protected: protected:
WS_ITEM_TYPE m_type; DS_ITEM_TYPE m_type;
PAGE_OPTION m_pageOption; PAGE_OPTION m_pageOption;
std::vector<WS_DRAW_ITEM_BASE*> m_drawItems; std::vector<DS_DRAW_ITEM_BASE*> m_drawItems;
public: public:
wxString m_Name; // a item name used in page layout 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: 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; 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: 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; virtual int GetPenSizeUi() override;
@ -360,16 +355,16 @@ public:
class BITMAP_BASE; class BITMAP_BASE;
class WS_DATA_ITEM_BITMAP : public WS_DATA_ITEM class DS_DATA_ITEM_BITMAP : public DS_DATA_ITEM
{ {
public: public:
WS_DATA_ITEM_BITMAP( BITMAP_BASE* aImage ) : DS_DATA_ITEM_BITMAP( BITMAP_BASE* aImage ) :
WS_DATA_ITEM( WS_BITMAP ) DS_DATA_ITEM( DS_BITMAP )
{ {
m_ImageBitmap = aImage; 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; int GetPPI() const;
void SetPPI( int aBitmapPPI ); 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef WS_DATA_MODEL_H #ifndef DS_DATA_MODEL_H
#define WS_DATA_MODEL_H #define DS_DATA_MODEL_H
#include <math/vector2d.h> #include <math/vector2d.h>
#include <eda_text.h> #include <eda_text.h>
#include <bitmap_base.h> #include <bitmap_base.h>
class WS_DATA_ITEM; class DS_DATA_ITEM;
class PAGE_INFO; class PAGE_INFO;
/** /**
* Handle the graphic items list to draw/plot the frame and title block. * Handle the graphic items list to draw/plot the frame and title block.
*/ */
class WS_DATA_MODEL class DS_DATA_MODEL
{ {
public: public:
WS_DATA_MODEL(); DS_DATA_MODEL();
~WS_DATA_MODEL()
~DS_DATA_MODEL()
{ {
ClearList(); 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 * @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; } double GetLeftMargin() { return m_leftMargin; }
void SetLeftMargin( double aMargin ) { m_leftMargin = aMargin; } 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. * 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 Append( DS_DATA_ITEM* aItem );
void Remove( WS_DATA_ITEM* aItem ); void Remove( DS_DATA_ITEM* aItem );
/** /**
* @return the index of aItem, or -1 if does not exist. * @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. * @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. * @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. * @return the item count.
@ -153,7 +154,7 @@ public:
* default internal description. * default internal description.
* @param Append if true: do not delete old layout, and load only \a aFullFileName. * @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. * Populate the list from a S expr description stored in a string.
@ -204,9 +205,9 @@ public:
// displayed "as this" // displayed "as this"
private: 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 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) // is run (useful mainly for drawing sheet editor)
double m_leftMargin; // the left page margin in mm double m_leftMargin; // the left page margin in mm
double m_rightMargin; // the right 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef WS_DRAW_ITEM_H #ifndef DS_DRAW_ITEM_H
#define WS_DRAW_ITEM_H #define DS_DRAW_ITEM_H
#include <core/typeinfo.h> #include <core/typeinfo.h>
#include <math/vector2d.h> #include <math/vector2d.h>
@ -36,7 +36,7 @@
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
class WS_DATA_ITEM; class DS_DATA_ITEM;
class TITLE_BLOCK; class TITLE_BLOCK;
class PAGE_INFO; class PAGE_INFO;
class EDA_ITEM; class EDA_ITEM;
@ -55,12 +55,12 @@ class PROJECT;
* - bitmaps (also for logos, but they cannot be plot by SVG, GERBER or HPGL plotters * - bitmaps (also for logos, but they cannot be plot by SVG, GERBER or HPGL plotters
* where we just plot the bounding box) * where we just plot the bounding box)
*/ */
class WS_DRAW_ITEM_BASE : public EDA_ITEM class DS_DRAW_ITEM_BASE : public EDA_ITEM
{ {
public: 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; } int GetIndexInPeer() const { return m_index; }
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
@ -100,7 +100,7 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) override;
protected: 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 ) EDA_ITEM( aType )
{ {
m_peer = aPeer; m_peer = aPeer;
@ -109,26 +109,26 @@ protected:
m_flags = 0; 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_index; // the index in the parent's repeat count
int m_penWidth; int m_penWidth;
}; };
// This class draws a thick segment // 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: 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 ) : int aPenWidth ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_LINE_T ) DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_LINE_T )
{ {
m_start = aStart; m_start = aStart;
m_end = aEnd; m_end = aEnd;
m_penWidth = aPenWidth; 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; } const wxPoint& GetStart() const { return m_start; }
void SetStart( wxPoint aPos ) { m_start = aPos; } 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: public:
WS_DRAW_ITEM_POLYPOLYGONS( WS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos, int aPenWidth ) : DS_DRAW_ITEM_POLYPOLYGONS( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos, int aPenWidth ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_POLY_T ) DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_POLY_T )
{ {
m_penWidth = aPenWidth; m_penWidth = aPenWidth;
m_pos = aPos; 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; } SHAPE_POLY_SET& GetPolygons() { return m_Polygons; }
wxPoint GetPosition() const override { return m_pos; } wxPoint GetPosition() const override { return m_pos; }
@ -194,7 +194,7 @@ public:
private: 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) // (used only in drawing sheet editor to draw anchors)
}; };
@ -202,19 +202,19 @@ private:
/** /**
* Non filled rectangle with thick segment. * 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: 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 ) : int aPenWidth ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_RECT_T ) DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_RECT_T )
{ {
m_start = aStart; m_start = aStart;
m_end = aEnd; m_end = aEnd;
m_penWidth = aPenWidth; 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; } const wxPoint& GetStart() const { return m_start; }
void SetStart( wxPoint aPos ) { m_start = aPos; } 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 * A rectangle with thick segment showing the page limits and a marker showing the coordinate
* origin. * origin.
* *
* This only a draw item only. Therefore m_peer ( the parent WS_DATA_ITEM item in the * This only a draw item only. Therefore m_peer ( the parent DS_DATA_ITEM item in the
* WS_DATA_MODEL) is always a nullptr. * 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: public:
WS_DRAW_ITEM_PAGE( int aPenWidth, double aMarkerSize ) : DS_DRAW_ITEM_PAGE( int aPenWidth, double aMarkerSize ) :
WS_DRAW_ITEM_BASE( nullptr, 0, WSG_PAGE_T ) DS_DRAW_ITEM_BASE( nullptr, 0, WSG_PAGE_T )
{ {
m_penWidth = aPenWidth; m_penWidth = aPenWidth;
m_markerSize = aMarkerSize; 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; } void SetPageSize( wxSize aSize ) { m_pageSize = aSize; }
wxSize GetPageSize() const { return m_pageSize; } 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 * It is derived from an #EDA_TEXT, so it handle all characteristics of this graphic text
* (justification, rotation ... ). * (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: 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, wxSize aSize, int aPenWidth, bool aItalic = false,
bool aBold = 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 ) EDA_TEXT( aText )
{ {
SetTextPos( aPos ); SetTextPos( aPos );
@ -310,7 +310,7 @@ public:
SetBold( aBold ); 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; void PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
@ -334,18 +334,18 @@ public:
/** /**
* A bitmap. * A bitmap.
*/ */
class WS_DRAW_ITEM_BITMAP : public WS_DRAW_ITEM_BASE class DS_DRAW_ITEM_BITMAP : public DS_DRAW_ITEM_BASE
{ {
public: public:
WS_DRAW_ITEM_BITMAP( WS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos ) : DS_DRAW_ITEM_BITMAP( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos ) :
WS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_BITMAP_T ) DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_BITMAP_T )
{ {
m_pos = aPos; 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; } wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPos ) override { m_pos = aPos; } void SetPosition( const wxPoint& aPos ) override { m_pos = aPos; }
@ -373,10 +373,10 @@ private:
* the title block and frame references, and parameters to * the title block and frame references, and parameters to
* draw/plot them * draw/plot them
*/ */
class WS_DRAW_ITEM_LIST class DS_DRAW_ITEM_LIST
{ {
public: public:
WS_DRAW_ITEM_LIST() DS_DRAW_ITEM_LIST()
{ {
m_idx = 0; m_idx = 0;
m_milsToIu = 1.0; m_milsToIu = 1.0;
@ -390,10 +390,10 @@ public:
m_isFirstPage = true; m_isFirstPage = true;
} }
~WS_DRAW_ITEM_LIST() ~DS_DRAW_ITEM_LIST()
{ {
// Items in the m_graphicList are owned by their respective WORKSHEET_DATAITEMs. // 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; // delete item;
} }
@ -470,18 +470,18 @@ public:
m_sheetCount = aSheetCount; m_sheetCount = aSheetCount;
} }
void Append( WS_DRAW_ITEM_BASE* aItem ) void Append( DS_DRAW_ITEM_BASE* aItem )
{ {
m_graphicList.push_back( 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 ); auto newEnd = std::remove( m_graphicList.begin(), m_graphicList.end(), aItem );
m_graphicList.erase( newEnd, m_graphicList.end() ); m_graphicList.erase( newEnd, m_graphicList.end() );
} }
WS_DRAW_ITEM_BASE* GetFirst() DS_DRAW_ITEM_BASE* GetFirst()
{ {
m_idx = 0; m_idx = 0;
@ -491,7 +491,7 @@ public:
return NULL; return NULL;
} }
WS_DRAW_ITEM_BASE* GetNext() DS_DRAW_ITEM_BASE* GetNext()
{ {
m_idx++; m_idx++;
@ -501,7 +501,7 @@ public:
return NULL; return NULL;
} }
void GetAllItems( std::vector<WS_DRAW_ITEM_BASE*>* aList ) void GetAllItems( std::vector<DS_DRAW_ITEM_BASE*>* aList )
{ {
*aList = m_graphicList; *aList = m_graphicList;
} }
@ -561,7 +561,7 @@ public:
wxString BuildFullText( const wxString& aTextbase ); wxString BuildFullText( const wxString& aTextbase );
protected: 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 unsigned m_idx; // for GetFirst, GetNext functions
double m_milsToIu; // the scalar to convert pages units ( mils) double m_milsToIu; // the scalar to convert pages units ( mils)
// to draw/plot units. // 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 // For page and paper size, values are in 1/1000 inch
#ifndef WS_PAINTER_H #ifndef DS_PAINTER_H
#define WS_PAINTER_H #define DS_PAINTER_H
#include <gal/color4d.h> #include <gal/color4d.h>
#include <painter.h> #include <painter.h>
#include <page_info.h> #include <page_info.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
// Forward declarations: // Forward declarations:
class EDA_RECT; class EDA_RECT;
@ -43,12 +43,12 @@ namespace KIGFX
/** /**
* Store page-layout-specific render settings. * Store page-layout-specific render settings.
*/ */
class WS_RENDER_SETTINGS : public RENDER_SETTINGS class DS_RENDER_SETTINGS : public RENDER_SETTINGS
{ {
public: public:
friend class WS_PAINTER; friend class DS_PAINTER;
WS_RENDER_SETTINGS(); DS_RENDER_SETTINGS();
void LoadColors( const COLOR_SETTINGS* aSettings ) override; void LoadColors( const COLOR_SETTINGS* aSettings ) override;
@ -95,10 +95,10 @@ private:
/** /**
* Methods for drawing worksheet items. * Methods for drawing worksheet items.
*/ */
class WS_PAINTER : public PAINTER class DS_PAINTER : public PAINTER
{ {
public: public:
WS_PAINTER( GAL* aGal ) : DS_PAINTER( GAL* aGal ) :
PAINTER( aGal ) PAINTER( aGal )
{ } { }
@ -111,15 +111,15 @@ public:
virtual RENDER_SETTINGS* GetSettings() override { return &m_renderSettings; } virtual RENDER_SETTINGS* GetSettings() override { return &m_renderSettings; }
private: private:
void draw( const WS_DRAW_ITEM_LINE* aItem, int aLayer ) const; void draw( const DS_DRAW_ITEM_LINE* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_RECT* aItem, int aLayer ) const; void draw( const DS_DRAW_ITEM_RECT* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_POLYPOLYGONS* aItem, int aLayer ) const; void draw( const DS_DRAW_ITEM_POLYPOLYGONS* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const; void draw( const DS_DRAW_ITEM_TEXT* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_BITMAP* aItem, int aLayer ) const; void draw( const DS_DRAW_ITEM_BITMAP* aItem, int aLayer ) const;
void draw( const WS_DRAW_ITEM_PAGE* aItem, int aLayer ) const; void draw( const DS_DRAW_ITEM_PAGE* aItem, int aLayer ) const;
private: private:
WS_RENDER_SETTINGS m_renderSettings; DS_RENDER_SETTINGS m_renderSettings;
}; };
} // namespace KIGFX } // namespace KIGFX
@ -144,10 +144,10 @@ private:
* - the LTmargin The left top margin of the page layout. * - the LTmargin The left top margin of the page layout.
* - the RBmargin The right bottom 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 wxString& aFullSheetName, const wxString& aFileName,
const TITLE_BLOCK& aTitleBlock, int aSheetCount, const wxString& aPageNumber, const TITLE_BLOCK& aTitleBlock, int aSheetCount,
double aScalar, const PROJECT* aProject, const wxString& aPageNumber, double aScalar, const PROJECT* aProject,
const wxString& aSheetLayer = wxEmptyString, bool aIsFirstPage = true ); 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef WS_PROXY_UNDO_ITEM_H #ifndef DS_PROXY_UNDO_ITEM_H
#define WS_PROXY_UNDO_ITEM_H #define DS_PROXY_UNDO_ITEM_H
#include <eda_item.h> #include <eda_item.h>
#include <title_block.h> #include <title_block.h>
#include <page_info.h> #include <page_info.h>
class WS_PROXY_UNDO_ITEM : public EDA_ITEM class DS_PROXY_UNDO_ITEM : public EDA_ITEM
{ {
public: 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 * Restores the saved worksheet layout to the global worksheet record, and the saved
@ -49,7 +49,7 @@ public:
wxString GetClass() const override wxString GetClass() const override
{ {
return wxT( "WS_PROXY_UNDO_ITEM" ); return wxT( "DS_PROXY_UNDO_ITEM" );
} }
protected: protected:
@ -60,4 +60,4 @@ protected:
int m_selectedDrawItem; 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef WS_PROXY_VIEW_ITEM_H #ifndef DS_PROXY_VIEW_ITEM_H
#define WS_PROXY_VIEW_ITEM_H #define DS_PROXY_VIEW_ITEM_H
#include <eda_item.h> #include <eda_item.h>
@ -32,21 +32,22 @@ class BOARD;
class PAGE_INFO; class PAGE_INFO;
class PROJECT; class PROJECT;
class TITLE_BLOCK; class TITLE_BLOCK;
class WS_DRAW_ITEM_LINE; class DS_DRAW_ITEM_LINE;
class WS_DRAW_ITEM_RECT; class DS_DRAW_ITEM_RECT;
class WS_DRAW_ITEM_TEXT; class DS_DRAW_ITEM_TEXT;
class WS_DRAW_ITEM_BITMAP; class DS_DRAW_ITEM_BITMAP;
class WS_DRAW_ITEM_LIST; class DS_DRAW_ITEM_LIST;
namespace KIGFX namespace KIGFX
{ {
class VIEW; class VIEW;
class GAL; class GAL;
}
class WS_PROXY_VIEW_ITEM : public EDA_ITEM class DS_PROXY_VIEW_ITEM : public EDA_ITEM
{ {
public: 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 ); const TITLE_BLOCK* aTitleBlock );
/** /**
@ -65,7 +66,7 @@ public:
void SetPageNumber( const std::string& aPageNumber ) { m_pageNumber = aPageNumber; } 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; } void SetSheetCount( int aSheetCount ) { m_sheetCount = aSheetCount; }
@ -102,7 +103,7 @@ public:
const BOX2I ViewBBox() const override; const BOX2I ViewBBox() const override;
/// @copydoc VIEW_ITEM::ViewDraw() /// @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() /// @copydoc VIEW_ITEM::ViewGetLayers()
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
@ -117,13 +118,13 @@ public:
*/ */
virtual wxString GetClass() const override 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: 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) /// the factor between mils (units used in worksheet and internal units)
/// it is the value IU_PER_MILS used in the caller /// it is the value IU_PER_MILS used in the caller
@ -144,6 +145,5 @@ protected:
/// Layer that is used for page border color /// Layer that is used for page border color
int m_pageBorderColorLayer; 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 ); 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 aScreen screen to draw.
* @param aMils2Iu The mils to Iu conversion factor. * @param aMils2Iu The mils to Iu conversion factor.

View File

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

View File

@ -26,9 +26,9 @@
#include <wx/wupdlock.h> #include <wx/wupdlock.h>
#include <eda_item.h> #include <eda_item.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include "dialogs/dialog_design_inspector_base.h" #include "dialogs/dialog_design_inspector_base.h"
@ -209,7 +209,7 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
m_itemsList.clear(); 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() ); wxFileName fn( static_cast<PL_EDITOR_FRAME*>( GetParent() )->GetCurrentFileName() );
if( fn.GetName().IsEmpty() ) if( fn.GetName().IsEmpty() )
@ -227,33 +227,33 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
Iu2Millimeter( page_sizeIU.x ), Iu2Millimeter( page_sizeIU.y ) ) ); Iu2Millimeter( page_sizeIU.x ), Iu2Millimeter( page_sizeIU.y ) ) );
GetGridList()->SetCellRenderer (row, COL_BITMAP, new BitmapGridCellRenderer( root_xpm ) ); GetGridList()->SetCellRenderer (row, COL_BITMAP, new BitmapGridCellRenderer( root_xpm ) );
GetGridList()->SetReadOnly( row, COL_BITMAP ); 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 // Now adding all current items
row++; row++;
for( WS_DATA_ITEM* item : pglayout.GetItems() ) for( DS_DATA_ITEM* item : drawingSheet.GetItems() )
{ {
const char** img = nullptr; const char** img = nullptr;
switch( item->GetType() ) switch( item->GetType() )
{ {
case WS_DATA_ITEM::WS_SEGMENT: case DS_DATA_ITEM::DS_SEGMENT:
img = line_xpm; img = line_xpm;
break; break;
case WS_DATA_ITEM::WS_RECT: case DS_DATA_ITEM::DS_RECT:
img = rect_xpm; img = rect_xpm;
break; break;
case WS_DATA_ITEM::WS_TEXT: case DS_DATA_ITEM::DS_TEXT:
img = text_xpm; img = text_xpm;
break; break;
case WS_DATA_ITEM::WS_POLYPOLYGON: case DS_DATA_ITEM::DS_POLYPOLYGON:
img = poly_xpm; img = poly_xpm;
break; break;
case WS_DATA_ITEM::WS_BITMAP: case DS_DATA_ITEM::DS_BITMAP:
img = img_xpm; img = img_xpm;
break; break;
} }
@ -266,9 +266,9 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
wxString::Format( "%d", item->m_RepeatCount ) ); wxString::Format( "%d", item->m_RepeatCount ) );
GetGridList()->SetCellValue( row, COL_COMMENT, item->m_Info ); 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 ); 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 // Select the row corresponding to the DS_DATA_ITEM aItem
void DIALOG_INSPECTOR::SelectRow( WS_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 ) for( unsigned row = 1; row < m_itemsList.size(); ++row )
{ {
if( m_itemsList[row] == aItem ) 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 //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 ( 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 ) void DIALOG_INSPECTOR::onCellClicked( wxGridEvent& event )
{ {
int row = event.GetRow(); int row = event.GetRow();
GetGridList()->SelectRow( row ); 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; return;
// Select this item in drawing sheet editor, and update the properties panel: // 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; } wxGrid* GetGridList() const { return m_gridListItems; }
void onCellClicked( wxGridEvent& event ) override; void onCellClicked( wxGridEvent& event ) override;
// The list of WS_DATA_ITEM found in page layout // The list of DS_DATA_ITEM found in page layout
std::vector<WS_DATA_ITEM*> m_itemsList; std::vector<DS_DATA_ITEM*> m_itemsList;
PL_EDITOR_FRAME* m_editorFrame; PL_EDITOR_FRAME* m_editorFrame;
public: public:
@ -53,16 +53,13 @@ public:
void ReCreateDesignList(); 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) // Select the tree item corresponding to the DS_DATA_ITEM aItem
*/ void SelectRow( DS_DATA_ITEM* aItem );
WS_DATA_ITEM* GetSelectedWsDataItem() const;
// Select the tree item corresponding to the WS_DATA_ITEM aItem
void SelectRow( WS_DATA_ITEM* aItem );
}; };
#endif /* _DESIGN_INSPECTOR_H */ #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 <dialog_helpers.h>
#include <eda_item.h> #include <eda_item.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <page_layout/ws_painter.h> #include <drawing_sheet/ds_painter.h>
#include <dialogs/dialog_page_settings.h> #include <dialogs/dialog_page_settings.h>
#include "invoke_pl_editor_dialog.h" #include "invoke_pl_editor_dialog.h"
@ -188,19 +188,19 @@ void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
screen->SetVirtualPageNumber( aPageNum ); screen->SetVirtualPageNumber( aPageNum );
KIGFX::WS_RENDER_SETTINGS renderSettings; KIGFX::DS_RENDER_SETTINGS renderSettings;
renderSettings.SetDefaultPenWidth( 1 ); renderSettings.SetDefaultPenWidth( 1 );
renderSettings.SetLayerColor( LAYER_DRAWINGSHEET, COLOR4D( RED ) ); renderSettings.SetLayerColor( LAYER_DRAWINGSHEET, COLOR4D( RED ) );
renderSettings.SetPrintDC( dc ); renderSettings.SetPrintDC( dc );
// Ensure the scaling factor (used only in printing) of bitmaps is up to date // 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() ); bitmap->SetPixelSizeIu( IU_PER_MILS * 1000 / bitmap->GetPPI() );
} }
} }

View File

@ -26,13 +26,12 @@
#include <project.h> #include <project.h>
#include <scintilla_tricks.h> #include <scintilla_tricks.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <view/view.h> #include <view/view.h>
#include "properties_frame.h" #include "properties_frame.h"
#include "pl_draw_panel_gal.h"
#include "pl_editor_frame.h" #include "pl_editor_frame.h"
#include "tools/pl_selection_tool.h" #include "tools/pl_selection_tool.h"
@ -101,7 +100,7 @@ wxSize PROPERTIES_FRAME::GetMinSize() const
// Data transfert from general properties to widgets // Data transfert from general properties to widgets
void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel() void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
{ {
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance(); DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
// Set default parameters // Set default parameters
m_textCtrlDefaultLineWidthBinder.SetDoubleValue( m_textCtrlDefaultLineWidthBinder.SetDoubleValue(
@ -125,7 +124,7 @@ void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
// Data transfert from widgets to general properties // Data transfert from widgets to general properties
bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral() 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 // Import default parameters from widgets
model.m_DefaultLineWidth = model.m_DefaultLineWidth =
@ -156,7 +155,7 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
// Data transfert from item to widgets in properties frame // 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 ) if( !aItem )
{ {
@ -166,7 +165,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
wxString msg; 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_staticTextType->SetLabel( aItem->GetClassName() );
m_textCtrlComment->SetValue( aItem->m_Info ); m_textCtrlComment->SetValue( aItem->m_Info );
@ -210,12 +209,12 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
m_textCtrlThicknessBinder.SetDoubleValue( m_textCtrlThicknessBinder.SetDoubleValue(
From_User_Unit( EDA_UNITS::MILLIMETRES, aItem->m_LineWidth ) ); 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, // For a given type, disable widgets which are not relevant,
// and be sure widgets which are relevant are enabled // 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; item->m_FullText = item->m_TextBase;
// Replace our '\' 'n' sequence by the EOL char // Replace our '\' 'n' sequence by the EOL char
item->ReplaceAntiSlashSequence(); item->ReplaceAntiSlashSequence();
@ -259,17 +258,17 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
From_User_Unit( EDA_UNITS::MILLIMETRES, item->m_TextSize.y ) ); 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) // Rotation (poly and text)
msg.Printf( wxT("%.3f"), item->m_Orient ); msg.Printf( wxT("%.3f"), item->m_Orient );
m_textCtrlRotation->SetValue( msg ); 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 // select definition in PPI
msg.Printf( wxT("%d"), item->GetPPI() ); msg.Printf( wxT("%d"), item->GetPPI() );
m_textCtrlBitmapDPI->SetValue( msg ); m_textCtrlBitmapDPI->SetValue( msg );
@ -277,15 +276,15 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
m_SizerItemProperties->Show( true ); 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 m_sbSizerEndPosition->Show( aItem->GetType() == DS_DATA_ITEM::DS_SEGMENT
|| aItem->GetType() == WS_DATA_ITEM::WS_RECT ); || 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 if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT
|| aItem->GetType() == WS_DATA_ITEM::WS_POLYPOLYGON ) || aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
{ {
m_staticTextRot->Show( true ); m_staticTextRot->Show( true );
m_textCtrlRotation->Show( true ); m_textCtrlRotation->Show( true );
@ -296,11 +295,11 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
m_textCtrlRotation->Show( false ); m_textCtrlRotation->Show( false );
} }
m_staticTextBitmapDPI->Show( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP ); m_staticTextBitmapDPI->Show( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP );
m_textCtrlBitmapDPI->Show( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP ); m_textCtrlBitmapDPI->Show( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP );
m_staticTextInclabel->Show( aItem->GetType() == WS_DATA_ITEM::WS_TEXT ); m_staticTextInclabel->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
m_textCtrlTextIncrement->Show( aItem->GetType() == WS_DATA_ITEM::WS_TEXT ); m_textCtrlTextIncrement->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
// Repeat parameters // Repeat parameters
msg.Printf( wxT("%d"), aItem->m_RepeatCount ); msg.Printf( wxT("%d"), aItem->m_RepeatCount );
@ -334,11 +333,11 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
m_parent->SaveCopyInUndoList(); 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 ) if( drawItem )
{ {
WS_DATA_ITEM* dataItem = drawItem->GetPeer(); DS_DATA_ITEM* dataItem = drawItem->GetPeer();
CopyPrmsFromPanelToItem( dataItem ); CopyPrmsFromPanelToItem( dataItem );
// Be sure what is displayed is what is set for item // Be sure what is displayed is what is set for item
// (mainly, texts can be modified if they contain "\n") // (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 ) 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_DefaultTextSize = DSIZE( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE );
model.m_DefaultLineWidth = 0.15; model.m_DefaultLineWidth = 0.15;
@ -376,7 +375,7 @@ void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
// Data transfert from properties frame to item parameters // 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 ) if( aItem == NULL )
return false; 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.x = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlStepXBinder.GetValue() );
aItem->m_IncrementVector.y = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlStepYBinder.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(); 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() ); 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(); msg = m_textCtrlRotation->GetValue();
item->m_Orient = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); 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; long value;
msg = m_textCtrlBitmapDPI->GetValue(); msg = m_textCtrlBitmapDPI->GetValue();
@ -507,7 +506,7 @@ void PROPERTIES_FRAME::onScintillaCharAdded( wxStyledTextEvent &aEvent )
&& m_stcText->GetCharAt( start-2 ) == '$' && m_stcText->GetCharAt( start-2 ) == '$'
&& m_stcText->GetCharAt( start-1 ) == '{' ) && m_stcText->GetCharAt( start-1 ) == '{' )
{ {
WS_DRAW_ITEM_LIST::GetTextVars( &autocompleteTokens ); DS_DRAW_ITEM_LIST::GetTextVars( &autocompleteTokens );
partial = m_stcText->GetTextRange( start, pos ); partial = m_stcText->GetTextRange( start, pos );

View File

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

View File

@ -26,7 +26,7 @@
#include <confirm.h> #include <confirm.h>
#include <gestfich.h> #include <gestfich.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <paths.h> #include <paths.h>
#include <widgets/infobar.h> #include <widgets/infobar.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
@ -89,7 +89,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
wxString msg; wxString msg;
int id = event.GetId(); int id = event.GetId();
wxString filename = GetCurrentFileName(); 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 ) if( filename.IsEmpty() && id == wxID_SAVE )
id = wxID_SAVEAS; id = wxID_SAVEAS;
@ -223,7 +223,7 @@ bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName )
{ {
if( wxFileExists( aFullFileName ) ) if( wxFileExists( aFullFileName ) )
{ {
WS_DATA_MODEL::GetTheInstance().SetPageLayout( aFullFileName ); DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( aFullFileName );
SetCurrentFileName( aFullFileName ); SetCurrentFileName( aFullFileName );
UpdateFileHistory( aFullFileName ); UpdateFileHistory( aFullFileName );
GetScreen()->ClrModify(); GetScreen()->ClrModify();
@ -251,7 +251,7 @@ bool PL_EDITOR_FRAME::InsertPageLayoutDescrFile( const wxString& aFullFileName )
{ {
const bool append = true; const bool append = true;
SaveCopyInUndoList(); SaveCopyInUndoList();
WS_DATA_MODEL::GetTheInstance().SetPageLayout( aFullFileName, append ); DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( aFullFileName, append );
return true; return true;
} }
@ -269,7 +269,7 @@ bool PL_EDITOR_FRAME::SavePageLayoutDescrFile( const wxString& aFullFileName )
try try
{ {
WS_DATA_MODEL::GetTheInstance().Save( tempFile.GetFullPath() ); DS_DATA_MODEL::GetTheInstance().Save( tempFile.GetFullPath() );
} }
catch( const IO_ERROR& ) 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 // Often this is not used in the prototypes, since wxFrame is good enough and would
// represent maximum information hiding. // represent maximum information hiding.
class PL_EDITOR_FRAME; class PL_EDITOR_FRAME;
class WS_DATA_ITEM; class DS_DATA_ITEM;
class wxPrintData; class wxPrintData;
class wxPageSetupDialogData; 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 /// Create and show a print dialog
/// returns 1 if OK, 0 , there is a problem. /// returns 1 if OK, 0 , there is a problem.
int InvokeDialogPrint( PL_EDITOR_FRAME* aCaller, wxPrintData* aPrintData, int InvokeDialogPrint( PL_EDITOR_FRAME* aCaller, wxPrintData* aPrintData,

View File

@ -23,10 +23,10 @@
#include <view/view.h> #include <view/view.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <view/wx_view_controls.h> #include <view/wx_view_controls.h>
#include <page_layout/ws_proxy_view_item.h> #include <drawing_sheet/ds_proxy_view_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <page_layout/ws_painter.h> #include <drawing_sheet/ds_painter.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <kiway.h> #include <kiway.h>
#include <settings/settings_manager.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 */ ); 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(); SETTINGS_MANAGER& settingsManager = Pgm().GetSettingsManager();
PL_EDITOR_SETTINGS* cfg = settingsManager.GetAppSettings<PL_EDITOR_SETTINGS>(); 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() void PL_DRAW_PANEL_GAL::DisplayWorksheet()
{ {
PL_SELECTION_TOOL* selTool = m_edaFrame->GetToolManager()->GetTool<PL_SELECTION_TOOL>(); 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(); selTool->GetSelection().Clear();
m_view->Clear(); m_view->Clear();
@ -102,22 +102,22 @@ void PL_DRAW_PANEL_GAL::DisplayWorksheet()
model.SetupDrawEnvironment( m_edaFrame->GetPageSettings(), Mils2iu( 1 ) ); model.SetupDrawEnvironment( m_edaFrame->GetPageSettings(), Mils2iu( 1 ) );
// To show the formatted texts instead of raw texts in drawing sheet editor, we need // To show the formatted texts instead of raw texts in drawing sheet editor, we need
// a dummy WS_DRAW_ITEM_LIST. // a dummy DS_DRAW_ITEM_LIST.
WS_DRAW_ITEM_LIST dummy; DS_DRAW_ITEM_LIST dummy;
dummy.SetPaperFormat( &m_edaFrame->GetPageSettings().GetType() ); dummy.SetPaperFormat( &m_edaFrame->GetPageSettings().GetType() );
dummy.SetTitleBlock( &m_edaFrame->GetTitleBlock() ); dummy.SetTitleBlock( &m_edaFrame->GetTitleBlock() );
dummy.SetProject( &m_edaFrame->Prj() ); dummy.SetProject( &m_edaFrame->Prj() );
dummy.SetMilsToIUfactor( IU_PER_MILS ); dummy.SetMilsToIUfactor( IU_PER_MILS );
for( WS_DATA_ITEM* dataItem : model.GetItems() ) for( DS_DATA_ITEM* dataItem : model.GetItems() )
dataItem->SyncDrawItems( &dummy, m_view ); 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 // 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 const int penWidth = 0; // This value is to use the default thickness line
constexpr double markerSize = Millimeter2iu( 5 ); 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() ); m_view->Add( m_pageDrawItem.get() );
selTool->RebuildSelection(); selTool->RebuildSelection();

View File

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

View File

@ -35,7 +35,7 @@
class PL_DRAW_PANEL_GAL; class PL_DRAW_PANEL_GAL;
class PROPERTIES_FRAME; class PROPERTIES_FRAME;
class WS_DATA_ITEM; class DS_DATA_ITEM;
/** /**
@ -69,7 +69,7 @@ public:
PROPERTIES_FRAME* GetPropertiesFrame() { return m_propertiesPagelayout; } 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(); void ShowDesignInspector();
@ -243,11 +243,11 @@ public:
* Function AddPageLayoutItem * Function AddPageLayoutItem
* Add a new item to the page layout item list. * Add a new item to the page layout item list.
* @param aType = the type of item: * @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. * @param aIdx = the position in list to insert the new item.
* @return a reference to 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 * Must be called after a change in order to set the "modify" flag

View File

@ -30,7 +30,7 @@
#include <page_info.h> #include <page_info.h>
#include <title_block.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; PAGE_INFO m_paper;
TITLE_BLOCK m_titles; TITLE_BLOCK m_titles;
WS_DRAW_ITEM_LIST m_drawItemList; DS_DRAW_ITEM_LIST m_drawItemList;
public: public:
PL_EDITOR_LAYOUT(); PL_EDITOR_LAYOUT();
@ -63,7 +63,7 @@ public:
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; } const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; } void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
WS_DRAW_ITEM_LIST& GetDrawItems() DS_DRAW_ITEM_LIST& GetDrawItems()
{ {
return m_drawItemList; return m_drawItemList;
} }

View File

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

View File

@ -25,7 +25,7 @@
#include <tool/tool_action.h> #include <tool/tool_action.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <eda_item.h> #include <eda_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include "tools/pl_actions.h" #include "tools/pl_actions.h"
@ -42,22 +42,22 @@
TOOL_ACTION PL_ACTIONS::drawLine( "plEditor.InteractiveDrawing.drawLine", TOOL_ACTION PL_ACTIONS::drawLine( "plEditor.InteractiveDrawing.drawLine",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Add Line" ), _( "Add a line" ), _( "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", TOOL_ACTION PL_ACTIONS::drawRectangle( "plEditor.InteractiveDrawing.drawRectangle",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Add Rectangle" ), _( "Add a rectangle" ), _( "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", TOOL_ACTION PL_ACTIONS::placeText( "plEditor.InteractiveDrawing.placeText",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Add Text" ), _( "Add a text item" ), _( "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", TOOL_ACTION PL_ACTIONS::placeImage( "plEditor.InteractiveDrawing.placeImage",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Add Bitmap" ), _( "Add a bitmap image" ), _( "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 // PL_EDIT_TOOL

View File

@ -29,8 +29,8 @@
#include <view/view.h> #include <view/view.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include "invoke_pl_editor_dialog.h" #include "invoke_pl_editor_dialog.h"
#include "pl_editor_frame.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 ) 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; VECTOR2I cursorPos;
WS_DRAW_ITEM_BASE* item = nullptr; DS_DRAW_ITEM_BASE* item = nullptr;
bool isText = aEvent.IsAction( &PL_ACTIONS::placeText ); bool isText = aEvent.IsAction( &PL_ACTIONS::placeText );
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
@ -151,7 +151,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
// First click creates... // First click creates...
if( !item ) 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 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 ) int PL_DRAWING_TOOLS::DrawShape( 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>();
WS_DRAW_ITEM_BASE* item = nullptr; DS_DRAW_ITEM_BASE* item = nullptr;
// We might be running as the same shape in another co-routine. Make sure that one // We might be running as the same shape in another co-routine. Make sure that one
// gets whacked. // gets whacked.
@ -279,7 +279,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
m_frame->SaveCopyInUndoList(); m_frame->SaveCopyInUndoList();
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); 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 ); dataItem->MoveToUi( (wxPoint) cursorPos );
item = dataItem->GetDrawItems()[0]; item = dataItem->GetDrawItems()[0];

View File

@ -24,9 +24,9 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/picker_tool.h> #include <tool/picker_tool.h>
#include <page_layout/ws_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <page_layout/ws_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <page_layout/ws_draw_item.h> #include <drawing_sheet/ds_draw_item.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <confirm.h> #include <confirm.h>
#include <eda_item.h> #include <eda_item.h>
@ -108,11 +108,11 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
if( selection.Empty() || m_moveInProgress ) if( selection.Empty() || m_moveInProgress )
return 0; return 0;
std::set<WS_DATA_ITEM*> unique_peers; std::set<DS_DATA_ITEM*> unique_peers;
for( EDA_ITEM* item : selection ) 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() ); 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. // 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 ); moveItem( item, m_moveOffset );
// Set up the starting position and move/drag offset // 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(); VECTOR2I delta = m_cursor - selection.GetReferencePoint();
// Drag items to the current cursor position // Drag items to the current cursor position
for( WS_DATA_ITEM* item : unique_peers ) for( DS_DATA_ITEM* item : unique_peers )
moveItem( item, delta ); moveItem( item, delta );
selection.SetReferencePoint( m_cursor ); selection.SetReferencePoint( m_cursor );
@ -192,7 +192,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
m_moveOffset += delta; m_moveOffset += delta;
prevPos = m_cursor; prevPos = m_cursor;
for( WS_DATA_ITEM* item : unique_peers ) for( DS_DATA_ITEM* item : unique_peers )
moveItem( item, delta ); moveItem( item, delta );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified ); 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 ); 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 ); getView()->Update( item );
item->SetFlags( IS_MOVED ); item->SetFlags( IS_MOVED );
@ -326,11 +326,11 @@ int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
while( selection.Front() ) while( selection.Front() )
{ {
WS_DRAW_ITEM_BASE* drawItem = static_cast<WS_DRAW_ITEM_BASE*>( selection.Front() ); DS_DRAW_ITEM_BASE* drawItem = static_cast<DS_DRAW_ITEM_BASE*>( selection.Front() );
WS_DATA_ITEM* dataItem = drawItem->GetPeer(); DS_DATA_ITEM* dataItem = drawItem->GetPeer();
WS_DATA_MODEL::GetTheInstance().Remove( dataItem ); 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 // 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 ) ); int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
EDA_ITEM* item = nullptr; 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 ) ) 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 ) int PL_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
{ {
PL_SELECTION& selection = m_selectionTool->RequestSelection(); PL_SELECTION& selection = m_selectionTool->RequestSelection();
std::vector<WS_DATA_ITEM*> items; std::vector<DS_DATA_ITEM*> items;
WS_DATA_MODEL& model = WS_DATA_MODEL::GetTheInstance(); DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
wxString sexpr; wxString sexpr;
if( selection.GetSize() == 0 ) if( selection.GetSize() == 0 )
return 0; return 0;
for( EDA_ITEM* item : selection.GetItems() ) 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 try
{ {
@ -483,7 +483,7 @@ int PL_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
int PL_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent ) int PL_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
{ {
PL_SELECTION& selection = m_selectionTool->GetSelection(); 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(); std::string sexpr = m_toolMgr->GetClipboardUTF8();
m_selectionTool->ClearSelection(); m_selectionTool->ClearSelection();
@ -491,7 +491,7 @@ int PL_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
model.SetPageLayout( sexpr.c_str(), true, wxT( "clipboard" ) ); model.SetPageLayout( sexpr.c_str(), true, wxT( "clipboard" ) );
// Build out draw items and select the first of each data item // 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() ) if( dataItem->GetDrawItems().empty() )
{ {

View File

@ -66,7 +66,7 @@ public:
int DeleteItemCursor( const TOOL_EVENT& aEvent ); int DeleteItemCursor( const TOOL_EVENT& aEvent );
private: 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 ///< Return the right modification point (e.g. for rotation), depending on the number of
///< selected items. ///< selected items.

View File

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

View File

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

View File

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

View File

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

View File

@ -29,11 +29,8 @@ class COLOR_SETTINGS;
class PAGE_INFO; class PAGE_INFO;
class FOOTPRINT_EDIT_FRAME; class FOOTPRINT_EDIT_FRAME;
class TITLE_BLOCK; 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 class PANEL_FP_EDITOR_COLOR_SETTINGS : public PANEL_COLOR_SETTINGS
{ {

View File

@ -30,7 +30,7 @@
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <footprint_preview_panel.h> #include <footprint_preview_panel.h>
#include <widgets/appearance_controls.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 <pcb_painter.h>
#include <track.h> #include <track.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/kicad_plugin.h>
@ -512,10 +512,10 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems()
m_preview->UpdateColors(); m_preview->UpdateColors();
m_preview->DisplayBoard( m_preview->GetBoard() ); 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 ); m_titleBlock );
worksheet->SetColorLayer( LAYER_DRAWINGSHEET ); drawingSheet->SetColorLayer( LAYER_DRAWINGSHEET );
m_preview->SetDrawingSheet( worksheet ); m_preview->SetDrawingSheet( drawingSheet );
zoomFitPreview(); zoomFitPreview();
} }

View File

@ -30,11 +30,8 @@ class PAGE_INFO;
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
class FOOTPRINT_PREVIEW_PANEL; class FOOTPRINT_PREVIEW_PANEL;
class TITLE_BLOCK; class TITLE_BLOCK;
class DS_PROXY_VIEW_ITEM;
namespace KIGFX
{
class WS_PROXY_VIEW_ITEM;
}
class PANEL_PCBNEW_COLOR_SETTINGS : public PANEL_COLOR_SETTINGS 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 ) : DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings ) :
m_designSettings ( aSettings ), m_designSettings ( aSettings ),
m_board( aBoard ), m_board( aBoard ),
m_worksheet( nullptr ), m_drawingSheet( nullptr ),
m_schematicNetlist( nullptr ), m_schematicNetlist( nullptr ),
m_rulesValid( false ), m_rulesValid( false ),
m_userUnits( EDA_UNITS::MILLIMETRES ), m_userUnits( EDA_UNITS::MILLIMETRES ),

View File

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

View File

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

View File

@ -26,7 +26,7 @@
#include <pcb_view.h> #include <pcb_view.h>
#include <view/wx_view_controls.h> #include <view/wx_view_controls.h>
#include <pcb_painter.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 <connectivity/connectivity_data.h>
#include <board.h> #include <board.h>
@ -36,7 +36,7 @@
#include <pcb_base_frame.h> #include <pcb_base_frame.h>
#include <pcbnew_settings.h> #include <pcbnew_settings.h>
#include <ratsnest/ratsnest_data.h> #include <ratsnest/ratsnest_data.h>
#include <ratsnest/ratsnest_viewitem.h> #include <ratsnest/ratsnest_view_item.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
@ -198,8 +198,8 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
t.detach(); t.detach();
} }
if( m_worksheet ) if( m_drawingSheet )
m_worksheet->SetFileName( TO_UTF8( aBoard->GetFileName() ) ); m_drawingSheet->SetFileName( TO_UTF8( aBoard->GetFileName() ) );
// Load drawings // Load drawings
for( BOARD_ITEM* drawing : aBoard->Drawings() ) for( BOARD_ITEM* drawing : aBoard->Drawings() )
@ -226,15 +226,15 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
m_view->Add( zone ); m_view->Add( zone );
// Ratsnest // 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() ); 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_drawingSheet.reset( aDrawingSheet );
m_view->Add( m_worksheet.get() ); m_view->Add( m_drawingSheet.get() );
} }
@ -535,8 +535,8 @@ void PCB_DRAW_PANEL_GAL::RedrawRatsnest()
BOX2I PCB_DRAW_PANEL_GAL::GetDefaultViewBBox() const BOX2I PCB_DRAW_PANEL_GAL::GetDefaultViewBBox() const
{ {
if( m_worksheet && m_view->IsLayerVisible( LAYER_DRAWINGSHEET ) ) if( m_drawingSheet && m_view->IsLayerVisible( LAYER_DRAWINGSHEET ) )
return m_worksheet->ViewBBox(); return m_drawingSheet->ViewBBox();
return BOX2I(); return BOX2I();
} }

View File

@ -31,11 +31,8 @@
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#include <pcb_view.h> #include <pcb_view.h>
namespace KIGFX class DS_PROXY_VIEW_ITEM;
{ class RATSNEST_VIEW_ITEM;
class WS_PROXY_VIEW_ITEM;
class RATSNEST_VIEWITEM;
}
class PCB_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL class PCB_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
{ {
@ -54,14 +51,14 @@ public:
void DisplayBoard( BOARD* aBoard ); 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. * #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 // TODO(JE) Look at optimizing this out
/** /**
@ -117,11 +114,11 @@ protected:
///< Set rendering targets & dependencies for layers. ///< Set rendering targets & dependencies for layers.
void setDefaultLayerDeps(); void setDefaultLayerDeps();
///< Currently used worksheet. ///< Currently used drawing-sheet.
std::unique_ptr<KIGFX::WS_PROXY_VIEW_ITEM> m_worksheet; std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
///< Ratsnest view item ///< 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_ */ #endif /* PCB_DRAW_PANEL_GAL_H_ */

View File

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

View File

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

View File

@ -33,7 +33,7 @@
#include <panel_pcbnew_display_origin.h> #include <panel_pcbnew_display_origin.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/pcb_selection_tool.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 <pcbplot.h>
#include <pcb_painter.h> #include <pcb_painter.h>
#include <invoke_pcb_dialog.h> #include <invoke_pcb_dialog.h>
@ -71,14 +71,13 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
BASE_SCREEN::m_PageLayoutDescrFileName = project.m_BoardPageLayoutDescrFile; 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 // BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
// If empty, or not existing, the default descr is loaded // If empty, or not existing, the default descr is loaded
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance(); wxString filename = DS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
wxString filename = WS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_PageLayoutDescrFileName,
Prj().GetProjectPath() ); Prj().GetProjectPath() );
pglayout.SetPageLayout( filename ); DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename );
// Load render settings that aren't stored in PCB_DISPLAY_OPTIONS // 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. * @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 <gal/graphics_abstraction_layer.h>
#include <pcb_painter.h> #include <pcb_painter.h>
@ -43,15 +42,13 @@
#include <view/view.h> #include <view/view.h>
namespace KIGFX { RATSNEST_VIEW_ITEM::RATSNEST_VIEW_ITEM( std::shared_ptr<CONNECTIVITY_DATA> aData ) :
RATSNEST_VIEWITEM::RATSNEST_VIEWITEM( std::shared_ptr<CONNECTIVITY_DATA> aData ) :
EDA_ITEM( NOT_USED ), m_data( std::move(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 // Make it always visible
BOX2I bbox; 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 ); 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->SetIsStroke( true );
gal->SetIsFill( false ); gal->SetIsFill( false );
gal->SetLineWidth( 1.0 ); 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 defaultColor = rs->GetColor( nullptr, LAYER_RATSNEST );
COLOR4D color = defaultColor; 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; aCount = 1;
aLayers[0] = LAYER_RATSNEST; aLayers[0] = LAYER_RATSNEST;
} }
}

View File

@ -25,12 +25,11 @@
*/ */
/** /**
* @file ratsnest_viewitem.h
* @brief Class that draws missing connections on a PCB. * @brief Class that draws missing connections on a PCB.
*/ */
#ifndef RATSNEST_VIEWITEM_H #ifndef RATSNEST_VIEW_ITEM_H
#define RATSNEST_VIEWITEM_H #define RATSNEST_VIEW_ITEM_H
#include <memory> #include <memory>
#include <eda_item.h> #include <eda_item.h>
@ -39,12 +38,11 @@
class GAL; class GAL;
class CONNECTIVITY_DATA; class CONNECTIVITY_DATA;
namespace KIGFX
{ class RATSNEST_VIEW_ITEM : public EDA_ITEM
class RATSNEST_VIEWITEM : public EDA_ITEM
{ {
public: public:
RATSNEST_VIEWITEM( std::shared_ptr<CONNECTIVITY_DATA> aData ); RATSNEST_VIEW_ITEM( std::shared_ptr<CONNECTIVITY_DATA> aData );
/// @copydoc VIEW_ITEM::ViewBBox() /// @copydoc VIEW_ITEM::ViewBBox()
const BOX2I ViewBBox() const override; const BOX2I ViewBBox() const override;
@ -65,21 +63,14 @@ public:
void Show( int x, std::ostream& st ) const override { } void Show( int x, std::ostream& st ) const override { }
#endif #endif
/**
* Get class name.
*
* @return string "RATSNEST_VIEWITEM"
*/
virtual wxString GetClass() const override virtual wxString GetClass() const override
{ {
return wxT( "RATSNEST_VIEWITEM" ); return wxT( "RATSNEST_VIEW_ITEM" );
} }
protected: protected:
///< Object containing ratsnest data. std::shared_ptr<CONNECTIVITY_DATA> m_data; ///< Object containing ratsnest data.
std::shared_ptr<CONNECTIVITY_DATA> m_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_controls.h>
#include <view/view_group.h> #include <view/view_group.h>
#include <wildcards_and_files_ext.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> #include <footprint_edit_frame.h>
using namespace std::placeholders; 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 ) int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
{ {
PICKED_ITEMS_LIST undoCmd; 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 ); ITEM_PICKER wrapper( nullptr, undoItem, UNDO_REDO::PAGESETTINGS );
undoCmd.PushItem( wrapper ); undoCmd.PushItem( wrapper );

View File

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

View File

@ -30,7 +30,7 @@
#include <fp_shape.h> #include <fp_shape.h>
#include <collectors.h> #include <collectors.h>
#include <pcb_edit_frame.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 <kiway.h>
#include <array_creator.h> #include <array_creator.h>
#include <pcbnew_settings.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 ) ) 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 ); VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
if( worksheet && worksheet->HitTestDrawingSheetItems( getView(), (wxPoint) cursorPos ) ) if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursorPos ) )
m_toolMgr->RunAction( ACTIONS::pageSettings ); m_toolMgr->RunAction( ACTIONS::pageSettings );
} }

View File

@ -42,7 +42,7 @@ using namespace std::placeholders;
#include <tools/pcb_selection_tool.h> #include <tools/pcb_selection_tool.h>
#include <tools/pcb_control.h> #include <tools/pcb_control.h>
#include <tools/board_editor_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. /* Functions to undo and redo edit commands.
* commands to undo are stored in CurrentScreen->m_UndoList * 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: case UNDO_REDO::PAGESETTINGS:
{ {
// swap current settings with stored settings // swap current settings with stored settings
WS_PROXY_UNDO_ITEM alt_item( this ); DS_PROXY_UNDO_ITEM alt_item( this );
WS_PROXY_UNDO_ITEM* item = (WS_PROXY_UNDO_ITEM*) eda_item; DS_PROXY_UNDO_ITEM* item = static_cast<DS_PROXY_UNDO_ITEM*>( eda_item );
item->Restore( this ); item->Restore( this );
*item = alt_item; *item = alt_item;
} }