2018-10-23 07:55:03 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
#ifndef SCH_VIEW_H_
|
|
|
|
#define SCH_VIEW_H_
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <view/view.h>
|
2018-10-10 15:26:23 +00:00
|
|
|
#include <math/box2.h>
|
2018-08-03 12:18:26 +00:00
|
|
|
|
|
|
|
#include <view/wx_view_controls.h>
|
2019-05-26 15:36:40 +00:00
|
|
|
#include <ws_proxy_view_item.h>
|
2018-08-03 12:18:26 +00:00
|
|
|
#include <layers_id_colors_and_visibility.h>
|
|
|
|
|
|
|
|
class SCH_SHEET;
|
|
|
|
class SCH_SCREEN;
|
|
|
|
class LIB_PART;
|
2018-12-24 11:17:35 +00:00
|
|
|
class LIB_PIN;
|
2018-11-19 09:21:28 +00:00
|
|
|
class SCH_BASE_FRAME;
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2018-10-23 07:53:05 +00:00
|
|
|
// Eeschema uses mils as the internal units
|
|
|
|
constexpr double SCH_WORLD_UNIT = 0.001;
|
2018-10-21 12:50:31 +00:00
|
|
|
|
|
|
|
static const LAYER_NUM SCH_LAYER_ORDER[] =
|
2019-08-08 09:06:53 +00:00
|
|
|
{
|
|
|
|
LAYER_GP_OVERLAY, LAYER_SELECT_OVERLAY,
|
|
|
|
LAYER_ERC_ERR, LAYER_ERC_WARN,
|
|
|
|
LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS,
|
|
|
|
LAYER_JUNCTION, LAYER_NOCONNECT,
|
|
|
|
LAYER_HIERLABEL,
|
|
|
|
LAYER_WIRE, LAYER_BUS,
|
|
|
|
LAYER_DEVICE,
|
|
|
|
LAYER_NOTES,
|
|
|
|
LAYER_SHEET,
|
|
|
|
LAYER_SELECTION_SHADOWS,
|
|
|
|
LAYER_DEVICE_BACKGROUND,
|
|
|
|
LAYER_SHEET_BACKGROUND,
|
|
|
|
LAYER_WORKSHEET
|
|
|
|
};
|
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;
|
2019-05-26 15:36:40 +00:00
|
|
|
class WS_PROXY_VIEW_ITEM;
|
2018-08-03 12:18:26 +00:00
|
|
|
|
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:
|
2018-11-19 09:21:28 +00:00
|
|
|
// Note: aFrame is used to know the sheet path name when drawing the page layout.
|
|
|
|
// It can be null.
|
|
|
|
SCH_VIEW( bool aIsDynamic, SCH_BASE_FRAME* aFrame );
|
2018-08-03 12:18:26 +00:00
|
|
|
~SCH_VIEW();
|
|
|
|
|
2018-11-20 14:30:18 +00:00
|
|
|
void DisplaySheet( SCH_SHEET* aSheet );
|
|
|
|
void DisplaySheet( SCH_SCREEN* aScreen );
|
|
|
|
void DisplayComponent( LIB_PART* aPart );
|
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)
|
|
|
|
void ResizeSheetWorkingArea( SCH_SCREEN *aScreen );
|
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
void ClearPreview();
|
2018-11-20 14:30:18 +00:00
|
|
|
void AddToPreview( EDA_ITEM* aItem, bool aTakeOwnership = true );
|
2018-08-03 12:18:26 +00:00
|
|
|
|
|
|
|
void ShowPreview( bool aShow = true );
|
|
|
|
|
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
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
void HideWorksheet();
|
|
|
|
|
2018-12-24 11:17:35 +00:00
|
|
|
void HighlightItem( EDA_ITEM *aItem, LIB_PIN* aPin = nullptr );
|
|
|
|
|
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
|
|
|
|
// to know the sheet path name when drawing the page layout
|
2019-05-31 17:37:07 +00:00
|
|
|
|
|
|
|
std::unique_ptr<WS_PROXY_VIEW_ITEM> m_worksheet;
|
2018-08-03 12:18:26 +00:00
|
|
|
std::unique_ptr<KIGFX::PREVIEW::SELECTION_AREA> m_selectionArea;
|
2019-05-31 17:37:07 +00:00
|
|
|
std::unique_ptr<KIGFX::VIEW_GROUP> m_preview;
|
|
|
|
std::vector<EDA_ITEM *> m_ownedItems;
|
2018-08-03 12:18:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace
|
|
|
|
|
|
|
|
#endif
|