Øyvind's patch

This commit is contained in:
dickelbeck 2009-09-27 14:09:26 +00:00
parent e8fef505f8
commit 8b3d5a69cf
17 changed files with 93 additions and 29 deletions

View File

@ -77,6 +77,7 @@ static struct hotkey_name_descr s_Hotkey_Name_List[] =
{ wxT( "Backspace" ), WXK_BACK },
{ wxT( "Insert" ), WXK_INSERT },
{ wxT( "Home" ), WXK_HOME },
{ wxT( "End" ), WXK_END },
{ wxT( "Page Up" ), WXK_PAGEUP },
{ wxT( "Page Down" ), WXK_PAGEDOWN },

View File

@ -152,7 +152,12 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
break;
case ID_ZOOM_PAGE:
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 );
break;
case ID_POPUP_ZOOM_SELECT:

View File

@ -132,24 +132,24 @@ void WinEDA_DisplayFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ),
_( "zoom + (F1)" ) );
_( "Zoom in (F1)" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ),
_( "zoom - (F2)" ) );
_( "Zoom out (F2)" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ),
_( "redraw (F3)" ) );
_( "Redraw view (F3)" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "1:1 zoom" ) );
_( "Zoom auto (Home)" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString,
wxBitmap( show_3d_xpm ),
_( "1:1 zoom" ) );
_( "3D Display" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
@ -236,6 +236,13 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
curpos = GetScreen()->m_Curseur;
break;
case WXK_HOME:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
curpos = GetScreen()->m_Curseur;
break;
case ' ':
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break;

View File

@ -48,6 +48,8 @@
/* Hotkey list: */
// Common commands
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO,
WXK_HOME );
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER,
WXK_F4 );
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW,
@ -107,7 +109,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] =
{
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw,
&HkZoomCenter,
&HkZoomCenter, &HkZoomAuto,
&HkResetLocalCoord,
&HkUndo, &HkRedo,
NULL
@ -164,6 +166,14 @@ struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[] =
{ NULL, NULL, NULL }
};
// list of sections and corresponding hotkey list for the component browser
// (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[] =
{
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL },
{ NULL, NULL, NULL }
};
/*
* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive
@ -236,6 +246,11 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_UNDO:
case HK_REDO:
if( !ItemInEdit )
@ -517,6 +532,11 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_UNDO:
if( !ItemInEdit )
{

View File

@ -14,6 +14,7 @@ enum hotkey_id_commnand {
HK_ZOOM_OUT,
HK_ZOOM_REDRAW,
HK_ZOOM_CENTER,
HK_ZOOM_AUTO,
HK_NEXT_SEARCH,
HK_DELETE,
HK_REPEAT_LAST,
@ -41,5 +42,7 @@ extern struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[];
extern struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[];
// List of hotkey descriptors for the lib editor only
extern struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[];
// List of hotkey descriptors for the lib browser only
extern struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[];
#endif // KOTKEYS_H

View File

@ -170,8 +170,10 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
item->SetBitmap( zoom_out_xpm );
viewMenu->Append( item );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, _( "Zoom auto" ),
_( "Zoom auto" ), wxITEM_NORMAL );
msg = AddHotkeyName( _( "Zoom auto" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_AUTO );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, msg, _( "Zoom auto" ),
wxITEM_NORMAL );
item->SetBitmap( zoom_auto_xpm );
viewMenu->Append( item );

View File

@ -169,8 +169,9 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Libedit_Hokeys_Descr, HK_ZOOM_AUTO );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ), _( "Zoom page" ) );
wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString,

View File

@ -96,8 +96,9 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) );
msg );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ),

View File

@ -10,13 +10,14 @@
#include "program.h"
#include "general.h"
#include "protos.h"
#include "hotkeys.h"
#include "class_library.h"
#include "libviewfrm.h"
void WinEDA_ViewlibFrame::ReCreateHToolbar()
{
int ii;
int ii; wxString msg;
CMP_LIBRARY* lib;
LIB_COMPONENT* component = NULL;
CMP_LIB_ENTRY* entry = NULL;
@ -47,21 +48,21 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
_( "Display next part" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ),
_( "Zoom in" ) );
wxBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ),
_( "Zoom out" ) );
wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ),
_( "Redraw view" ) );
wxBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_AUTO );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "Best zoom" ) );
wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,

View File

@ -56,7 +56,8 @@ static wxAcceleratorEntry accels[] =
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F1, ID_ZOOM_IN ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_ZOOM_PAGE )
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_POPUP_ZOOM_CENTER ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_HOME, ID_ZOOM_PAGE )
};
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )

View File

@ -30,6 +30,7 @@
/* local variables */
/* Hotkey list: */
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
@ -51,7 +52,7 @@ static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT(
Ki_HotkeyInfo* s_Gerbview_Hotkey_List[] = {
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkSwitchUnits, &HkResetLocalCoord,
&HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord,
&HkTrackDisplayMode,
&HkSwitch2NextCopperLayer,
&HkSwitch2PreviousCopperLayer,
@ -123,6 +124,11 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break;

View File

@ -16,6 +16,7 @@ enum hotkey_id_commnand {
HK_ZOOM_OUT,
HK_ZOOM_REDRAW,
HK_ZOOM_CENTER,
HK_ZOOM_AUTO,
HK_SWITCH_LAYER_TO_NEXT,
HK_SWITCH_LAYER_TO_PREVIOUS
};

View File

@ -226,9 +226,10 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
wxBitmap( zoom_redraw_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_AUTO );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) );
msg );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString,

