Commit Graph

110 Commits

Author SHA1 Message Date
jean-pierre charras f52763f22b Legacy canvas: fix issue when zooming in/out using mousewheel: slightly shifts screen up/down.
It happens only when the 'warp and center cursor on zoom' option is disabled.

Was created after modifying the code in EDA_DRAW_FRAME::AdjustScrollBars(),
making EDA_DRAW_FRAME::RedrawScreen2() not working very well.

(partial fix of bug 1562173)
2018-06-19 19:53:00 +02:00
jean-pierre charras 0171547154 Context menu: use same message for Zoom and Grid in Legacy mode and GAL mode.
a minor cosmetic other fix in Eeschema, edit submenu.
2018-04-01 21:09:52 +02:00
jean-pierre charras e750417fa0 Eeschema: fix many wxASSERT when trying to open menus from the main menubar.
This is due to the fact the same ID was used for menuitems in menubar,
and tools in toobars.
Especially, some items were not compatible due to different attributes.

Windows does not accept the same ID for 2 items inside the same frame.
It creates issues (items not shown, Asserts, ...)
2018-04-01 20:58:27 +02:00
Wayne Stambaugh 8d8c422a19 Add zoom to selection menu entry to all editors.
Fixes lp:1753339

https://bugs.launchpad.net/kicad/+bug/1753339
2018-03-25 12:34:19 -04:00
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
Jeff Young 1afbfad44a Use "..." uniformly in menus.
See the bug report for some wording changes and a couple of
menu restructurings that were also cleaned up.

Fixes: lp:1597827
* https://bugs.launchpad.net/kicad/+bug/1597827
2018-02-10 17:32:28 -05:00
jean-pierre charras d0754acf00 Fix code after renaming files 2018-01-29 11:37:29 +01:00
Wayne Stambaugh f4273b9e41 Fix coding policy fixes from previous commit along with a few others. 2018-01-27 20:34:14 -05:00
Martin Sivak d5cdd78062 eeschema: keystroke zoom should obey disabled centering
Keystroke zoom (F1/F2) always centered the screen, because it
was handled as ID_POPUP_ZOOM_IN event. Mousewheel scrolling
was ok, because it is handled using different event based
on the configuration.

This patch introduces special event ids for keystroke
zooming that are then properly translated to either
ID_POPUP_ZOOM_IN or ID_OFFCENTER_ZOOM_IN depending
on the configuration.

The same issue is fixed for legacy canvas pcbnew.

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

Signed-off-by: Martin Sivak <mars@montik.net>
2018-01-27 20:20:32 -05:00
jean-pierre charras 2de913797a Fix a UI policy issue. Very minor cosmetic change: give same look to Zoom and Grid selection in 2 menus. 2017-01-20 11:35:24 +01:00
jean-pierre charras adb679dc46 ROUTER_TOOL_MENU: add zoom selection to this menu. 2017-01-20 08:51:12 +01:00
jean-pierre charras e710b8b370 Fix incorrect parameter type when appending zoom and grid menuitems 2017-01-19 20:26:57 +01: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
jean-pierre charras 37b0868376 Pcbnew: fix minor issues about fast grid switching, and next/previous grid selection from hotkeys. (GAL mode still has an issue) 2015-05-12 11:05:36 +02:00
jean-pierre charras 5a02b91e5f Fix some issues created by rev 5632:
*  Use only double to store zoom levels in class BASE_SCREEN (int type is not working for eeschema or page layout editor) (this fix Bug #1450551, Assertion failed on wxRound() when zooming)
*  Fix crash in all apps but Pcbnew when a grid or a zoom was selected from the popup menu.
*  Modify default hotkeys for Next Grid and Previous Grid: the initial key was a dead key, not suitable as hotkey. the 'N' and Shift N keys are used instead (with a change for unfill zone hotkey)
*  Modify code in EDA_DRAW_FRAME::SetNextGrid() and EDA_DRAW_FRAME::SetPreviousGrid() to make them compatible with other editors than the board editor.
2015-05-01 11:31:23 +02:00
Maciej Suminski 47582e2741 GAL autozooms on every EDA_DRAW_FRAME::Zoom_Automatique 2015-04-30 10:46:08 +02:00
Maciej Suminski c4888afbcc Refactored the way GAL handles zoom settings. 2015-04-30 10:46:02 +02: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 ad74a9a191 Pcbnew: better display of tracks/vias/grid sizes in toolbar 2015-01-05 14:20:04 +01:00
jean-pierre charras d82f403fd7 Libview and Modview: fix issues relative to hotkeys (hardcoded keys instead of user defined keys) and not working tools and popup menus.
Fix also some minor coding style issues.
2014-10-15 13:40:38 +02:00
Maciej Suminski ba275918e3 Renamed [class_]drawpanel_gal.[cpp|h] to [class_]draw_panel_gal.[cpp|h] to follow current naming scheme. 2014-04-04 11:56:04 +02:00
Maciej Suminski 23392ce8c9 Upstream merge. 2014-04-02 15:38:59 +02:00
Maciej Suminski 60e9546b62 PCB_EDIT_FRAME::SetHighContrastLayer() went public.
Refactored code that handled zooming events.
Added PCB_RENDER_SETTINGS::Get/SetSketchMode().
PCBNEW_CONTROL reacts to hot keys changing display modes (sketch via/tracks, high contrast).
2014-03-24 17:20:23 +01:00
Maciej Suminski dbc4a8f292 GAL zooms in and out using the default hot keys (F1/F2).
Screen size is saved in VECTOR2I instead of VECTOR2D.
2014-03-20 08:47:31 +01:00
Dick Hollenbeck 2c67c3ff80 * KIWAY Milestone A): Make major modules into DLL/DSOs.
!   The initial testing of this commit should be done using a Debug build so that
    all the wxASSERT()s are enabled.  Also, be sure and keep enabled the
    USE_KIWAY_DLLs option.  The tree won't likely build without it.  Turning it
    off is senseless anyways.  If you want stable code, go back to a prior version,
    the one tagged with "stable".

