2018-10-23 07:55:03 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-10-23 07:55:03 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
#ifndef SCH_VIEW_H_
|
|
|
|
#define SCH_VIEW_H_
|
|
|
|
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2019-06-25 23:39:58 +00:00
|
|
|
#include <math/vector2d.h>
|
2018-08-03 12:18:26 +00:00
|
|
|
#include <view/view.h>
|
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
2018-08-03 12:18:26 +00:00
|
|
|
|
|
|
|
class SCH_SHEET;
|
|
|
|
class SCH_SCREEN;
|
2021-06-10 18:51:46 +00:00
|
|
|
class LIB_SYMBOL;
|
2018-12-24 11:17:35 +00:00
|
|
|
class LIB_PIN;
|
2018-11-19 09:21:28 +00:00
|
|
|
class SCH_BASE_FRAME;
|
2021-02-22 23:47:17 +00:00
|
|
|
class DS_PROXY_VIEW_ITEM;
|
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2019-12-30 18:28:00 +00:00
|
|
|
// Eeschema 100nm as the internal units
|
|
|
|
constexpr double SCH_WORLD_UNIT ( 1e-7 / 0.0254 );
|
2018-10-21 12:50:31 +00:00
|
|
|
|
2021-07-21 23:14:56 +00:00
|
|
|
static const int SCH_LAYER_ORDER[] =
|
2019-08-08 09:06:53 +00:00
|
|
|
{
|
|
|
|
LAYER_GP_OVERLAY, LAYER_SELECT_OVERLAY,
|
2021-11-05 21:16:26 +00:00
|
|
|
LAYER_ERC_ERR, LAYER_ERC_WARN, LAYER_ERC_EXCLUSION, LAYER_DANGLING,
|
2019-08-08 09:06:53 +00:00
|
|
|
LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS,
|
2021-10-12 20:05:37 +00:00
|
|
|
LAYER_INTERSHEET_REFS, LAYER_NETCLASS_REFS,
|
2020-04-23 01:33:57 +00:00
|
|
|
LAYER_BUS_JUNCTION, LAYER_JUNCTION, LAYER_NOCONNECT,
|
2022-01-23 17:55:58 +00:00
|
|
|
LAYER_HIERLABEL, LAYER_GLOBLABEL, LAYER_LOCLABEL,
|
2023-01-14 20:37:23 +00:00
|
|
|
LAYER_SHEETFILENAME, LAYER_SHEETNAME, LAYER_SHEETLABEL, LAYER_SHEETFIELDS,
|
2023-01-15 22:56:37 +00:00
|
|
|
LAYER_NOTES,
|
2019-08-08 09:06:53 +00:00
|
|
|
LAYER_WIRE, LAYER_BUS,
|
|
|
|
LAYER_DEVICE,
|
|
|
|
LAYER_SHEET,
|
|
|
|
LAYER_SELECTION_SHADOWS,
|
2022-01-23 17:55:58 +00:00
|
|
|
LAYER_DRAW_BITMAPS,
|
2019-08-08 09:06:53 +00:00
|
|
|
LAYER_DEVICE_BACKGROUND,
|
|
|
|
LAYER_SHEET_BACKGROUND,
|
2021-07-17 19:56:18 +00:00
|
|
|
LAYER_NOTES_BACKGROUND,
|
2021-02-22 16:37:43 +00:00
|
|
|
LAYER_DRAWINGSHEET
|
2019-08-08 09:06:53 +00:00
|
|
|
};
|
2018-10-21 12:50:31 +00:00
|
|
|
|
|
|
|
|
2018-09-16 21:19:33 +00:00
|
|
|
namespace KIGFX
|
|
|
|
{
|
2018-08-03 12:18:26 +00:00
|
|
|
class VIEW_GROUP;
|
|
|
|
|
2018-09-16 21:19:33 +00:00
|
|
|
namespace PREVIEW
|
|
|
|
{
|
|
|
|
class SELECTION_AREA;
|
|
|
|
};
|
2018-08-03 12:18:26 +00:00
|
|
|
|
|
|
|
class SCH_VIEW : public KIGFX::VIEW
|
|
|
|
{
|
|
|
|
public:
|
2021-05-30 22:56:24 +00:00
|
|
|
// Note: aFrame is used to know the sheet path name when drawing the drawing sheet.
|
2018-11-19 09:21:28 +00:00
|
|
|
// It can be null.
|
|
|
|
SCH_VIEW( bool aIsDynamic, SCH_BASE_FRAME* aFrame );
|
2018-08-03 12:18:26 +00:00
|
|
|
~SCH_VIEW();
|
|
|
|
|
2020-08-08 20:52:57 +00:00
|
|
|
void Cleanup();
|
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void DisplaySheet( const SCH_SCREEN* aScreen );
|
2021-06-14 18:00:08 +00:00
|
|
|
void DisplaySymbol( LIB_SYMBOL* aSymbol );
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2018-11-20 14:11:22 +00:00
|
|
|
// Call it to set new draw area limits (max working and draw area size)
|
2020-12-20 18:44:13 +00:00
|
|
|
void ResizeSheetWorkingArea( const SCH_SCREEN *aScreen );
|
2018-11-20 14:11:22 +00:00
|
|
|
|
2019-08-08 09:06:53 +00:00
|
|
|
void SetScale( double aScale, VECTOR2D aAnchor = { 0, 0 } ) override;
|
|
|
|
|
2018-12-29 08:39:08 +00:00
|
|
|
/**
|
|
|
|
* Clear the hide flag of all items in the view
|
|
|
|
*/
|
2018-08-03 12:18:26 +00:00
|
|
|
void ClearHiddenFlags();
|
2018-12-29 08:39:08 +00:00
|
|
|
|
2021-02-22 16:37:43 +00:00
|
|
|
void HideDrawingSheet();
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
DS_PROXY_VIEW_ITEM* GetDrawingSheet() const { return m_drawingSheet.get(); }
|
2020-05-02 23:06:43 +00:00
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
private:
|
2018-11-19 09:21:28 +00:00
|
|
|
SCH_BASE_FRAME* m_frame; // The frame using this view. Can be null. Used mainly
|
2021-05-30 22:56:24 +00:00
|
|
|
// to know the sheet path name when drawing the drawing sheet
|
2019-05-31 17:37:07 +00:00
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
|
2018-08-03 12:18:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace
|
|
|
|
|
|
|
|
#endif
|