2011-10-15 13:25:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-07-26 10:03:24 +00:00
|
|
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2018-01-08 04:05:03 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-15 13:25:57 +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
|
|
|
|
*/
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2018-01-30 10:49:51 +00:00
|
|
|
* @file sch_edit_frame.cpp
|
2011-10-07 14:41:30 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +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-20 00:42:08 +00:00
|
|
|
#include <kiface_i.h>
|
|
|
|
#include <pgm_base.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gr_basic.h>
|
2018-08-03 12:18:26 +00:00
|
|
|
#include <sch_draw_panel.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gestfich.h>
|
2012-03-08 17:47:23 +00:00
|
|
|
#include <confirm.h>
|
2012-04-16 01:25:26 +00:00
|
|
|
#include <base_units.h>
|
2013-01-12 17:32:24 +00:00
|
|
|
#include <msgpanel.h>
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
#include <html_messagebox.h>
|
2017-02-09 09:36:38 +00:00
|
|
|
#include <executable_names.h>
|
2018-08-11 16:04:46 +00:00
|
|
|
#include <eda_dockart.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <general.h>
|
|
|
|
#include <eeschema_id.h>
|
|
|
|
#include <netlist.h>
|
|
|
|
#include <lib_pin.h>
|
|
|
|
#include <class_library.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <sch_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <sch_component.h>
|
2017-10-06 18:07:43 +00:00
|
|
|
#include <symbol_lib_table.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_helpers.h>
|
2018-02-17 11:43:56 +00:00
|
|
|
#include <reporter.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <lib_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <viewlib_frame.h>
|
|
|
|
#include <hotkeys.h>
|
|
|
|
#include <eeschema_config.h>
|
|
|
|
#include <sch_sheet.h>
|
2015-02-21 08:11:58 +00:00
|
|
|
#include <sch_sheet_path.h>
|
2016-08-29 17:47:08 +00:00
|
|
|
#include "sim/sim_plot_frame.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2013-06-10 12:24:01 +00:00
|
|
|
#include <invoke_sch_dialog.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialogs/dialog_schematic_find.h>
|
2017-10-22 00:48:25 +00:00
|
|
|
#include <dialog_symbol_remap.h>
|
2018-08-03 12:18:26 +00:00
|
|
|
#include <view/view.h>
|
|
|
|
#include <tool/tool_manager.h>
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2011-11-10 17:01:33 +00:00
|
|
|
#include <wx/display.h>
|
2012-01-14 11:52:46 +00:00
|
|
|
#include <build_version.h>
|
2012-02-16 20:03:33 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2012-01-14 11:52:46 +00:00
|
|
|
|
2016-01-29 10:24:39 +00:00
|
|
|
#include <netlist_exporter_kicad.h>
|
|
|
|
#include <kiway.h>
|
2018-05-11 09:32:54 +00:00
|
|
|
#include <dialogs/dialog_fields_editor_global.h>
|
2011-11-10 17:01:33 +00:00
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
#include <sch_view.h>
|
|
|
|
#include <sch_painter.h>
|
|
|
|
|
|
|
|
#include <gal/graphics_abstraction_layer.h>
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
// non-member so it can be moved easily, and kept REALLY private.
|
|
|
|
// Do NOT Clear() in here.
|
|
|
|
static void add_search_paths( SEARCH_STACK* aDst, const SEARCH_STACK& aSrc, int aIndex )
|
|
|
|
{
|
|
|
|
for( unsigned i=0; i<aSrc.GetCount(); ++i )
|
|
|
|
aDst->AddPaths( aSrc[i], aIndex );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// non-member so it can be moved easily, and kept REALLY private.
|
|
|
|
// Do NOT Clear() in here.
|
|
|
|
static void add_search_paths( SEARCH_STACK* aDst, wxConfigBase* aCfg, int aIndex )
|
|
|
|
{
|
|
|
|
for( int i=1; true; ++i )
|
|
|
|
{
|
|
|
|
wxString key = wxString::Format( wxT( "LibraryPath%d" ), i );
|
|
|
|
wxString upath = aCfg->Read( key, wxEmptyString );
|
|
|
|
|
|
|
|
if( !upath )
|
|
|
|
break;
|
|
|
|
|
|
|
|
aDst->AddPaths( upath, aIndex );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----<SCH "data on demand" functions>-------------------------------------------
|
|
|
|
|
|
|
|
SEARCH_STACK* PROJECT::SchSearchS()
|
|
|
|
{
|
|
|
|
SEARCH_STACK* ss = (SEARCH_STACK*) GetElem( PROJECT::ELEM_SCH_SEARCH_STACK );
|
|
|
|
|
|
|
|
wxASSERT( !ss || dynamic_cast<SEARCH_STACK*>( GetElem( PROJECT::ELEM_SCH_SEARCH_STACK ) ) );
|
|
|
|
|
|
|
|
if( !ss )
|
|
|
|
{
|
|
|
|
ss = new SEARCH_STACK();
|
|
|
|
|
|
|
|
// Make PROJECT the new SEARCH_STACK owner.
|
|
|
|
SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, ss );
|
|
|
|
|
|
|
|
// to the empty SEARCH_STACK for SchSearchS(), add project dir as first
|
|
|
|
ss->AddPaths( m_project_name.GetPath() );
|
|
|
|
|
|
|
|
// next add the paths found in *.pro, variable "LibDir"
|
|
|
|
wxString libDir;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
PART_LIBS::LibNamesAndPaths( this, false, &libDir );
|
|
|
|
}
|
2016-10-10 15:04:48 +00:00
|
|
|
catch( const IO_ERROR& DBG( ioe ) )
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
{
|
2016-09-14 22:36:45 +00:00
|
|
|
DBG(printf( "%s: %s\n", __func__, TO_UTF8( ioe.What() ) );)
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !!libDir )
|
|
|
|
{
|
|
|
|
wxArrayString paths;
|
|
|
|
|
|
|
|
SEARCH_STACK::Split( &paths, libDir );
|
|
|
|
|
|
|
|
for( unsigned i =0; i<paths.GetCount(); ++i )
|
|
|
|
{
|
|
|
|
wxString path = AbsolutePath( paths[i] );
|
|
|
|
|
|
|
|
ss->AddPaths( path ); // at the end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// append all paths from aSList
|
|
|
|
add_search_paths( ss, Kiface().KifaceSearch(), -1 );
|
|
|
|
|
|
|
|
// addLibrarySearchPaths( SEARCH_STACK* aSP, wxConfigBase* aCfg )
|
|
|
|
// This is undocumented, but somebody wanted to store !schematic!
|
|
|
|
// library search paths in the .kicad_common file?
|
|
|
|
add_search_paths( ss, Pgm().CommonSettings(), -1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
return ss;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PART_LIBS* PROJECT::SchLibs()
|
|
|
|
{
|
2018-09-15 11:05:54 +00:00
|
|
|
PART_LIBS* libs = (PART_LIBS*) GetElem( PROJECT::ELEM_SCH_PART_LIBS );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2018-09-15 11:05:54 +00:00
|
|
|
wxASSERT( !libs || libs->Type() == PART_LIBS_T );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
if( !libs )
|
|
|
|
{
|
|
|
|
libs = new PART_LIBS();
|
|
|
|
|
|
|
|
// Make PROJECT the new PART_LIBS owner.
|
|
|
|
SetElem( PROJECT::ELEM_SCH_PART_LIBS, libs );
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
libs->LoadAllLibraries( this );
|
|
|
|
}
|
|
|
|
catch( const PARSE_ERROR& pe )
|
|
|
|
{
|
|
|
|
wxString lib_list = UTF8( pe.inputLine );
|
2018-09-13 20:05:24 +00:00
|
|
|
wxWindow* parent = Pgm().App().GetTopWindow();
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
// parent of this dialog cannot be NULL since that breaks the Kiway() chain.
|
|
|
|
HTML_MESSAGE_BOX dlg( parent, _( "Not Found" ) );
|
|
|
|
|
|
|
|
dlg.MessageSet( _( "The following libraries were not found:" ) );
|
|
|
|
|
|
|
|
dlg.ListSet( lib_list );
|
|
|
|
|
|
|
|
dlg.Layout();
|
|
|
|
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
catch( const IO_ERROR& ioe )
|
|
|
|
{
|
2018-09-13 20:05:24 +00:00
|
|
|
wxWindow* parent = Pgm().App().GetTopWindow();
|
|
|
|
|
|
|
|
DisplayError( parent, ioe.What() );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return libs;
|
|
|
|
}
|
|
|
|
|
2015-06-07 18:18:45 +00:00
|
|
|
/*
|
|
|
|
NETLIST_OBJECT_LIST* PROJECT::Netlist()
|
|
|
|
{
|
|
|
|
NETLIST_OBJECT_LIST* netlist = (NETLIST_OBJECT_LIST*) GetElem( PROJECT::ELEM_SCH_NETLIST );
|
|
|
|
|
|
|
|
wxASSERT( !libs || dynamic_cast<NETLIST_OBJECT_LIST*>( netlist ) );
|
|
|
|
|
|
|
|
if( !netlist )
|
|
|
|
{
|
|
|
|
netlist = new NETLIST_OBJECT_LIST();
|
|
|
|
|
|
|
|
// Make PROJECT the new NETLIST_OBJECT_LIST owner.
|
|
|
|
SetElem( PROJECT::ELEM_SCH_NETLIST, netlist );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
//-----</SCH "data on demand" functions>------------------------------------------
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|
|
|
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, EDA_DRAW_FRAME::OnSockRequestServer )
|
|
|
|
EVT_SOCKET( ID_EDA_SOCKET_EVENT, EDA_DRAW_FRAME::OnSockRequest )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_CLOSE( SCH_EDIT_FRAME::OnCloseWindow )
|
|
|
|
EVT_SIZE( SCH_EDIT_FRAME::OnSize )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_MENU( ID_NEW_PROJECT, SCH_EDIT_FRAME::OnNewProject )
|
|
|
|
EVT_MENU( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
2018-08-20 13:46:38 +00:00
|
|
|
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, SCH_EDIT_FRAME::OnLoadFile )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
2013-01-24 17:46:37 +00:00
|
|
|
EVT_MENU( ID_APPEND_PROJECT, SCH_EDIT_FRAME::OnAppendProject )
|
2017-09-20 14:20:38 +00:00
|
|
|
EVT_MENU( ID_IMPORT_NON_KICAD_SCH, SCH_EDIT_FRAME::OnImportProject )
|
2013-01-24 17:46:37 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_TOOL( ID_NEW_PROJECT, SCH_EDIT_FRAME::OnNewProject )
|
|
|
|
EVT_TOOL( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
EVT_MENU( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnSaveProject )
|
2012-09-28 17:47:41 +00:00
|
|
|
EVT_MENU( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::Save_File )
|
|
|
|
EVT_MENU( ID_SAVE_ONE_SHEET_UNDER_NEW_NAME, SCH_EDIT_FRAME::Save_File )
|
2012-09-17 17:42:27 +00:00
|
|
|
EVT_MENU( ID_GEN_PLOT_SCHEMATIC, SCH_EDIT_FRAME::PlotSchematic )
|
2011-01-21 19:30:59 +00:00
|
|
|
EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, EDA_DRAW_FRAME::CopyToClipboard )
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
|
2017-07-24 19:58:55 +00:00
|
|
|
EVT_MENU( ID_POPUP_SCH_SELECT_ON_PCB, SCH_EDIT_FRAME::SelectAllFromSheet )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
2017-07-03 15:37:18 +00:00
|
|
|
EVT_MENU( ID_POPUP_SCH_DUPLICATE_ITEM, SCH_EDIT_FRAME::OnCopySchematicItemRequest )
|
2010-01-09 08:50:30 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config )
|
|
|
|
EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config )
|
2018-05-14 17:34:18 +00:00
|
|
|
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, SCH_EDIT_FRAME::Process_Config )
|
2010-03-20 19:57:59 +00:00
|
|
|
|
2014-08-25 16:31:32 +00:00
|
|
|
EVT_TOOL( wxID_PREFERENCES, SCH_EDIT_FRAME::OnPreferencesOptions )
|
2017-12-24 17:57:57 +00:00
|
|
|
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, SCH_EDIT_FRAME::OnConfigurePaths )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
EVT_TOOL( ID_RUN_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor )
|
2011-05-28 18:51:32 +00:00
|
|
|
EVT_TOOL( ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP, SCH_EDIT_FRAME::OnOpenLibraryEditor )
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
|
2015-06-22 15:38:54 +00:00
|
|
|
EVT_TOOL( ID_RESCUE_CACHED, SCH_EDIT_FRAME::OnRescueProject )
|
2017-10-22 00:48:25 +00:00
|
|
|
EVT_MENU( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnRemapSymbols )
|
2017-11-20 16:14:25 +00:00
|
|
|
EVT_MENU( ID_EDIT_COMPONENTS_TO_SYMBOLS_LIB_ID, SCH_EDIT_FRAME::OnEditComponentSymbolsId )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
EVT_TOOL( ID_RUN_PCB, SCH_EDIT_FRAME::OnOpenPcbnew )
|
|
|
|
EVT_TOOL( ID_RUN_PCB_MODULE_EDITOR, SCH_EDIT_FRAME::OnOpenPcbModuleEditor )
|
2014-05-05 17:28:40 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
EVT_TOOL( ID_RUN_CVPCB, SCH_EDIT_FRAME::OnOpenCvpcb )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
EVT_TOOL( ID_SHEET_SET, EDA_DRAW_FRAME::Process_PageSettings )
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_TOOL( ID_HIERARCHY, SCH_EDIT_FRAME::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_CUT, SCH_EDIT_FRAME::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_COPY, SCH_EDIT_FRAME::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_PASTE, SCH_EDIT_FRAME::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_UNDO, SCH_EDIT_FRAME::GetSchematicFromUndoList )
|
|
|
|
EVT_TOOL( wxID_REDO, SCH_EDIT_FRAME::GetSchematicFromRedoList )
|
|
|
|
EVT_TOOL( ID_GET_ANNOTATE, SCH_EDIT_FRAME::OnAnnotate )
|
|
|
|
EVT_TOOL( wxID_PRINT, SCH_EDIT_FRAME::OnPrint )
|
|
|
|
EVT_TOOL( ID_GET_ERC, SCH_EDIT_FRAME::OnErc )
|
|
|
|
EVT_TOOL( ID_GET_NETLIST, SCH_EDIT_FRAME::OnCreateNetlist )
|
2016-01-29 10:24:39 +00:00
|
|
|
EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, SCH_EDIT_FRAME::OnUpdatePCB )
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
|
2017-04-02 12:09:01 +00:00
|
|
|
EVT_TOOL( ID_OPEN_CMP_TABLE, SCH_EDIT_FRAME::OnLaunchBomManager )
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
|
2011-12-01 16:49:28 +00:00
|
|
|
EVT_TOOL( wxID_REPLACE, SCH_EDIT_FRAME::OnFindItems )
|
2013-02-02 17:39:59 +00:00
|
|
|
EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile )
|
2017-08-25 13:27:06 +00:00
|
|
|
EVT_TOOL( ID_UPDATE_FIELDS, SCH_EDIT_FRAME::OnUpdateFields )
|
2011-10-28 20:30:50 +00:00
|
|
|
EVT_TOOL( ID_SCH_MOVE_ITEM, SCH_EDIT_FRAME::OnMoveItem )
|
2015-12-13 16:56:47 +00:00
|
|
|
EVT_TOOL( ID_AUTOPLACE_FIELDS, SCH_EDIT_FRAME::OnAutoplaceFields )
|
2011-04-17 13:54:17 +00:00
|
|
|
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
|
2011-08-04 18:03:26 +00:00
|
|
|
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
|
2016-09-24 00:44:52 +00:00
|
|
|
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
|
2011-05-16 19:32:57 +00:00
|
|
|
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
|
2018-09-04 00:00:17 +00:00
|
|
|
EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings )
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Tools and buttons for vertical toolbar.
|
2011-02-24 20:22:12 +00:00
|
|
|
EVT_TOOL( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnSelectTool )
|
2016-11-16 10:07:02 +00:00
|
|
|
EVT_TOOL( ID_HIGHLIGHT, SCH_EDIT_FRAME::OnSelectTool )
|
2018-04-01 18:58:27 +00:00
|
|
|
EVT_MENU( ID_MENU_ZOOM_SELECTION, SCH_EDIT_FRAME::OnSelectTool )
|
2016-06-08 11:19:53 +00:00
|
|
|
EVT_TOOL( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnSelectTool )
|
2011-02-21 13:54:29 +00:00
|
|
|
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
|
|
|
SCH_EDIT_FRAME::OnSelectTool )
|
2018-04-01 18:58:27 +00:00
|
|
|
EVT_TOOL_RANGE( ID_SCHEMATIC_PLACE_MENU_START, ID_SCHEMATIC_PLACE_MENU_END,
|
|
|
|
SCH_EDIT_FRAME::OnSelectTool )
|
2016-08-11 12:41:16 +00:00
|
|
|
|
2016-08-11 12:42:13 +00:00
|
|
|
#ifdef KICAD_SPICE
|
|
|
|
EVT_TOOL( ID_SIM_SHOW, SCH_EDIT_FRAME::OnSimulate )
|
2016-08-11 12:41:45 +00:00
|
|
|
EVT_TOOL( ID_SIM_PROBE, SCH_EDIT_FRAME::OnSelectTool )
|
|
|
|
EVT_TOOL( ID_SIM_TUNE, SCH_EDIT_FRAME::OnSelectTool )
|
2016-08-11 12:42:13 +00:00
|
|
|
#endif /* KICAD_SPICE */
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2011-02-05 19:22:58 +00:00
|
|
|
EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
|
2011-10-27 17:51:22 +00:00
|
|
|
EVT_MENU( ID_SCH_DRAG_ITEM, SCH_EDIT_FRAME::OnDragItem )
|
2011-10-28 20:30:50 +00:00
|
|
|
EVT_MENU_RANGE( ID_SCH_ROTATE_CLOCKWISE, ID_SCH_ROTATE_COUNTERCLOCKWISE,
|
|
|
|
SCH_EDIT_FRAME::OnRotate )
|
2011-10-27 13:34:28 +00:00
|
|
|
EVT_MENU_RANGE( ID_SCH_EDIT_ITEM, ID_SCH_EDIT_COMPONENT_FOOTPRINT,
|
|
|
|
SCH_EDIT_FRAME::OnEditItem )
|
2011-10-28 20:30:50 +00:00
|
|
|
EVT_MENU_RANGE( ID_SCH_MIRROR_X, ID_SCH_ORIENT_NORMAL, SCH_EDIT_FRAME::OnOrient )
|
|
|
|
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
|
|
|
SCH_EDIT_FRAME::Process_Special_Functions )
|
2018-09-24 14:31:35 +00:00
|
|
|
EVT_MENU( ID_POPUP_SCH_DISPLAYDOC_CMP, SCH_EDIT_FRAME::OnEditItem )
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2018-09-10 13:37:28 +00:00
|
|
|
EVT_MENU( ID_MENU_CANVAS_CAIRO, SCH_EDIT_FRAME::OnSwitchCanvas )
|
|
|
|
EVT_MENU( ID_MENU_CANVAS_OPENGL, SCH_EDIT_FRAME::OnSwitchCanvas )
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Tools and buttons options toolbar
|
2011-10-26 20:46:04 +00:00
|
|
|
EVT_TOOL( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnSelectOptionToolbar )
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnSelectOptionToolbar )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_EDIT_FRAME::Process_Special_Functions )
|
2015-04-07 11:52:29 +00:00
|
|
|
EVT_MENU_RANGE( ID_POPUP_SCH_SELECT_UNIT1, ID_POPUP_SCH_SELECT_UNIT_CMP_MAX,
|
2011-03-02 00:46:08 +00:00
|
|
|
SCH_EDIT_FRAME::OnSelectUnit )
|
2011-03-03 01:58:12 +00:00
|
|
|
EVT_MENU_RANGE( ID_POPUP_SCH_CHANGE_TYPE_TEXT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
|
|
|
|
SCH_EDIT_FRAME::OnConvertTextType )
|
2011-03-02 00:46:08 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
// Multple item selection context menu commands.
|
2011-04-27 19:44:32 +00:00
|
|
|
EVT_MENU_RANGE( ID_SELECT_ITEM_START, ID_SELECT_ITEM_END, SCH_EDIT_FRAME::OnSelectItem )
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
/* Handle user interface update events. */
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
|
2011-02-24 20:22:12 +00:00
|
|
|
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnUpdateSelectTool )
|
2016-11-16 10:07:02 +00:00
|
|
|
EVT_UPDATE_UI( ID_HIGHLIGHT, SCH_EDIT_FRAME::OnUpdateSelectTool )
|
2016-06-08 11:19:53 +00:00
|
|
|
EVT_UPDATE_UI( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnUpdateSelectTool )
|
2011-02-21 13:54:29 +00:00
|
|
|
EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
|
|
|
SCH_EDIT_FRAME::OnUpdateSelectTool )
|
2015-06-11 17:27:36 +00:00
|
|
|
EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave )
|
|
|
|
EVT_UPDATE_UI( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::OnUpdateSaveSheet )
|
|
|
|
EVT_UPDATE_UI( ID_POPUP_SCH_LEAVE_SHEET, SCH_EDIT_FRAME::OnUpdateHierarchySheet )
|
2017-10-22 00:48:25 +00:00
|
|
|
EVT_UPDATE_UI( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnUpdateRemapSymbols )
|
2018-09-10 13:37:28 +00:00
|
|
|
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, SCH_EDIT_FRAME::OnUpdateSwitchCanvas )
|
|
|
|
EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, SCH_EDIT_FRAME::OnUpdateSwitchCanvas )
|
2010-03-16 18:22:59 +00:00
|
|
|
|
|
|
|
/* Search dialog events. */
|
2010-12-08 20:12:46 +00:00
|
|
|
EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
|
|
|
|
EVT_FIND_DRC_MARKER( wxID_ANY, SCH_EDIT_FRAME::OnFindDrcMarker )
|
|
|
|
EVT_FIND( wxID_ANY, SCH_EDIT_FRAME::OnFindSchematicItem )
|
2011-11-17 01:06:08 +00:00
|
|
|
EVT_FIND_REPLACE( wxID_ANY, SCH_EDIT_FRAME::OnFindReplace )
|
2011-12-01 16:49:28 +00:00
|
|
|
EVT_FIND_REPLACE_ALL( wxID_ANY, SCH_EDIT_FRAME::OnFindReplace )
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
* 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
|
|
|
SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
2014-04-19 18:47:20 +00:00
|
|
|
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ),
|
* 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
|
|
|
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
|
2013-08-05 21:02:41 +00:00
|
|
|
m_item_to_repeat( 0 )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-12-14 20:03:15 +00:00
|
|
|
m_showAxis = false; // true to show axis
|
|
|
|
m_showBorderAndTitleBlock = true; // true to show sheet references
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
m_CurrentSheet = new SCH_SHEET_PATH;
|
2010-02-24 15:33:03 +00:00
|
|
|
m_DefaultSchematicFileName = NAMELESS_PROJECT;
|
|
|
|
m_DefaultSchematicFileName += wxT( ".sch" );
|
2011-12-09 16:37:11 +00:00
|
|
|
m_showAllPins = false;
|
2010-02-02 15:01:09 +00:00
|
|
|
m_printMonochrome = true;
|
2010-11-29 15:05:01 +00:00
|
|
|
m_printSheetReference = true;
|
2014-06-20 11:13:04 +00:00
|
|
|
SetShowPageLimits( true );
|
2015-05-19 16:39:05 +00:00
|
|
|
m_hotkeysDescrList = g_Schematic_Hokeys_Descr;
|
2010-03-16 18:22:59 +00:00
|
|
|
m_dlgFindReplace = NULL;
|
|
|
|
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
|
2018-07-05 15:50:21 +00:00
|
|
|
m_findReplaceStatus = new wxString( wxEmptyString );
|
2011-04-05 14:46:51 +00:00
|
|
|
m_undoItem = NULL;
|
2011-10-15 13:25:57 +00:00
|
|
|
m_hasAutoSave = true;
|
2018-12-10 12:12:39 +00:00
|
|
|
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
|
2013-06-07 20:56:55 +00:00
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
m_toolManager = new TOOL_MANAGER;
|
|
|
|
|
2012-09-28 17:47:41 +00:00
|
|
|
SetForceHVLines( true );
|
2016-09-16 18:36:19 +00:00
|
|
|
SetSpiceAjustPassiveValues( false );
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
// Give an icon
|
2011-09-09 19:30:59 +00:00
|
|
|
wxIcon icon;
|
|
|
|
icon.CopyFromBitmap( KiBitmap( icon_eeschema_xpm ) );
|
|
|
|
SetIcon( icon );
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2013-11-05 21:14:09 +00:00
|
|
|
// Initialize grid id to the default value (50 mils):
|
2018-09-04 18:22:26 +00:00
|
|
|
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
2013-11-05 21:14:09 +00:00
|
|
|
|
* 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
|
|
|
LoadSettings( config() );
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2015-08-06 00:10:52 +00:00
|
|
|
CreateScreens();
|
|
|
|
|
2018-09-04 17:02:25 +00:00
|
|
|
SetPresetGrid( m_LastGridSizeId );
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
if( m_canvas )
|
|
|
|
m_canvas->SetEnableBlockCommands( true );
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
ReCreateMenuBar();
|
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateVToolbar();
|
|
|
|
ReCreateOptToolbar();
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2012-03-26 21:45:05 +00:00
|
|
|
// Initialize common print setup dialog settings.
|
|
|
|
m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
|
|
|
|
m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
|
|
|
|
m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
|
|
|
|
m_pageSetupData.GetPrintData().SetNoCopies( 1 );
|
2010-02-02 15:01:09 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
m_auimgr.SetManagedWindow( this );
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
|
|
|
|
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
|
|
|
|
m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) );
|
2018-08-03 12:18:26 +00:00
|
|
|
m_auimgr.AddPane( m_canvas->GetWindow(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
|
|
|
m_auimgr.Update();
|
2011-04-12 12:41:13 +00:00
|
|
|
|
2015-03-06 17:46:04 +00:00
|
|
|
Zoom_Automatique( false );
|
2016-03-31 06:28:16 +00:00
|
|
|
|
2018-09-07 16:13:20 +00:00
|
|
|
if( GetGalCanvas() )
|
|
|
|
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
|
|
|
|
|
2016-03-31 06:28:16 +00:00
|
|
|
// Net list generator
|
|
|
|
DefaultExecFlags();
|
2017-08-12 12:09:39 +00:00
|
|
|
|
2017-08-12 16:10:47 +00:00
|
|
|
Bind( wxEVT_COMMAND_MENU_SELECTED, &SCH_EDIT_FRAME::OnEditSymbolLibTable, this,
|
2017-08-12 12:09:39 +00:00
|
|
|
ID_EDIT_SYM_LIB_TABLE );
|
2019-03-15 12:09:04 +00:00
|
|
|
|
|
|
|
UpdateTitle();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-08-12 16:10:47 +00:00
|
|
|
Unbind( wxEVT_COMMAND_MENU_SELECTED, &SCH_EDIT_FRAME::OnEditSymbolLibTable, this,
|
2017-08-12 12:09:39 +00:00
|
|
|
ID_EDIT_SYM_LIB_TABLE );
|
|
|
|
|
2013-08-05 21:02:41 +00:00
|
|
|
delete m_item_to_repeat; // we own the cloned object, see this->SetRepeatItem()
|
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
SetScreen( NULL );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2013-08-05 21:02:41 +00:00
|
|
|
delete m_CurrentSheet; // a SCH_SHEET_PATH, on the heap.
|
2013-04-28 14:28:13 +00:00
|
|
|
delete m_undoItem;
|
|
|
|
delete m_findReplaceData;
|
2018-07-05 15:50:21 +00:00
|
|
|
delete m_findReplaceStatus;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
delete g_RootSheet;
|
2013-04-28 14:28:13 +00:00
|
|
|
g_RootSheet = NULL;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2014-09-07 19:01:26 +00:00
|
|
|
|
2013-08-05 21:02:41 +00:00
|
|
|
void SCH_EDIT_FRAME::SetRepeatItem( SCH_ITEM* aItem )
|
|
|
|
{
|
|
|
|
// we cannot store a pointer to an item in the display list here since
|
|
|
|
// that item may be deleted, such as part of a line concatonation or other.
|
|
|
|
// So simply always keep a copy of the object which is to be repeated.
|
|
|
|
|
|
|
|
SCH_ITEM* old = m_item_to_repeat;
|
|
|
|
SCH_ITEM* cur = aItem;
|
|
|
|
|
|
|
|
if( cur != old )
|
|
|
|
{
|
|
|
|
if( cur )
|
2013-08-06 22:59:07 +00:00
|
|
|
{
|
2013-08-05 21:02:41 +00:00
|
|
|
aItem = (SCH_ITEM*) cur->Clone();
|
|
|
|
|
2013-08-06 22:59:07 +00:00
|
|
|
// Clone() preserves the flags, we want 'em cleared.
|
|
|
|
aItem->ClearFlags();
|
|
|
|
}
|
|
|
|
|
2013-08-05 21:02:41 +00:00
|
|
|
m_item_to_repeat = aItem;
|
|
|
|
|
|
|
|
delete old;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::SetSheetNumberAndCount()
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2015-11-03 19:44:05 +00:00
|
|
|
SCH_SCREEN* screen;
|
2010-10-26 20:25:48 +00:00
|
|
|
SCH_SCREENS s_list;
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/* Set the sheet count, and the sheet number (1 for root sheet)
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
int sheet_count = g_RootSheet->CountSheets();
|
|
|
|
int SheetNumber = 1;
|
|
|
|
wxString current_sheetpath = m_CurrentSheet->Path();
|
2016-03-06 21:22:01 +00:00
|
|
|
SCH_SHEET_LIST sheetList( g_RootSheet );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
|
|
|
// Examine all sheets path to find the current sheets path,
|
2009-11-04 20:46:53 +00:00
|
|
|
// and count them from root to the current sheet path:
|
2016-03-06 21:22:01 +00:00
|
|
|
for( unsigned i = 0; i < sheetList.size(); i++ )
|
2008-04-30 17:04:22 +00:00
|
|
|
{
|
2016-03-06 21:22:01 +00:00
|
|
|
wxString sheetpath = sheetList[i].Path();
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
if( sheetpath == current_sheetpath ) // Current sheet path found
|
|
|
|
break;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
SheetNumber++; /* Not found, increment sheet
|
|
|
|
* number before this current
|
|
|
|
* path */
|
2008-04-30 17:04:22 +00:00
|
|
|
}
|
|
|
|
|
2018-02-18 22:02:06 +00:00
|
|
|
m_CurrentSheet->SetPageNumber( SheetNumber );
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
|
|
|
|
{
|
2012-05-27 00:19:12 +00:00
|
|
|
screen->m_NumberOfScreens = sheet_count;
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GetScreen()->m_ScreenNumber = SheetNumber;
|
|
|
|
}
|
2008-04-30 17:04:22 +00:00
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_SCREEN* SCH_EDIT_FRAME::GetScreen() const
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
|
|
|
return m_CurrentSheet->LastScreen();
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
|
2013-09-11 09:34:10 +00:00
|
|
|
wxString SCH_EDIT_FRAME::GetScreenDesc() const
|
2008-02-12 21:12:46 +00:00
|
|
|
{
|
2008-02-26 01:07:38 +00:00
|
|
|
wxString s = m_CurrentSheet->PathHumanReadable();
|
|
|
|
|
|
|
|
return s;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::CreateScreens()
|
2008-02-12 21:12:46 +00:00
|
|
|
{
|
2008-02-26 01:07:38 +00:00
|
|
|
if( g_RootSheet == NULL )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
g_RootSheet = new SCH_SHEET();
|
2008-02-26 01:07:38 +00:00
|
|
|
}
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
if( g_RootSheet->GetScreen() == NULL )
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
2015-08-06 00:10:52 +00:00
|
|
|
SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
|
|
|
|
screen->SetMaxUndoItems( m_UndoRedoCountMax );
|
|
|
|
g_RootSheet->SetScreen( screen );
|
2011-02-05 16:11:24 +00:00
|
|
|
SetScreen( g_RootSheet->GetScreen() );
|
2008-02-26 01:07:38 +00:00
|
|
|
}
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
g_RootSheet->GetScreen()->SetFileName( m_DefaultSchematicFileName );
|
2012-01-09 08:35:06 +00:00
|
|
|
|
2016-02-27 19:35:45 +00:00
|
|
|
m_CurrentSheet->clear();
|
|
|
|
m_CurrentSheet->push_back( g_RootSheet );
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
if( GetScreen() == NULL )
|
2015-08-06 00:10:52 +00:00
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
|
|
|
|
screen->SetMaxUndoItems( m_UndoRedoCountMax );
|
|
|
|
SetScreen( screen );
|
|
|
|
}
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2011-07-05 12:46:14 +00:00
|
|
|
GetScreen()->SetZoom( 32.0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2011-12-08 21:05:43 +00:00
|
|
|
SCH_SHEET_PATH& SCH_EDIT_FRAME::GetCurrentSheet()
|
|
|
|
{
|
|
|
|
wxASSERT_MSG( m_CurrentSheet != NULL, wxT( "SCH_EDIT_FRAME m_CurrentSheet member is NULL." ) );
|
|
|
|
|
|
|
|
return *m_CurrentSheet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::SetCurrentSheet( const SCH_SHEET_PATH& aSheet )
|
|
|
|
{
|
2018-10-17 01:03:50 +00:00
|
|
|
if( aSheet != *m_CurrentSheet )
|
|
|
|
{
|
|
|
|
*m_CurrentSheet = aSheet;
|
|
|
|
|
|
|
|
static_cast<SCH_DRAW_PANEL*>( m_canvas )->DisplaySheet( m_CurrentSheet->LastScreen() );
|
|
|
|
}
|
2011-12-08 21:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-10-17 11:14:09 +00:00
|
|
|
void SCH_EDIT_FRAME::HardRedraw()
|
|
|
|
{
|
|
|
|
static_cast<SCH_DRAW_PANEL*>( m_canvas )->DisplaySheet( m_CurrentSheet->LastScreen() );
|
|
|
|
GetCanvas()->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-05 14:46:51 +00:00
|
|
|
void SCH_EDIT_FRAME::SetUndoItem( const SCH_ITEM* aItem )
|
|
|
|
{
|
2011-06-16 19:52:12 +00:00
|
|
|
// if aItem != NULL, delete a previous m_undoItem, if exists
|
|
|
|
// if aItme = NULL, just clear m_undoItem,
|
|
|
|
// because when calling SetUndoItem( NULL ), we only clear m_undoItem,
|
|
|
|
// because the owner of m_undoItem is no more me.
|
|
|
|
if( aItem && m_undoItem )
|
2011-04-05 14:46:51 +00:00
|
|
|
{
|
|
|
|
delete m_undoItem;
|
|
|
|
}
|
|
|
|
|
2011-06-16 19:52:12 +00:00
|
|
|
m_undoItem = NULL;
|
2011-04-05 14:46:51 +00:00
|
|
|
|
|
|
|
if( aItem )
|
2012-03-17 14:39:27 +00:00
|
|
|
m_undoItem = (SCH_ITEM*) aItem->Clone();
|
2011-04-05 14:46:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::SaveUndoItemInUndoList( SCH_ITEM* aItem )
|
|
|
|
{
|
2011-06-09 13:30:46 +00:00
|
|
|
wxCHECK_RET( aItem != NULL,
|
|
|
|
wxT( "Cannot swap undo item structures. Bad programmer!." ) );
|
|
|
|
wxCHECK_RET( m_undoItem != NULL,
|
|
|
|
wxT( "Cannot swap undo item structures. Bad programmer!." ) );
|
|
|
|
wxCHECK_RET( aItem->Type() == m_undoItem->Type(),
|
2011-04-05 14:46:51 +00:00
|
|
|
wxT( "Cannot swap undo item structures. Bad programmer!." ) );
|
|
|
|
|
|
|
|
aItem->SwapData( m_undoItem );
|
|
|
|
SaveCopyInUndoList( aItem, UR_CHANGED );
|
|
|
|
aItem->SwapData( m_undoItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
if( Kiface().IsSingle() )
|
|
|
|
{
|
|
|
|
LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
|
|
|
|
if( libeditFrame && !libeditFrame->Close() ) // Can close component editor?
|
|
|
|
return;
|
|
|
|
|
|
|
|
LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
|
|
|
|
if( viewlibFrame && !viewlibFrame->Close() ) // Can close component viewer?
|
|
|
|
return;
|
2008-02-26 01:07:38 +00:00
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false );
|
2018-10-24 14:18:19 +00:00
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
if( viewlibFrame && !viewlibFrame->Close() ) // Can close modal component viewer?
|
|
|
|
return;
|
|
|
|
}
|
2011-04-07 17:48:26 +00:00
|
|
|
|
2016-08-29 17:47:08 +00:00
|
|
|
SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, false );
|
|
|
|
|
|
|
|
if( simFrame && !simFrame->Close() ) // Can close the simulator?
|
|
|
|
return;
|
|
|
|
|
2016-03-06 21:22:01 +00:00
|
|
|
SCH_SHEET_LIST sheetList( g_RootSheet );
|
2016-02-15 20:21:18 +00:00
|
|
|
|
|
|
|
if( sheetList.IsModified() )
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
|
2018-08-01 23:06:12 +00:00
|
|
|
wxString msg = _( "Save changes to\n\"%s\"\nbefore closing?" );
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2018-08-11 20:46:03 +00:00
|
|
|
if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName ),
|
|
|
|
[&]()->bool { return SaveProject(); } ) )
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
2018-08-01 23:06:12 +00:00
|
|
|
aEvent.Veto();
|
|
|
|
return;
|
2008-02-26 01:07:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-29 17:49:49 +00:00
|
|
|
// Close the find dialog and preserve it's setting if it is displayed.
|
2011-11-10 17:01:33 +00:00
|
|
|
if( m_dlgFindReplace )
|
|
|
|
{
|
|
|
|
m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
|
|
|
|
m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
|
|
|
|
m_dlgFindReplace->Destroy();
|
|
|
|
m_dlgFindReplace = NULL;
|
|
|
|
}
|
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
SCH_SCREENS screens;
|
|
|
|
wxFileName fn;
|
|
|
|
|
|
|
|
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
|
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
fn = Prj().AbsolutePath( screen->GetFileName() );
|
2011-10-15 13:25:57 +00:00
|
|
|
|
2019-03-18 12:22:33 +00:00
|
|
|
// Auto save file name is the normal file name prepended with GetAutoSaveFilePrefix().
|
|
|
|
fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
|
2011-10-15 13:25:57 +00:00
|
|
|
|
|
|
|
if( fn.FileExists() && fn.IsFileWritable() )
|
|
|
|
wxRemoveFile( fn.GetFullPath() );
|
|
|
|
}
|
|
|
|
|
2016-02-15 20:21:18 +00:00
|
|
|
sheetList.ClearModifyStatus();
|
2008-02-26 01:07:38 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
|
|
|
|
|
|
|
|
if( !g_RootSheet->GetScreen()->GetFileName().IsEmpty() &&
|
|
|
|
g_RootSheet->GetScreen()->GetDrawItems() != NULL )
|
|
|
|
{
|
|
|
|
UpdateFileHistory( fileName );
|
|
|
|
}
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2011-06-15 18:44:24 +00:00
|
|
|
g_RootSheet->GetScreen()->Clear();
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
// all sub sheets are deleted, only the main sheet is usable
|
2016-02-27 19:35:45 +00:00
|
|
|
m_CurrentSheet->clear();
|
2014-01-29 17:01:42 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
Destroy();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-05 12:46:14 +00:00
|
|
|
double SCH_EDIT_FRAME::BestZoom()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-02-13 21:19:41 +00:00
|
|
|
double sizeX = (double) GetScreen()->GetPageSettings().GetWidthIU();
|
|
|
|
double sizeY = (double) GetScreen()->GetPageSettings().GetHeightIU();
|
|
|
|
wxPoint centre( wxPoint( sizeX / 2, sizeY / 2 ) );
|
2011-04-12 12:41:13 +00:00
|
|
|
|
2018-02-13 21:19:41 +00:00
|
|
|
// The sheet boundary already affords us some margin, so add only an
|
|
|
|
// additional 5%.
|
|
|
|
double margin_scale_factor = 1.05;
|
2011-03-30 19:20:23 +00:00
|
|
|
|
2018-02-13 21:19:41 +00:00
|
|
|
return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2013-02-01 07:58:49 +00:00
|
|
|
wxFileName fn = GetScreen()->GetFileName();
|
2009-01-08 20:29:07 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
// Name is <root sheet filename>-<sheet path> and has no extension.
|
|
|
|
// However if filename is too long name is <sheet filename>-<sheet number>
|
2013-05-19 19:35:49 +00:00
|
|
|
|
2013-05-22 15:08:57 +00:00
|
|
|
#define FN_LEN_MAX 80 // A reasonable value for the short filename len
|
2013-05-19 19:35:49 +00:00
|
|
|
|
2013-05-22 15:08:57 +00:00
|
|
|
wxString filename = fn.GetName();
|
|
|
|
wxString sheetFullName = m_CurrentSheet->PathHumanReadable();
|
|
|
|
|
|
|
|
// Remove the last '/' of the path human readable
|
|
|
|
// (and for the root sheet, make sheetFullName empty):
|
|
|
|
sheetFullName.RemoveLast();
|
|
|
|
|
2013-05-25 16:10:19 +00:00
|
|
|
sheetFullName.Trim( true );
|
|
|
|
sheetFullName.Trim( false );
|
|
|
|
|
2013-05-22 15:08:57 +00:00
|
|
|
// Convert path human readable separator to '-'
|
|
|
|
sheetFullName.Replace( wxT( "/" ), wxT( "-" ) );
|
|
|
|
|
|
|
|
if( ( filename.Len() + sheetFullName.Len() ) < FN_LEN_MAX )
|
|
|
|
filename += sheetFullName;
|
2009-01-08 20:29:07 +00:00
|
|
|
else
|
2009-11-04 20:46:53 +00:00
|
|
|
filename << wxT( "-" ) << GetScreen()->m_ScreenNumber;
|
2009-01-08 20:29:07 +00:00
|
|
|
|
|
|
|
return filename;
|
|
|
|
}
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
|
2011-10-28 20:30:50 +00:00
|
|
|
void SCH_EDIT_FRAME::OnModify()
|
2010-02-18 20:07:29 +00:00
|
|
|
{
|
2010-10-26 20:25:48 +00:00
|
|
|
GetScreen()->SetModify();
|
2011-10-15 13:25:57 +00:00
|
|
|
GetScreen()->SetSave();
|
2010-02-18 20:07:29 +00:00
|
|
|
|
2015-04-09 19:37:48 +00:00
|
|
|
m_foundItems.SetForceSearch();
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
m_canvas->Refresh();
|
2010-02-18 20:07:29 +00:00
|
|
|
}
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2011-12-21 20:21:15 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
|
2009-04-29 17:09:00 +00:00
|
|
|
{
|
2011-01-07 19:24:24 +00:00
|
|
|
event.Enable( m_blockItems.GetCount() > 0 );
|
2009-04-29 17:09:00 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
|
2009-04-29 17:09:00 +00:00
|
|
|
{
|
2012-09-28 17:47:41 +00:00
|
|
|
wxString tool_tip = GetForceHVLines() ?
|
2009-12-02 21:44:03 +00:00
|
|
|
_( "Draw wires and buses in any direction" ) :
|
|
|
|
_( "Draw horizontal and vertical wires and buses only" );
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2012-09-28 17:47:41 +00:00
|
|
|
aEvent.Check( GetForceHVLines() );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip );
|
2009-04-29 17:09:00 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
|
2009-04-29 17:09:00 +00:00
|
|
|
{
|
2011-12-09 16:37:11 +00:00
|
|
|
wxString tool_tip = m_showAllPins ? _( "Do not show hidden pins" ) :
|
2009-11-04 20:46:53 +00:00
|
|
|
_( "Show hidden pins" );
|
|
|
|
|
2011-12-09 16:37:11 +00:00
|
|
|
aEvent.Check( m_showAllPins );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
|
2009-04-29 17:09:00 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2015-06-11 17:27:36 +00:00
|
|
|
void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
2016-03-06 21:22:01 +00:00
|
|
|
SCH_SHEET_LIST sheetList( g_RootSheet );
|
2016-02-15 20:21:18 +00:00
|
|
|
|
|
|
|
aEvent.Enable( sheetList.IsModified() );
|
2015-06-11 17:27:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-22 00:48:25 +00:00
|
|
|
void SCH_EDIT_FRAME::OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
SCH_SCREENS schematic;
|
|
|
|
|
|
|
|
// The remapping can only be performed on legacy projects.
|
|
|
|
aEvent.Enable( schematic.HasNoFullyDefinedLibIds() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-11 17:27:36 +00:00
|
|
|
void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
aEvent.Enable( GetScreen()->IsModify() );
|
2016-02-15 20:21:18 +00:00
|
|
|
|
2015-06-11 17:27:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
aEvent.Enable( m_CurrentSheet->Last() != g_RootSheet );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2013-06-09 18:14:01 +00:00
|
|
|
// See if it's already open...
|
2013-06-07 20:56:55 +00:00
|
|
|
wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2013-06-07 20:56:55 +00:00
|
|
|
if( erc )
|
2013-06-09 18:14:01 +00:00
|
|
|
// Bring it to the top if already open. Dual monitor users need this.
|
|
|
|
erc->Raise();
|
2013-06-07 20:56:55 +00:00
|
|
|
else
|
|
|
|
InvokeDialogERC( this );
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
|
2018-08-28 22:56:26 +00:00
|
|
|
void SCH_EDIT_FRAME::CloseErc()
|
|
|
|
{
|
|
|
|
// Find the ERC dialog if it's open and close it
|
|
|
|
wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this );
|
|
|
|
|
|
|
|
if( erc )
|
|
|
|
erc->Close( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-01-29 10:24:39 +00:00
|
|
|
void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
|
2018-02-16 18:26:11 +00:00
|
|
|
{
|
|
|
|
doUpdatePcb( "" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::doUpdatePcb( const wxString& aUpdateOptions )
|
2016-01-29 10:24:39 +00:00
|
|
|
{
|
2016-01-29 10:36:51 +00:00
|
|
|
wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
|
|
|
|
|
|
|
|
fn.SetExt( PcbFileExtension );
|
|
|
|
|
|
|
|
if( Kiface().IsSingle() )
|
|
|
|
{
|
|
|
|
DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is"
|
|
|
|
" opened in stand-alone mode. In order to create/update"
|
|
|
|
" PCBs from schematics, you need to launch Kicad shell"
|
|
|
|
" and create a PCB project." ) );
|
|
|
|
return;
|
2016-10-22 18:02:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-01-29 10:36:51 +00:00
|
|
|
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true );
|
|
|
|
|
|
|
|
// a pcb frame can be already existing, but not yet used.
|
|
|
|
// this is the case when running the footprint editor, or the footprint viewer first
|
|
|
|
// if the frame is not visible, the board is not yet loaded
|
|
|
|
if( !frame->IsVisible() )
|
|
|
|
{
|
|
|
|
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
|
|
|
frame->Show( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
// On Windows, Raise() does not bring the window on screen, when iconized
|
|
|
|
if( frame->IsIconized() )
|
|
|
|
frame->Iconize( false );
|
|
|
|
|
|
|
|
frame->Raise();
|
|
|
|
}
|
|
|
|
|
2018-02-16 18:26:11 +00:00
|
|
|
if( aUpdateOptions.Contains( "quiet-annotate" ) )
|
|
|
|
{
|
|
|
|
SCH_SCREENS schematic;
|
|
|
|
schematic.UpdateSymbolLinks();
|
|
|
|
SCH_SHEET_LIST sheets( g_RootSheet );
|
|
|
|
sheets.AnnotatePowerSymbols();
|
2018-02-18 20:44:33 +00:00
|
|
|
AnnotateComponents( true, UNSORTED, INCREMENTAL_BY_REF, 0, false, false, true,
|
2018-02-17 11:43:56 +00:00
|
|
|
NULL_REPORTER::GetInstance() );
|
2018-02-16 18:26:11 +00:00
|
|
|
}
|
2016-10-22 18:02:15 +00:00
|
|
|
|
2018-02-16 18:26:11 +00:00
|
|
|
if( !aUpdateOptions.Contains( "no-annotate" ) )
|
|
|
|
{
|
|
|
|
// Ensure the schematic is OK for a netlist creation
|
|
|
|
// (especially all components are annotated):
|
|
|
|
if( !prepareForNetlist() )
|
|
|
|
return;
|
|
|
|
}
|
2016-10-22 18:02:15 +00:00
|
|
|
|
2016-01-29 10:24:39 +00:00
|
|
|
NETLIST_OBJECT_LIST* net_atoms = BuildNetListBase();
|
2018-05-24 17:24:08 +00:00
|
|
|
NETLIST_EXPORTER_KICAD exporter( this, net_atoms );
|
2016-01-29 10:24:39 +00:00
|
|
|
STRING_FORMATTER formatter;
|
|
|
|
|
|
|
|
exporter.Format( &formatter, GNL_ALL );
|
|
|
|
|
2018-03-12 13:27:45 +00:00
|
|
|
auto updateOptions = aUpdateOptions.ToStdString();
|
|
|
|
auto netlistString = formatter.GetString();
|
|
|
|
auto finalNetlist = updateOptions + "\n" + netlistString;
|
2018-03-11 17:38:27 +00:00
|
|
|
|
2016-10-22 18:02:15 +00:00
|
|
|
// Now, send the "kicad" (s-expr) netlist to Pcbnew
|
2018-03-12 13:27:45 +00:00
|
|
|
Kiway().ExpressMail( FRAME_PCB, MAIL_SCH_PCB_UPDATE, finalNetlist, this );
|
2016-01-29 10:24:39 +00:00
|
|
|
}
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2013-06-27 20:34:30 +00:00
|
|
|
int result;
|
2008-02-27 19:38:16 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2013-06-27 20:34:30 +00:00
|
|
|
result = InvokeDialogNetList( this );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
// If a plugin is removed or added, rebuild and reopen the new dialog
|
|
|
|
|
|
|
|
} while( result == NET_PLUGIN_CHANGE );
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnCreateBillOfMaterials( wxCommandEvent& )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2013-06-14 14:59:52 +00:00
|
|
|
InvokeDialogCreateBOM( this );
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
|
2017-04-02 12:09:01 +00:00
|
|
|
void SCH_EDIT_FRAME::OnLaunchBomManager( wxCommandEvent& event )
|
|
|
|
{
|
2018-05-11 09:32:54 +00:00
|
|
|
DIALOG_FIELDS_EDITOR_GLOBAL dlg( this );
|
|
|
|
dlg.ShowQuasiModal();
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
|
2011-12-01 16:49:28 +00:00
|
|
|
void SCH_EDIT_FRAME::OnFindItems( wxCommandEvent& aEvent )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2011-12-01 16:49:28 +00:00
|
|
|
wxCHECK_RET( m_findReplaceData != NULL,
|
|
|
|
wxT( "Forgot to create find/replace data. Bad Programmer!" ) );
|
2010-03-16 18:22:59 +00:00
|
|
|
|
|
|
|
if( m_dlgFindReplace )
|
|
|
|
{
|
|
|
|
delete m_dlgFindReplace;
|
|
|
|
m_dlgFindReplace = NULL;
|
|
|
|
}
|
|
|
|
|
2011-12-01 16:49:28 +00:00
|
|
|
int style = 0;
|
|
|
|
|
|
|
|
if( aEvent.GetId() == wxID_REPLACE )
|
|
|
|
style = wxFR_REPLACEDIALOG;
|
|
|
|
|
2018-07-05 15:50:21 +00:00
|
|
|
m_dlgFindReplace = new DIALOG_SCH_FIND( this, m_findReplaceData, m_findReplaceStatus,
|
2018-09-09 09:57:54 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, style );
|
2011-11-10 17:01:33 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
m_dlgFindReplace->SetFindEntries( m_findStringHistoryList );
|
|
|
|
m_dlgFindReplace->SetReplaceEntries( m_replaceStringHistoryList );
|
|
|
|
m_dlgFindReplace->Show( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnFindDialogClose( wxFindDialogEvent& event )
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
2011-02-03 21:57:02 +00:00
|
|
|
// If the user dismissed the dialog with the mouse, this will send the cursor back
|
|
|
|
// to the last item found.
|
|
|
|
OnFindSchematicItem( event );
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
if( m_dlgFindReplace )
|
|
|
|
{
|
|
|
|
m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
|
|
|
|
m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
|
|
|
|
m_dlgFindReplace->Destroy();
|
|
|
|
m_dlgFindReplace = NULL;
|
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
* 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
|
|
|
wxString fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
|
2008-02-27 19:38:16 +00:00
|
|
|
|
* 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
|
|
|
if( fn.size() )
|
|
|
|
OpenProjectFiles( std::vector<wxString>( 1, fn ) );
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
2008-05-07 15:08:16 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2013-02-02 17:39:59 +00:00
|
|
|
void SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile( wxCommandEvent& event )
|
2008-05-07 15:08:16 +00:00
|
|
|
{
|
2013-02-02 17:39:59 +00:00
|
|
|
LoadCmpToFootprintLinkFile();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2008-05-07 15:08:16 +00:00
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2017-08-25 13:27:06 +00:00
|
|
|
void SCH_EDIT_FRAME::OnUpdateFields( wxCommandEvent& event )
|
|
|
|
{
|
2017-10-02 12:53:48 +00:00
|
|
|
std::list<SCH_COMPONENT*> components;
|
2017-08-25 13:27:06 +00:00
|
|
|
|
2017-10-02 12:53:48 +00:00
|
|
|
for( SCH_ITEM* item = GetScreen()->GetDrawItems(); item; item = item->Next() )
|
2017-08-25 13:27:06 +00:00
|
|
|
{
|
2017-10-02 12:53:48 +00:00
|
|
|
if( item->Type() == SCH_COMPONENT_T )
|
|
|
|
components.push_back( static_cast<SCH_COMPONENT*>( item ) );
|
2017-08-25 13:27:06 +00:00
|
|
|
}
|
|
|
|
|
2017-10-02 18:39:09 +00:00
|
|
|
if( InvokeDialogUpdateFields( this, components, true ) == wxID_OK )
|
2017-10-02 12:53:48 +00:00
|
|
|
m_canvas->Refresh();
|
2017-08-25 13:27:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2015-09-25 19:38:09 +00:00
|
|
|
wxString pro_dir = m_mruPath;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir,
|
2017-11-12 00:31:38 +00:00
|
|
|
wxEmptyString, SchematicFileWildcard(),
|
2014-03-28 13:08:48 +00:00
|
|
|
wxFD_SAVE );
|
* 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
|
|
|
|
|
|
|
if( dlg.ShowModal() != wxID_CANCEL )
|
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
// Enforce the extension, wxFileDialog is inept.
|
|
|
|
wxFileName create_me = dlg.GetPath();
|
|
|
|
create_me.SetExt( SchematicFileExtension );
|
|
|
|
|
|
|
|
if( create_me.FileExists() )
|
|
|
|
{
|
2018-09-09 21:06:38 +00:00
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Schematic file \"%s\" already exists." ), create_me.GetFullName() );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OpenProjectFiles() requires absolute
|
2018-09-09 21:06:38 +00:00
|
|
|
wxASSERT_MSG( create_me.IsAbsolute(), "wxFileDialog returned non-absolute path" );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
|
2015-09-25 19:38:09 +00:00
|
|
|
m_mruPath = create_me.GetPath();
|
* 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
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2015-09-25 19:38:09 +00:00
|
|
|
wxString pro_dir = m_mruPath;
|
* 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
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir,
|
2017-11-12 00:31:38 +00:00
|
|
|
wxEmptyString, SchematicFileWildcard(),
|
* 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
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() != wxID_CANCEL )
|
|
|
|
{
|
|
|
|
OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
|
2015-09-25 19:38:09 +00:00
|
|
|
m_mruPath = Prj().GetProjectPath();
|
* 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
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2015-07-19 14:38:02 +00:00
|
|
|
wxFileName kicad_board = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2015-07-19 14:38:02 +00:00
|
|
|
if( kicad_board.IsOk() )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2015-07-19 14:38:02 +00:00
|
|
|
kicad_board.SetExt( PcbFileExtension );
|
|
|
|
wxFileName legacy_board( kicad_board );
|
|
|
|
legacy_board.SetExt( LegacyPcbFileExtension );
|
|
|
|
wxFileName& boardfn = ( !legacy_board.FileExists() || kicad_board.FileExists() ) ?
|
|
|
|
kicad_board : legacy_board;
|
2010-05-11 14:35:13 +00:00
|
|
|
|
2014-04-20 04:35:34 +00:00
|
|
|
if( Kiface().IsSingle() )
|
|
|
|
{
|
2015-07-19 14:38:02 +00:00
|
|
|
wxString filename = QuoteFullPath( boardfn );
|
2014-04-20 04:35:34 +00:00
|
|
|
ExecuteFile( this, PCBNEW_EXE, filename );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-23 10:59:38 +00:00
|
|
|
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true );
|
2014-04-20 04:35:34 +00:00
|
|
|
|
2015-06-23 10:59:38 +00:00
|
|
|
// a pcb frame can be already existing, but not yet used.
|
|
|
|
// this is the case when running the footprint editor, or the footprint viewer first
|
|
|
|
// if the frame is not visible, the board is not yet loaded
|
|
|
|
if( !frame->IsVisible() )
|
2014-04-20 04:35:34 +00:00
|
|
|
{
|
2015-07-19 14:38:02 +00:00
|
|
|
frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
|
2015-06-23 10:59:38 +00:00
|
|
|
frame->Show( true );
|
2014-04-20 04:35:34 +00:00
|
|
|
}
|
2015-06-23 10:59:38 +00:00
|
|
|
|
|
|
|
// On Windows, Raise() does not bring the window on screen, when iconized
|
|
|
|
if( frame->IsIconized() )
|
|
|
|
frame->Iconize( false );
|
|
|
|
|
|
|
|
frame->Raise();
|
2014-04-20 04:35:34 +00:00
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
else
|
2011-10-28 20:30:50 +00:00
|
|
|
{
|
2008-02-27 19:38:16 +00:00
|
|
|
ExecuteFile( this, PCBNEW_EXE );
|
2011-10-28 20:30:50 +00:00
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2014-05-05 17:28:40 +00:00
|
|
|
void SCH_EDIT_FRAME::OnOpenPcbModuleEditor( wxCommandEvent& event )
|
|
|
|
{
|
2015-09-08 18:45:11 +00:00
|
|
|
wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
|
2014-05-05 17:28:40 +00:00
|
|
|
|
2015-09-08 18:45:11 +00:00
|
|
|
if( fn.IsOk() )
|
|
|
|
{
|
|
|
|
KIWAY_PLAYER* fp_editor = Kiway().Player( FRAME_PCB_MODULE_EDITOR );
|
2015-07-16 19:29:40 +00:00
|
|
|
|
2015-09-08 18:45:11 +00:00
|
|
|
// On Windows, Raise() does not bring the window on screen, when iconized
|
|
|
|
if( fp_editor->IsIconized() )
|
|
|
|
fp_editor->Iconize( false );
|
2015-07-16 19:29:40 +00:00
|
|
|
|
2015-09-08 18:45:11 +00:00
|
|
|
fp_editor->Show( true );
|
|
|
|
fp_editor->Raise();
|
2014-05-05 17:28:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
|
2009-04-05 20:49:15 +00:00
|
|
|
fn.SetExt( NetlistFileExtension );
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2017-11-27 16:11:12 +00:00
|
|
|
if( !prepareForNetlist() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
try
|
2011-10-28 20:30:50 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
|
|
|
|
|
|
|
|
if( !player )
|
|
|
|
{
|
|
|
|
player = Kiway().Player( FRAME_CVPCB, true );
|
|
|
|
player->Show( true );
|
2015-09-08 18:45:11 +00:00
|
|
|
// player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
}
|
2015-04-08 12:50:36 +00:00
|
|
|
|
2015-09-08 18:45:11 +00:00
|
|
|
sendNetlist();
|
2015-06-07 18:18:45 +00:00
|
|
|
|
2015-09-08 18:45:11 +00:00
|
|
|
player->Raise();
|
2011-10-28 20:30:50 +00:00
|
|
|
}
|
2018-04-18 07:10:29 +00:00
|
|
|
catch( const IO_ERROR& )
|
2017-11-27 16:11:12 +00:00
|
|
|
{
|
|
|
|
DisplayError( this, _( "Could not open CvPcb" ) );
|
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 00:06:37 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2011-05-28 18:51:32 +00:00
|
|
|
SCH_COMPONENT* component = NULL;
|
2014-02-21 00:06:37 +00:00
|
|
|
|
2011-05-28 18:51:32 +00:00
|
|
|
if( event.GetId() == ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP )
|
|
|
|
{
|
2015-03-14 11:50:39 +00:00
|
|
|
// We want to edit a component with Libedit.
|
|
|
|
// we are here by a hot key, or by a popup menu
|
2011-05-28 18:51:32 +00:00
|
|
|
SCH_ITEM* item = GetScreen()->GetCurItem();
|
2011-10-28 20:30:50 +00:00
|
|
|
|
2015-03-14 11:50:39 +00:00
|
|
|
if( !item )
|
|
|
|
{
|
|
|
|
// If we didn't get here by a hot key, then something has gone wrong.
|
|
|
|
if( event.GetInt() == 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) event.GetClientObject();
|
|
|
|
|
|
|
|
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
|
|
|
|
|
|
|
|
// Set the locat filter, according to the edit command
|
|
|
|
const KICAD_T* filterList = SCH_COLLECTOR::ComponentsOnly;
|
|
|
|
item = LocateAndShowItem( data->GetPosition(), filterList, event.GetInt() );
|
|
|
|
|
|
|
|
// Exit if no item found at the current location or the item is already being edited.
|
|
|
|
if( (item == NULL) || (item->GetFlags() != 0) )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
if( !item || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
|
2011-05-28 18:51:32 +00:00
|
|
|
{
|
2017-12-24 15:04:02 +00:00
|
|
|
wxMessageBox( _( "Error: not a symbol or no symbol." ) );
|
2011-05-28 18:51:32 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
component = (SCH_COMPONENT*) item;
|
|
|
|
}
|
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
if( !libeditFrame )
|
|
|
|
{
|
|
|
|
libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, true );
|
|
|
|
libeditFrame->Show( true );
|
|
|
|
}
|
|
|
|
|
2015-08-25 14:16:15 +00:00
|
|
|
libeditFrame->PushPreferences( m_canvas );
|
|
|
|
|
2015-07-16 19:29:40 +00:00
|
|
|
// On Windows, Raise() does not bring the window on screen, when iconized
|
|
|
|
if( libeditFrame->IsIconized() )
|
|
|
|
libeditFrame->Iconize( false );
|
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
libeditFrame->Raise();
|
2014-04-20 04:35:34 +00:00
|
|
|
|
2011-05-28 18:51:32 +00:00
|
|
|
if( component )
|
|
|
|
{
|
2017-10-06 18:07:43 +00:00
|
|
|
LIB_ID id = component->GetLibId();
|
|
|
|
LIB_ALIAS* entry = nullptr;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
entry = Prj().SchSymbolLibTable()->LoadSymbol( id );
|
|
|
|
}
|
|
|
|
catch( const IO_ERROR& ioe )
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
{
|
2017-10-06 18:07:43 +00:00
|
|
|
wxString msg;
|
2011-10-28 20:30:50 +00:00
|
|
|
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Error occurred loading symbol \"%s\" from library \"%s\"." ),
|
2017-10-06 18:07:43 +00:00
|
|
|
id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
|
|
|
|
DisplayErrorMessage( this, msg, ioe.What() );
|
|
|
|
return;
|
|
|
|
}
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
if( !entry ) // Should not occur
|
|
|
|
return;
|
2011-10-28 20:30:50 +00:00
|
|
|
|
2018-11-08 21:26:01 +00:00
|
|
|
libeditFrame->LoadComponentAndSelectLib( id, component->GetUnit(), component->GetConvert() );
|
2011-05-28 18:51:32 +00:00
|
|
|
}
|
2015-12-13 16:56:47 +00:00
|
|
|
|
2017-10-25 22:21:42 +00:00
|
|
|
SchematicCleanUp();
|
2015-12-13 16:56:47 +00:00
|
|
|
m_canvas->Refresh();
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
|
2015-06-25 19:06:51 +00:00
|
|
|
|
2015-06-22 15:38:54 +00:00
|
|
|
void SCH_EDIT_FRAME::OnRescueProject( wxCommandEvent& event )
|
2015-04-25 22:26:51 +00:00
|
|
|
{
|
2017-10-22 00:48:25 +00:00
|
|
|
SCH_SCREENS schematic;
|
|
|
|
|
|
|
|
if( schematic.HasNoFullyDefinedLibIds() )
|
|
|
|
RescueLegacyProject( true );
|
|
|
|
else
|
|
|
|
RescueSymbolLibTableProject( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnRemapSymbols( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
DIALOG_SYMBOL_REMAP dlgRemap( this );
|
|
|
|
|
|
|
|
dlgRemap.ShowQuasiModal();
|
2017-11-08 00:15:09 +00:00
|
|
|
|
|
|
|
m_canvas->Refresh( true );
|
2015-04-25 22:26:51 +00:00
|
|
|
}
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2015-06-25 19:06:51 +00:00
|
|
|
|
2017-11-20 16:14:25 +00:00
|
|
|
// This method is not the same as OnRemapSymbols.
|
|
|
|
// It allows renaming the lib id of groups of components when a symbol
|
2018-04-08 10:28:59 +00:00
|
|
|
// has moved from a library to another library.
|
2017-11-20 16:14:25 +00:00
|
|
|
// For instance to rename libname1::mysymbol to libname2::mysymbol
|
|
|
|
// or any other lib id name
|
|
|
|
void SCH_EDIT_FRAME::OnEditComponentSymbolsId( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
InvokeDialogEditComponentsLibId( this );
|
|
|
|
m_canvas->Refresh( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2015-06-25 19:06:51 +00:00
|
|
|
Close( false );
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
2010-03-20 19:57:59 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
|
2010-11-11 21:10:27 +00:00
|
|
|
{
|
2013-06-07 20:56:55 +00:00
|
|
|
InvokeDialogPrintUsingPrinter( this );
|
2010-11-11 21:10:27 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
|
2011-01-20 16:34:57 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( fn.GetName() != NAMELESS_PROJECT )
|
2010-11-11 21:10:27 +00:00
|
|
|
{
|
* 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
|
|
|
// was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParametersList() );
|
2014-09-30 08:12:00 +00:00
|
|
|
Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDITOR,
|
|
|
|
GetProjectFileParametersList() );
|
2010-11-11 21:10:27 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-17 21:47:27 +00:00
|
|
|
|
* 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
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode,
|
2013-03-30 17:24:04 +00:00
|
|
|
void* aData )
|
2011-03-28 19:26:31 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
DrawWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, fileName );
|
2011-03-28 19:26:31 +00:00
|
|
|
}
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
void SCH_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
int id = aEvent.GetId();
|
2011-04-27 19:44:32 +00:00
|
|
|
int index = id - ID_SELECT_ITEM_START;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
if( (id >= ID_SELECT_ITEM_START && id <= ID_SELECT_ITEM_END)
|
2011-03-25 19:16:05 +00:00
|
|
|
&& (index >= 0 && index < m_collectedItems.GetCount()) )
|
|
|
|
{
|
|
|
|
SCH_ITEM* item = m_collectedItems[index];
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAbortRequest( false );
|
2011-03-25 19:16:05 +00:00
|
|
|
GetScreen()->SetCurItem( item );
|
|
|
|
}
|
|
|
|
}
|
2011-10-15 13:25:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool SCH_EDIT_FRAME::isAutoSaveRequired() const
|
|
|
|
{
|
2014-08-23 15:22:50 +00:00
|
|
|
// In case this event happens before g_RootSheet is initialized which does happen
|
|
|
|
// on mingw64 builds.
|
2016-02-15 20:19:22 +00:00
|
|
|
|
2014-08-23 15:22:50 +00:00
|
|
|
if( g_RootSheet != NULL )
|
|
|
|
{
|
2017-07-26 10:03:24 +00:00
|
|
|
SCH_SCREENS screenList;
|
2016-02-15 20:19:22 +00:00
|
|
|
|
2017-07-26 10:03:24 +00:00
|
|
|
for( SCH_SCREEN* screen = screenList.GetFirst(); screen; screen = screenList.GetNext() )
|
|
|
|
{
|
|
|
|
if( screen->IsSave() )
|
|
|
|
return true;
|
|
|
|
}
|
2014-08-23 15:22:50 +00:00
|
|
|
}
|
2014-08-23 19:36:22 +00:00
|
|
|
|
|
|
|
return false;
|
2011-10-15 13:25:57 +00:00
|
|
|
}
|
2012-01-04 22:08:46 +00:00
|
|
|
|
|
|
|
|
2018-10-16 13:11:33 +00:00
|
|
|
void SCH_EDIT_FRAME::addCurrentItemToScreen()
|
2012-01-04 22:08:46 +00:00
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2013-08-06 22:59:07 +00:00
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
2012-01-04 22:08:46 +00:00
|
|
|
|
|
|
|
wxCHECK_RET( item != NULL, wxT( "Cannot add current item to list." ) );
|
|
|
|
|
|
|
|
m_canvas->SetAutoPanRequest( false );
|
|
|
|
|
2018-10-24 15:08:21 +00:00
|
|
|
SCH_SHEET* parentSheet = nullptr;
|
|
|
|
SCH_COMPONENT* parentComponent = nullptr;
|
|
|
|
SCH_ITEM* undoItem = item;
|
2012-01-04 22:08:46 +00:00
|
|
|
|
|
|
|
if( item->Type() == SCH_SHEET_PIN_T )
|
|
|
|
{
|
2018-10-24 15:08:21 +00:00
|
|
|
parentSheet = (SCH_SHEET*) item->GetParent();
|
2012-01-04 22:08:46 +00:00
|
|
|
|
2018-10-24 15:08:21 +00:00
|
|
|
wxCHECK_RET( parentSheet && parentSheet->Type() == SCH_SHEET_T,
|
2012-01-04 22:08:46 +00:00
|
|
|
wxT( "Cannot place sheet pin in invalid schematic sheet object." ) );
|
|
|
|
|
2018-10-24 15:08:21 +00:00
|
|
|
undoItem = parentSheet;
|
2012-01-04 22:08:46 +00:00
|
|
|
}
|
|
|
|
|
2012-10-23 16:37:19 +00:00
|
|
|
else if( item->Type() == SCH_FIELD_T )
|
|
|
|
{
|
2018-10-24 15:08:21 +00:00
|
|
|
parentComponent = (SCH_COMPONENT*) item->GetParent();
|
2012-10-23 16:37:19 +00:00
|
|
|
|
2018-10-24 15:08:21 +00:00
|
|
|
wxCHECK_RET( parentComponent && parentComponent->Type() == SCH_COMPONENT_T,
|
2012-10-23 16:37:19 +00:00
|
|
|
wxT( "Cannot place field in invalid schematic component object." ) );
|
|
|
|
|
2018-10-24 15:08:21 +00:00
|
|
|
undoItem = parentComponent;
|
2012-10-23 16:37:19 +00:00
|
|
|
}
|
|
|
|
|
2012-01-04 22:08:46 +00:00
|
|
|
if( item->IsNew() )
|
|
|
|
{
|
2018-09-03 10:11:39 +00:00
|
|
|
// When a new sheet is added to the hierarchy, a clear annotation can be needed
|
|
|
|
// for all new sheet paths added by the new sheet (if this sheet is loaded from
|
|
|
|
// and existing sheet or a existing file, it can also contain subsheets)
|
|
|
|
bool doClearAnnotation = false;
|
|
|
|
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
|
|
|
|
|
2012-01-04 22:08:46 +00:00
|
|
|
if( item->Type() == SCH_SHEET_T )
|
|
|
|
{
|
|
|
|
// Fix the size and position of the new sheet using the last values set by
|
|
|
|
// the m_mouseCaptureCallback function.
|
|
|
|
m_canvas->SetMouseCapture( NULL, NULL );
|
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet, &doClearAnnotation ) )
|
2012-01-04 22:08:46 +00:00
|
|
|
{
|
|
|
|
screen->SetCurItem( NULL );
|
|
|
|
delete item;
|
2015-06-28 16:45:05 +00:00
|
|
|
|
2012-01-04 22:08:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetSheetNumberAndCount();
|
|
|
|
|
2018-10-24 14:18:19 +00:00
|
|
|
if( !screen->CheckIfOnDrawList( item ) ) // don't want a loop!
|
|
|
|
AddToScreen( item );
|
2018-10-16 21:54:12 +00:00
|
|
|
|
2012-01-04 22:08:46 +00:00
|
|
|
SetRepeatItem( item );
|
|
|
|
SaveCopyInUndoList( undoItem, UR_NEW );
|
|
|
|
}
|
2018-10-24 15:08:21 +00:00
|
|
|
else if( item->Type() == SCH_SHEET_PIN_T )
|
|
|
|
{
|
|
|
|
// Sheet pins are owned by their parent sheet.
|
|
|
|
SaveCopyInUndoList( undoItem, UR_CHANGED ); // save the parent sheet
|
|
|
|
|
|
|
|
parentSheet->AddPin( (SCH_SHEET_PIN*) item );
|
|
|
|
}
|
|
|
|
else if( item->Type() == SCH_FIELD_T )
|
|
|
|
{
|
|
|
|
// Component fields are also owned by their parent, but new component fields
|
|
|
|
// are handled elsewhere.
|
|
|
|
wxLogMessage( wxT( "addCurrentItemToScreen: unexpected new SCH_FIELD" ) );
|
|
|
|
}
|
2012-01-04 22:08:46 +00:00
|
|
|
else
|
|
|
|
{
|
2018-10-24 15:08:21 +00:00
|
|
|
if( !screen->CheckIfOnDrawList( item ) ) // don't want a loop!
|
|
|
|
AddToScreen( item );
|
|
|
|
|
|
|
|
SetRepeatItem( item );
|
|
|
|
SaveCopyInUndoList( undoItem, UR_NEW );
|
2012-01-04 22:08:46 +00:00
|
|
|
}
|
2018-09-03 10:11:39 +00:00
|
|
|
|
|
|
|
if( doClearAnnotation )
|
|
|
|
{
|
|
|
|
// Clear annotation of new sheet paths: the new sheet and its sub-sheets
|
|
|
|
// If needed the missing alternate references of components will be created
|
|
|
|
SCH_SCREENS screensList( g_RootSheet );
|
|
|
|
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
|
|
|
|
}
|
2012-01-04 22:08:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SaveUndoItemInUndoList( undoItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
item->ClearFlags();
|
2018-10-14 22:09:59 +00:00
|
|
|
|
2012-01-04 22:08:46 +00:00
|
|
|
screen->SetModify();
|
|
|
|
screen->SetCurItem( NULL );
|
|
|
|
m_canvas->SetMouseCapture( NULL, NULL );
|
|
|
|
m_canvas->EndMouseCapture();
|
|
|
|
|
2018-10-18 09:50:43 +00:00
|
|
|
RefreshItem( item );
|
|
|
|
|
2012-01-04 22:08:46 +00:00
|
|
|
if( item->IsConnectable() )
|
2017-11-27 19:27:24 +00:00
|
|
|
{
|
|
|
|
std::vector< wxPoint > pts;
|
|
|
|
item->GetConnectionPoints( pts );
|
2018-10-25 13:12:34 +00:00
|
|
|
|
2017-12-01 22:53:23 +00:00
|
|
|
for( auto i = pts.begin(); i != pts.end(); i++ )
|
2017-11-27 19:27:24 +00:00
|
|
|
{
|
2017-12-01 22:53:23 +00:00
|
|
|
for( auto j = i + 1; j != pts.end(); j++ )
|
|
|
|
TrimWire( *i, *j, true );
|
|
|
|
|
|
|
|
if( screen->IsJunctionNeeded( *i, true ) )
|
|
|
|
AddJunction( *i, true );
|
2017-11-27 19:27:24 +00:00
|
|
|
}
|
2018-10-25 13:12:34 +00:00
|
|
|
|
2018-10-16 13:11:33 +00:00
|
|
|
TestDanglingEnds();
|
2017-11-27 19:27:24 +00:00
|
|
|
}
|
2012-01-04 22:08:46 +00:00
|
|
|
|
2018-10-16 13:11:33 +00:00
|
|
|
GetCanvas()->Refresh();
|
2012-01-04 22:08:46 +00:00
|
|
|
}
|
2012-01-14 11:52:46 +00:00
|
|
|
|
2014-02-21 00:06:37 +00:00
|
|
|
|
2012-01-14 11:52:46 +00:00
|
|
|
void SCH_EDIT_FRAME::UpdateTitle()
|
|
|
|
{
|
|
|
|
wxString title;
|
|
|
|
|
|
|
|
if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
|
|
|
|
{
|
2019-03-15 12:09:04 +00:00
|
|
|
title.Printf( _( "Eeschema" ) + wxT( " \u2014 %s" ), GetScreen()->GetFileName() );
|
2012-01-14 11:52:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
|
|
|
|
wxFileName fn = fileName;
|
2012-01-14 11:52:46 +00:00
|
|
|
|
2018-03-12 19:54:07 +00:00
|
|
|
title.Printf( _( "Eeschema" ) + wxT( " \u2014 %s [%s] \u2014 %s" ),
|
2019-03-15 12:09:04 +00:00
|
|
|
fn.GetFullName(), m_CurrentSheet->PathHumanReadable(),
|
|
|
|
fn.GetPath() );
|
2012-01-14 11:52:46 +00:00
|
|
|
|
|
|
|
if( fn.FileExists() )
|
|
|
|
{
|
|
|
|
if( !fn.IsFileWritable() )
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
title += _( " [Read Only]" );
|
2012-01-14 11:52:46 +00:00
|
|
|
}
|
|
|
|
else
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
title += _( " [no file]" );
|
2012-01-14 11:52:46 +00:00
|
|
|
}
|
2012-05-10 06:25:27 +00:00
|
|
|
|
|
|
|
SetTitle( title );
|
2012-01-14 11:52:46 +00:00
|
|
|
}
|
2017-12-24 17:57:57 +00:00
|
|
|
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
void SCH_EDIT_FRAME::CommonSettingsChanged()
|
2018-01-08 04:05:03 +00:00
|
|
|
{
|
2018-05-14 17:34:18 +00:00
|
|
|
SCH_BASE_FRAME::CommonSettingsChanged();
|
2018-01-08 04:05:03 +00:00
|
|
|
|
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateVToolbar();
|
|
|
|
ReCreateOptToolbar();
|
|
|
|
Layout();
|
|
|
|
SendSizeEvent();
|
|
|
|
}
|
2018-06-30 22:38:04 +00:00
|
|
|
|
|
|
|
|
2018-11-20 14:11:22 +00:00
|
|
|
void SCH_EDIT_FRAME::OnPageSettingsChange()
|
|
|
|
{
|
|
|
|
// Rebuild the sheet view (draw area and any other items):
|
|
|
|
DisplayCurrentSheet();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-30 22:38:04 +00:00
|
|
|
void SCH_EDIT_FRAME::ShowChangedLanguage()
|
|
|
|
{
|
|
|
|
// call my base class
|
|
|
|
SCH_BASE_FRAME::ShowChangedLanguage();
|
|
|
|
|
|
|
|
// tooltips in toolbars
|
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateVToolbar();
|
|
|
|
ReCreateOptToolbar();
|
|
|
|
|
|
|
|
// status bar
|
|
|
|
UpdateMsgPanel();
|
2019-02-25 18:26:14 +00:00
|
|
|
|
|
|
|
// This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
|
|
|
|
// windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
|
|
|
|
// wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
|
|
|
|
// toolbar to update correctly.
|
|
|
|
#if defined( __WXMSW__ )
|
|
|
|
PostSizeEvent();
|
|
|
|
#endif
|
2018-06-30 22:38:04 +00:00
|
|
|
}
|
|
|
|
|
2018-11-04 16:37:29 +00:00
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
void SCH_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
|
|
|
|
{
|
|
|
|
EDA_DRAW_FRAME::SetScreen( aScreen );
|
|
|
|
auto c = static_cast<SCH_DRAW_PANEL*>(m_canvas);
|
|
|
|
c->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
|
|
|
|
}
|
|
|
|
|
2018-11-04 16:37:29 +00:00
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
const BOX2I SCH_EDIT_FRAME::GetDocumentExtents() const
|
|
|
|
{
|
|
|
|
int sizeX = GetScreen()->GetPageSettings().GetWidthIU();
|
|
|
|
int sizeY = GetScreen()->GetPageSettings().GetHeightIU();
|
|
|
|
|
|
|
|
return BOX2I( VECTOR2I(0, 0), VECTOR2I( sizeX, sizeY ) );
|
|
|
|
}
|