kicad-source/kicad/menubar.cpp

349 lines
12 KiB
C++
Raw Normal View History

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 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
*/
2008-11-02 22:53:38 +00:00
/**
* @file kicad/menubar.cpp
* @brief (Re)Create the project manager menubar for KiCad
2008-11-02 22:53:38 +00:00
*/
#include <fctsys.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-19 19:42:08 -05:00
#include <pgm_kicad.h>
#include <kicad.h>
#include <menus_helpers.h>
#include <tree_project_frame.h>
2010-02-14 14:59:43 +00:00
/* Menubar and toolbar event table */
2011-04-17 15:54:17 +02:00
BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
2011-04-13 15:30:27 -04:00
/* Window events */
2011-04-17 15:54:17 +02:00
EVT_SIZE( KICAD_MANAGER_FRAME::OnSize )
EVT_CLOSE( KICAD_MANAGER_FRAME::OnCloseWindow )
2011-04-13 15:30:27 -04:00
/* Toolbar events */
2011-04-17 15:54:17 +02:00
EVT_TOOL( ID_NEW_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject )
EVT_TOOL( ID_NEW_PROJECT_FROM_TEMPLATE, KICAD_MANAGER_FRAME::OnLoadProject )
2011-04-17 15:54:17 +02:00
EVT_TOOL( ID_LOAD_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject )
EVT_TOOL( ID_SAVE_PROJECT, KICAD_MANAGER_FRAME::OnSaveProject )
EVT_TOOL( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles )
2011-04-13 15:30:27 -04:00
/* Menu events */
2011-04-17 15:54:17 +02:00
EVT_MENU( ID_SAVE_PROJECT, KICAD_MANAGER_FRAME::OnSaveProject )
EVT_MENU( wxID_EXIT, KICAD_MANAGER_FRAME::OnExit )
EVT_MENU( ID_TO_EDITOR, KICAD_MANAGER_FRAME::OnOpenTextEditor )
EVT_MENU( ID_BROWSE_AN_SELECT_FILE, KICAD_MANAGER_FRAME::OnOpenFileInTextEditor )
2011-04-13 15:30:27 -04:00
EVT_MENU( ID_SELECT_PREFERED_EDITOR, EDA_BASE_FRAME::OnSelectPreferredEditor )
2011-04-17 15:54:17 +02:00
EVT_MENU( ID_SELECT_DEFAULT_PDF_BROWSER, KICAD_MANAGER_FRAME::OnSelectDefaultPdfBrowser )
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER, KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser )
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER_NAME,
KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser )
2011-04-17 15:54:17 +02:00
EVT_MENU( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles )
EVT_MENU( ID_READ_ZIP_ARCHIVE, KICAD_MANAGER_FRAME::OnUnarchiveFiles )
EVT_MENU( ID_PROJECT_TREE_REFRESH, KICAD_MANAGER_FRAME::OnRefresh )
EVT_MENU( wxID_HELP, KICAD_MANAGER_FRAME::GetKicadHelp )
EVT_MENU( wxID_INDEX, KICAD_MANAGER_FRAME::GetKicadHelp )
2011-04-17 15:54:17 +02:00
EVT_MENU( wxID_ABOUT, KICAD_MANAGER_FRAME::GetKicadAbout )
2011-04-13 15:30:27 -04:00
/* Range menu events */
2011-04-17 15:54:17 +02:00
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, KICAD_MANAGER_FRAME::SetLanguage )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, KICAD_MANAGER_FRAME::OnFileHistory )
2011-04-13 15:30:27 -04:00
// Special functions
#ifdef KICAD_USE_FILES_WATCHER
EVT_MENU( ID_INIT_WATCHED_PATHS, KICAD_MANAGER_FRAME::OnChangeWatchedPaths )
#endif
2011-04-13 15:30:27 -04:00
/* Button events */
2011-04-17 15:54:17 +02:00
EVT_BUTTON( ID_TO_PCB, KICAD_MANAGER_FRAME::OnRunPcbNew )
EVT_BUTTON( ID_TO_CVPCB, KICAD_MANAGER_FRAME::OnRunCvpcb )
EVT_BUTTON( ID_TO_EESCHEMA, KICAD_MANAGER_FRAME::OnRunEeschema )
EVT_BUTTON( ID_TO_GERBVIEW, KICAD_MANAGER_FRAME::OnRunGerbview )
EVT_BUTTON( ID_TO_BITMAP_CONVERTER, KICAD_MANAGER_FRAME::OnRunBitmapConverter )
EVT_BUTTON( ID_TO_PCB_CALCULATOR, KICAD_MANAGER_FRAME::OnRunPcbCalculator )
EVT_BUTTON( ID_TO_PL_EDITOR, KICAD_MANAGER_FRAME::OnRunPageLayoutEditor )
2011-04-13 15:30:27 -04:00
2011-04-17 15:54:17 +02:00
EVT_UPDATE_UI( ID_SELECT_DEFAULT_PDF_BROWSER, KICAD_MANAGER_FRAME::OnUpdateDefaultPdfBrowser )
EVT_UPDATE_UI( ID_SELECT_PREFERED_PDF_BROWSER,
KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser )
2008-11-02 22:53:38 +00:00
END_EVENT_TABLE()
2008-11-02 22:53:38 +00:00
/**
2010-02-14 14:59:43 +00:00
* @brief (Re)Create the menubar
2008-11-02 22:53:38 +00:00
*/
2011-04-17 15:54:17 +02:00
void KICAD_MANAGER_FRAME::ReCreateMenuBar()
2008-11-02 22:53:38 +00:00
{
static wxMenu* openRecentMenu; // Open Recent submenu,
// static to remember this menu
// Create and try to get the current menubar
wxMenuBar* menuBar = GetMenuBar();
2008-11-02 22:53:38 +00:00
if( !menuBar )
menuBar = new wxMenuBar();
2008-11-02 22:53:38 +00:00
// Delete all existing menus so they can be rebuilt.
// This allows language changes of the menu text on the fly.
menuBar->Freeze();
// Before deleting, remove the menus managed by m_fileHistory
// (the file history will be updated when adding/removing files in history)
if( openRecentMenu )
* 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-19 19:42:08 -05:00
Pgm().GetFileHistory().RemoveMenu( openRecentMenu );
// Delete all existing menus
while( menuBar->GetMenuCount() )
delete menuBar->Remove( 0 );
// Recreate all menus:
// Menu File:
wxMenu* fileMenu = new wxMenu;
2010-12-18 09:59:04 +01:00
// Open
AddMenuItem( fileMenu,
ID_LOAD_PROJECT,
_( "&Open Project\tCtrl+O" ),
_( "Open existing project" ),
KiBitmap( open_project_xpm ) );
// File history
2011-04-17 15:54:17 +02:00
openRecentMenu = new wxMenu();
* 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-19 19:42:08 -05:00
Pgm().GetFileHistory().UseMenu( openRecentMenu );
Pgm().GetFileHistory().AddFilesToMenu( );
AddMenuItem( fileMenu, openRecentMenu,
wxID_ANY,
_( "Open &Recent" ),
_( "Open recent schematic project" ),
KiBitmap( open_project_xpm ) );
2010-02-14 14:59:43 +00:00
2010-12-18 09:59:04 +01:00
// New
wxMenu* newMenu = new wxMenu();
AddMenuItem( newMenu, ID_NEW_PROJECT,
_( "&Blank Project\tCtrl+N" ),
_( "Create blank project" ),
KiBitmap( new_project_xpm ) );
AddMenuItem( newMenu, ID_NEW_PROJECT_FROM_TEMPLATE,
_( "Project from &Template\tCtrl+T" ),
_( "Create new project from template" ),
KiBitmap( new_project_with_template_xpm ) );
AddMenuItem( fileMenu, newMenu,
wxID_ANY,
_( "New" ),
_( "Create new project" ),
KiBitmap( new_project_xpm ) );
// Save
AddMenuItem( fileMenu,
ID_SAVE_PROJECT,
_( "&Save\tCtrl+S" ),
_( "Save current project" ),
KiBitmap( save_project_xpm ) );
2010-12-18 09:59:04 +01:00
// Archive
fileMenu->AppendSeparator();
AddMenuItem( fileMenu,
ID_SAVE_AND_ZIP_FILES,
_( "&Archive" ),
_( "Archive project files in zip archive" ),
KiBitmap( zip_xpm ) );
2010-12-18 09:59:04 +01:00
// Unarchive
AddMenuItem( fileMenu,
ID_READ_ZIP_ARCHIVE,
_( "&Unarchive" ),
_( "Unarchive project files from zip file" ),
KiBitmap( unzip_xpm ) );
// Separator
fileMenu->AppendSeparator();
// Quit
AddMenuItem( fileMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit KiCad" ),
KiBitmap( exit_xpm ) );
// Menu Browse:
wxMenu* browseMenu = new wxMenu();
2010-12-18 09:59:04 +01:00
// Text editor
AddMenuItem( browseMenu,
ID_TO_EDITOR,
_( "Open Text E&ditor" ),
_( "Launch preferred text editor" ),
KiBitmap( editor_xpm ) );
// View file
AddMenuItem( browseMenu,
ID_BROWSE_AN_SELECT_FILE,
_( "&Open Local File" ),
_( "Edit local file" ),
KiBitmap( browse_files_xpm ) );
2010-02-14 14:59:43 +00:00
// Menu Preferences:
wxMenu* preferencesMenu = new wxMenu;
2010-12-18 09:59:04 +01:00
// Text editor
AddMenuItem( preferencesMenu,
ID_SELECT_PREFERED_EDITOR,
_( "&Set Text Editor" ),
_( "Set your preferred text editor" ),
KiBitmap( editor_xpm ) );
2010-12-18 09:59:04 +01:00
// PDF Viewer submenu:System browser or user defined checkbox
wxMenu* SubMenuPdfBrowserChoice = new wxMenu;
2010-12-18 09:59:04 +01:00
// Default
2014-02-07 17:09:15 +01:00
AddMenuItem( SubMenuPdfBrowserChoice, ID_SELECT_DEFAULT_PDF_BROWSER,
_( "System &Default PDF Viewer" ),
_( "Use system default PDF viewer" ),
2014-02-07 17:09:15 +01:00
KiBitmap( datasheet_xpm ),
wxITEM_CHECK );
SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER,
* 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-19 19:42:08 -05:00
Pgm().UseSystemPdfBrowser() );
// Favourite
2014-02-07 17:09:15 +01:00
AddMenuItem( SubMenuPdfBrowserChoice, ID_SELECT_PREFERED_PDF_BROWSER,
_( "&Favourite PDF Viewer" ),
_( "Use favourite PDF viewer" ),
KiBitmap( datasheet_xpm ),
2014-02-07 17:09:15 +01:00
wxITEM_CHECK );
SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER,
* 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-19 19:42:08 -05:00
!Pgm().UseSystemPdfBrowser() );
2014-02-07 17:09:15 +01:00
SubMenuPdfBrowserChoice->AppendSeparator();
// Append PDF Viewer submenu to preferences
AddMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_( "Set &PDF Viewer" ),
_( "Set favourite PDF viewer" ),
KiBitmap( datasheet_xpm ) );
// PDF viewer submenu
2014-02-07 17:09:15 +01:00
AddMenuItem( preferencesMenu, SubMenuPdfBrowserChoice, -1,
_( "&PDF Viewer" ),
_( "PDF viewer preferences" ),
KiBitmap( datasheet_xpm ) );
// Language submenu
preferencesMenu->AppendSeparator();
* 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-19 19:42:08 -05:00
Pgm().AddMenuLanguageList( preferencesMenu );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
2011-04-13 15:30:27 -04:00
// Version info
AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
2014-02-07 17:09:15 +01:00
AddMenuItem( helpMenu, wxID_HELP,
_( "KiCad Manual" ),
_( "Open KiCad user manual" ),
KiBitmap( online_help_xpm ) );
2014-02-07 17:09:15 +01:00
AddMenuItem( helpMenu, wxID_INDEX,
_( "&Getting Started in KiCad" ),
_( "Open \"Getting Started in KiCad\" guide for beginners" ),
KiBitmap( help_xpm ) );
// Separator
2010-01-18 19:33:45 +00:00
helpMenu->AppendSeparator();
// About
2014-02-07 17:09:15 +01:00
AddMenuItem( helpMenu, wxID_ABOUT,
_( "&About KiCad" ),
_( "About KiCad project manager" ),
KiBitmap( info_xpm ) );
2010-12-18 09:59:04 +01:00
// Create the menubar and append all submenus
menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( browseMenu, _( "&Browse" ) );
menuBar->Append( preferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw();
// Associate the menu bar with the frame, if no previous menubar
if( GetMenuBar() == NULL )
SetMenuBar( menuBar );
else
menuBar->Refresh();
}
2008-11-02 22:53:38 +00:00
/**
2010-02-14 14:59:43 +00:00
* @brief (Re)Create the horizontal toolbar
2008-11-02 22:53:38 +00:00
*/
2011-04-17 15:54:17 +02:00
void KICAD_MANAGER_FRAME::RecreateBaseHToolbar()
{
// Check if toolbar is not already created
if( m_mainToolBar != NULL )
return;
2008-11-02 22:53:38 +00:00
// Allocate memory for m_mainToolBar
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
// New
m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString,
KiBitmap( new_project_xpm ),
_( "Create new project" ) );
m_mainToolBar->AddTool( ID_NEW_PROJECT_FROM_TEMPLATE, wxEmptyString,
KiBitmap( new_project_with_template_xpm ),
_( "Create new project from template" ) );
// Load
m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString,
KiBitmap( open_project_xpm ),
_( "Open existing project" ) );
2008-11-02 22:53:38 +00:00
// Save
m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
KiBitmap( save_project_xpm ),
_( "Save current project" ) );
2008-11-02 22:53:38 +00:00
// Separator
m_mainToolBar->AddSeparator();
2008-11-02 22:53:38 +00:00
// Archive
m_mainToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString,
KiBitmap( zip_xpm ),
_( "Archive all project files" ) );
2008-11-02 22:53:38 +00:00
// Separator
m_mainToolBar->AddSeparator();
2008-11-02 22:53:38 +00:00
// Refresh project tree
m_mainToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString,
KiBitmap( reload_xpm ),
_( "Refresh project tree" ) );
2008-11-02 22:53:38 +00:00
// Create m_mainToolBar
m_mainToolBar->Realize();
2008-11-02 22:53:38 +00:00
}