*   Relocate all functionality out of the wxApp derivative into more finely
    targeted purposes:
    a) DLL/DSO specific
    b) PROJECT specific
    c) EXE or process specific
    d) configuration file specific data
    e) configuration file manipulations functions.

    All of this functionality was blended into an extremely large wxApp derivative
    and that was incompatible with the desire to support multiple concurrently
    loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
    An amazing amount of organization come from simply sorting each bit of
    functionality into the proper box.

*   Switch to wxConfigBase from wxConfig everywhere except instantiation.
*   Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
    PGM_SINGLE_TOP,
*   Remove "Return" prefix on many function names.
*   Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
*   Fix building boost for use in a DSO on linux.
*   Remove some of the assumptions in the CMakeLists.txt files that windows had
    to be the host platform when building windows binaries.
*   Reduce the number of wxStrings being constructed at program load time via
    static construction.
*   Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
    these functions are useful even when the wxConfigBase comes from another
    source, as is the case in the KICAD_MANAGER_FRAME.
*   Move the setting of the KIPRJMOD environment variable into class PROJECT,
    so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
*   Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
    its child wxFrames and wxDialogs now have a Kiway() member function which
    returns a KIWAY& that that window tree branch is in support of.  This is like
    wxWindows DNA in that child windows get this member with proper value at time
    of construction.
*   Anticipate some of the needs for milestones B) and C) and make code
    adjustments now in an effort to reduce work in those milestones.
*   No testing has been done for python scripting, since milestone C) has that
    being largely reworked and re-thought-out.
2014-03-19 19:42:08 -05:00
Dick Hollenbeck 517ca83fbc Hide m_galCanvas and m_galCanvasActive behind accessors. Fix DLIST concatonation API corner case. 2013-12-26 16:36:43 -06:00
Maciej Suminski 0ac3e1fbf2 Namespace KiGfx->KIGFX.
template<> -> template <>
Some more reformatting according to uncrustify results.
2013-10-14 16:13:35 +02:00
Maciej Suminski a991cb4470 Changed the way of refreshing canvases (both standard & GAL). 2013-09-20 17:29:32 +02:00
Maciej Suminski c00533a150 Merged kicad-gal 2013-09-20 15:48:27 +02:00
Maciej Suminski ab4cb862b0 Solved refreshing issues. 2013-09-06 11:31:16 +02:00
Maciej Suminski d15f0e91e2 Upstream merge. 2013-08-05 14:46:05 +02:00
Dick Hollenbeck efb34166ea *) retain grid origin in the BOARD and save it in legacy and kicad board files.
*) 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.
2013-08-03 00:15:23 -05:00
Maciej Sumiński 07781d34be Removed KICAD_GAL CMake option. 2013-07-07 02:30:28 +02:00
Maciej Suminski 0baa580b8d Added zoom in, zoom out & fit on screen view commands handling in GAL. 2013-06-25 09:15:57 +02:00
Maciej Suminski 820e6e5e16 Introduced Cairo-based rendering backend using GAL.
Moved switching canvas routines to pcbnew, as they are used only there right now (otherwise libgal would have to be linked to every Kicad application).
2013-04-15 17:57:03 +02:00
Maciej Suminski e262b32198 Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
    - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
    - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
    - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
    - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
    - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
    - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
    - STROKE_FONT - Implements stroke font drawing using GAL methods.
                          