View File

@ -83,6 +83,7 @@ static Ki_HotkeyInfo HkDelete(wxT("Delete Track or Footprint"), HK_DELETE,
WXK_DELETE);
static Ki_HotkeyInfo HkResetLocalCoord(wxT("Reset local coord."),
HK_RESET_LOCAL_COORD, ' ');
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
static Ki_HotkeyInfo HkZoomCenter(wxT("Zoom Center"), HK_ZOOM_CENTER, WXK_F4);
static Ki_HotkeyInfo HkZoomRedraw(wxT("Zoom Redraw"), HK_ZOOM_REDRAW, WXK_F3);
static Ki_HotkeyInfo HkZoomOut(wxT("Zoom Out"), HK_ZOOM_OUT, WXK_F2);
@ -99,8 +100,8 @@ static Ki_HotkeyInfo HkToggle(wxT("Toggle Present Command"), HK_TOGGLE, 'E');
// List of common hotkey descriptors
Ki_HotkeyInfo
* s_Common_Hotkey_List[] = { &HkHelp, &HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkSwitchUnits,
&HkResetLocalCoord, NULL };
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto,
&HkSwitchUnits, &HkResetLocalCoord, NULL };
// List of hotkey descriptors for pcbnew
Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = { &HkTrackDisplayMode, &HkDelete,
@ -280,6 +281,11 @@ void WinEDA_PcbFrame::OnHotKey(wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct)
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ZOOM_AUTO:
cmd.SetId(ID_ZOOM_PAGE);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break;
@ -594,6 +600,11 @@ void WinEDA_ModuleEditFrame::OnHotKey(wxDC* DC, int hotkey,
cmd.SetId(ID_POPUP_ZOOM_CENTER);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ZOOM_AUTO:
cmd.SetId(ID_ZOOM_PAGE);
GetEventHandler()->ProcessEvent(cmd);
break;
}
}

View File

@ -14,6 +14,7 @@ enum hotkey_id_commnand {
HK_ZOOM_OUT,
HK_ZOOM_REDRAW,
HK_ZOOM_CENTER,
HK_ZOOM_AUTO,
HK_DELETE,
HK_BACK_SPACE,
HK_ROTATE_FOOTPRINT,

View File

@ -118,9 +118,10 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_AUTO );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) );
wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString,

View File

@ -255,9 +255,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_AUTO );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) );
wxBitmap( zoom_auto_xpm ), msg );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Find components and texts" ),