2018-08-28 13:26:39 +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-08-28 13:26:39 +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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SYMBOL_PREVIEW_WIDGET_H
|
|
|
|
#define SYMBOL_PREVIEW_WIDGET_H
|
|
|
|
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <kiway.h>
|
2023-09-23 03:17:53 +00:00
|
|
|
#include <gal_display_options_common.h>
|
2018-09-15 07:00:13 +00:00
|
|
|
#include <class_draw_panel_gal.h>
|
2018-08-28 13:26:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LIB_ID;
|
2021-06-10 18:51:46 +00:00
|
|
|
class LIB_SYMBOL;
|
2018-08-28 13:26:39 +00:00
|
|
|
class wxStaticText;
|
|
|
|
class wxSizer;
|
|
|
|
|
|
|
|
|
|
|
|
class SYMBOL_PREVIEW_WIDGET: public wxPanel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a symbol preview widget.
|
|
|
|
*
|
|
|
|
* @param aParent - parent window
|
|
|
|
* @param aKiway - an active Kiway instance
|
2018-09-15 07:00:13 +00:00
|
|
|
* @param aCanvasType = the type of canvas (GAL_TYPE_OPENGL or GAL_TYPE_CAIRO only)
|
2018-08-28 13:26:39 +00:00
|
|
|
*/
|
2023-09-02 21:13:48 +00:00
|
|
|
SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY* aKiway, bool aIncludeStatus,
|
2018-09-15 07:00:13 +00:00
|
|
|
EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
|
2018-08-28 13:26:39 +00:00
|
|
|
|
2018-08-29 18:31:43 +00:00
|
|
|
~SYMBOL_PREVIEW_WIDGET() override;
|
|
|
|
|
2018-08-28 13:26:39 +00:00
|
|
|
/**
|
|
|
|
* Set the contents of the status label and display it.
|
|
|
|
*/
|
2021-07-27 12:22:27 +00:00
|
|
|
void SetStatusText( const wxString& aText );
|
2018-08-28 13:26:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the currently displayed symbol.
|
|
|
|
*/
|
2024-01-26 16:16:13 +00:00
|
|
|
void DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, int aBodyStyle = 0 );
|
2018-08-28 13:26:39 +00:00
|
|
|
|
2024-01-26 16:16:13 +00:00
|
|
|
void DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aBodyStyle = 0 );
|
2018-08-30 21:44:50 +00:00
|
|
|
|
2023-03-09 17:41:18 +00:00
|
|
|
protected:
|
2018-09-17 09:22:11 +00:00
|
|
|
void onSize( wxSizeEvent& aEvent );
|
|
|
|
|
|
|
|
void fitOnDrawArea(); // set the view scale to fit the item on screen and center
|
|
|
|
|
2023-03-09 17:41:18 +00:00
|
|
|
KIWAY* m_kiway;
|
2018-08-28 13:26:39 +00:00
|
|
|
|
2023-09-23 03:17:53 +00:00
|
|
|
GAL_DISPLAY_OPTIONS_IMPL m_galDisplayOptions;
|
2018-08-28 13:26:39 +00:00
|
|
|
EDA_DRAW_PANEL_GAL* m_preview;
|
|
|
|
|
|
|
|
wxStaticText* m_status;
|
2020-08-09 23:51:36 +00:00
|
|
|
wxPanel* m_statusPanel;
|
2018-08-30 21:44:50 +00:00
|
|
|
wxSizer* m_statusSizer;
|
2020-08-09 23:51:36 +00:00
|
|
|
wxSizer* m_outerSizer;
|
2018-08-29 18:31:43 +00:00
|
|
|
|
2019-11-06 19:15:42 +00:00
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* A local copy of the #LIB_SYMBOL to display on the canvas.
|
2018-10-31 14:52:10 +00:00
|
|
|
*/
|
2021-06-10 18:51:46 +00:00
|
|
|
LIB_SYMBOL* m_previewItem;
|
2018-10-31 14:52:10 +00:00
|
|
|
|
|
|
|
/// The bounding box of the current item
|
|
|
|
BOX2I m_itemBBox;
|
2018-08-28 13:26:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SYMBOL_PREVIEW_WIDGET_H
|