Commit Graph

54 Commits

Author SHA1 Message Date
Jeff Young 4bae901dc8 Centralize zoom-to-fit code.
Fixes a bunch of errors:
- libedit and libbrowser would zoom to bounding box but centre on canvas
- libedit, libbrowser and gerbview didn’t take the scroll bars into account
- pcbnew didn’t take scroll bars into account or apply the 10% margin
- appending a board file would re-centre, but not re-zoom

Fixes: lp:1504302
* https://bugs.launchpad.net/kicad/+bug/1504302
2018-02-13 20:06:03 -05:00
jean-pierre charras 5d72aebd22 Fix code after renaming files 2018-01-29 16:40:22 +01:00
Maciej Suminski da305e7750 Move SwitchCanvas() implementation to EDA_DRAW_FRAME
Share more code between pcbnew and gerbview. Fix warnings regarding
shadowing EDA_DRAW_FRAME::SwitchCanvas().
2018-01-22 09:06:55 +01:00
Maciej Suminski d87a7ae58e Fallback to Cairo when OpenGL is not supported
Fixes: lp:1741787
* https://bugs.launchpad.net/kicad/+bug/1741787
2018-01-18 10:17:06 +01:00
Jon Evans b21f301097 Defer canvas type setting save until destruction of EDA_DRAW_FRAME
Fixes: lp:1741787
* https://bugs.launchpad.net/kicad/+bug/1741787
2018-01-18 10:17:06 +01:00
Jon Evans 2dec95b4e6 Add a first-run dialog to encourage user to switch to OpenGL 2018-01-04 10:14:40 -05:00
Jon Evans 0564d3456b Preserve color scheme when switching to legacy (Fixes lp:1670669)
Instead of modifying the colors when switching to legacy canvas,
they will now be preserved and only returned as the "legacy" colors.
2017-11-28 10:47:04 +01:00
jean-pierre charras 4905bbe500 hotkey management: enhancements in code to know if a hotkey was handled by an event or not.
No actual change in key management: in legacy it was partially existing, and not yet used in GAL mode.
2017-10-06 09:23:13 +02:00
Maciej Suminski 05a120f09f Unified {Load,Save]CanvasTypeSetting in EDA_DRAW_FRAME 2017-09-25 13:39:32 +02:00
Jon Evans 460b1e8540 Move forceColorsToLegacy() to EDA_DRAW_FRAME as virtual method 2017-09-25 13:35:01 +02:00
Wayne Stambaugh 427e5ec461 Eeschema: fix crash when undo called during item edit.
Add EDA_DRAW_FRAME::isBusy() method to test if the current item is being
edited or a block operation is in progress.

Ignore undo and redo commands when editor is busy.

Fixes lp:1718656

https://bugs.launchpad.net/kicad/+bug/1718656
2017-09-21 12:37:52 -04:00
Jon Evans eec1366ead Move ZOOM_TOOL to common; add RMB-drag to zoom out 2017-08-31 10:04:00 +02:00
Tomasz Włostowski 32185ddcd3 Multiple improvements concerning colors, configuration handling and legacy features in pcbnew:
- support for background color setting
    - removed several global config settings (such as g_Drc_On)
    - wrapped most of global config settings in PCB_GENERAL_SETTINGS class
    - reorganized PCB general options dialog to clearly mark which options concern only the legacy canvas
    - new GAL feature for legacy users: double-click (or E) to change track width available as an option.

Fixes: lp:1530543
* https://bugs.launchpad.net/kicad/+bug/1530543

Fixes: lp:1707145
* https://bugs.launchpad.net/kicad/+bug/1707145
2017-08-04 16:06:57 +02:00
Wayne Stambaugh 66e97fa905 Doxygen comment improvements.
Fix lots of Doxygen warnings.

Fix Doxygen comment for IO_MGR::FootprintEnumerate() which was recently
changed.
2017-06-13 19:47:46 -04:00
jean-pierre charras 1ada4863fc Pcbnew: fix incorrect UI behavior of "Zoom to selection" tool in GAL canvas. 2017-06-13 09:24:21 +02:00
jean-pierre charras 6ed4f9b208 Make EDA_DRAW_FRAME::SetToolID and mouse cursor shape setting working in GAL canvases, and uses same mouse cursor shapes in legacy and gal canvases.
Starting fixing incorrect UI behavior of Zoom to selection in Pcbnew.
2017-06-12 15:16:09 +02:00
John Beard 27374c0aa3 Move file locking utilities to a separate file
The global ::LockFile() function is used in a single place, but it's in
common.h, so visible to all files.

The GetKicadLockFilePath function is used in only two places, and one of
them is LockFile.

This commit puts them both in a separate header, so they're only visible
to code using them.

The implementation of GetKicadLockFilePath is moved to lockfile.cpp,
where LockFile already was.

