2013-07-19 18:27:22 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 CERN
|
2016-06-11 13:51:05 +00:00
|
|
|
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-08-13 17:51:22 +00:00
|
|
|
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2013-07-19 18:27:22 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 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
|
|
|
|
*/
|
|
|
|
|
2016-06-11 13:51:05 +00:00
|
|
|
/**
|
|
|
|
* @file pl_editor_frame.h
|
|
|
|
*/
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
#ifndef _PL_EDITOR_FRAME_H
|
|
|
|
#define _PL_EDITOR_FRAME_H
|
|
|
|
|
|
|
|
|
* 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
|
|
|
#include <config_params.h>
|
|
|
|
#include <draw_frame.h>
|
2013-07-19 18:27:22 +00:00
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <class_pl_editor_screen.h>
|
|
|
|
#include <class_pl_editor_layout.h>
|
|
|
|
|
|
|
|
class PROPERTIES_FRAME;
|
|
|
|
class DESIGN_TREE_FRAME;
|
|
|
|
class WORKSHEET_DATAITEM;
|
|
|
|
|
* 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
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
/**
|
|
|
|
* Class PL_EDITOR_FRAME
|
|
|
|
* is the main window used in the page layout editor.
|
|
|
|
*/
|
2015-03-02 17:29:18 +00:00
|
|
|
#define PL_EDITOR_FRAME_NAME wxT( "PlEditorFrame" )
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
class PL_EDITOR_FRAME : public EDA_DRAW_FRAME
|
|
|
|
{
|
|
|
|
PL_EDITOR_LAYOUT m_pageLayout;
|
* 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
|
|
|
|
|
|
|
int m_designTreeWidth; // the last width (in pixels) of m_treePagelayout
|
|
|
|
int m_propertiesFrameWidth; // the last width (in pixels) of m_propertiesPagelayout
|
|
|
|
|
|
|
|
wxChoice* m_originSelectBox; // Corner origin choice for coordinates
|
|
|
|
int m_originSelectChoice; // the last choice for m_originSelectBox
|
|
|
|
wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages
|
|
|
|
// usefull when there are some items which are
|
|
|
|
// only on page 1, not on page 1
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint m_grid_origin;
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
protected:
|
|
|
|
/// The last filename chosen to be proposed to the user
|
|
|
|
wxString m_lastFileName;
|
|
|
|
DESIGN_TREE_FRAME* m_treePagelayout;
|
|
|
|
PROPERTIES_FRAME* m_propertiesPagelayout;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// list of PARAM_CFG_xxx to read/write parameters saved in config
|
|
|
|
PARAM_CFG_ARRAY m_configSettings;
|
|
|
|
|
|
|
|
public:
|
* 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
|
|
|
PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
2013-07-19 18:27:22 +00:00
|
|
|
~PL_EDITOR_FRAME();
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override;
|
* 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 LoadPageLayoutDescrFile
|
|
|
|
* Loads a .kicad_wks page layout descr file
|
|
|
|
* @param aFullFileName = the filename.
|
|
|
|
*/
|
|
|
|
bool LoadPageLayoutDescrFile( const wxString& aFullFileName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SavePageLayoutDescrFile
|
|
|
|
* Save the current layout in a .kicad_wks page layout descr file
|
|
|
|
* @param aFullFileName = the filename.
|
|
|
|
*/
|
|
|
|
bool SavePageLayoutDescrFile( const wxString& aFullFileName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function InsertPageLayoutDescrFile
|
|
|
|
* Loads a .kicad_wks page layout descr file, and add items
|
|
|
|
* to the current layout list
|
|
|
|
* @param aFullFileName = the filename.
|
|
|
|
*/
|
|
|
|
bool InsertPageLayoutDescrFile( const wxString& aFullFileName );
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
|
|
|
|
|
|
|
// Virtual basic functions:
|
2016-09-24 18:53:15 +00:00
|
|
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
|
|
|
void ReCreateHToolbar() override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetPageSettings(const PAGE_INFO&) override;
|
2016-09-25 17:06:49 +00:00
|
|
|
const PAGE_INFO& GetPageSettings () const override;
|
|
|
|
const wxSize GetPageSizeIU() const override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2015-01-06 07:38:58 +00:00
|
|
|
/**
|
|
|
|
* Function GetZoomLevelIndicator
|
|
|
|
* returns a human readable value which can be displayed as zoom
|
|
|
|
* level indicator in dialogs.
|
|
|
|
* Virtual from the base class
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
const wxString GetZoomLevelIndicator() const override;
|
2015-01-06 07:38:58 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
PL_EDITOR_SCREEN* GetScreen() const override
|
2013-07-19 18:27:22 +00:00
|
|
|
{
|
2014-06-16 16:42:27 +00:00
|
|
|
return (PL_EDITOR_SCREEN*) EDA_DRAW_FRAME::GetScreen();
|
2013-07-19 18:27:22 +00:00
|
|
|
}
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
const wxPoint& GetAuxOrigin() const override
|
2013-07-19 18:27:22 +00:00
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
static wxPoint dummy; // ( 0,0 );
|
2013-07-19 18:27:22 +00:00
|
|
|
return dummy;
|
|
|
|
}
|
2016-09-25 17:06:49 +00:00
|
|
|
void SetAuxOrigin( const wxPoint& aPosition ) override {}
|
2013-08-03 05:15:23 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
const wxPoint& GetGridOrigin() const override
|
2013-08-03 05:15:23 +00:00
|
|
|
{
|
|
|
|
return m_grid_origin;
|
|
|
|
}
|
2016-09-25 17:06:49 +00:00
|
|
|
void SetGridOrigin( const wxPoint& aPoint ) override
|
2013-08-03 05:15:23 +00:00
|
|
|
{
|
|
|
|
m_grid_origin = aPoint;
|
|
|
|
}
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
const TITLE_BLOCK& GetTitleBlock() const override;
|
|
|
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
void UpdateStatusBar() override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2013-07-20 19:36:19 +00:00
|
|
|
/**
|
|
|
|
* Must be called to initialize parameters when a new page layout
|
|
|
|
* description is loaded
|
|
|
|
*/
|
|
|
|
void OnNewPageLayout();
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
/**
|
|
|
|
* creates or updates the right vertical toolbar.
|
|
|
|
* @note This is currently not used.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateVToolbar() override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create or update the left vertical toolbar (option toolbar
|
|
|
|
* @note This is currently not used.
|
|
|
|
*/
|
|
|
|
void ReCreateOptToolbar();
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateMenuBar() override;
|
|
|
|
void OnLeftClick( wxDC* aDC, const wxPoint& aMousePos ) override;
|
|
|
|
void OnLeftDClick( wxDC* aDC, const wxPoint& aMousePos ) override;
|
|
|
|
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) override;
|
|
|
|
double BestZoom() override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
// Events created by clicking on the design tree list:
|
|
|
|
void OnTreeSelection( wxTreeEvent& event );
|
|
|
|
void OnTreeMiddleClick( wxTreeEvent& event );
|
|
|
|
void OnTreeRightClick( wxTreeEvent& event );
|
|
|
|
|
|
|
|
const PL_EDITOR_LAYOUT& GetPageLayout() const { return m_pageLayout; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Page layout editor can show the title block using a page number
|
|
|
|
* 1 or an other number.
|
|
|
|
* This is because some items can be shown (or not) only on page 1
|
|
|
|
* (a feature which look like word processing option
|
|
|
|
* "page 1 differs from other pages".
|
|
|
|
* @return true if the page 1 is selected, and false if not
|
|
|
|
*/
|
|
|
|
bool GetPageNumberOption() const
|
|
|
|
{
|
|
|
|
return m_pageSelectBox->GetSelection() == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays the short filename (if exists) loaded file
|
|
|
|
* on the caption of the main window
|
|
|
|
*/
|
|
|
|
void UpdateTitleAndInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Populates the applicatios settings list.
|
|
|
|
* (list of parameters that must be saved in project parameters)
|
|
|
|
* Currently, only the settings that are needed at start up by the main window are
|
|
|
|
* defined here. There are other locally used settings scattered throughout the
|
|
|
|
* source code (mainly in dialogs). If you need to define a configuration
|
|
|
|
* setting that need to be loaded at run time, this is the place to define it.
|
|
|
|
*/
|
|
|
|
PARAM_CFG_ARRAY& GetConfigurationSettings( void );
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
void LoadSettings( wxConfigBase* aCfg ) override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
void SaveSettings( wxConfigBase* aCfg ) override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
void Process_Special_Functions( wxCommandEvent& event );
|
|
|
|
void OnSelectOptionToolbar( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* called when the user select one of the 4 page corner as corner
|
|
|
|
* reference (or the left top paper corner)
|
|
|
|
*/
|
|
|
|
void OnSelectCoordOriginCorner( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Toggle the display mode between the normal mode and the editor mode:
|
|
|
|
* In normal mode, title block texts are shown like they will be
|
|
|
|
* shown in other kicad applications: the format symbols in texts
|
|
|
|
* are replaced by the actual text.
|
|
|
|
* In editor mode, the format symbols in texts are not replaced
|
|
|
|
* by the actual text, and therefore format symbols are displayed.
|
|
|
|
*/
|
|
|
|
void OnSelectTitleBlockDisplayMode( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnUpdateTitleBlockDisplayNormalMode( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateTitleBlockDisplaySpecialMode( wxUpdateUIEvent& event );
|
2016-06-11 13:51:05 +00:00
|
|
|
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function BlockCommand
|
|
|
|
* returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
|
|
|
|
* the \a aKey (ALT, SHIFT ALT ..)
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual int BlockCommand( EDA_KEY key ) override;
|
2016-06-11 13:51:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function HandleBlockPlace
|
|
|
|
* handles the block place command.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void HandleBlockPlace( wxDC* DC ) override;
|
2016-06-11 13:51:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function HandleBlockEnd( )
|
|
|
|
* handles the end of a block command,
|
|
|
|
* It 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.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual bool HandleBlockEnd( wxDC* DC ) override;
|
2016-06-11 13:51:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Block_Move
|
|
|
|
* moves all items within the selected block.
|
|
|
|
* New location is determined by the current offset from the selected
|
|
|
|
* block's original location.
|
|
|
|
*
|
|
|
|
* @param DC A device context to draw on.
|
|
|
|
*/
|
|
|
|
void Block_Move( wxDC* DC );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function OnQuit
|
|
|
|
* called on request of application quit
|
|
|
|
*/
|
|
|
|
void OnQuit( wxCommandEvent& event );
|
|
|
|
|
2015-05-05 18:39:42 +00:00
|
|
|
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
2016-09-24 18:53:15 +00:00
|
|
|
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
|
2015-05-05 18:39:42 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
/**
|
|
|
|
* Function OnHotKey.
|
|
|
|
* ** Commands are case insensitive **
|
|
|
|
* Some commands are relatives to the item under the mouse cursor
|
|
|
|
* @param aDC = current device context
|
|
|
|
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
|
|
|
|
* @param aPosition The cursor position in logical (drawing) units.
|
|
|
|
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
void Process_Settings( wxCommandEvent& event );
|
|
|
|
void Process_Config( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ToPlotter
|
|
|
|
* Open a dialog frame to create plot and drill files
|
|
|
|
* relative to the current board
|
|
|
|
*/
|
|
|
|
void ToPlotter( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ToPrinter
|
|
|
|
* Open a dialog frame to print layers
|
|
|
|
*/
|
|
|
|
void ToPrinter( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void Files_io( wxCommandEvent& event );
|
2016-09-24 18:53:15 +00:00
|
|
|
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
/** Virtual function PrintPage
|
|
|
|
* used to print a page
|
|
|
|
* @param aDC = wxDC given by the calling print function
|
|
|
|
* @param aPrintMasklayer = a 32 bits mask: bit n = 1 -> layer n is printed
|
|
|
|
* @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)
|
|
|
|
*/
|
2014-06-24 16:17:18 +00:00
|
|
|
virtual void PrintPage( wxDC* aDC, LSET aPrintMasklayer,
|
2016-09-25 17:06:49 +00:00
|
|
|
bool aPrintMirrorMode, void * aData ) override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
void OnFileHistory( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the filename of the current layout descr file
|
|
|
|
* If this is the default (no loaded file) returns a emtpy name
|
|
|
|
* or a new design.
|
|
|
|
*/
|
|
|
|
const wxString& GetCurrFileName() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores the current layout descr file filename
|
|
|
|
*/
|
|
|
|
void SetCurrFileName( const wxString& aName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function RebuildDesignTree
|
|
|
|
* Re creates the design graphic tree list items,
|
|
|
|
* and ensures each item has an unique name
|
|
|
|
*/
|
|
|
|
void RebuildDesignTree();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function AddPageLayoutItem
|
|
|
|
* Add a new item to the page layout item list.
|
|
|
|
* @param aType = the type of item:
|
|
|
|
* WS_TEXT, WS_SEGMENT, WS_RECT, WS_POLYPOLYGON
|
|
|
|
* @param aIdx = the position in list to insert the new item.
|
|
|
|
* @return a reference to the new item
|
|
|
|
*/
|
|
|
|
WORKSHEET_DATAITEM * AddPageLayoutItem( int aType, int aIdx = -1 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetSelectedItem
|
|
|
|
* @return the current selected item, or NULL
|
|
|
|
*/
|
|
|
|
WORKSHEET_DATAITEM * GetSelectedItem();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Locate
|
|
|
|
* @return the page layout item found at position aPosition
|
|
|
|
* @param aPosition = the position (in user units) of the reference point
|
|
|
|
*/
|
|
|
|
WORKSHEET_DATAITEM *Locate( const wxPoint& aPosition );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize a move item command
|
2013-07-23 16:45:23 +00:00
|
|
|
* @param aItem is the item to move
|
2013-07-19 18:27:22 +00:00
|
|
|
*/
|
|
|
|
void MoveItem( WORKSHEET_DATAITEM* aItem );
|
|
|
|
|
2013-07-26 12:50:29 +00:00
|
|
|
/**
|
|
|
|
* Save in Undo list the layout, and place an item being moved.
|
|
|
|
* @param aItem is the item moved
|
|
|
|
*/
|
|
|
|
void PlaceItem( WORKSHEET_DATAITEM* aItem );
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
/**
|
|
|
|
* Must be called after a change
|
|
|
|
* in order to set the "modify" flag of the current screen
|
|
|
|
*/
|
|
|
|
void OnModify()
|
|
|
|
{
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
}
|
|
|
|
|
2013-07-26 12:50:29 +00:00
|
|
|
/**
|
|
|
|
* Save a copy of the description (in a S expr string)
|
|
|
|
* for Undo/redo commands
|
|
|
|
*/
|
|
|
|
void SaveCopyInUndoList();
|
|
|
|
|
|
|
|
/** Redo the last edition:
|
|
|
|
* - Place the current edited layout in undo list
|
|
|
|
* - Get the previous version of the current edited layput
|
|
|
|
*/
|
|
|
|
void GetLayoutFromRedoList( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/** Undo the last edition:
|
|
|
|
* - Place the current layout in Redo list
|
|
|
|
* - Get the previous version of the current edited layout
|
|
|
|
*/
|
|
|
|
void GetLayoutFromUndoList( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the last command in Undo List.
|
|
|
|
* Used to clean the Undo stack after a cancel command
|
|
|
|
*/
|
|
|
|
void RemoveLastCommandInUndoList();
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _PL_EDITOR_FRAME_H */
|