Most important changes to Kicad original code:
    * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
    * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
    * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
    * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
    * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
    * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
    * Removed tools/class_painter.h, as now it is extended and included in source code.
                         
Build changes:
    * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
    * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
    * GAL-related code is compiled into a static library (common/libgal).
    * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
                            
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 08:54:03 +02:00
jean-pierre charras 4343eb5b8d Fix Bug #1132416. Minor update in templates. 2013-02-24 18:31:18 +01:00
Emmeran 226b877ab9 tabs converted to spaces except wxstruct.h 2013-02-12 04:56:46 +01:00
Emmeran 0bdf5bac72 added option to allow zooming around the crosshair instead of the center; can be enabled via options or by holding alt while using the mousewheel 2013-02-02 20:10:48 +01:00
jean-pierre charras b660b033ad All: remove macros MAX, MIN, ABS from macros.h and replace these macros by std::max, std::min and std::abs (mainly found in old code). 2012-09-22 13:19:37 +02:00
Dick Hollenbeck 40ccdd5763 Fix Pcbnew markers in nanometer build with proper scaling factor. Use double in Zoom() 2012-05-07 16:47:25 -05:00
Dick Hollenbeck 86e04b4fb3 more nanometer work, see comment at line 66 of pcbnew/classpcb.cpp 2012-05-06 15:10:43 -05:00
Jerry Jacobs 5f5c504288 Cosmetic UI changes mostly for Mac OS X, see CHANGELOG.txt 2012-05-05 18:02:09 +02:00
Dick Hollenbeck 33616f3051 * Add DRECT, DPOINT, and DSIZE (double rect, point, and size) using Torsten's vector2d.h
as a starting point
* Make double Distance() take double arguments and remove internal range checking.
* Start on EDA_DRAW_FRAME::AdjustScrollBars() and use "double" for most all calculations
  in anticipation of setting INT_MAX INT_MIN limits eventually.
2012-04-23 16:56:26 -05:00
Wayne Stambaugh 57d75a75a8 More internal unit improvements.
* 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.
2012-04-13 14:51:24 -04:00
jean-pierre charras 8f62c6aa05 Move AddMenuItem inline functions outside wxstruct.h in a new file (menu_helpers.h)
Enhancements in AddMenuItem (that accepts now a menu type)
Partial use of the Edwin van den Oetelaar's patch (patch not fully working or correct)
2012-04-09 11:16:47 +02:00
Dick Hollenbeck b8a0ab4c52 switch to <> for includes from "" per conversation with Jean-Pierre and Wayne, adjust search paths 2012-01-22 22:33:36 -06:00
Wayne Stambaugh c2e5fcaec8 More encapsulation improvements.
* EDA_DRAW_FRAME completely encapsulated.
* Encapsulate the the low hanging fruit in EDA_DRAW_PANEL.
2011-12-22 08:28:11 -05:00
Wayne Stambaugh fac288cffa More encapsulation work and other minor improvements.
* 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.
2011-12-16 08:32:23 -05:00
Wayne Stambaugh 4a7dc4ad03 Add menu item function fixes and other minor improvements.
* Rename all ADD_MENUITEM_* functions to AddMenuItem and move them to
  wxstruct.h since they are used by the Kicad main frame classes.
* Move SET_BITMAP and SETBITMAPS definitions to wxstruct.h.
* Fix a bug in SET_BITMAPS that prevented enabling menu item images on
  OSX.
* Rename MsgItem to EDA_MSG_ITEM.
* Remove redundant includes from modified files.
* Doxygen and coding style policy fixes.
2011-09-01 08:54:34 -04:00