kicad/include/wxstruct.h

536 lines
18 KiB
C
Raw Normal View History

/*
* 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
*/
/**
* @file wxstruct.h
* @brief Base window classes and related definitions.
*/
#ifndef WXSTRUCT_H_
#define WXSTRUCT_H_
#include <vector>
#include <wx/socket.h>
#include <wx/log.h>
#include <wx/config.h>
#include <wx/wxhtml.h>
#include <wx/laywin.h>
2009-11-02 22:24:55 +00:00
#include <wx/aui/aui.h>
#include <wx/docview.h>
2009-11-02 22:24:55 +00:00
#include <colors.h>
#include <fctsys.h>
#include <common.h>
#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
// Option for main frames
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
// Readability helper definitions for creating backup files.
#define CREATE_BACKUP_FILE true
#define NO_BACKUP_FILE false
class EDA_ITEM;
class EDA_RECT;
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;
class EDA_MSG_PANEL;
class BASE_SCREEN;
class PARAM_CFG_BASE;
class PAGE_INFO;
class PLOTTER;
class TITLE_BLOCK;
class MSG_PANEL_ITEM;
2007-08-04 04:42:49 +00:00
enum id_librarytype {
LIBRARY_TYPE_EESCHEMA,
LIBRARY_TYPE_PCBNEW,
LIBRARY_TYPE_DOC,
LIBRARY_TYPE_SYMBOL
};
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +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,
KICAD_MAIN_FRAME_TYPE,
PL_EDITOR_FRAME_TYPE
};
/// Custom trace mask to enable and disable auto save tracing.
extern const wxChar traceAutoSave[];
/**
* Class EDA_BASE_FRAME
* is the base frame for deriving all KiCad main window classes. This class is not
* intended to be used directly. It provides support for automatic calls to
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* a SaveSettings() function. SaveSettings() for a derived class can choose
* to do nothing, or rely on basic SaveSettings() support in this base class to do
* most of the work by calling it from the derived class's SaveSettings().
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* <p>
* This class is not a KIWAY_PLAYER because KICAD_MANAGER_FRAME is derived from it
* and that class is not a player.
*/
class EDA_BASE_FRAME : public wxFrame
{
/**
* Function windowClosing
* (with its unexpected name so it does not collide with the real OnWindowClose()
* function provided in derived classes) is called just before a window
* closing, and is used to call a derivation specific
* SaveSettings(). SaveSettings() is called for all derived wxFrames in this
* base class overload. (Calling it from a destructor is deprecated since the
* wxFrame's position is not available in the destructor on linux.) In other words,
* you should not need to call call SaveSettings() anywhere, except in this
* one function found only in this class.
*/
void windowClosing( wxCloseEvent& event );
protected:
ID_DRAWFRAME_TYPE m_Ident; ///< Id Type (pcb, schematic, library..)
2011-04-13 19:30:27 +00:00
wxPoint m_FramePos;
wxSize m_FrameSize;
wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar
2011-04-13 19:30:27 +00:00
bool m_FrameIsActive;
wxString m_FrameName; ///< name used for writing and reading setup
///< It is "SchematicFrame", "PcbFrame" ....
wxString m_AboutTitle; ///< Name of program displayed in About.
2011-04-13 19:30:27 +00:00
wxAuiManager m_auimgr;
2009-11-02 22:24:55 +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;
wxString m_perspective; ///< wxAuiManager perspective.
/**
* Function onAutoSaveTimer
* handles the auto save timer event.
*/
void onAutoSaveTimer( wxTimerEvent& aEvent );
/**
* Function autoSaveRequired
* returns the auto save status of the application. Override this function if
* your derived frame supports automatic file saving.
*/
virtual bool isAutoSaveRequired() const { return false; }
/**
* 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();
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
/**
* Function config
* returns the wxConfigBase used in SaveSettings(), and is overloaded in
* KICAD_MANAGER_FRAME
*/
virtual wxConfigBase* config();
/**
* Function sys_search
* returns a SEARCH_STACK pertaining to entire program, and is overloaded in
* KICAD_MANAGER_FRAME
*/
virtual const SEARCH_STACK& sys_search();
virtual wxString help_name();
public:
EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString& aFrameName );
~EDA_BASE_FRAME();
/**
* 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.
*/
bool ProcessEvent( wxEvent& aEvent ); // overload wxFrame::ProcessEvent()
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; }
bool IsType( ID_DRAWFRAME_TYPE aType ) const { return m_Ident == aType; }
void GetKicadHelp( wxCommandEvent& event );
void GetKicadAbout( wxCommandEvent& event );
/**
* Function CopyVersionInfoToClipboard
* copies the version information to the clipboard for bug reporting purposes.
*/
void CopyVersionInfoToClipboard( wxCommandEvent& event );
void PrintMsg( const wxString& text );
/**
* Append the copy version information to clipboard help menu entry to \a aMenu.
*
* @param aMenu - The menu to append.
*/
void AddHelpVersionInfoMenuEntry( wxMenu* aMenu );
/**
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* Function LoadSettings
* loads common frame parameters from a configuration file.
*
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* Don't forget to call the base method or your frames won't
* remember their positions and sizes.
*/
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
virtual void LoadSettings( wxConfigBase* aCfg );
/**
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* Function SaveSettings
* saves common frame parameters to a configuration data file.
*
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* Don't forget to call the base class's SaveSettings() from
* your derived SaveSettings() otherwise the frames won't remember their
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* positions and sizes.
*/
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
virtual void SaveSettings( wxConfigBase* aCfg );
/**
* 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 ) {};
/**
* Function OnSelectPreferredEditor
* Open a dialog to select the editor that will used in KiCad
* to edit or display files (reports ... )
* The full filename editor is saved in configuration (global params)
*/
virtual void OnSelectPreferredEditor( wxCommandEvent& event );
// Read/Save and Import/export hotkeys config
2010-11-12 15:17:10 +00:00
/**
* Function ReadHotkeyConfig
* Read configuration data and fill the current hotkey list with hotkeys
* @param aDescList = current hotkey list descr. to initialize.
*/
int ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList );
2010-11-12 15:17:10 +00:00
/**
* Function WriteHotkeyConfig
* Store the current hotkey list
* It is stored using the standard wxConfig mechanism or a file.
*
* @param aDescList = pointer to the current hotkey list.
* @param aFullFileName = a wxString pointer to a full file name.
* if NULL, use the standard wxConfig mechanism (default)
* the output format is: shortcut "key" "function"
* lines starting with # are comments
*/
int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL);
2010-11-12 15:17:10 +00:00
/**
* Function ReadHotkeyConfigFile
* Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list
* with hotkeys
* @param aFilename = file name to read.
* @param aDescList = current hotkey list descr. to initialize.
*/
int ReadHotkeyConfigFile( const wxString& aFilename, struct EDA_HOTKEY_CONFIG* aDescList );
2010-11-12 15:17:10 +00:00
/**
* Function ImportHotkeyConfigFromFile
* Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialize.
*/
void ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDescList );
2010-11-12 15:17:10 +00:00
/**
* Function ExportHotkeyConfigToFile
* Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialize.
*/
void ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescList );
2010-11-12 15:17:10 +00:00
/**
* Function SetLanguage
* called on a language menu selection
* when using a derived function, do not forget to call this one
*/
virtual void SetLanguage( wxCommandEvent& event );
/**
* 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
* @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
* @return a wxString containing the selected filename
*/
wxString GetFileFromHistory( int cmdId, const wxString& type,
wxFileHistory* aFileHistory = NULL );
/**
* 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
* @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.
*/
void UpdateFileHistory( const wxString& FullFileName, wxFileHistory * aFileHistory = NULL );
2011-04-17 13:54:17 +00:00
/**
* Function ReCreateMenuBar
* Creates recreates the menu bar.
* Needed when the language is changed
*/
virtual void ReCreateMenuBar();
/**
* Function IsWritable
* checks if \a aFileName can be written.
* <p>
* 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.
* </p>
*
* @note The file name path must be set or an assertion will be raised on debug
* builds and return false on release builds.
* @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 );
/**
* 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 );
/**
* 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 );
};
/**
* Specialization of the wxAuiPaneInfo class for KiCad panels.
*
* Documentation for wxAui is poor at this time. The following notes spring from errors made in
* previous KiCad implementations:
*
* 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.
*
* Eventually panels will be movable. Each initialization function sets up the panel for this,
* 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
* Change *this to a horizontal toolbar for KiCad.
*/
EDA_PANEINFO& HorizontalToolbarPane()
{
ToolbarPane();
CloseButton( false );
LeftDockable( false );
RightDockable( false );
//==================== Remove calls below here for movable toolbars //
Gripper( false );
DockFixed( true );
Movable( false );
Resizable( true );
return *this;
}
/**
* Function VerticalToolbarPane
* Change *this to a vertical toolbar for KiCad.
*/
EDA_PANEINFO& VerticalToolbarPane()
{
ToolbarPane();
CloseButton( false );
TopDockable( false );
BottomDockable( false );
//==================== Remove calls below here for movable toolbars //
Gripper( false );
DockFixed( true );
Movable( false );
Resizable( true );
return *this;
}
/**
* Function MessageToolbarPane
* Change *this to a message pane for KiCad.
*
*/
EDA_PANEINFO& MessageToolbarPane()
{
Gripper( false );
DockFixed( true );
Movable( false );
Floatable( false );
CloseButton( false );
CaptionVisible( false );
return *this;
}
/**
* Function LayersToolbarPane
* Change *this to a layers toolbar for KiCad.
*/
EDA_PANEINFO& LayersToolbarPane()
{
CloseButton( false );
return *this;
}
/**
* Function InfoToolbarPane
* Change *this to a information panel for for KiCad.
*
* Info panes are used for vertical display of information next to the center pane.
* Used in CvPcb and the library viewer primarily.
*/
EDA_PANEINFO& InfoToolbarPane()
{
Gripper( false );
CloseButton( false );
CaptionVisible( false );
return *this;
}
/**
* Function ScriptingToolbarPane
* Change *this to a scripting toolbar for KiCad.
*/
EDA_PANEINFO& ScriptingToolbarPane()
{
CloseButton( false );
Floatable( true );
Resizable( true );
return *this;
}
};
#endif // WXSTRUCT_H_