Also removed a (large) handful of wxT macros, which aren't needed any
more and make code less readable.
2017-03-23 09:23:45 -04:00
John Beard b8edecc10f Move cursor shape flag into GAL settings
The motivation here is to concentrate display options in the GAL display
settings, ready for removal of legacy canvases. Instead of having the
property as a member of the DRAW_FRAME, with the GAL canvas retreiving
it from there, it is now in the GAL_DISPLAY_OPTIONS struct, and both GAL
and legacy get it from there.

The options for setting cursor shape are then moved out of the general
options dialog, and into the GAL display options widget, where they can
be used in all GAL-aware programs.

GAL cursor shape works on GAL, but not legacy, so the option is now
available on OSX (but only affects GAL, and is labelled as such).
2017-03-22 10:24:48 +01:00
Jon Evans a52250a91e Change from EDA_COLOR_T to COLOR4D globally; arbitrary color support
eeschema now supports arbitrary colors for all object types, and
pcbnew does in GAL canvas.  When switching from GAL to legacy canvas,
pcbnew will convert colors to the nearest legacy color.
2017-02-22 17:35:00 +01:00
Jon Evans 167f45ca2b Refactor COMMON_ACTIONS into a base and derived class
New virtual class ACTIONS is added as a member to EDA_DRAW_FRAME so
that the TOOL_DISPATCHER can have access to the appropriate derived
version of TranslateLegacyId()
2017-02-22 10:32:48 +01:00
John Beard cdfcc9a2ab Put draw_frame.h GAL_DISPLAY_OPTIONS behind firewall
The GAL_DISPLAY_OPTIONS member of EDA_DRAW_FRAME is a private member and
is used in only a couple of places in the class. The real use of this
member is by a by-ref interface, GetGalDisplayOptions.

Because te GAL options are used by a very select few users of
EDA_DRAW_FRAME, it makes little sense to force all the (many) files
including draw_frame.h to also include gal_display_options.h, when the
vast majority have no need for it.

This massively speeds up compilation of the project when
gal_display_options.h is changed.

More isolation could be acheived by separating the GAL config types (eg
OpenGL antialias modes and grid style) from the options header, as,
although the GAL class uses them, not many includers of the GAL header
need the options struct as well.
2017-02-20 10:52:33 +01:00
decimad 77138e3702 Add UI control to set up gal opengl antialiasing and load/store the settings 2017-01-11 16:20:37 +01:00
Simon Richter 59c81976dc Explicitly mark overriding functions. 2016-09-24 14:53:15 -04:00
Ian Roth 7ad2f37391 Add %L formatter to worksheets to print layer name. 2016-09-10 14:23:59 -04:00
Chris Pavlina 8c01318141 Add zoom-to-selection tool 2016-06-08 07:19:53 -04:00
Chris Pavlina c490e7dd06 Fix typing problems with GR_KB_* constants 2016-01-20 07:11:17 -05:00
Simon Wells 09ef795a02 Minor coding style fixes in headers 2016-01-12 11:33:33 -05:00
Jon Neal 0aa9fad668 Push UI preferences to child edit and view windows. (fixes lp:1468388)
* Push center on zoom, use middle mouse button to pan, limit panning, and
  pan while moving object settings from schematic editor to symbol library
  editor and symbol library viewer child windows.
* Push center on zoom, use middle mouse button to pan, limit panning, and
  pan while moving object settings from board editor to footprint library
  editor and footprint library viewer child windows.
