2012-04-13 18:51:24 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-01-19 09:51:47 +00:00
|
|
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2018-01-28 01:34:14 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-04-13 18:51:24 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file zoom.cpp
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/*
|
2009-11-23 15:16:50 +00:00
|
|
|
* Manage zoom, grid step, and auto crop.
|
2007-08-20 01:49:24 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <id.h>
|
|
|
|
#include <class_drawpanel.h>
|
2013-06-25 07:15:57 +00:00
|
|
|
#include <view/view.h>
|
2018-01-29 10:37:29 +00:00
|
|
|
#include <base_screen.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 <draw_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <kicad_device_context.h>
|
|
|
|
#include <hotkeys_basic.h>
|
2012-04-09 09:16:47 +00:00
|
|
|
#include <menus_helpers.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2015-04-30 08:46:08 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2013-02-02 19:10:48 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2015-04-30 08:46:02 +00:00
|
|
|
if( IsGalCanvasActive() )
|
|
|
|
return;
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
AdjustScrollBars( aCenterPoint );
|
2010-01-15 10:02:47 +00:00
|
|
|
|
2011-07-09 06:41:32 +00:00
|
|
|
// Move the mouse cursor to the on grid graphic cursor position
|
2011-01-30 22:22:38 +00:00
|
|
|
if( aWarpPointer )
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-07-09 06:41:32 +00:00
|
|
|
|
2013-09-20 15:29:32 +00:00
|
|
|
m_canvas->Refresh();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Update();
|
2012-04-23 21:56:26 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-28 01:34:14 +00:00
|
|
|
|
2013-02-02 19:10:48 +00:00
|
|
|
void EDA_DRAW_FRAME::RedrawScreen2( const wxPoint& posBefore )
|
|
|
|
{
|
2015-04-30 08:46:02 +00:00
|
|
|
if( IsGalCanvasActive() )
|
|
|
|
return;
|
|
|
|
|
2018-01-28 01:34:14 +00:00
|
|
|
// relative screen position to center before zoom
|
|
|
|
wxPoint dPos = posBefore - m_canvas->GetClientSize() / 2;
|
|
|
|
|
|
|
|
// screen position of crosshair after zoom
|
|
|
|
wxPoint newScreenPos = m_canvas->ToDeviceXY( GetCrossHairPosition() );
|
2013-02-12 03:56:46 +00:00
|
|
|
wxPoint newCenter = m_canvas->ToLogicalXY( newScreenPos - dPos );
|
2013-02-02 19:10:48 +00:00
|
|
|
|
|
|
|
AdjustScrollBars( newCenter );
|
|
|
|
|
2013-09-20 15:29:32 +00:00
|
|
|
m_canvas->Refresh();
|
2013-02-02 19:10:48 +00:00
|
|
|
m_canvas->Update();
|
|
|
|
}
|
|
|
|
|
2007-08-20 01:49:24 +00:00
|
|
|
|
2018-02-13 21:19:41 +00:00
|
|
|
// Factor out the calculation portion of the various BestZoom() implementations.
|
|
|
|
//
|
|
|
|
// Note that like it's forerunners this routine has an intentional side-effect: it
|
|
|
|
// sets the scroll centre position. While I'm not happy about that, it's probably
|
|
|
|
// not worth fixing as its days are numbered (GAL canvases use a different method).
|
|
|
|
double EDA_DRAW_FRAME::bestZoom( double sizeX, double sizeY, double scaleFactor, wxPoint centre )
|
|
|
|
{
|
|
|
|
double bestzoom = std::max( sizeX * scaleFactor / (double) m_canvas->GetClientSize().x,
|
|
|
|
sizeY * scaleFactor / (double) m_canvas->GetClientSize().y );
|
|
|
|
|
|
|
|
// Take scrollbars into account
|
|
|
|
DSIZE scrollbarSize = m_canvas->GetSize() - m_canvas->GetClientSize();
|
|
|
|
centre.x -= int( bestzoom * scrollbarSize.x / 2.0 );
|
|
|
|
centre.y -= int( bestzoom * scrollbarSize.y / 2.0 );
|
|
|
|
|
|
|
|
SetScrollCenterPosition( centre );
|
|
|
|
|
|
|
|
return bestzoom;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-04-23 21:56:26 +00:00
|
|
|
BASE_SCREEN* screen = GetScreen();
|
|
|
|
|
2012-05-06 20:10:43 +00:00
|
|
|
// Set the best zoom and get center point.
|
|
|
|
|
2012-05-07 21:47:25 +00:00
|
|
|
// BestZoom() can compute an illegal zoom if the client window size
|
|
|
|
// is small, say because frame is not maximized. So use the clamping form
|
|
|
|
// of SetZoom():
|
|
|
|
double bestzoom = BestZoom();
|
2012-05-06 20:10:43 +00:00
|
|
|
screen->SetScalingFactor( bestzoom );
|
2011-07-09 06:41:32 +00:00
|
|
|
|
2011-03-01 18:45:21 +00:00
|
|
|
if( screen->m_FirstRedraw )
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( GetScrollCenterPosition() );
|
2011-07-09 06:41:32 +00:00
|
|
|
|
2013-12-26 22:36:43 +00:00
|
|
|
if( !IsGalCanvasActive() )
|
2013-08-05 12:46:05 +00:00
|
|
|
RedrawScreen( GetScrollCenterPosition(), aWarpPointer );
|
2015-04-30 08:46:08 +00:00
|
|
|
else
|
|
|
|
m_toolManager->RunAction( "common.Control.zoomFitScreen", true );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:49:24 +00:00
|
|
|
|
2011-03-29 19:33:07 +00:00
|
|
|
void EDA_DRAW_FRAME::Window_Zoom( EDA_RECT& Rect )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-04-23 21:56:26 +00:00
|
|
|
// Compute the best zoom
|
2007-08-20 01:49:24 +00:00
|
|
|
Rect.Normalize();
|
2012-04-23 21:56:26 +00:00
|
|
|
|
|
|
|
wxSize size = m_canvas->GetClientSize();
|
2010-01-12 13:15:13 +00:00
|
|
|
|
2008-04-03 19:38:24 +00:00
|
|
|
// Use ceil to at least show the full rect
|
2012-04-23 21:56:26 +00:00
|
|
|
double scalex = (double) Rect.GetSize().x / size.x;
|
|
|
|
double bestscale = (double) Rect.GetSize().y / size.y;
|
|
|
|
|
2012-09-22 11:19:37 +00:00
|
|
|
bestscale = std::max( bestscale, scalex );
|
2007-08-20 01:49:24 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
GetScreen()->SetScalingFactor( bestscale );
|
2011-02-11 20:48:13 +00:00
|
|
|
RedrawScreen( Rect.Centre(), true );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:49:24 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas == NULL )
|
2010-01-12 13:15:13 +00:00
|
|
|
return;
|
2009-01-07 15:59:49 +00:00
|
|
|
|
|
|
|
int id = event.GetId();
|
2009-01-29 14:26:20 +00:00
|
|
|
bool zoom_at_cursor = false;
|
2011-02-05 02:21:11 +00:00
|
|
|
BASE_SCREEN* screen = GetScreen();
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint center = GetScrollCenterPosition();
|
2007-08-20 01:49:24 +00:00
|
|
|
|
2018-01-28 01:34:14 +00:00
|
|
|
if ( id == ID_KEY_ZOOM_IN )
|
|
|
|
{
|
2018-01-12 10:40:55 +00:00
|
|
|
id = GetCanvas()->GetEnableZoomNoCenter() ?
|
|
|
|
ID_OFFCENTER_ZOOM_IN : ID_POPUP_ZOOM_IN;
|
2018-01-28 01:34:14 +00:00
|
|
|
}
|
|
|
|
else if ( id == ID_KEY_ZOOM_OUT )
|
|
|
|
{
|
2018-01-12 10:40:55 +00:00
|
|
|
id = GetCanvas()->GetEnableZoomNoCenter() ?
|
|
|
|
ID_OFFCENTER_ZOOM_OUT : ID_POPUP_ZOOM_OUT;
|
|
|
|
}
|
|
|
|
|
2007-08-20 01:49:24 +00:00
|
|
|
switch( id )
|
|
|
|
{
|
2013-02-02 19:10:48 +00:00
|
|
|
case ID_OFFCENTER_ZOOM_IN:
|
2013-08-03 05:15:23 +00:00
|
|
|
center = m_canvas->ToDeviceXY( GetCrossHairPosition() );
|
2018-01-28 01:34:14 +00:00
|
|
|
|
2013-02-02 19:10:48 +00:00
|
|
|
if( screen->SetPreviousZoom() )
|
|
|
|
RedrawScreen2( center );
|
|
|
|
break;
|
|
|
|
|
2008-02-17 21:19:13 +00:00
|
|
|
case ID_POPUP_ZOOM_IN:
|
2009-01-07 15:59:49 +00:00
|
|
|
zoom_at_cursor = true;
|
2013-08-03 05:15:23 +00:00
|
|
|
center = GetCrossHairPosition();
|
2010-01-12 13:15:13 +00:00
|
|
|
|
|
|
|
// fall thru
|
2014-10-15 11:40:38 +00:00
|
|
|
case ID_VIEWER_ZOOM_IN:
|
2009-01-07 15:59:49 +00:00
|
|
|
case ID_ZOOM_IN:
|
2012-05-06 20:10:43 +00:00
|
|
|
if( screen->SetPreviousZoom() )
|
|
|
|
RedrawScreen( center, zoom_at_cursor );
|
2009-01-07 15:59:49 +00:00
|
|
|
break;
|
|
|
|
|
2013-02-02 19:10:48 +00:00
|
|
|
case ID_OFFCENTER_ZOOM_OUT:
|
2013-08-03 05:15:23 +00:00
|
|
|
center = m_canvas->ToDeviceXY( GetCrossHairPosition() );
|
2018-01-28 01:34:14 +00:00
|
|
|
|
2013-02-02 19:10:48 +00:00
|
|
|
if( screen->SetNextZoom() )
|
|
|
|
RedrawScreen2( center );
|
|
|
|
break;
|
|
|
|
|
2008-02-17 21:19:13 +00:00
|
|
|
case ID_POPUP_ZOOM_OUT:
|
2009-01-07 15:59:49 +00:00
|
|
|
zoom_at_cursor = true;
|
2013-08-03 05:15:23 +00:00
|
|
|
center = GetCrossHairPosition();
|
2010-01-12 13:15:13 +00:00
|
|
|
|
|
|
|
// fall thru
|
2014-10-15 11:40:38 +00:00
|
|
|
case ID_VIEWER_ZOOM_OUT:
|
2009-01-07 15:59:49 +00:00
|
|
|
case ID_ZOOM_OUT:
|
2012-05-06 20:10:43 +00:00
|
|
|
if( screen->SetNextZoom() )
|
|
|
|
RedrawScreen( center, zoom_at_cursor );
|
2009-01-07 15:59:49 +00:00
|
|
|
break;
|
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
case ID_VIEWER_ZOOM_REDRAW:
|
|
|
|
case ID_POPUP_ZOOM_REDRAW:
|
2009-01-07 15:59:49 +00:00
|
|
|
case ID_ZOOM_REDRAW:
|
2013-09-20 15:29:32 +00:00
|
|
|
m_canvas->Refresh();
|
2009-01-07 15:59:49 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-20 01:49:24 +00:00
|
|
|
case ID_POPUP_ZOOM_CENTER:
|
2013-08-03 05:15:23 +00:00
|
|
|
center = GetCrossHairPosition();
|
2011-02-11 20:48:13 +00:00
|
|
|
RedrawScreen( center, true );
|
2009-01-07 15:59:49 +00:00
|
|
|
break;
|
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
case ID_POPUP_ZOOM_PAGE:
|
|
|
|
case ID_VIEWER_ZOOM_PAGE:
|
2009-01-07 15:59:49 +00:00
|
|
|
case ID_ZOOM_PAGE:
|
2009-12-19 19:24:49 +00:00
|
|
|
Zoom_Automatique( false );
|
2007-08-20 01:49:24 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_SELECT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:49:24 +00:00
|
|
|
break;
|
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
default:
|
2015-04-30 08:46:02 +00:00
|
|
|
SetPresetZoom( id - ID_POPUP_ZOOM_LEVEL_START );
|
2007-08-20 01:49:24 +00:00
|
|
|
}
|
|
|
|
|
2014-03-24 16:20:23 +00:00
|
|
|
UpdateStatusBar();
|
|
|
|
}
|
2013-06-25 07:15:57 +00:00
|
|
|
|
|
|
|
|
2014-03-24 16:20:23 +00:00
|
|
|
void EDA_DRAW_FRAME::SetNextZoom()
|
|
|
|
{
|
|
|
|
GetScreen()->SetNextZoom();
|
|
|
|
}
|
2014-03-20 07:47:31 +00:00
|
|
|
|
2013-06-25 07:15:57 +00:00
|
|
|
|
2014-03-24 16:20:23 +00:00
|
|
|
void EDA_DRAW_FRAME::SetPrevZoom()
|
|
|
|
{
|
|
|
|
GetScreen()->SetPreviousZoom();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-30 08:46:02 +00:00
|
|
|
void EDA_DRAW_FRAME::SetPresetZoom( int aIndex )
|
|
|
|
{
|
|
|
|
BASE_SCREEN* screen = GetScreen();
|
|
|
|
|
|
|
|
if( aIndex >= (int) screen->m_ZoomList.size() )
|
|
|
|
{
|
|
|
|
wxLogDebug( wxT( "%s %d: index %d is outside the bounds of the zoom list." ),
|
|
|
|
__TFILE__, __LINE__, aIndex );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-05-01 09:31:23 +00:00
|
|
|
if( m_zoomSelectBox )
|
|
|
|
m_zoomSelectBox->SetSelection( aIndex );
|
2015-04-30 08:46:02 +00:00
|
|
|
|
|
|
|
if( screen->SetZoom( screen->m_ZoomList[aIndex] ) )
|
|
|
|
RedrawScreen( GetScrollCenterPosition(), true );
|
|
|
|
|
|
|
|
UpdateStatusBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-01-29 14:26:20 +00:00
|
|
|
int maxZoomIds;
|
2015-05-01 09:31:23 +00:00
|
|
|
double zoom;
|
2009-01-29 14:26:20 +00:00
|
|
|
wxString msg;
|
2012-04-23 21:56:26 +00:00
|
|
|
BASE_SCREEN* screen = m_canvas->GetScreen();
|
2010-02-14 18:14:33 +00:00
|
|
|
|
2015-05-19 16:39:05 +00:00
|
|
|
msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
|
2014-10-15 11:40:38 +00:00
|
|
|
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
|
2018-03-25 15:02:53 +00:00
|
|
|
msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
|
2014-10-15 11:40:38 +00:00
|
|
|
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
|
2007-08-20 01:49:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
wxMenu* zoom_choice = new wxMenu;
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( MasterMenu, zoom_choice,
|
2018-04-01 19:09:52 +00:00
|
|
|
ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
|
2011-09-01 12:54:34 +00:00
|
|
|
KiBitmap( zoom_selection_xpm ) );
|
2007-08-20 01:49:24 +00:00
|
|
|
|
2010-02-14 18:14:33 +00:00
|
|
|
zoom = screen->GetZoom();
|
2009-01-29 14:26:20 +00:00
|
|
|
maxZoomIds = ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START;
|
2012-05-06 20:10:43 +00:00
|
|
|
maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
|
|
|
|
maxZoomIds : screen->m_ZoomList.size();
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2012-04-23 21:56:26 +00:00
|
|
|
// Populate zoom submenu.
|
2010-02-15 08:23:05 +00:00
|
|
|
for( int i = 0; i < maxZoomIds; i++ )
|
2007-08-20 01:49:24 +00:00
|
|
|
{
|
2015-01-06 07:38:58 +00:00
|
|
|
msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
|
2009-01-31 10:05:16 +00:00
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
|
|
|
|
wxEmptyString, wxITEM_CHECK );
|
2010-02-14 18:14:33 +00:00
|
|
|
if( zoom == screen->m_ZoomList[i] )
|
2009-01-29 14:26:20 +00:00
|
|
|
zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
|
2007-08-20 01:49:24 +00:00
|
|
|
}
|
|
|
|
|
2012-04-23 21:56:26 +00:00
|
|
|
// Create grid submenu as required.
|
2010-12-08 20:12:46 +00:00
|
|
|
if( screen->GetGridCount() )
|
2008-12-05 16:03:05 +00:00
|
|
|
{
|
2010-02-15 08:23:05 +00:00
|
|
|
wxMenu* gridMenu = new wxMenu;
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
|
2018-04-01 19:09:52 +00:00
|
|
|
_( "Grid" ), KiBitmap( grid_select_xpm ) );
|
2007-08-20 01:49:24 +00:00
|
|
|
|
2015-01-05 13:20:04 +00:00
|
|
|
wxArrayString gridsList;
|
|
|
|
int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
|
2007-08-20 01:49:24 +00:00
|
|
|
|
2015-01-05 13:20:04 +00:00
|
|
|
for( unsigned i = 0; i < gridsList.GetCount(); i++ )
|
2007-08-20 01:49:24 +00:00
|
|
|
{
|
2015-01-05 13:20:04 +00:00
|
|
|
GRID_TYPE& grid = screen->GetGrid( i );
|
2017-01-19 09:51:47 +00:00
|
|
|
gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
|
2015-01-05 13:20:04 +00:00
|
|
|
|
|
|
|
if( (int)i == icurr )
|
2015-05-12 09:05:36 +00:00
|
|
|
gridMenu->Check( grid.m_CmdId, true );
|
2007-08-20 01:49:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MasterMenu->AppendSeparator();
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|