← Back to team overview

kicad-developers team mailing list archive

Patch to add hotkey for Zoom auto, and a fix to WinEDA_DrawFrame::OnZoom


---511572392-735779010-1254052233=:8144 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

The attached patch adds the Home key as hotkey
for "Zoom auto" everywhere in kicad, i.e.:

* eeschema, including the library editor and browser,
* pcbnew and the module editor,
* cvpcb (The "View selected footprint" window),
* gerbview.

The eeschema library browser didn't have any zoom hotkeys
at all, so those (i.e. F1 to F4) have also been added.

I've also changed the popup names for the Zoom keys in
cvpcb, to make them consistent with the rest of kicad.

Also, the "3D Display" button in cvpcb was labelled
"1:1 zoom", which is clearly a (cut-n-paste) mistake.

With this patch, all parts of kicad uses the following
zoom hotkeys (unless changed with a hotkey config file :-):

F1: Zoom in
F2: Zoom out
F3: Redraw view
F4: Zoom center
Home: Zoom auto

Someone has recently added F4 as "Zoom auto" in the eeschema
library browser (it's not present in kicad stable 2009-02-16).

As F4 is "Zoom center" everywhere else, IMHO it's much
better to keep that use consistent, and instead use
the "new" Home key as "Zoom auto" there as well :-)

I've also changed WinEDA_DrawFrame::OnZoom in common/zoom.cpp:

--- common/zoom.cpp (revision 1973)
+++ common/zoom.cpp (working copy)
@@ -152,7 +152,12 @@

- Zoom_Automatique( false );
+ // With Zoom_Automatique(), the "Zoom Auto" button (and hotkey)
+ // does nothing if the view is already at the correct
+ // zoom level, but needs to be shifted (centered).
+ //Zoom_Automatique( false );
+ GetBaseScreen()->SetZoom( BestZoom() );
+ Recadre_Trace( false );


Without this change, the "Zoom auto" button and the Home key
doesn't work (does nothing) if the view is already at the
correct zoom level, but needs to be shifted (centered).

My first approach was to add a "Recadre_Trace( false );" after
the "Zoom_Automatique( false );", but that updates the view twice
if the zoom level does need changing, so that's not a good idea.

Maybe, there's a better way of fixing this problem,
and if so, please change my code appropriately :-)


Quidquid latine dictum sit, altum viditur. ---511572392-735779010-1254052233=:8144 Content-Type: TEXT/x-diff; charset=US-ASCII; name=kicad-zoom.patch
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.64.0909271350330.8144@...>
Content-Disposition: attachment; filename=kicad-zoom.patch

[Attachment content not displayed.] ---511572392-735779010-1254052233=:8144-- 

Follow ups