2015-08-25 10:16:15 -04:00
Chris Pavlina fa29c62277 Fix saving undo/redo limits in Eeschema. 2015-08-05 20:10:52 -04:00
Maciej Suminski c9837595ef Fixed VIEW_CONTROLS too frequent reset. 2015-07-28 10:30:06 +02:00
Maciej Suminski 3cb095b7c2 GAL canvases update status bar, message panel & zoom widget. 2015-07-03 20:58:12 +02:00
jean-pierre charras 1311f81448 Replace wxComboBoxes by wxChoice in auxiliary horizontal toolbar, to try to avoid issues on OSX. 2015-07-02 11:50:38 +02:00
Maciej Suminski 8964ff8922 Hotkey lists displayed after pressing the Help button (GAL). 2015-06-18 17:51:52 +02:00
jean-pierre charras 84ba36fa72 Allows switching GAL or legacy mode in footprint editor (previously, the mode was inherited from the board editor, and was not modifiable without closing the footprint editor) by menu or F9, F11 and F12 keys) 2015-05-19 18:39:05 +02:00
Maciej Suminski da75c52665 Hot keys settings are synchronized between GAL & legacy 2015-05-05 20:39:42 +02:00
Maciej Suminski 025d4cf23a Alternative way of handling grid settings in GAL. 2015-04-30 10:46:04 +02:00
Maciej Suminski c4888afbcc Refactored the way GAL handles zoom settings. 2015-04-30 10:46:02 +02:00
Maciej Suminski 557bb43dd2 Moved TOOL_MANAGER & TOOL_DISPATCHER to EDA_DRAW_FRAME. 2015-04-30 10:46:02 +02:00
jean-pierre charras 9cfb97d8b4 Add hight contrast option in Modedit. In hight contrast mode, solder masks and solder paste are shown.
this option was possible only by modifying the way display options are managed.
before these changes, display options were a global DISPLAY_OPTIONS class instance.
Now each EDA_DRAW_FRAME(and derivated classes)  includes its own DISPLAY_OPTIONS class instance.
As a consequence, some duplicate display option variables in these classes have been removed, because there were just duplicate variables of the  DISPLAY_OPTIONS class instance.
2015-01-10 11:27:49 +01:00
jean-pierre charras 678a763481 Pcbnew: better display of tracks/vias/grid in toolbar. All: modify the zoom value shown in toolbar or status bar (roughly now zoom 1.0 is near the 1:1 scale, on a 22 inches Monitor). Fix also many other minor and very minor issues 2015-01-06 08:38:58 +01:00
jean-pierre charras 9bcdef85cd Eeschema: canvas background color: all frame are now using the same parameter.
fix recent bug which prevent eeschema to save color preferences.
fix few other minor issues.
2014-09-26 12:35:11 +02:00
Dick Hollenbeck 3e861db371 Lock file improvements. 2014-09-07 15:01:26 -04:00
Wayne Stambaugh ec9cd765bc Fix default menu alt key accelerator bug. (fixes lp:1035151)
* Add hot key handled return indicator to DRAW_FRAME::GeneralControl() and
  DRAW_FRAME::OnHotKey() and all classed derived from DRAW_FRAME.
* Add code to all GeneralControl() and OnHotKey() functions to return true if
  hot key was handled.
* Call event skip in DRAW_PANEL::OnKeyEvent() when key event is not handled to
  allow default menu event handler to function properly.
2014-08-29 16:23:40 -04:00
Maciej Suminski 2f6c5f3156 Removed EDA_DRAW_FRAME::SetGalCanvasActive() [it may be misleading], added EDA_DRAW_PANEL_GAL::GetBackend(). 2014-07-09 10:34:00 +02:00
Dick Hollenbeck 1e7495e634 merge 2014-06-30 00:46:18 -05:00
Dick Hollenbeck 4578ea8b9e 1) Add 32 Cu Layers.
2) Change from legacy Cu stack to counting down from top=(F_Cu or 0).
   The old Cu stack required knowing the count of Cu layers to make
   sense of the layer number when converting to many exported file types.
   The new Cu stack is more commonly used, although ours still gives
   B_Cu a fixed number.
3) Introduce class LSET and enum LAYER_ID.
4) Change *.kicad_pcb file format version to 4 from 3.
5) Change fixed names Inner1_Cu-Inner14_Cu to In1_Cu-In30_Cu and their
   meanings are typically flipped.
6) Moved the #define LAYER_N_* stuff into legacy_plugin.cpp where they
   can die a quiet death, and switch to enum LAYER_ID symbols throughout.
7) Removed the LEGACY_PLUGIN::Save() and FootprintSave() functions.
   You will need to convert to the format immediately, *.kicad_pcb and
   *.kicad_mod (=pretty) since legacy format was never going to know
   about 32 Cu layers and additional technical layers and the reversed Cu
   stack.
2014-06-24 11:17:18 -05:00
jean-pierre charras 7c99a242cf Remove 2 global variables: g_DrawBgColor and g_ShowPageLimits.
They are now member of EDA_DRAW_FRAME.
This change could fix Bug #1330781 (Background color change in Eeschema affects background color in Pcbnew)
Show page limits has meaning only for the schematic editor,  the board editor and the page layout editor.
Draw background color selection exists only in eeschema and  page layout editor.
In pcbnew, only a black background is allowed.
A side effect is now the user should set the background color in schematic editor, and the library editor (2 different options).
The default is still the white color.
2014-06-20 13:13:04 +02:00
Lorenzo Marcantonio bee6b9f9b7 Fixes #1186269
- Refactored the common part of cursor key movement and crosshair update
  in the various GeneralControl
- Add x10 movement with the keyboard (CTRL modifier)
- Avoid fixup of the cursor position by dummy mouse movements generated
  by cursor warping (original analysis and idea Chris Gibson)
- Do key handling in a way to permit sub-pixel cursor movement
2014-06-12 18:12:14 +02:00
Maciej Suminski 9536ed811d Upstream merge. 2014-05-05 10:51:31 +02:00
Dick Hollenbeck 991926d320 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 12:40:19 -05:00