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
|
2023-04-16 13:36:34 +00:00
|
|
|
* Copyright (C) 2021-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2014-07-09 08:57:32 +00:00
|
|
|
* @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>
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2019-06-13 17:28:55 +00:00
|
|
|
#include <pcb_view.h>
|
2014-07-09 08:57:32 +00:00
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
class DS_PROXY_VIEW_ITEM;
|
|
|
|
class RATSNEST_VIEW_ITEM;
|
2021-11-25 16:19:03 +00:00
|
|
|
class PROGRESS_REPORTER;
|
2014-07-09 08:57:32 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Add all items from the current board to the VIEW, so they can be displayed by GAL.
|
|
|
|
*
|
2014-07-09 08:57:32 +00:00
|
|
|
* @param aBoard is the PCB to be loaded.
|
|
|
|
*/
|
2021-11-25 16:19:03 +00:00
|
|
|
void DisplayBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr );
|
2014-07-09 08:57:32 +00:00
|
|
|
|
|
|
|
/**
|
2021-02-22 23:47:17 +00:00
|
|
|
* Sets (or updates) drawing-sheet used by the draw panel.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2021-02-22 23:47:17 +00:00
|
|
|
* @param aDrawingSheet is the drawing-sheet to be used. The object is then owned by
|
2023-04-16 13:36:34 +00:00
|
|
|
* #PCB_DRAW_PANEL_GAL.
|
2014-07-09 08:57:32 +00:00
|
|
|
*/
|
2021-02-22 23:47:17 +00:00
|
|
|
void SetDrawingSheet( DS_PROXY_VIEW_ITEM* aDrawingSheet );
|
2014-07-09 08:57:32 +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
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
// TODO(JE) Look at optimizing this out
|
2014-07-09 09:22:42 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Update 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
|
|
|
|
2021-01-27 22:15:38 +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
|
|
|
}
|
|
|
|
|
2021-01-27 22:15:38 +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
|
|
|
|
2021-01-27 22:15:38 +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
|
|
|
}
|
|
|
|
|
2021-01-27 22:15:38 +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
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Update "visibility" property of each layer of a given #BOARD.
|
|
|
|
*
|
2014-07-09 09:24:56 +00:00
|
|
|
* @param aBoard contains layers visibility settings to be applied.
|
|
|
|
*/
|
|
|
|
void SyncLayersVisibility( const BOARD* aBoard );
|
|
|
|
|
2021-01-27 22:15:38 +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
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc EDA_DRAW_PANEL_GAL::OnShow()
|
2016-05-09 15:23:01 +00:00
|
|
|
void OnShow() override;
|
|
|
|
|
2016-12-07 09:20:31 +00:00
|
|
|
bool SwitchBackend( GAL_TYPE aGalType ) override;
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Force refresh of the ratsnest visual representation.
|
2017-08-01 13:20:40 +00:00
|
|
|
void RedrawRatsnest();
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc EDA_DRAW_PANEL_GAL::GetDefaultViewBBox()
|
2018-01-11 03:53:55 +00:00
|
|
|
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:
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Reassign layer order to the initial settings.
|
2015-09-05 17:00:54 +00:00
|
|
|
void setDefaultLayerOrder();
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Set rendering targets & dependencies for layers.
|
2015-09-05 17:00:54 +00:00
|
|
|
void setDefaultLayerDeps();
|
|
|
|
|
2023-04-16 13:36:34 +00:00
|
|
|
protected:
|
|
|
|
std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet; ///< Currently used drawing-sheet.
|
|
|
|
std::unique_ptr<RATSNEST_VIEW_ITEM> m_ratsnest; ///< Ratsnest view item
|
2014-07-09 08:57:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* PCB_DRAW_PANEL_GAL_H_ */
|