2011-10-13 19:56:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 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
|
|
|
|
*/
|
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
/**
|
|
|
|
* @file wxstruct.h
|
|
|
|
* @brief Base window classes and related definitions.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-09 17:24:01 +00:00
|
|
|
#ifndef WXSTRUCT_H_
|
|
|
|
#define WXSTRUCT_H_
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include <wx/socket.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <wx/log.h>
|
|
|
|
#include <wx/config.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
#include <wx/wxhtml.h>
|
|
|
|
#include <wx/laywin.h>
|
2009-11-02 22:24:55 +00:00
|
|
|
#include <wx/aui/aui.h>
|
2011-03-17 19:14:45 +00:00
|
|
|
#include <wx/docview.h>
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <colors.h>
|
2013-03-30 17:24:04 +00:00
|
|
|
#include <fctsys.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <common.h>
|
2013-03-30 17:24:04 +00:00
|
|
|
#include <layers_id_colors_and_visibility.h>
|
2007-10-10 18:01:14 +00:00
|
|
|
|
2012-01-10 17:54:40 +00:00
|
|
|
#ifdef USE_WX_OVERLAY
|
|
|
|
#include <wx/overlay.h>
|
|
|
|
#endif
|
|
|
|
|
2013-11-15 09:28:31 +00:00
|
|
|
// Option for main frames
|
2009-01-29 14:26:20 +00:00
|
|
|
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
|
|
|
|
// Readability helper definitions for creating backup files.
|
|
|
|
#define CREATE_BACKUP_FILE true
|
|
|
|
#define NO_BACKUP_FILE false
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
class EDA_ITEM;
|
2011-03-29 19:33:07 +00:00
|
|
|
class EDA_RECT;
|
2011-01-21 19:30:59 +00:00
|
|
|
class EDA_DRAW_PANEL;
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
class EDA_DRAW_PANEL_GAL;
|
2011-04-12 14:19:59 +00:00
|
|
|
class EDA_MSG_PANEL;
|
2007-06-05 12:10:51 +00:00
|
|
|
class BASE_SCREEN;
|
|
|
|
class PARAM_CFG_BASE;
|
2011-12-22 21:57:50 +00:00
|
|
|
class PAGE_INFO;
|
2009-08-29 10:20:48 +00:00
|
|
|
class PLOTTER;
|
2012-01-09 08:35:06 +00:00
|
|
|
class TITLE_BLOCK;
|
2013-01-12 17:32:24 +00:00
|
|
|
class MSG_PANEL_ITEM;
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
enum id_librarytype {
|
|
|
|
LIBRARY_TYPE_EESCHEMA,
|
|
|
|
LIBRARY_TYPE_PCBNEW,
|
2009-08-27 11:41:56 +00:00
|
|
|
LIBRARY_TYPE_DOC,
|
|
|
|
LIBRARY_TYPE_SYMBOL
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2012-09-11 19:03:21 +00:00
|
|
|
enum ID_DRAWFRAME_TYPE
|
|
|
|
{
|
|
|
|
NOT_INIT_FRAME_TYPE = 0,
|
|
|
|
SCHEMATIC_FRAME_TYPE,
|
|
|
|
LIBEDITOR_FRAME_TYPE,
|
|
|
|
VIEWER_FRAME_TYPE,
|
|
|
|
PCB_FRAME_TYPE,
|
|
|
|
MODULE_EDITOR_FRAME_TYPE,
|
|
|
|
MODULE_VIEWER_FRAME_TYPE,
|
|
|
|
FOOTPRINT_WIZARD_FRAME_TYPE,
|
|
|
|
CVPCB_FRAME_TYPE,
|
|
|
|
CVPCB_DISPLAY_FRAME_TYPE,
|
|
|
|
GERBER_FRAME_TYPE,
|
|
|
|
TEXT_EDITOR_FRAME_TYPE,
|
|
|
|
DISPLAY3D_FRAME_TYPE,
|
2013-07-19 18:27:22 +00:00
|
|
|
KICAD_MAIN_FRAME_TYPE,
|
|
|
|
PL_EDITOR_FRAME_TYPE
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
/// Custom trace mask to enable and disable auto save tracing.
|
|
|
|
extern const wxChar* traceAutoSave;
|
|
|
|
|
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
/**
|
|
|
|
* Class EDA_BASE_FRAME
|
2011-09-30 18:15:37 +00:00
|
|
|
* is the base frame for deriving all KiCad main window classes. This class is not
|
2011-09-01 12:54:34 +00:00
|
|
|
* intended to be used directly.
|
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
class EDA_BASE_FRAME : public wxFrame
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-10-13 19:56:32 +00:00
|
|
|
protected:
|
2013-08-03 05:15:23 +00:00
|
|
|
ID_DRAWFRAME_TYPE m_Ident; ///< Id Type (pcb, schematic, library..)
|
2011-04-13 19:30:27 +00:00
|
|
|
wxPoint m_FramePos;
|
|
|
|
wxSize m_FrameSize;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar
|
2011-04-13 19:30:27 +00:00
|
|
|
bool m_FrameIsActive;
|
2013-08-03 05:15:23 +00:00
|
|
|
wxString m_FrameName; ///< name used for writing and reading setup
|
|
|
|
///< It is "SchematicFrame", "PcbFrame" ....
|
|
|
|
wxString m_AboutTitle; ///< Name of program displayed in About.
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-04-13 19:30:27 +00:00
|
|
|
wxAuiManager m_auimgr;
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2011-10-13 19:56:32 +00:00
|
|
|
/// Flag to indicate if this frame supports auto save.
|
|
|
|
bool m_hasAutoSave;
|
|
|
|
|
|
|
|
/// Flag to indicate the last auto save state.
|
|
|
|
bool m_autoSaveState;
|
|
|
|
|
|
|
|
/// The auto save interval time in seconds.
|
|
|
|
int m_autoSaveInterval;
|
|
|
|
|
|
|
|
/// The timer used to implement the auto save feature;
|
|
|
|
wxTimer* m_autoSaveTimer;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function onAutoSaveTimer
|
|
|
|
* handles the auto save timer event.
|
|
|
|
*/
|
|
|
|
void onAutoSaveTimer( wxTimerEvent& aEvent );
|
|
|
|
|
|
|
|
/**
|
2011-10-15 13:25:57 +00:00
|
|
|
* Function autoSaveRequired
|
|
|
|
* returns the auto save status of the application. Override this function if
|
2011-10-13 19:56:32 +00:00
|
|
|
* your derived frame supports automatic file saving.
|
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
virtual bool isAutoSaveRequired() const { return false; }
|
2011-10-13 19:56:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function doAutoSave
|
|
|
|
* should be overridden by the derived class to handle the auto save feature.
|
|
|
|
*
|
|
|
|
* @return true if the auto save was successful otherwise false.
|
|
|
|
*/
|
|
|
|
virtual bool doAutoSave();
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2012-09-12 09:53:11 +00:00
|
|
|
EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
|
|
|
const wxString& aTitle,
|
|
|
|
const wxPoint& aPos, const wxSize& aSize,
|
|
|
|
long aStyle,
|
|
|
|
const wxString & aFrameName );
|
2011-10-13 19:56:32 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
~EDA_BASE_FRAME();
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2011-10-13 19:56:32 +00:00
|
|
|
/**
|
|
|
|
* Function ProcessEvent
|
|
|
|
* overrides the default process event handler to implement the auto save feature.
|
|
|
|
*
|
|
|
|
* @warning If you override this function in a derived class, make sure you call
|
|
|
|
* down to this or the auto save feature will be disabled.
|
|
|
|
*/
|
|
|
|
virtual bool ProcessEvent( wxEvent& aEvent );
|
|
|
|
|
|
|
|
void SetAutoSaveInterval( int aInterval ) { m_autoSaveInterval = aInterval; }
|
|
|
|
|
|
|
|
int GetAutoSaveInterval() const { return m_autoSaveInterval; }
|
|
|
|
|
|
|
|
wxString GetName() const { return m_FrameName; }
|
|
|
|
|
|
|
|
bool IsActive() const { return m_FrameIsActive; }
|
|
|
|
|
2012-09-11 19:03:21 +00:00
|
|
|
bool IsType( ID_DRAWFRAME_TYPE aType ) const { return m_Ident == aType; }
|
2011-10-13 19:56:32 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
void GetKicadHelp( wxCommandEvent& event );
|
2011-10-13 19:56:32 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
void GetKicadAbout( wxCommandEvent& event );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
|
|
|
/**
|
2011-09-01 12:54:34 +00:00
|
|
|
* Function CopyVersionInfoToClipboard
|
|
|
|
* copies the version information to the clipboard for bug reporting purposes.
|
2010-08-24 17:26:51 +00:00
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
void CopyVersionInfoToClipboard( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void PrintMsg( const wxString& text );
|
2009-04-07 11:53:58 +00:00
|
|
|
|
2010-08-24 17:26:51 +00:00
|
|
|
/**
|
|
|
|
* Append the copy version information to clipboard help menu entry to \a aMenu.
|
|
|
|
*
|
|
|
|
* @param aMenu - The menu to append.
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
void AddHelpVersionInfoMenuEntry( wxMenu* aMenu );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2011-10-13 19:56:32 +00:00
|
|
|
/**
|
|
|
|
* Load common frame parameters from configuration.
|
|
|
|
*
|
|
|
|
* The method is virtual so you can override it to load frame specific
|
|
|
|
* parameters. Don't forget to call the base method or your frames won't
|
|
|
|
* remember their positions and sizes.
|
|
|
|
*/
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual void LoadSettings();
|
2011-10-13 19:56:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save common frame parameters from configuration.
|
|
|
|
*
|
|
|
|
* The method is virtual so you can override it to save frame specific
|
|
|
|
* parameters. Don't forget to call the base method or your frames won't
|
|
|
|
* remember their positions and sizes.
|
|
|
|
*/
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual void SaveSettings();
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
/**
|
|
|
|
* Function SaveProjectSettings
|
|
|
|
* saves changes to the project settings to the project (.pro) file.
|
|
|
|
* The method is virtual so you can override it to call the suitable save method.
|
|
|
|
* The base method do nothing
|
|
|
|
* @param aAskForSave = true to open a dialog before saving the settings
|
|
|
|
*/
|
|
|
|
virtual void SaveProjectSettings( bool aAskForSave ) {};
|
|
|
|
|
2011-03-13 18:03:43 +00:00
|
|
|
/**
|
|
|
|
* Function OnSelectPreferredEditor
|
2011-09-30 18:15:37 +00:00
|
|
|
* Open a dialog to select the editor that will used in KiCad
|
2011-03-13 18:03:43 +00:00
|
|
|
* to edit or display files (reports ... )
|
|
|
|
* The full filename editor is saved in configuration (global params)
|
|
|
|
*/
|
|
|
|
virtual void OnSelectPreferredEditor( wxCommandEvent& event );
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
// Read/Save and Import/export hotkeys config
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function ReadHotkeyConfig
|
2010-08-28 18:02:24 +00:00
|
|
|
* Read configuration data and fill the current hotkey list with hotkeys
|
2011-09-01 12:54:34 +00:00
|
|
|
* @param aDescList = current hotkey list descr. to initialize.
|
2010-08-28 18:02:24 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
int ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function WriteHotkeyConfig
|
2010-08-28 18:02:24 +00:00
|
|
|
* Store the current hotkey list
|
|
|
|
* It is stored using the standard wxConfig mechanism or a file.
|
|
|
|
*
|
|
|
|
* @param aDescList = pointer to the current hotkey list.
|
2011-09-01 12:54:34 +00:00
|
|
|
* @param aFullFileName = a wxString pointer to a full file name.
|
2010-08-28 18:02:24 +00:00
|
|
|
* if NULL, use the standard wxConfig mechanism (default)
|
|
|
|
* the output format is: shortcut "key" "function"
|
|
|
|
* lines starting with # are comments
|
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL);
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function ReadHotkeyConfigFile
|
2010-12-14 15:56:30 +00:00
|
|
|
* Read an old configuration file (<file>.key) and fill the current hotkey list
|
2010-08-28 18:02:24 +00:00
|
|
|
* with hotkeys
|
|
|
|
* @param aFilename = file name to read.
|
2011-09-01 12:54:34 +00:00
|
|
|
* @param aDescList = current hotkey list descr. to initialize.
|
2010-08-28 18:02:24 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
int ReadHotkeyConfigFile( const wxString& aFilename, struct EDA_HOTKEY_CONFIG* aDescList );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function ImportHotkeyConfigFromFile
|
2010-08-28 18:02:24 +00:00
|
|
|
* Prompt the user for an old hotkey file to read, and read it.
|
2011-09-01 12:54:34 +00:00
|
|
|
* @param aDescList = current hotkey list descr. to initialize.
|
2010-08-28 18:02:24 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
void ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDescList );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function ExportHotkeyConfigToFile
|
2010-08-28 18:02:24 +00:00
|
|
|
* Prompt the user for an old hotkey file to read, and read it.
|
2011-09-01 12:54:34 +00:00
|
|
|
* @param aDescList = current hotkey list descr. to initialize.
|
2010-08-28 18:02:24 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
void ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescList );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetLanguage
|
2010-02-26 15:39:10 +00:00
|
|
|
* called on a language menu selection
|
|
|
|
* when using a derived function, do not forget to call this one
|
|
|
|
*/
|
|
|
|
virtual void SetLanguage( wxCommandEvent& event );
|
2009-04-07 11:53:58 +00:00
|
|
|
|
2011-03-17 19:14:45 +00:00
|
|
|
/**
|
2011-03-25 19:16:05 +00:00
|
|
|
* Function GetFileFromHistory
|
|
|
|
* fetches the file name from the file history list.
|
2011-04-17 13:54:17 +00:00
|
|
|
* and removes the selected file, if this file does not exists
|
|
|
|
* Note also the menu is updated, if wxFileHistory::UseMenu
|
|
|
|
* was called at init time
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param cmdId The command ID associated with the \a aFileHistory object.
|
|
|
|
* @param type Please document me!
|
|
|
|
* @param aFileHistory The wxFileHistory in use. If null, the main application file
|
|
|
|
* history is used
|
2011-03-17 19:14:45 +00:00
|
|
|
* @return a wxString containing the selected filename
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
wxString GetFileFromHistory( int cmdId, const wxString& type,
|
|
|
|
wxFileHistory* aFileHistory = NULL );
|
2011-03-17 19:14:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function UpdateFileHistory
|
2011-04-17 13:54:17 +00:00
|
|
|
* Updates the list of recently opened files.
|
|
|
|
* Note also the menu is updated, if wxFileHistory::UseMenu
|
|
|
|
* was called at init time
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param FullFileName The full file name including the path.
|
2011-04-17 13:54:17 +00:00
|
|
|
* @param aFileHistory The wxFileHistory in use.
|
|
|
|
* If NULL, the main application file history is used.
|
2011-03-17 19:14:45 +00:00
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
void UpdateFileHistory( const wxString& FullFileName, wxFileHistory * aFileHistory = NULL );
|
2011-03-17 19:14:45 +00:00
|
|
|
|
2011-04-17 13:54:17 +00:00
|
|
|
/**
|
|
|
|
* Function ReCreateMenuBar
|
|
|
|
* Creates recreates the menu bar.
|
|
|
|
* Needed when the language is changed
|
|
|
|
*/
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual void ReCreateMenuBar();
|
2011-08-18 19:25:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsWritable
|
|
|
|
* checks if \a aFileName can be written.
|
|
|
|
* <p>
|
2011-10-28 20:30:50 +00:00
|
|
|
* The function performs a number of tests on \a aFileName to verify that it
|
|
|
|
* can be saved. If \a aFileName defines a path with no file name, them the
|
|
|
|
* path is tested for user write permission. If \a aFileName defines a file
|
|
|
|
* name that does not exist in the path, the path is tested for user write
|
|
|
|
* permission. If \a aFileName defines a file that already exits, the file
|
|
|
|
* name is tested for user write permissions.
|
2011-08-18 19:25:12 +00:00
|
|
|
* </p>
|
|
|
|
*
|
2011-10-28 20:30:50 +00:00
|
|
|
* @note The file name path must be set or an assertion will be raised on debug
|
|
|
|
* builds and return false on release builds.
|
2011-08-18 19:25:12 +00:00
|
|
|
* @param aFileName The full path and/or file name of the file to test.
|
|
|
|
* @return False if \a aFileName cannot be written.
|
|
|
|
*/
|
|
|
|
bool IsWritable( const wxFileName& aFileName );
|
2011-10-15 13:25:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function CheckForAutoSaveFile
|
|
|
|
* checks if an auto save file exists for \a aFileName and takes the appropriate
|
|
|
|
* action depending on the user input.
|
|
|
|
* <p>
|
|
|
|
* If an auto save file exists for \a aFileName, the user is prompted if they wish
|
|
|
|
* to replace file \a aFileName with the auto saved file. If the user chooses to
|
|
|
|
* replace the file, the backup file of \a aFileName is removed, \a aFileName is
|
|
|
|
* renamed to the backup file name, and the auto save file is renamed to \a aFileName.
|
|
|
|
* If user chooses to keep the existing version of \a aFileName, the auto save file
|
|
|
|
* is removed.
|
|
|
|
* </p>
|
|
|
|
* @param aFileName A wxFileName object containing the file name to check.
|
|
|
|
* @param aBackupFileExtension A wxString object containing the backup file extension
|
|
|
|
* used to create the backup file name.
|
|
|
|
*/
|
|
|
|
void CheckForAutoSaveFile( const wxFileName& aFileName, const wxString& aBackupFileExtension );
|
2012-09-11 19:03:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetModalMode
|
|
|
|
* Disable or enable all other windows, to emulate a dialog behavior
|
|
|
|
* Useful when the frame is used to show and selec items
|
|
|
|
* (see FOOTPRINT_VIEWER_FRAME and LIB_VIEW_FRAME)
|
|
|
|
*
|
|
|
|
* @param aModal = true to disable all other opened windows (i.e.
|
|
|
|
* this windows is in dialog mode
|
|
|
|
* = false to enable other windows
|
|
|
|
* This function is analog to MakeModal( aModal ), deprecated since wxWidgets 2.9.4
|
|
|
|
*/
|
|
|
|
void SetModalMode( bool aModal );
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
/**
|
|
|
|
* Class EDA_DRAW_FRAME
|
2011-09-30 18:15:37 +00:00
|
|
|
* is the base class for create windows for drawing purpose. The Eeschema, Pcbnew and
|
|
|
|
* GerbView main windows are just a few examples of classes derived from EDA_DRAW_FRAME.
|
2011-09-01 12:54:34 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
class EDA_DRAW_FRAME : public EDA_BASE_FRAME
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-01-05 08:07:11 +00:00
|
|
|
/// Let the #EDA_DRAW_PANEL object have access to the protected data since
|
|
|
|
/// it is closely tied to the #EDA_DRAW_FRAME.
|
|
|
|
friend class EDA_DRAW_PANEL;
|
|
|
|
|
2011-12-12 14:02:37 +00:00
|
|
|
///< Id of active button on the vertical toolbar.
|
|
|
|
int m_toolId;
|
2011-02-24 20:22:12 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
|
|
|
|
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
|
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
protected:
|
2011-09-29 16:49:40 +00:00
|
|
|
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
|
2011-12-22 21:57:50 +00:00
|
|
|
int m_LastGridSizeId;
|
|
|
|
bool m_DrawGrid; // hide/Show grid
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
bool m_galCanvasActive; // whether to use new GAL engine
|
2012-09-02 12:06:47 +00:00
|
|
|
EDA_COLOR_T m_GridColor; // Grid color
|
2009-10-14 19:43:31 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
/// The area to draw on.
|
|
|
|
EDA_DRAW_PANEL* m_canvas;
|
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
/// New type of area (GAL-based) to draw on.
|
|
|
|
EDA_DRAW_PANEL_GAL* m_galCanvas;
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
/// Tool ID of previously active draw tool bar button.
|
2013-08-03 05:15:23 +00:00
|
|
|
int m_lastDrawToolId;
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
/// The shape of the KiCad cursor. The default value (0) is the normal cross
|
|
|
|
/// hair cursor. Set to non-zero value to draw the full screen cursor.
|
|
|
|
/// @note This is not the system mouse cursor.
|
2013-08-03 05:15:23 +00:00
|
|
|
int m_cursorShape;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
|
|
|
/// True shows the X and Y axis indicators.
|
2013-08-03 05:15:23 +00:00
|
|
|
bool m_showAxis;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
|
|
|
/// True shows the grid axis indicators.
|
2013-08-03 05:15:23 +00:00
|
|
|
bool m_showGridAxis;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
|
|
|
/// True shows the origin axis used to indicate the coordinate offset for
|
|
|
|
/// drill, gerber, and component position files.
|
2013-08-03 05:15:23 +00:00
|
|
|
bool m_showOriginAxis;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
|
|
|
/// True shows the drawing border and title block.
|
2013-08-03 05:15:23 +00:00
|
|
|
bool m_showBorderAndTitleBlock;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
|
|
|
/// Choice box to choose the grid size.
|
2013-08-03 05:15:23 +00:00
|
|
|
wxComboBox* m_gridSelectBox;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
|
|
|
/// Choice box to choose the zoom value.
|
2013-08-03 05:15:23 +00:00
|
|
|
wxComboBox* m_zoomSelectBox;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
|
|
|
/// The tool bar that contains the buttons for quick access to the application draw
|
|
|
|
/// tools. It typically is located on the right side of the main window.
|
2013-08-03 05:15:23 +00:00
|
|
|
wxAuiToolBar* m_drawToolBar;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
|
|
|
/// The options tool bar typcially located on the left edge of the main window.
|
2013-08-03 05:15:23 +00:00
|
|
|
wxAuiToolBar* m_optionsToolBar;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
2011-12-12 14:02:37 +00:00
|
|
|
/// Panel used to display information at the bottom of the main window.
|
2013-08-03 05:15:23 +00:00
|
|
|
EDA_MSG_PANEL* m_messagePanel;
|
2011-12-12 14:02:37 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
int m_MsgFrameHeight;
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
#ifdef USE_WX_OVERLAY
|
|
|
|
// MAC Uses overlay to workaround the wxINVERT and wxXOR miss
|
2013-08-03 05:15:23 +00:00
|
|
|
wxOverlay m_overlay;
|
2011-12-29 20:11:42 +00:00
|
|
|
#endif
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2012-01-05 08:07:11 +00:00
|
|
|
void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
/**
|
|
|
|
* Function unitsChangeRefresh
|
|
|
|
* is called when when the units setting has changed to allow for any derived classes
|
|
|
|
* to handle refreshing and controls that have units based measurements in them. The
|
|
|
|
* default version only updates the status bar. Don't forget to call the default
|
|
|
|
* in your derived class or the status bar will not get updated properly.
|
|
|
|
*/
|
2011-03-11 15:53:28 +00:00
|
|
|
virtual void unitsChangeRefresh();
|
2011-03-01 19:26:17 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2012-09-12 09:53:11 +00:00
|
|
|
EDA_DRAW_FRAME( wxWindow* aParent,
|
|
|
|
ID_DRAWFRAME_TYPE aFrameType,
|
|
|
|
const wxString& aTitle,
|
|
|
|
const wxPoint& aPos, const wxSize& aSize,
|
|
|
|
long aStyle,
|
|
|
|
const wxString & aFrameName );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
~EDA_DRAW_FRAME();
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0;
|
|
|
|
virtual const PAGE_INFO& GetPageSettings() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetPageSizeIU
|
|
|
|
* works off of GetPageSettings() to return the size of the paper page in
|
|
|
|
* the internal units of this particular view.
|
|
|
|
*/
|
|
|
|
virtual const wxSize GetPageSizeIU() const = 0;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
/**
|
|
|
|
* Function GetAuxOrigin
|
|
|
|
* returns the origin of the axis used for plotting and various exports.
|
|
|
|
*/
|
|
|
|
virtual const wxPoint& GetAuxOrigin() const = 0;
|
|
|
|
virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetGridOrigin
|
|
|
|
* returns the absolute coordinates of the origin of the snap grid. This is
|
|
|
|
* treated as a relative offset, and snapping will occur at multiples of the grid
|
|
|
|
* size relative to this point.
|
|
|
|
*/
|
|
|
|
virtual const wxPoint& GetGridOrigin() const = 0;
|
|
|
|
virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
|
|
|
|
|
|
|
|
//-----<BASE_SCREEN API moved here>------------------------------------------
|
|
|
|
/**
|
|
|
|
* Function GetCrossHairPosition
|
|
|
|
* return the current cross hair position in logical (drawing) coordinates.
|
|
|
|
* @param aInvertY Inverts the Y axis position.
|
|
|
|
* @return The cross hair position in drawing coordinates.
|
|
|
|
*/
|
|
|
|
wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCrossHairPosition
|
|
|
|
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
|
|
|
|
* @param aPosition The new cross hair position.
|
|
|
|
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
|
|
|
|
* \a aPosition.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCursorPosition
|
|
|
|
* returns the current cursor position in logical (drawing) units.
|
|
|
|
* @param aOnGrid Returns the nearest grid position at the current cursor position.
|
|
|
|
* @param aGridSize Custom grid size instead of the current grid size. Only valid
|
|
|
|
* if \a aOnGrid is true.
|
|
|
|
* @return The current cursor position.
|
|
|
|
*/
|
|
|
|
wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetNearestGridPosition
|
|
|
|
* returns the nearest \a aGridSize location to \a aPosition.
|
|
|
|
* @param aPosition The position to check.
|
|
|
|
* @param aGridSize The grid size to locate to if provided. If NULL then the current
|
|
|
|
* grid size is used.
|
|
|
|
* @return The nearst grid position.
|
|
|
|
*/
|
|
|
|
wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCursorScreenPosition
|
|
|
|
* returns the cross hair position in device (display) units.b
|
|
|
|
* @return The current cross hair position.
|
|
|
|
*/
|
|
|
|
wxPoint GetCrossHairScreenPosition() const;
|
|
|
|
|
|
|
|
void SetMousePosition( const wxPoint& aPosition );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function RefPos
|
|
|
|
* Return the reference position, coming from either the mouse position
|
|
|
|
* or the cursor position.
|
|
|
|
*
|
|
|
|
* @param useMouse If true, return mouse position, else cursor's.
|
|
|
|
*
|
|
|
|
* @return wxPoint - The reference point, either the mouse position or
|
|
|
|
* the cursor position.
|
|
|
|
*/
|
|
|
|
wxPoint RefPos( bool useMouse ) const;
|
|
|
|
|
|
|
|
const wxPoint& GetScrollCenterPosition() const;
|
|
|
|
void SetScrollCenterPosition( const wxPoint& aPoint );
|
|
|
|
|
|
|
|
//-----</BASE_SCREEN API moved here>-----------------------------------------
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
|
2012-01-09 08:35:06 +00:00
|
|
|
virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
|
|
|
|
virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
int GetCursorShape() const { return m_cursorShape; }
|
|
|
|
|
|
|
|
void SetCursorShape( int aCursorShape ) { m_cursorShape = aCursorShape; }
|
|
|
|
|
|
|
|
bool GetShowBorderAndTitleBlock() const { return m_showBorderAndTitleBlock; }
|
|
|
|
|
|
|
|
void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
EDA_DRAW_PANEL* GetCanvas() { return m_canvas; }
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2013-09-11 09:34:10 +00:00
|
|
|
virtual wxString GetScreenDesc() const;
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
/**
|
2012-01-05 08:07:11 +00:00
|
|
|
* Function GetScreen
|
|
|
|
* returns a pointer to a BASE_SCREEN or one of its
|
|
|
|
* derivatives. It is overloaded by derived classes to return
|
|
|
|
* SCH_SCREEN or PCB_SCREEN.
|
2008-04-17 16:25:29 +00:00
|
|
|
*/
|
2012-01-05 08:07:11 +00:00
|
|
|
virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
|
2009-04-07 11:53:58 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
void OnMenuOpen( wxMenuEvent& event );
|
|
|
|
void OnMouseEvent( wxMouseEvent& event );
|
2012-12-06 21:53:00 +00:00
|
|
|
|
2012-12-07 10:05:19 +00:00
|
|
|
/** function SkipNextLeftButtonReleaseEvent
|
|
|
|
* after calling this function, if the left mouse button
|
|
|
|
* is down, the next left mouse button release event will be ignored.
|
|
|
|
* It is is usefull for instance when closing a dialog on a mouse click,
|
|
|
|
* to skip the next mouse left button release event
|
|
|
|
* by the parent window, because the mouse button
|
|
|
|
* clicked on the dialog is often released in the parent frame,
|
|
|
|
* and therefore creates a left button released mouse event
|
|
|
|
* which can be unwanted in some cases
|
2012-12-06 21:53:00 +00:00
|
|
|
*/
|
2012-12-07 10:05:19 +00:00
|
|
|
void SkipNextLeftButtonReleaseEvent();
|
2012-12-06 21:53:00 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|
|
|
EDA_ITEM* aItem = NULL );
|
2009-04-07 11:53:58 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function AddMenuZoomAndGrid (virtual)
|
2010-02-14 18:14:33 +00:00
|
|
|
* Add standard zoom commands and submenu zoom and grid selection to a popup menu
|
|
|
|
* uses zoom hotkeys info base to add hotkeys info to menu commands
|
|
|
|
* @param aMasterMenu = the menu to populate.
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
|
2010-02-14 18:14:33 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
void EraseMsgBox();
|
|
|
|
void Process_PageSettings( wxCommandEvent& event );
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetLanguage
|
2010-02-26 15:39:10 +00:00
|
|
|
* called on a language menu selection
|
|
|
|
* when using a derived function, do not forget to call this one
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void SetLanguage( wxCommandEvent& event );
|
2010-02-26 15:39:10 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void ReCreateHToolbar() = 0;
|
|
|
|
virtual void ReCreateVToolbar() = 0;
|
|
|
|
virtual void ReCreateMenuBar();
|
|
|
|
virtual void ReCreateAuxiliaryToolbar();
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetToolID
|
2011-02-24 20:22:12 +00:00
|
|
|
* sets the tool command ID to \a aId and sets the cursor to \a aCursor. The
|
|
|
|
* command ID must be greater or equal ::ID_NO_TOOL_SELECTED. If the command
|
|
|
|
* ID is less than ::ID_NO_TOOL_SELECTED, the tool command ID is set to
|
|
|
|
* ::ID_NO_TOOL_SELECTED. On debug builds, an assertion will be raised when
|
|
|
|
* \a aId is invalid.
|
|
|
|
* @param aId New tool command ID if greater than or equal to ::ID_NO_TOOL_SELECTED.
|
|
|
|
If less than zero, the current tool command ID is retained.
|
|
|
|
* @param aCursor Sets the cursor shape if greater than or equal to zero.
|
|
|
|
* @param aToolMsg The tool message to set in the status bar.
|
2010-07-27 16:49:38 +00:00
|
|
|
*/
|
2011-02-24 20:22:12 +00:00
|
|
|
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
|
|
|
|
|
|
|
|
int GetToolId() const { return m_toolId; }
|
2009-04-07 11:53:58 +00:00
|
|
|
|
2010-08-24 17:26:51 +00:00
|
|
|
/* These 4 functions provide a basic way to show/hide grid
|
2010-02-01 21:23:27 +00:00
|
|
|
* and /get/set grid color.
|
2011-09-30 18:15:37 +00:00
|
|
|
* These parameters are saved in KiCad config for each main frame
|
2010-02-01 21:23:27 +00:00
|
|
|
*/
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function IsGridVisible() , virtual
|
2010-02-01 21:23:27 +00:00
|
|
|
* @return true if the grid must be shown
|
|
|
|
*/
|
2012-09-02 12:06:47 +00:00
|
|
|
virtual bool IsGridVisible() const
|
2010-02-01 21:23:27 +00:00
|
|
|
{
|
|
|
|
return m_DrawGrid;
|
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetGridVisibility() , virtual
|
2010-02-01 21:23:27 +00:00
|
|
|
* It may be overloaded by derived classes
|
|
|
|
* @param aVisible = true if the grid must be shown
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void SetGridVisibility( bool aVisible )
|
2010-02-01 21:23:27 +00:00
|
|
|
{
|
|
|
|
m_DrawGrid = aVisible;
|
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetGridColor() , virtual
|
2010-02-01 21:23:27 +00:00
|
|
|
* @return the color of the grid
|
|
|
|
*/
|
2012-09-02 12:06:47 +00:00
|
|
|
virtual EDA_COLOR_T GetGridColor() const
|
2010-02-01 21:23:27 +00:00
|
|
|
{
|
|
|
|
return m_GridColor;
|
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetGridColor() , virtual
|
2010-02-01 21:23:27 +00:00
|
|
|
* @param aColor = the new color of the grid
|
|
|
|
*/
|
2012-09-02 12:06:47 +00:00
|
|
|
virtual void SetGridColor( EDA_COLOR_T aColor )
|
2010-02-01 21:23:27 +00:00
|
|
|
{
|
|
|
|
m_GridColor = aColor;
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
/**
|
|
|
|
* Function GetGridPosition
|
|
|
|
* returns the nearest grid position to \a aPosition if a screen is defined and snap to
|
2011-09-01 12:54:34 +00:00
|
|
|
* grid is enabled. Otherwise, the original positions is returned.
|
2011-02-03 19:27:28 +00:00
|
|
|
* @see m_snapToGrid and m_BaseScreen members.
|
|
|
|
* @param aPosition The position to test.
|
|
|
|
* @return The wxPoint of the appropriate cursor position.
|
|
|
|
*/
|
2012-09-02 12:06:47 +00:00
|
|
|
wxPoint GetGridPosition( const wxPoint& aPosition ) const;
|
2010-02-01 21:23:27 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/**
|
|
|
|
* Command event handler for selecting grid sizes.
|
|
|
|
*
|
|
|
|
* All commands that set the grid size should eventually end up here.
|
|
|
|
* This is where the application setting is saved. If you override
|
|
|
|
* this method, make sure you call down to the base class.
|
|
|
|
*
|
|
|
|
* @param event - Command event passed by selecting grid size from the
|
|
|
|
* grid size combobox on the toolbar.
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void OnSelectGrid( wxCommandEvent& event );
|
2011-11-07 19:04:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Functions OnSelectZoom
|
|
|
|
* sets the zoom factor when selected by the zoom list box in the main tool bar.
|
|
|
|
* @note List position 0 is fit to page
|
|
|
|
* List position >= 1 = zoom (1 to zoom max)
|
|
|
|
* Last list position is custom zoom not in zoom list.
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void OnSelectZoom( wxCommandEvent& event );
|
2009-04-07 11:53:58 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
// Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
|
|
|
|
void OnToggleGridState( wxCommandEvent& aEvent );
|
|
|
|
void OnSelectUnits( wxCommandEvent& aEvent );
|
|
|
|
void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
|
|
|
|
|
|
|
|
// Update user interface event handlers shared by all applications derived from
|
|
|
|
// EDA_DRAW_FRAME.
|
|
|
|
void OnUpdateUndo( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateRedo( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateGrid( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateUnits( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
|
|
|
|
|
2011-02-01 15:46:25 +00:00
|
|
|
/**
|
2011-02-22 16:43:03 +00:00
|
|
|
* Function GeneralControl
|
2011-02-01 15:46:25 +00:00
|
|
|
* performs application specific control using \a aDC at \a aPosition in logical units.
|
|
|
|
* <p>
|
|
|
|
* Override this function for application specific control. This function gets
|
|
|
|
* called on every mouse and key event.
|
|
|
|
*</p>
|
|
|
|
* @param aDC A device context.
|
2011-02-02 19:01:21 +00:00
|
|
|
* @param aPosition The current cursor position in logical (drawing) units.
|
2011-09-01 12:54:34 +00:00
|
|
|
* @param aHotKey A key event used for application specific control if not zero.
|
2011-02-01 15:46:25 +00:00
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ) { }
|
2011-02-01 15:46:25 +00:00
|
|
|
|
2011-11-07 19:04:24 +00:00
|
|
|
/**
|
|
|
|
* Function OnSize
|
|
|
|
* recalculates the size of toolbars and display panel when the frame size changes.
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void OnSize( wxSizeEvent& event );
|
2011-11-07 19:04:24 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
void OnEraseBackground( wxEraseEvent& SizeEvent );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void OnZoom( wxCommandEvent& event );
|
2011-01-30 22:22:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function RedrawScreen
|
|
|
|
* redraws the entire screen area by updating the scroll bars and mouse pointer in
|
2011-02-11 20:48:13 +00:00
|
|
|
* order to have \a aCenterPoint at the center of the screen.
|
|
|
|
* @param aCenterPoint The position in logical units to center the scroll bars.
|
|
|
|
* @param aWarpPointer Moves the mouse cursor to \a aCenterPoint if true.
|
2010-09-23 14:04:08 +00:00
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
|
2010-11-12 15:17:10 +00:00
|
|
|
|
2013-02-02 19:10:48 +00:00
|
|
|
/**
|
|
|
|
* Function RedrawScreen2
|
|
|
|
* puts the crosshair back to the screen position it had before zooming
|
2013-03-07 17:12:59 +00:00
|
|
|
* @param posBefore screen position of the crosshair before zooming
|
2013-02-02 19:10:48 +00:00
|
|
|
*/
|
|
|
|
void RedrawScreen2( const wxPoint& posBefore );
|
|
|
|
|
2012-04-23 21:56:26 +00:00
|
|
|
/**
|
|
|
|
* Function Zoom_Automatique
|
|
|
|
* redraws the screen with best zoom level and the best centering
|
|
|
|
* that shows all the page or the board
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
void Zoom_Automatique( bool aWarpPointer );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/* Set the zoom level to show the area Rect */
|
2011-09-01 12:54:34 +00:00
|
|
|
void Window_Zoom( EDA_RECT& Rect );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2012-05-06 20:10:43 +00:00
|
|
|
/** Return the zoom level which displays the full page on screen */
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual double BestZoom() = 0;
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2011-11-07 19:04:24 +00:00
|
|
|
/**
|
|
|
|
* Function GetZoom
|
|
|
|
* @return The current zoom level.
|
|
|
|
*/
|
2012-03-26 21:45:05 +00:00
|
|
|
double GetZoom();
|
|
|
|
|
|
|
|
/**
|
2013-05-22 08:45:25 +00:00
|
|
|
* Function DrawWorkSheet
|
|
|
|
* Draws on screen the page layout with the frame and the basic inscriptions.
|
2012-03-26 21:45:05 +00:00
|
|
|
* @param aDC The device context.
|
2013-05-22 08:45:25 +00:00
|
|
|
* @param aScreen screen to draw
|
|
|
|
* @param aLineWidth The pen width to use to draw the layout.
|
|
|
|
* @param aScale The mils to Iu conversion factor.
|
|
|
|
* @param aFilename The filename to display in basic inscriptions.
|
|
|
|
*/
|
|
|
|
void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
|
|
|
|
double aScale, const wxString &aFilename );
|
2007-10-26 06:08:19 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
void DisplayToolMsg( const wxString& msg );
|
|
|
|
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
|
|
|
|
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
|
|
|
|
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
|
|
|
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
|
|
|
|
virtual void ToolOnRightClick( wxCommandEvent& event );
|
|
|
|
void AdjustScrollBars( const wxPoint& aCenterPosition );
|
2009-04-09 17:34:51 +00:00
|
|
|
|
2010-07-23 14:12:37 +00:00
|
|
|
/**
|
|
|
|
* Function OnActivate (virtual)
|
|
|
|
* is called when activating the frame.
|
|
|
|
* In derived classes with a overriding OnActivate function,
|
2011-01-21 19:30:59 +00:00
|
|
|
* do not forget to call this EDA_DRAW_FRAME::OnActivate( event ) basic function.
|
2009-12-22 20:08:56 +00:00
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void OnActivate( wxActivateEvent& event );
|
2010-07-23 14:12:37 +00:00
|
|
|
|
2009-04-09 17:34:51 +00:00
|
|
|
/**
|
|
|
|
* Function UpdateStatusBar
|
|
|
|
* updates the status bar information.
|
|
|
|
*
|
|
|
|
* The base method updates the absolute and relative coordinates and the
|
|
|
|
* zoom information. If you override this virtual method, make sure to call
|
|
|
|
* this subclassed method. The status bar can draw itself. This is not
|
|
|
|
* a drawing function per se, but rather updates lines of text held by
|
|
|
|
* the components within the status bar which is owned by the wxFrame.
|
|
|
|
* <p>
|
2009-11-23 20:18:47 +00:00
|
|
|
* On a MAC, be careful about calling this function when there is an
|
|
|
|
* existing wxDC in existence on a sibling window.
|
2009-04-09 17:34:51 +00:00
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void UpdateStatusBar();
|
2009-04-09 17:34:51 +00:00
|
|
|
|
2011-11-07 19:04:24 +00:00
|
|
|
/**
|
|
|
|
* Function DisplayUnitsMsg
|
|
|
|
* displays current unit pane on the status bar.
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
void DisplayUnitsMsg();
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/* Handlers for block commands */
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void InitBlockPasteInfos();
|
2012-03-26 23:47:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function HandleBlockBegin
|
|
|
|
* initializes the block command including the command type, initial position,
|
|
|
|
* and other variables.
|
|
|
|
*/
|
|
|
|
virtual bool HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition );
|
2010-11-13 11:02:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ReturnBlockCommand
|
2012-03-26 23:47:08 +00:00
|
|
|
* Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the
|
|
|
|
* keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging
|
|
|
|
* the mouse.
|
|
|
|
*
|
2010-11-13 11:02:24 +00:00
|
|
|
* @param aKey = the key modifiers (Alt, Shift ...)
|
|
|
|
* @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual int ReturnBlockCommand( int aKey );
|
2010-11-13 11:02:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function HandleBlockPlace( )
|
|
|
|
* Called after HandleBlockEnd, when a block command needs to be
|
|
|
|
* executed after the block is moved to its new place
|
|
|
|
* (bloc move, drag, copy .. )
|
|
|
|
* Parameters must be initialized in GetScreen()->m_BlockLocate
|
|
|
|
*/
|
|
|
|
virtual void HandleBlockPlace( wxDC* DC );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function HandleBlockEnd( )
|
|
|
|
* Handle the "end" of a block command,
|
|
|
|
* i.e. is called at the end of the definition of the area of a block.
|
|
|
|
* depending on the current block command, this command is executed
|
|
|
|
* or parameters are initialized to prepare a call to HandleBlockPlace
|
|
|
|
* in GetScreen()->m_BlockLocate
|
|
|
|
* @return false if no item selected, or command finished,
|
|
|
|
* true if some items found and HandleBlockPlace must be called later
|
|
|
|
*/
|
|
|
|
virtual bool HandleBlockEnd( wxDC* DC );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2011-11-08 16:37:25 +00:00
|
|
|
/**
|
|
|
|
* Function CopyToClipboard
|
|
|
|
* copies the current page or the current block to the clipboard.
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
void CopyToClipboard( wxCommandEvent& event );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
|
|
|
/* interprocess communication */
|
2011-09-01 12:54:34 +00:00
|
|
|
void OnSockRequest( wxSocketEvent& evt );
|
|
|
|
void OnSockRequestServer( wxSocketEvent& evt );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-11-07 19:04:24 +00:00
|
|
|
/**
|
|
|
|
* Function LoadSettings
|
|
|
|
* loads the draw frame specific configuration settings.
|
|
|
|
*
|
|
|
|
* Don't forget to call this base method from any derived classes or the
|
|
|
|
* settings common to the draw frame will not get loaded.
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void LoadSettings();
|
2011-11-07 19:04:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Funxtion SaveSettings
|
|
|
|
* saves the draw frame specific configuration settings.
|
|
|
|
*
|
|
|
|
* Don't forget to call this base method from any derived classes or the
|
|
|
|
* settings common to the draw frame will not get saved.
|
|
|
|
*/
|
2011-09-01 12:54:34 +00:00
|
|
|
virtual void SaveSettings();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/**
|
|
|
|
* Append a message to the message panel.
|
|
|
|
*
|
|
|
|
* This helper method checks to make sure the message panel exists in
|
|
|
|
* the frame and appends a message to it using the message panel
|
|
|
|
* AppendMessage() method.
|
|
|
|
*
|
|
|
|
* @param textUpper - The message upper text.
|
|
|
|
* @param textLower - The message lower text.
|
2011-09-30 18:15:37 +00:00
|
|
|
* @param color - A color ID from the KiCad color list (see colors.h).
|
2009-10-14 19:43:31 +00:00
|
|
|
* @param pad - Number of spaces to pad between messages (default = 4).
|
|
|
|
*/
|
|
|
|
void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
|
2012-09-02 12:06:47 +00:00
|
|
|
EDA_COLOR_T color, int pad = 6 );
|
2009-10-14 19:43:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear all messages from the message panel.
|
|
|
|
*/
|
|
|
|
void ClearMsgPanel( void );
|
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
/**
|
|
|
|
* Function SetMsgPanel
|
|
|
|
* clears the message panel and populates it with the contents of \a aList.
|
|
|
|
*
|
|
|
|
* @param aList is the list of #MSG_PANEL_ITEM objects to fill the message panel.
|
|
|
|
*/
|
|
|
|
void SetMsgPanel( const std::vector< MSG_PANEL_ITEM >& aList );
|
|
|
|
|
|
|
|
void SetMsgPanel( EDA_ITEM* aItem );
|
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
/**
|
|
|
|
* Function PrintPage
|
2010-03-18 20:35:29 +00:00
|
|
|
* used to print a page
|
2011-02-01 15:46:25 +00:00
|
|
|
* Print the page pointed by current screen, set by the calling print function
|
2010-03-18 20:35:29 +00:00
|
|
|
* @param aDC = wxDC given by the calling print function
|
|
|
|
* @param aPrintMask = not used here
|
|
|
|
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
|
|
|
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
|
|
|
|
*/
|
2013-03-30 17:24:04 +00:00
|
|
|
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
|
2010-03-18 20:35:29 +00:00
|
|
|
|
2011-03-11 15:53:28 +00:00
|
|
|
/**
|
|
|
|
* Function CoordinateToString
|
2012-04-27 14:15:11 +00:00
|
|
|
* is a helper to convert the \a integer coordinate \a aValue to a string in inches or mm
|
2011-03-11 15:53:28 +00:00
|
|
|
* according to the current user units setting.
|
|
|
|
* @param aValue The coordinate to convert.
|
|
|
|
* @param aConvertToMils Convert inch values to mils if true. This setting has no effect if
|
|
|
|
* the current user unit is millimeters.
|
|
|
|
* @return The converted string for display in user interface elements.
|
|
|
|
*/
|
2012-09-02 12:06:47 +00:00
|
|
|
wxString CoordinateToString( int aValue, bool aConvertToMils = false ) const;
|
2011-03-11 15:53:28 +00:00
|
|
|
|
2012-04-27 14:15:11 +00:00
|
|
|
/**
|
|
|
|
* Function LengthDoubleToString
|
|
|
|
* is a helper to convert the \a double value \a aValue to a string in inches or mm
|
|
|
|
* according to the current user units setting.
|
|
|
|
* @param aValue The coordinate to convert.
|
|
|
|
* @param aConvertToMils Convert inch values to mils if true. This setting has no effect if
|
|
|
|
* the current user unit is millimeters.
|
|
|
|
* @return The converted string for display in user interface elements.
|
|
|
|
*/
|
2012-09-02 12:06:47 +00:00
|
|
|
wxString LengthDoubleToString( double aValue, bool aConvertToMils = false ) const;
|
2012-04-27 14:15:11 +00:00
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
/**
|
|
|
|
* Function UseGalCanvas
|
|
|
|
* used to switch between standard and GAL-based canvas.
|
2013-11-15 09:28:31 +00:00
|
|
|
*
|
|
|
|
* @param aEnable True for GAL-based canvas, false for standard canvas.
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
*/
|
2013-09-10 11:57:28 +00:00
|
|
|
virtual void UseGalCanvas( bool aEnable );
|
2013-11-15 09:28:31 +00:00
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
/**
|
|
|
|
* Function IsNewCanvasActive
|
|
|
|
* is used to check which canvas (GAL-based or standard) is currently in use.
|
2013-11-15 09:28:31 +00:00
|
|
|
*
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
* @return True for GAL-based canvas, false for standard canvas.
|
|
|
|
*/
|
|
|
|
bool IsGalCanvasActive() { return m_galCanvasActive; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCalCanvas
|
|
|
|
* returns a pointer to GAL-based canvas of given EDA draw frame.
|
|
|
|
*
|
|
|
|
* @return Pointer to GAL-based canvas.
|
|
|
|
*/
|
|
|
|
EDA_DRAW_PANEL_GAL* GetGalCanvas() { return m_galCanvas; }
|
|
|
|
|
2010-10-04 12:58:07 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2009-01-07 15:59:49 +00:00
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-09-15 18:25:44 +00:00
|
|
|
/**
|
2011-09-30 18:15:37 +00:00
|
|
|
* Specialization of the wxAuiPaneInfo class for KiCad panels.
|
2011-09-15 18:25:44 +00:00
|
|
|
*
|
|
|
|
* Documentation for wxAui is poor at this time. The following notes spring from errors made in
|
2011-09-30 18:15:37 +00:00
|
|
|
* previous KiCad implementations:
|
2011-09-15 18:25:44 +00:00
|
|
|
*
|
|
|
|
* wxAuiPaneInfo.ToolbarPane() and .Defaults() are used to clear and then prepare the objects so
|
|
|
|
* only use them once at the beginning of configuration..
|
|
|
|
*
|
|
|
|
* Panels are organized in layers, from 0 (close to the center) and increasing outward. Note
|
|
|
|
* that for ToolbarPanes, layer 0 considered a special default value, and ToolbarPanes on
|
|
|
|
* layer 0 are pushed to layer 10 automatically. Use Layer 1 for the inner layer as a work-
|
|
|
|
* around.
|
|
|
|
*
|
|
|
|
* Each panel has rows, starting at 0. Each row has positions starting at 0. Each item in a panel
|
|
|
|
* can have it's row and position set.
|
|
|
|
*
|
2011-11-07 19:04:24 +00:00
|
|
|
* Eventually panels will be movable. Each initialization function sets up the panel for this,
|
2011-09-15 18:25:44 +00:00
|
|
|
* then after a //==// break has additional calls to anchor toolbars in a way that matches
|
|
|
|
* present functionality.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class EDA_PANEINFO : public wxAuiPaneInfo
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function HorizontalToolbarPane
|
2011-09-30 18:15:37 +00:00
|
|
|
* Change *this to a horizontal toolbar for KiCad.
|
2011-09-15 18:25:44 +00:00
|
|
|
*/
|
|
|
|
EDA_PANEINFO& HorizontalToolbarPane()
|
|
|
|
{
|
|
|
|
ToolbarPane();
|
|
|
|
CloseButton( false );
|
|
|
|
LeftDockable( false );
|
|
|
|
RightDockable( false );
|
2011-11-07 19:04:24 +00:00
|
|
|
//==================== Remove calls below here for movable toolbars //
|
2011-09-15 18:25:44 +00:00
|
|
|
Gripper( false );
|
|
|
|
DockFixed( true );
|
|
|
|
Movable( false );
|
|
|
|
Resizable( true );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function VerticalToolbarPane
|
2011-09-30 18:15:37 +00:00
|
|
|
* Change *this to a vertical toolbar for KiCad.
|
2011-09-15 18:25:44 +00:00
|
|
|
*/
|
|
|
|
EDA_PANEINFO& VerticalToolbarPane()
|
|
|
|
{
|
|
|
|
ToolbarPane();
|
|
|
|
CloseButton( false );
|
|
|
|
TopDockable( false );
|
|
|
|
BottomDockable( false );
|
2011-11-07 19:04:24 +00:00
|
|
|
//==================== Remove calls below here for movable toolbars //
|
2011-09-15 18:25:44 +00:00
|
|
|
Gripper( false );
|
|
|
|
DockFixed( true );
|
|
|
|
Movable( false );
|
|
|
|
Resizable( true );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function MessageToolbarPane
|
2011-09-30 18:15:37 +00:00
|
|
|
* Change *this to a message pane for KiCad.
|
2011-09-15 18:25:44 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
EDA_PANEINFO& MessageToolbarPane()
|
|
|
|
{
|
|
|
|
Gripper( false );
|
|
|
|
DockFixed( true );
|
|
|
|
Movable( false );
|
|
|
|
Floatable( false );
|
|
|
|
CloseButton( false );
|
|
|
|
CaptionVisible( false );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function LayersToolbarPane
|
2011-09-30 18:15:37 +00:00
|
|
|
* Change *this to a layers toolbar for KiCad.
|
2011-09-15 18:25:44 +00:00
|
|
|
*/
|
|
|
|
EDA_PANEINFO& LayersToolbarPane()
|
|
|
|
{
|
|
|
|
CloseButton( false );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function InfoToolbarPane
|
2011-09-30 18:15:37 +00:00
|
|
|
* Change *this to a information panel for for KiCad.
|
2011-09-15 18:25:44 +00:00
|
|
|
*
|
|
|
|
* Info panes are used for vertical display of information next to the center pane.
|
2011-09-30 18:15:37 +00:00
|
|
|
* Used in CvPcb and the library viewer primarily.
|
2011-09-15 18:25:44 +00:00
|
|
|
*/
|
|
|
|
EDA_PANEINFO& InfoToolbarPane()
|
|
|
|
{
|
|
|
|
Gripper( false );
|
|
|
|
CloseButton( false );
|
|
|
|
CaptionVisible( false );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2012-08-02 17:24:53 +00:00
|
|
|
/**
|
|
|
|
* Function ScriptingToolbarPane
|
|
|
|
* Change *this to a scripting toolbar for KiCad.
|
|
|
|
*/
|
|
|
|
EDA_PANEINFO& ScriptingToolbarPane()
|
|
|
|
{
|
|
|
|
CloseButton( false );
|
|
|
|
Floatable( true );
|
|
|
|
Resizable( true );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-15 18:25:44 +00:00
|
|
|
};
|
|
|
|
|
2012-01-09 17:24:01 +00:00
|
|
|
#endif // WXSTRUCT_H_
|