|
KiCad PCB EDA Suite
|
Handle the graphic items list to draw/plot the frame and title block. More...
#include <ds_data_model.h>
Public Member Functions | |
| DS_DATA_MODEL () | |
| ~DS_DATA_MODEL () | |
| int | GetFileFormatVersionAtLoad () |
| void | SetFileFormatVersionAtLoad (int aVersion) |
| const wxString & | GetGenerator () const |
| void | SetGenerator (const wxString &aGenerator) |
| double | GetLeftMargin () |
| void | SetLeftMargin (double aMargin) |
| double | GetRightMargin () |
| void | SetRightMargin (double aMargin) |
| double | GetTopMargin () |
| void | SetTopMargin (double aMargin) |
| double | GetBottomMargin () |
| void | SetBottomMargin (double aMargin) |
| void | SetupDrawEnvironment (const PAGE_INFO &aPageInfo, double aMilsToIU) |
| void | AllowVoidList (bool Allow) |
| In KiCad applications, a drawing sheet is needed So if the list is empty, a default drawing sheet is loaded, the first time it is drawn. | |
| bool | VoidListAllowed () |
| void | ClearList () |
| Erase the list of items. | |
| void | Save (const wxString &aFullFileName) |
| Save the description in a file. | |
| void | SaveInString (wxString *aOutputString) |
| Save the description in a buffer. | |
| void | SaveInString (std::vector< DS_DATA_ITEM * > &aItemsList, wxString *aOutputString) |
| Fill the given string with an S-expr serialization of the WS_DATA_ITEMs. | |
| void | Append (DS_DATA_ITEM *aItem) |
| void | Remove (DS_DATA_ITEM *aItem) |
| DS_DATA_ITEM * | GetItem (unsigned aIdx) const |
| std::vector< DS_DATA_ITEM * > & | GetItems () |
| unsigned | GetCount () const |
| void | SetDefaultLayout () |
| void | SetEmptyLayout () |
| bool | LoadFromName (const wxString &aSheetName, const wxString &aBasePath, PROJECT *aProject, std::vector< const EMBEDDED_FILES * > aEmbeddedFilesStack, wxString *aMsg) |
Populate the list from aSheetName, which is either EmptyLayoutName, an embedded file reference or a path resolved against aBasePath. | |
| bool | LoadDrawingSheet (const wxString &aFullFileName, wxString *aMsg, bool aAppend=false) |
| Populate the list with a custom layout or the default layout if no custom layout is available. | |
| void | SetPageLayout (const char *aPageLayout, bool aAppend=false, const wxString &aSource=wxT("Sexpr_string")) |
| Populate the list from a S expr description stored in a string. | |
Static Public Member Functions | |
| static DS_DATA_MODEL & | GetTheInstance () |
| Return the instance of DS_DATA_MODEL used in the application. | |
| static void | SetAltInstance (DS_DATA_MODEL *aLayout=nullptr) |
| Set an alternate instance of DS_DATA_MODEL. | |
| static const wxString & | EmptyLayoutName () |
| Return the reserved drawing-sheet name that marks a design as deliberately having no sheet, as opposed to one that failed to resolve. | |
| static wxString | EmptyLayout () |
| Return a string containing the empty layout shape. | |
| static wxString | DefaultLayout () |
| Return a string containing the empty layout shape. | |
| static const wxString | ResolvePath (const wxString &aPath, const wxString &aProjectPath) |
| Resolve a path which might be project-relative or contain env variable references. | |
Public Attributes | |
| double | m_WSunits2Iu |
| VECTOR2D | m_RB_Corner |
| VECTOR2D | m_LT_Corner |
| double | m_DefaultLineWidth |
| VECTOR2D | m_DefaultTextSize |
| double | m_DefaultTextThickness |
| bool | m_EditMode |
Private Attributes | |
| std::vector< DS_DATA_ITEM * > | m_list |
| bool | m_allowVoidList |
| int | m_fileFormatVersionAtLoad |
| wxString | m_generator |
| double | m_leftMargin |
| double | m_rightMargin |
| double | m_topMargin |
| double | m_bottomMargin |
Handle the graphic items list to draw/plot the frame and title block.
Definition at line 36 of file ds_data_model.h.
| DS_DATA_MODEL::DS_DATA_MODEL | ( | ) |
Definition at line 56 of file ds_data_model.cpp.
References m_allowVoidList, m_bottomMargin, m_DefaultLineWidth, m_DefaultTextSize, m_DefaultTextThickness, m_EditMode, m_fileFormatVersionAtLoad, m_generator, m_leftMargin, m_rightMargin, m_topMargin, m_WSunits2Iu, and TB_DEFAULT_TEXTSIZE.
Referenced by GetTheInstance(), and SetAltInstance().
|
inline |
Definition at line 41 of file ds_data_model.h.
References ClearList().
|
inline |
In KiCad applications, a drawing sheet is needed So if the list is empty, a default drawing sheet is loaded, the first time it is drawn.
However, in drawing sheet editor an empty list is acceptable. AllowVoidList allows or not the empty list
Definition at line 84 of file ds_data_model.h.
References m_allowVoidList.
Referenced by PL_EDITOR_FRAME::Files_io(), DRAWING_SHEET_PARSER::parseSetup(), and PL_EDITOR_FRAME::PL_EDITOR_FRAME().
| void DS_DATA_MODEL::Append | ( | DS_DATA_ITEM * | aItem | ) |
Definition at line 117 of file ds_data_model.cpp.
References m_list.
Referenced by PL_DRAWING_TOOLS::DrawShape(), DRAWING_SHEET_PARSER::Parse(), PL_DRAWING_TOOLS::PlaceItem(), and SetPageLayout().
| void DS_DATA_MODEL::ClearList | ( | ) |
Erase the list of items.
Definition at line 108 of file ds_data_model.cpp.
References m_list.
Referenced by PL_EDITOR_FRAME::doCloseWindow(), PL_EDITOR_FRAME::Files_io(), LoadDrawingSheet(), PL_EDITOR_FRAME::PL_EDITOR_FRAME(), SetPageLayout(), and ~DS_DATA_MODEL().
|
static |
Return a string containing the empty layout shape.
Definition at line 931 of file drawing_sheet_parser.cpp.
References defaultDrawingSheet.
|
static |
Return a string containing the empty layout shape.
Definition at line 948 of file drawing_sheet_parser.cpp.
References emptyDrawingSheet.
|
static |
Return the reserved drawing-sheet name that marks a design as deliberately having no sheet, as opposed to one that failed to resolve.
It names no file on disk.
Definition at line 954 of file drawing_sheet_parser.cpp.
References name.
Referenced by SCH_EDIT_FRAME::importFile(), and LoadFromName().
|
inline |
Definition at line 73 of file ds_data_model.h.
References m_bottomMargin.
Referenced by DS_DATA_MODEL_IO::Format(), AUTOPLACER::getDrawableArea(), and SetupDrawEnvironment().
|
inline |
Definition at line 131 of file ds_data_model.h.
References m_list.
Referenced by DS_DATA_MODEL_IO::Format().
|
inline |
Definition at line 58 of file ds_data_model.h.
References m_fileFormatVersionAtLoad.
|
inline |
Definition at line 61 of file ds_data_model.h.
References m_generator.
Referenced by DS_DATA_MODEL_IO::Format(), and DS_DATA_MODEL_IO::Format().
| DS_DATA_ITEM * DS_DATA_MODEL::GetItem | ( | unsigned | aIdx | ) | const |
Definition at line 130 of file ds_data_model.cpp.
References m_list.
Referenced by DS_DATA_MODEL_IO::Format(), and DS_PROXY_UNDO_ITEM::Restore().
|
inline |
Definition at line 126 of file ds_data_model.h.
References m_list.
Referenced by DIALOG_INSPECTOR::ReCreateDesignList(), and DS_PROXY_UNDO_ITEM::Restore().
|
inline |
Definition at line 64 of file ds_data_model.h.
References m_leftMargin.
Referenced by DS_DATA_MODEL_IO::Format(), AUTOPLACER::getDrawableArea(), and SetupDrawEnvironment().
|
inline |
Definition at line 67 of file ds_data_model.h.
References m_rightMargin.
Referenced by DS_DATA_MODEL_IO::Format(), AUTOPLACER::getDrawableArea(), and SetupDrawEnvironment().
|
static |
Return the instance of DS_DATA_MODEL used in the application.
Definition at line 73 of file ds_data_model.cpp.
References DS_DATA_MODEL(), wksAltInstance, and wksTheInstance.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DS_DRAW_ITEM_LIST::BuildDrawItemsList(), DS_PROXY_VIEW_ITEM::CollectTextVarKeys(), PL_EDIT_TOOL::Copy(), PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel(), PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), PL_DRAW_PANEL_GAL::DisplayDrawingSheet(), PL_EDITOR_FRAME::doCloseWindow(), PL_EDIT_TOOL::DoDelete(), PL_DRAWING_TOOLS::DrawShape(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), PL_EDITOR_FRAME::Files_io(), DS_DATA_ITEM_POLYGONS::GetCornerPositionIU(), AUTOPLACER::getDrawableArea(), DS_DATA_ITEM::GetEndPos(), DS_DATA_ITEM::GetEndPosIU(), DS_DATA_ITEM::GetPenSizeIU(), DS_DATA_ITEM_POLYGONS::GetPenSizeIU(), DS_DATA_ITEM_TEXT::GetPenSizeIU(), DS_DATA_ITEM::GetStartPos(), DS_DATA_ITEM::GetStartPosIU(), SCH_EDIT_FRAME::importFile(), BOARD_LOADER::initializeLoadedBoard(), EESCHEMA_JOBS_HANDLER::InitRenderSettings(), PL_EDITOR_FRAME::InsertDrawingSheetFile(), PL_EDIT_TOOL::InteractiveDelete(), DS_DATA_ITEM::IsInsidePage(), DS_DATA_ITEM_POLYGONS::IsInsidePage(), EESCHEMA_JOBS_HANDLER::JobImport(), PCB_EDIT_FRAME::LoadDrawingSheet(), SCH_EDIT_FRAME::LoadDrawingSheet(), PL_EDITOR_FRAME::LoadDrawingSheetFile(), PCBNEW_JOBS_HANDLER::loadOverrideDrawingSheet(), DS_DATA_ITEM::MoveEndPointTo(), DS_DATA_ITEM::MoveEndPointToIU(), DS_DATA_ITEM::MoveStartPointTo(), DS_DATA_ITEM::MoveStartPointToIU(), DS_DATA_ITEM::MoveToIU(), PROPERTIES_FRAME::OnSetDefaultValues(), PL_EDIT_TOOL::Paste(), PL_EDITOR_FRAME::PL_EDITOR_FRAME(), PL_DRAWING_TOOLS::PlaceItem(), PLEDITOR_PRINTOUT::PrintPage(), PL_SELECTION_TOOL::RebuildSelection(), DIALOG_INSPECTOR::ReCreateDesignList(), repeatCountAtY(), repeatTexts(), DS_PROXY_UNDO_ITEM::Restore(), PL_EDITOR_FRAME::SaveDrawingSheetFile(), DIALOG_PAGES_SETTINGS::SavePageSettings(), SCH_EDIT_FRAME::saveProjectSettings(), PL_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), DS_DATA_ITEM_TEXT::SetConstrainedTextSize(), PL_EDITOR_FRAME::setupUIConditions(), DS_DATA_ITEM_TEXT::SyncDrawItems(), and PL_EDITOR_CONTROL::TitleBlockDisplayMode().
|
inline |
Definition at line 70 of file ds_data_model.h.
References m_topMargin.
Referenced by DS_DATA_MODEL_IO::Format(), AUTOPLACER::getDrawableArea(), and SetupDrawEnvironment().
| bool DS_DATA_MODEL::LoadDrawingSheet | ( | const wxString & | aFullFileName, |
| wxString * | aMsg, | ||
| bool | aAppend = false ) |
Populate the list with a custom layout or the default layout if no custom layout is available.
| aFullFileName | is the custom drawing sheet file. If empty, load the file defined by KICAD_WKSFILE and if its not defined, the default internal drawing sheet. |
| aMsg | [optional] if non-null, will be filled with any error messages. |
| aAppend | if true: do not delete old layout, and load only aFullFileName. |
Definition at line 997 of file drawing_sheet_parser.cpp.
References _, ClearList(), DRAWING_SHEET_PARSER::Parse(), SetDefaultLayout(), and IO_ERROR::What().
Referenced by PL_EDITOR_FRAME::InsertDrawingSheetFile(), LoadFromName(), and PL_EDITOR_FRAME::PL_EDITOR_FRAME().
| bool DS_DATA_MODEL::LoadFromName | ( | const wxString & | aSheetName, |
| const wxString & | aBasePath, | ||
| PROJECT * | aProject, | ||
| std::vector< const EMBEDDED_FILES * > | aEmbeddedFilesStack, | ||
| wxString * | aMsg ) |
Populate the list from aSheetName, which is either EmptyLayoutName, an embedded file reference or a path resolved against aBasePath.
Callers store an unresolved sheet name, so this owns the whole decision rather than leaving each of them to recognize the reserved name before resolving.
| aMsg | [optional] if non-null, is filled with any error message. |
Definition at line 962 of file drawing_sheet_parser.cpp.
References EmptyLayoutName(), LoadDrawingSheet(), Pgm(), resolver, and SetEmptyLayout().
| void DS_DATA_MODEL::Remove | ( | DS_DATA_ITEM * | aItem | ) |
Definition at line 123 of file ds_data_model.cpp.
References m_list.
Referenced by PL_EDIT_TOOL::DoDelete().
|
static |
Resolve a path which might be project-relative or contain env variable references.
| void DS_DATA_MODEL::Save | ( | const wxString & | aFullFileName | ) |
Save the description in a file.
| aFullFileName | the filename of the file to created. |
Definition at line 138 of file ds_data_model_io.cpp.
References DS_DATA_MODEL_FILEIO::Finish(), and DS_DATA_MODEL_IO::Format().
Referenced by PL_EDITOR_FRAME::SaveDrawingSheetFile(), and SCH_EDIT_FRAME::saveProjectSettings().
| void DS_DATA_MODEL::SaveInString | ( | std::vector< DS_DATA_ITEM * > & | aItemsList, |
| wxString * | aOutputString ) |
Fill the given string with an S-expr serialization of the WS_DATA_ITEMs.
Definition at line 153 of file ds_data_model_io.cpp.
References DS_DATA_MODEL_IO::Format().
| void DS_DATA_MODEL::SaveInString | ( | wxString * | aOutputString | ) |
Save the description in a buffer.
| aOutputString | is a wxString to store the S expr string |
Definition at line 146 of file ds_data_model_io.cpp.
References DS_DATA_MODEL_IO::Format().
Referenced by DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS().
|
static |
Set an alternate instance of DS_DATA_MODEL.
| aLayout | the alternate drawing sheet; if null restore the default drawing sheet. |
Definition at line 82 of file ds_data_model.cpp.
References DS_DATA_MODEL(), and wksAltInstance.
Referenced by DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample().
|
inline |
Definition at line 74 of file ds_data_model.h.
References m_bottomMargin.
Referenced by DRAWING_SHEET_PARSER::parseSetup().
| void DS_DATA_MODEL::SetDefaultLayout | ( | ) |
Definition at line 925 of file drawing_sheet_parser.cpp.
References defaultDrawingSheet, and SetPageLayout().
Referenced by LoadDrawingSheet().
| void DS_DATA_MODEL::SetEmptyLayout | ( | ) |
Definition at line 942 of file drawing_sheet_parser.cpp.
References emptyDrawingSheet, and SetPageLayout().
Referenced by SCH_EDIT_FRAME::importFile(), EESCHEMA_JOBS_HANDLER::InitRenderSettings(), EESCHEMA_JOBS_HANDLER::JobImport(), SCH_EDIT_FRAME::LoadDrawingSheet(), and LoadFromName().
|
inline |
Definition at line 59 of file ds_data_model.h.
References m_fileFormatVersionAtLoad.
Referenced by DRAWING_SHEET_PARSER::Parse().
|
inline |
Definition at line 62 of file ds_data_model.h.
References m_generator.
Referenced by DRAWING_SHEET_PARSER::Parse().
|
inline |
Definition at line 65 of file ds_data_model.h.
References m_leftMargin.
Referenced by DRAWING_SHEET_PARSER::parseSetup().
| void DS_DATA_MODEL::SetPageLayout | ( | const char * | aPageLayout, |
| bool | aAppend = false, | ||
| const wxString & | aSource = wxT( "Sexpr_string" ) ) |
Populate the list from a S expr description stored in a string.
| aPageLayout | is the S expr string. |
| aAppend | Do not delete old layout if true and append aPageLayout the existing one. |
| aSource | is the layout source description. |
Definition at line 979 of file drawing_sheet_parser.cpp.
References Append(), ClearList(), and DRAWING_SHEET_PARSER::Parse().
Referenced by DS_PROXY_UNDO_ITEM::Restore(), SetDefaultLayout(), and SetEmptyLayout().
|
inline |
Definition at line 68 of file ds_data_model.h.
References m_rightMargin.
Referenced by DRAWING_SHEET_PARSER::parseSetup().
|
inline |
Definition at line 71 of file ds_data_model.h.
References m_topMargin.
Referenced by DRAWING_SHEET_PARSER::parseSetup().
| void DS_DATA_MODEL::SetupDrawEnvironment | ( | const PAGE_INFO & | aPageInfo, |
| double | aMilsToIU ) |
Definition at line 88 of file ds_data_model.cpp.
References GetBottomMargin(), GetLeftMargin(), GetRightMargin(), PAGE_INFO::GetSizeMils(), GetTopMargin(), m_LT_Corner, m_RB_Corner, m_WSunits2Iu, MILS_TO_MM, VECTOR2< T >::x, and VECTOR2< T >::y.
|
inline |
Definition at line 89 of file ds_data_model.h.
References m_allowVoidList.
|
private |
Definition at line 208 of file ds_data_model.h.
Referenced by AllowVoidList(), DS_DATA_MODEL(), and VoidListAllowed().
|
private |
Definition at line 216 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), GetBottomMargin(), and SetBottomMargin().
| double DS_DATA_MODEL::m_DefaultLineWidth |
Definition at line 197 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), DS_DATA_MODEL_IO::Format(), DS_DATA_MODEL_IO::format(), and DRAWING_SHEET_PARSER::parseSetup().
| VECTOR2D DS_DATA_MODEL::m_DefaultTextSize |
Definition at line 198 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), DS_DATA_MODEL_IO::Format(), DRAWING_SHEET_PARSER::parseSetup(), and DS_DATA_ITEM_TEXT::SetConstrainedTextSize().
| double DS_DATA_MODEL::m_DefaultTextThickness |
Definition at line 199 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), DS_DATA_MODEL_IO::Format(), and DRAWING_SHEET_PARSER::parseSetup().
| bool DS_DATA_MODEL::m_EditMode |
Definition at line 200 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), PL_EDITOR_FRAME::PL_EDITOR_FRAME(), PL_EDITOR_FRAME::setupUIConditions(), and PL_EDITOR_CONTROL::TitleBlockDisplayMode().
|
private |
Definition at line 211 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), GetFileFormatVersionAtLoad(), and SetFileFormatVersionAtLoad().
|
private |
Definition at line 212 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), GetGenerator(), and SetGenerator().
|
private |
Definition at line 213 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), GetLeftMargin(), and SetLeftMargin().
|
private |
Definition at line 207 of file ds_data_model.h.
Referenced by Append(), ClearList(), GetCount(), GetItem(), GetItems(), and Remove().
| VECTOR2D DS_DATA_MODEL::m_LT_Corner |
Definition at line 196 of file ds_data_model.h.
Referenced by DS_DATA_ITEM::GetEndPos(), and SetupDrawEnvironment().
| VECTOR2D DS_DATA_MODEL::m_RB_Corner |
Definition at line 195 of file ds_data_model.h.
Referenced by DS_DATA_ITEM::GetEndPos(), and SetupDrawEnvironment().
|
private |
Definition at line 214 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), GetRightMargin(), and SetRightMargin().
|
private |
Definition at line 215 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), GetTopMargin(), and SetTopMargin().
| double DS_DATA_MODEL::m_WSunits2Iu |
Definition at line 193 of file ds_data_model.h.
Referenced by DS_DATA_MODEL(), DS_DATA_ITEM_POLYGONS::GetCornerPositionIU(), DS_DATA_ITEM::GetEndPosIU(), DS_DATA_ITEM::MoveEndPointToIU(), DS_DATA_ITEM::MoveToIU(), SetupDrawEnvironment(), and DS_DATA_ITEM_TEXT::SyncDrawItems().