Don't edit sheet during AddToScreenAndUndoList() call. If it's
cancelled and we delete the item, callers will still own pointers
to the freed memory. Do it in New and Paste instead.
When importing an existing schematic into a sheet that was no remapped
to use the symbol library table, the user was given the option to ignore
the warning and proceed with the import. This would end up with all of
the imported symbol links being broke. In hindsight, this was a bad
idea so now the user cannot import schematics that have been remapped.
Fixes lp:1791280
https://bugs.launchpad.net/kicad/+bug/1791280
Previously, when creating a new instance of a sheet, the full set of references
was cleared.
Moreover, if this sheet has sub-sheets, the annotation was incorrectly handled
Now only (and all) new sheet path(s) created have a reference cleared, as expected.
(new sheet paths can be more than one, if the new instance of the sheet has sub-sheets)
Fixes: lp:1789048
https://bugs.launchpad.net/kicad/+bug/1789048
For the path separator in full filename, the sheet filename from the dialog uses the Unix notation,
and the "old" sheet filename uses the default notation (it is the actual filename).
Therefore, on Windows, after closing the dialog, the filename was always seen as modified,
and the hierarchy was incorrectly modified (annotation cleared).
The messages on sheet duplication are changed to reflect the action
perceived by the user when accepting/rejecting the change.
Annotation is also reset for duplicating sheets where maintaining
existing annotation would conflict with existing sheets.
Renaming a subsheet but keeping the filename should not present a
warning to the user. The was triggered due to comparing a
fully-qualified filename to a relative filename.
Fixes: lp:1744475
* https://bugs.launchpad.net/kicad/+bug/1744475
With the implementation of the legacy schematic plugin, any I/O error
when parsing the schematics would prevent the entire schematic from
being loaded. This change restores (somewhat) the previous behavior
where as long as the root schematic is loaded properly, then all of
the remaining sub-sheet will attempt to load.
Add GetError() method the SCH_PLUGIN object to allow for partial
schematic loading.
Check the error message contents when no exception was caught to warn
the user of any accumulated errors.
Fixes lp:1690644
https://bugs.launchpad.net/kicad/+bug/1690644
Use the legacy plugin schematic loader in the sheet edit and append
schematic code paths.
Check for fully qualified LIB_ID objects (must have library nickname)
when loading existing schematics when edit sheets.
Rewrite append schematic feature to handle import issues rather than
change the name and file name of all of the sheets in the imported
schematic. This includes the following:
- Load the schematic into a temporary SCH_SHEET object.
- Make sure the imported schematic does not cause any hierarchy
recursion issues.
- Verify the imported schematic uses fully qualified #LIB_ID objects
(symbol library table).
- Check to see if any symbol libraries need to be added to the current
project's symbol library table. This includes:
- Check if the symbol library already exists in the project or global
symbol library table.
- Convert symbol library URLS that use the ${KIPRJMOD} environment
variable to absolute paths. ${KIPRJMOD} will not be the same for
this project.
- Check for duplicate symbol library nicknames and change the new symbol
library nickname to prevent library name clashes.
- Update all schematic symbol LIB_ID object library nicknames when the
library nickname was changed to prevent clashes.
- Check for duplicate sheet names which is illegal and automatically
rename any duplicate sheets in the imported schematic.
- Clear all of the annotation in the imported schematic to prevent
clashes.
- Append the objects from the temporary sheet to the current page.
- Replace any duplicate time stamps.
- Refresh the symbol library links.
Add support code to SCH_SCREEN object to assist with schematic import.
Doxygen comment cleaning.
Fixes lp:1731760
https://bugs.launchpad.net/kicad/+bug/1731760
Calculate the proper minimum height when resizing sheets to prevent resized
sheet height from always increasing.
Prevent the sheet pins from being drawn in the corners of the sheet when
updating the edge constraints on resize. This ensures that the sheet pin
is always drawn within the bounds of the sheet. Please note that this fix
may not be 100% accurate as is assumes the default grid size of 50 mils.
This may not be what the user expected but it guarantees that wires will
connect to the pin properly.
Fixes lp:1699796
https://bugs.launchpad.net/kicad/+bug/1699796
* Derive SCH_SHEET_LIST from std::vector rather than using internal array
management. Change all internal code to use iterators or array operator
in loops.
* Allow creation of empty SCH_SHEET_LIST for external population for plotting
and printing.
* Clean up print an plot code to take advantage of new SCH_SHEET_LIST behavior.
* Make BuildSheetList() public so list can be populated after creation.
* Update all instances of SCH_SHEET_LIST with the appropriate SCH_SHEET
object on initialization.
* Create const and non-const version of SCH_SHEET_PATH::GetSheet().
* Move FindSheetByName() function from SCH_SHEEET_PATH to SCH_SHEET object
and update calls to FindSheetByName() accordingly.
* Remove SCH_SHEET_PATH::FindSheet() which was unused.
* Add sorting option to SCH_SHEET::GetSheets().
* Add const and non-const version of GetRootSheet() to SCH_SHEET.
* Add GetSheetPaths() function to SCH_SHEET which behaves the same way
as SCH_SHEET_LIST except it uses standard C++ containers and is a much
simpler design.
* Add code to test for sheet path recursion to SCH_SHEET_PATH and SCH_SHEET_LIST.
* Add recursion tests to edit sheet code in Eeschema.
* Add recursion tests to block paste code in Eeschema.
Fix a i18n issue in field names when loading a component, if the language was changed during a session, and kicad not restarted (see Bug #1448654).
However changing the language needs restarting kicad, in order to have all messages or menus translated.
* Use "Close" in the file menu of every main frame window instead of the
mismatch of the terms "Close", "Exit", and "Quit".
* Change the terminology in the Pcbnew graphic text edit dialog to match the
module text edit dialog.
* Improve the layout of the Pcbnew graphic text dialog.
* Fix some wxPrintf parameter type assertions for 64 bit time_t.
* Fix all (at least I think I got all of them) duplicate menu accelerator
characters.
Move items rework: enhancements: for some items (sheets, components, bus entries) the mouse cursor is no more wrapped to the anchor. For large symbols, this is better: they are more easy to place.
There is also a change when starting a move item command: the full screen is redraw, and therefore there is no artifact due to the XOR draw mode.
Some other minor coverity fixes (uninitialized members).
* move not shared files (sch_item_struct.*, sch_base_frame.h) to eeschema;
* move wxEeschemaStruct.h to eeschema and rename it schframe.h to be consistent with the other corresponding file name schframe.cpp;
* remove few not needed #include
* Refresh canvas when user cancels edits so that the discarded sheet is
cleared from the schematic.
* Add file name validation to the sheet properties dialog to prevent
illegal file name characters from being entered into the text control.
* Rename FOOTPRINT_NAME_VALIDATOR to FILE_NAME_CHAR_VALIDATOR for clarity.
*) 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.
*) 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.
SVG plot, fix a missing reinitialization in plot lines, which could define a filled polyline, instead of a simple polyline
(these fixes solve Bug #1313084 )
! 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.
was simply a pointer to an object on the display list. At times this object
would disappear from the display list, in the test case because of a concatonation
of two wires, and if you then tried to clone the non-existent object you'd get a
crash. This was not merely a bug, but a naive design choice. IMO.
Now the item to repeat is cloned, so will never also be on the display list.
*) add hotkey for setting the grid origin as 'S', in board editor, module editor.
*) re-position the function interface for cursor movement from BASE_SCREEN into
class EDA_DRAW_FRAME. This is a prelude to getting rid of BASE_SCREEN or
splitting it up.
In most case the assignment to null was not necessary since it was easily provable that the (local) variable wouldn't have referenced after that anyway.
// This provides better project control over rounding to int from double
// than wxRound() did. This scheme provides better logging in Debug builds
// and it provides for compile time calculation of constants.
#include <stdio.h>
#include <assert.h>
#include <limits.h>
//-----<KiROUND KIT>------------------------------------------------------------
/**
* KiROUND
* rounds a floating point number to an int using
* "round halfway cases away from zero".
* In Debug build an assert fires if will not fit into an int.
*/
#if defined( DEBUG )
// DEBUG: a macro to capture line and file, then calls this inline
static inline int KiRound( double v, int line, const char* filename )
{
v = v < 0 ? v - 0.5 : v + 0.5;
if( v > INT_MAX + 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' > 0 ' for int\n", __FUNCTION__, filename, line, v );
}
else if( v < INT_MIN - 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' < 0 ' for int\n", __FUNCTION__, filename, line, v );
}
return int( v );
}
#define KiROUND( v ) KiRound( v, __LINE__, __FILE__ )
#else
// RELEASE: a macro so compile can pre-compute constants.
#define KiROUND( v ) int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 )
#endif
//-----</KiROUND KIT>-----------------------------------------------------------
// Only a macro is compile time calculated, an inline function causes a static constructor
// in a situation like this.
// Therefore the Release build is best done with a MACRO not an inline function.
int Computed = KiROUND( 14.3 * 8 );
int main( int argc, char** argv )
{
for( double d = double(INT_MAX)-1; d < double(INT_MAX)+8; d += 2.0 )
{
int i = KiROUND( d );
printf( "t: %d %.16g\n", i, d );
}
return 0;
}
* Move all convert from user to internal units into base_units.cpp.
* Remove internal units parameters from all moved conversion functions.
* Revise all source code that calls the moved conversion functions.
* Remove internal units from all dialog text control helper classes.
* Move all convert from internal to user units functions into separate file.
* Remove internal units parameter from all moved conversion functions.
* Revise all source code that calls the moved conversion functions.
* Compile these conversion routines separately for the appropriate pcb or
schematic internal units.
* Move internal units specific status bar update code into the appropriate
application for updating the status bar.
* Move millimeter user units rounding function to common.cpp.
* Convert Eeschema from manually linked list to DLIST for storing
SCH_ITEM objects.
* Add helper functions to SCH_SCREEN for appending list of SCH_ITEM
objects.
* Fix bug in wire editing code for accurate undo/redo behavior.
* Add member to DLIST to append another DLIST.
* Other minor code cleaning.
* EDA_DRAW_PANEL completely encapsulated.
* Moved OSX m_overlay member from EDA_DRAW_PANEL to EDA_DRAW_FRAME where
it is used.
* Doxygen comment warning fixes.
* EDA_DRAW_FRAME completely encapsulated except for DrawFrame member.
* Moved members specific to Pcbnew from EDA_DRAW_FRAME to PCB_BASE_FRAME
or PCB_EDIT_FRAME as appropriate.
* Replace EDA_TOOLBAR with wxAuiToolBar as EDA_TOOL bar provided no
additional functionality and made code less readable.
* Remove EDA_TOOLBAR class definition from wxstruct.h and delete file
wineda_toolbar.cpp.
* Rename tool bar members to something more descriptive since the
horizontal and vertical references wont mean anything once the
tool bars are movable.
* Lots of dead code removal.
In common.cpp GetTimeStamp is renamed GetNewTimeStamp (a better name).
Pcbnew: prepare work to calculate connections between pads that inteserct and therefore can be connected without any track (composite pads).
* Move the hierarchical label connected test into the NETLIST_OBJECT class.
* ERC pin type strings can now be translated.
* Remove unused EDA_DRAW_PANEL attribute from all ERC test functions.
* Add get marker count method to SCH_SCREENS object.
* Redundant header removal.
* Lots of coding style policy fixes.
* Move code from function ClearProjectDrawList() into SCH_SCREEN object
Clear() method.
* Delete eeschema/delsheet.cpp as none of the code in it is ever called.
* Move global spice and net list command line variables into SCH_EDIT_FRAME
object as priviate members and provide access methods.
* Remove unnecessary header includes from eeschema/sheet.cpp.
* Minor coding policy fixes.
* Fix debug build warning (lp:793373).
* Changed sheet edit restore and undo to use object copy and replace method.
* Add minimum width and height constraints when resizing sheets that have
hierarchical pins.
* Fix drag sheet hot key bug.
* Change Doxygen configuration to extract private methods and members
when creating documentation.
* Fix a bunch of Doxygen comment warnings.
* Move undo item copy global variable into schematic editor frame object
member variable.
* Add helper methods for accessing the undo item copy member variable.
* Fix undetected bug when changing a text type.
* Added an exchange command to the undo/redo base class for handling undoing
a changed item type which cannot be undone by swapping out the variables.
* Revert change to common/hotkeys_basic.cpp that broke hot key behavior.
* Lots of coding policy changes while making the changes above.
* Change all code references to pin sheet and sheet label to sheet pin to
more closely match the sheet pin object for improved code readability.
* Change menu and tool bar text from pin sheet to sheet pin for improved
user readability.
* Moved sheet pin place method to sheet pin object source file.
* Move last sheet pin stored state information into schematic frame object.
* Add Doxygen comments for the sheet pin editing methods.
* Old control state handling code completely removed in all applications.
* Factor common control state handlers into EDA_DRAW_FRAME.
* Replaced EDA_ITEM test for newness with IsNew() method.
* Factor vertical right toolbar command handlers out of giant edit command
switch statement in EESchema and PCBNew.
* Rename all member variables and methods that reference the cross hair
code in draw panel object from cursor to cross hair to eliminate confusion
between the two concepts.
* Rename cursor capture call backs in draw panel object to improve code
readability.
* Create helper class for turning off the cross hair while drawing.
* Remove redundant block clear code.
* Remove redundant mouse capture call back reset code when end capture
call back is called.
* Remove unused function definitions in base draw frame object.
* Lots of minor coding policy and doxygen comment fixes.
* Changed managed cursor callback definition to include the current
cursor drawing position.
* Modified all managed cursor callbacks to match new definition.
* Added snap to grid option to base drawing frame object.
* Changed add no connect managed cursor callback to use new position
parameter instead of the stored one.
* Lots of coding policy fixes.
* Move schematic wire and bus break code into schematic screen object.
* Move schematic test for dangling ends into schematic screen object.
* Remove left over debugging output in schematic screen object.
* Remove unused file eeschema/cleanup.cpp.
* Fix bug in schematic line object hit test algorithm.
* Fix a string concatenation compile error added in r2752.
* Rename class WinEDA_BasicFrame to EDA_BASE_FRAME.
* Rename class WinEDA_DrawFrame to EDA_DRAW_FRAME.
* Rename class WinEDA_DrawPanel to EDA_DRAW_PANEL.
* Encapsulate file name member of base screen object.
* Encapsulate associated screen member of schematic sheet object.
* Create add screen method to schematic sheet object to simplify setting
the associated screen.
* Move the change file name code in the schematic sheet object to the edit
sheet method in the schematic editor frame object to eliminate message
dialogs.
* Improve reference counting in schematic screen object.
* Add helper type definitions for changing schematic object storage to C++
containers.
* Rename sch_item files to sch_junction.
* Make global variable g_ItemToRepeat a private member of SCH_EDIT_FRAME
object.
* Encapsulate SCH_SCREEN reference count member.
* Move update block pick list code to SCH_SCREEN object.
* Remove redundant drawing function RedrawOneStruct().
* Change context menu text "Noconn" to "No Connect".
* Change context menu text "GLabel" to "Global Label".
inches and mm, the industry is crazy enough to force us with mixed
design. For example I routinely use imperial units for track size and
clearance, but drilling is strictly a metric issue...
So I added a little parser to recognize a suffix specification in the
unit text boxes... so you can put in things like:
1in (1 inch)
1" (idem)
25th (25 thou)
25mi (25 mils, the same)
6mm (6 mm, obviously)
The rules are: spaces between the number and the unit are accepted, only
the first two letters are significant.
As a bonus, it also recognize the period (.) as a decimal point
substituting it with the correct locale character (there was a wishlist
for it, IIRC). Most useful for number pad fans :D
* Continue component library class clean up and encapsulation work.
* Change hierarchical sheet label container to boost::vector_ptr.
* Encapsulate hierarchical label handling in hierarchical sheet class.
* Convert some missed occurrences of wxString::GetData() to GetChars( wxString ).
* Fix some minor code formatting issues.