2014-07-09 08:57:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 CERN
|
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PCB_DRAW_PANEL_GAL_H_
|
|
|
|
#define PCB_DRAW_PANEL_GAL_H_
|
|
|
|
|
|
|
|
#include <class_draw_panel_gal.h>
|
2017-02-17 00:59:31 +00:00
|
|
|
#include <layers_id_colors_and_visibility.h>
|
2019-06-13 17:28:55 +00:00
|
|
|
#include <pcb_view.h>
|
2018-04-10 10:52:12 +00:00
|
|
|
#include <common.h>
|
2014-07-09 08:57:32 +00:00
|
|
|
|
|
|
|
namespace KIGFX
|
|
|
|
{
|
2019-05-26 15:36:40 +00:00
|
|
|
class WS_PROXY_VIEW_ITEM;
|
2014-07-09 08:57:32 +00:00
|
|
|
class RATSNEST_VIEWITEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
class PCB_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition,
|
2017-01-02 06:13:45 +00:00
|
|
|
const wxSize& aSize, KIGFX::GAL_DISPLAY_OPTIONS& aOptions,
|
|
|
|
GAL_TYPE aGalType = GAL_TYPE_OPENGL );
|
2014-07-09 08:57:32 +00:00
|
|
|
|
|
|
|
virtual ~PCB_DRAW_PANEL_GAL();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function DisplayBoard
|
|
|
|
* adds all items from the current board to the VIEW, so they can be displayed by GAL.
|
|
|
|
* @param aBoard is the PCB to be loaded.
|
|
|
|
*/
|
2017-11-23 16:20:27 +00:00
|
|
|
void DisplayBoard( BOARD* aBoard );
|
2014-07-09 08:57:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetWorksheet
|
|
|
|
* Sets (or updates) worksheet used by the draw panel.
|
|
|
|
* @param aWorksheet is the worksheet to be used.
|
|
|
|
* The object is then owned by PCB_DRAW_PANEL_GAL.
|
|
|
|
*/
|
2019-05-26 15:36:40 +00:00
|
|
|
void SetWorksheet( KIGFX::WS_PROXY_VIEW_ITEM* aWorksheet );
|
2014-07-09 08:57:32 +00:00
|
|
|
|
2020-05-02 23:06:43 +00:00
|
|
|
KIGFX::WS_PROXY_VIEW_ITEM* GetWorksheet() const { return m_worksheet.get(); }
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
// TODO(JE) Look at optimizing this out
|
2014-07-09 09:22:42 +00:00
|
|
|
/**
|
2020-01-13 01:44:19 +00:00
|
|
|
* Updates the color settings in the painter and GAL
|
2014-07-09 09:22:42 +00:00
|
|
|
*/
|
2020-01-13 01:44:19 +00:00
|
|
|
void UpdateColors();
|
2014-07-09 09:22:42 +00:00
|
|
|
|
2014-07-09 08:57:32 +00:00
|
|
|
///> @copydoc EDA_DRAW_PANEL_GAL::SetHighContrastLayer()
|
2017-02-17 00:59:31 +00:00
|
|
|
virtual void SetHighContrastLayer( int aLayer ) override
|
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
SetHighContrastLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
|
2017-02-17 00:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///> SetHighContrastLayer(), with some extra smarts for PCB
|
2017-03-13 03:19:33 +00:00
|
|
|
void SetHighContrastLayer( PCB_LAYER_ID aLayer );
|
2014-07-09 08:57:32 +00:00
|
|
|
|
|
|
|
///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer()
|
2017-02-17 00:59:31 +00:00
|
|
|
virtual void SetTopLayer( int aLayer ) override
|
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
SetTopLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
|
2017-02-17 00:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///> SetTopLayer(), with some extra smarts for PCB
|
2017-03-13 03:19:33 +00:00
|
|
|
void SetTopLayer( PCB_LAYER_ID aLayer );
|
2014-07-09 08:57:32 +00:00
|
|
|
|
2014-07-09 09:24:56 +00:00
|
|
|
/**
|
|
|
|
* Function SyncLayersVisibility
|
|
|
|
* Updates "visibility" property of each layer of a given BOARD.
|
|
|
|
* @param aBoard contains layers visibility settings to be applied.
|
|
|
|
*/
|
|
|
|
void SyncLayersVisibility( const BOARD* aBoard );
|
|
|
|
|
2015-07-03 18:58:12 +00:00
|
|
|
///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo()
|
2020-04-24 13:36:10 +00:00
|
|
|
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
2015-07-03 18:58:12 +00:00
|
|
|
|
2016-05-09 15:23:01 +00:00
|
|
|
///> @copydoc EDA_DRAW_PANEL_GAL::OnShow()
|
|
|
|
void OnShow() override;
|
|
|
|
|
2016-12-07 09:20:31 +00:00
|
|
|
bool SwitchBackend( GAL_TYPE aGalType ) override;
|
|
|
|
|
2017-08-01 13:20:40 +00:00
|
|
|
///> Forces refresh of the ratsnest visual representation
|
|
|
|
void RedrawRatsnest();
|
|
|
|
|
2018-01-11 03:53:55 +00:00
|
|
|
///> @copydoc EDA_DRAW_PANEL_GAL::GetDefaultViewBBox()
|
|
|
|
BOX2I GetDefaultViewBBox() const override;
|
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
virtual KIGFX::PCB_VIEW* GetView() const override;
|
2017-10-30 19:17:23 +00:00
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
protected:
|
2017-11-23 16:20:27 +00:00
|
|
|
|
2015-09-05 17:00:54 +00:00
|
|
|
///> Reassigns layer order to the initial settings.
|
|
|
|
void setDefaultLayerOrder();
|
|
|
|
|
|
|
|
///> Sets rendering targets & dependencies for layers.
|
|
|
|
void setDefaultLayerDeps();
|
|
|
|
|
2014-07-09 08:57:32 +00:00
|
|
|
///> Currently used worksheet
|
2019-05-26 15:36:40 +00:00
|
|
|
std::unique_ptr<KIGFX::WS_PROXY_VIEW_ITEM> m_worksheet;
|
2014-07-09 08:57:32 +00:00
|
|
|
|
|
|
|
///> Ratsnest view item
|
2017-03-02 22:57:13 +00:00
|
|
|
std::unique_ptr<KIGFX::RATSNEST_VIEWITEM> m_ratsnest;
|
2014-07-09 08:57:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* PCB_DRAW_PANEL_GAL_H_ */
|