Commit 25720516 authored by charras's avatar charras

Eeschema, libedit: fixed add/remove alias functions, broken

All: added in popup menus hotkeys info for zoom commands
parent 3624034f
......@@ -38,6 +38,8 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
m_Center = true;
m_CurrentSheetDesc = &g_Sheet_A4;
m_IsPrinting = false;
m_ScrollPixelsPerUnitX = 1;
m_ScrollPixelsPerUnitY = 1;
InitDatas();
}
......
......@@ -54,6 +54,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_AuxiliaryToolBar = NULL;
m_SelGridBox = NULL;
m_SelZoomBox = NULL;
m_HotkeysZoomAndGridList = NULL;
DrawPanel = NULL;
MsgPanel = NULL;
......@@ -442,7 +443,7 @@ int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC )
void WinEDA_DrawFrame::AdjustScrollBars()
{
int pixelsPerUnitX, pixelsPerUnitY, unitsX, unitsY, posX, posY;
int unitsX, unitsY, posX, posY;
wxSize drawingSize, clientSize;
BASE_SCREEN* screen = GetBaseScreen();
......@@ -488,7 +489,7 @@ void WinEDA_DrawFrame::AdjustScrollBars()
* pixels per unit to 10, you have potential for the zoom point to
* jump around +/-5 pixels from the nearest grid point.
*/
pixelsPerUnitX = pixelsPerUnitY = 1;
screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
// Calculate the number of scroll bar units for the given zoom level. */
#ifdef USE_WX_ZOOM
......@@ -524,11 +525,12 @@ void WinEDA_DrawFrame::AdjustScrollBars()
#if 0
wxLogDebug( wxT( "SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
pixelsPerUnitX, pixelsPerUnitY, unitsX, unitsY, posX, posY );
m_ScrollPixelsPerUnitX, m_ScrollPixelsPerUnitY,
unitsX, unitsY, posX, posY );
#endif
DrawPanel->SetScrollbars( pixelsPerUnitX,
pixelsPerUnitY,
DrawPanel->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
screen->m_ScrollPixelsPerUnitY,
screen->m_ScrollbarNumber.x,
screen->m_ScrollbarNumber.y,
screen->m_ScrollbarPos.x,
......
......@@ -958,7 +958,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
if( !m_Parent->OnRightClick( pos, &MasterMenu ) )
return false;
AddMenuZoom( &MasterMenu );
m_Parent->AddMenuZoomAndGrid( &MasterMenu );
m_IgnoreMouseEvents = TRUE;
PopupMenu( &MasterMenu, pos );
......
......@@ -240,11 +240,13 @@ wxString ReturnKeyNameFromKeyCode( int keycode )
* @param CommandId = Command Id value
* @return text (key name) in a wxString if found or text without modification
*/
wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List,
int CommandId )
wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList,
int aCommandId )
{
wxString msg = text;
wxString keyname = ReturnKeyNameFromCommandId( List, CommandId );
wxString msg = aText;
wxString keyname;
if( aList )
keyname = ReturnKeyNameFromCommandId( aList, aCommandId );
if( !keyname.IsEmpty() )
msg << wxT( "\t" ) << keyname;
......@@ -259,22 +261,25 @@ wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List,
* @param CommandId = Command Id value
* @return text (key name) in a wxString if found or text without modification
*/
wxString AddHotkeyName( const wxString& text,
struct Ki_HotkeyInfoSectionDescriptor* DescList,
int CommandId )
wxString AddHotkeyName( const wxString& aText,
struct Ki_HotkeyInfoSectionDescriptor* aDescList,
int aCommandId )
{
wxString msg = text;
wxString msg = aText;
wxString keyname;
Ki_HotkeyInfo** List;
for( ; DescList->m_HK_InfoList != NULL; DescList++ )
if( aDescList )
{
List = DescList->m_HK_InfoList;
keyname = ReturnKeyNameFromCommandId( List, CommandId );
if( !keyname.IsEmpty() )
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
{
msg << wxT( "\t" ) << keyname;
break;
List = aDescList->m_HK_InfoList;
keyname = ReturnKeyNameFromCommandId( List, aCommandId );
if( !keyname.IsEmpty() )
{
msg << wxT( "\t" ) << keyname;
break;
}
}
}
......
......@@ -15,6 +15,7 @@
#include "class_base_screen.h"
#include "wxstruct.h"
#include "kicad_device_context.h"
#include "hotkeys_basic.h"
/** Compute draw offset (scroll bars and draw parameters)
* in order to have the current graphic cursor position at the screen center
......@@ -174,7 +175,7 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
/* add the zoom list menu the the MasterMenu.
* used in OnRightClick(wxMouseEvent& event)
*/
void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
{
size_t i;
int maxZoomIds;
......@@ -184,58 +185,62 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
GRID_TYPE tmp;
wxMenu* gridMenu;
double gridValue;
BASE_SCREEN * screen = DrawPanel->GetScreen();
msg = AddHotkeyName( _( "Center" ), m_HotkeysZoomAndGridList, HK_ZOOM_CENTER );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, zoom_center_xpm );
msg = AddHotkeyName( _( "Zoom in" ), m_HotkeysZoomAndGridList, HK_ZOOM_IN );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_IN, msg, zoom_in_xpm );
msg = AddHotkeyName( _( "Zoom out" ), m_HotkeysZoomAndGridList, HK_ZOOM_OUT );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_OUT, msg, zoom_out_xpm );
msg = AddHotkeyName( _( "Redraw view" ), m_HotkeysZoomAndGridList, HK_ZOOM_REDRAW );
ADD_MENUITEM( MasterMenu, ID_ZOOM_REDRAW, msg, zoom_redraw_xpm );
msg = AddHotkeyName( _( "Zoom auto" ), m_HotkeysZoomAndGridList, HK_ZOOM_AUTO );
ADD_MENUITEM( MasterMenu, ID_ZOOM_PAGE, msg, zoom_auto_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_CENTER, _( "Center" ),
zoom_center_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_IN, _( "Zoom in" ), zoom_in_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_OUT, _( "Zoom out" ), zoom_out_xpm );
ADD_MENUITEM( MasterMenu, ID_ZOOM_PAGE, _( "Zoom auto" ), zoom_auto_xpm );
wxMenu* zoom_choice = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, zoom_choice,
ID_POPUP_ZOOM_SELECT, _( "Zoom select" ),
zoom_select_xpm );
ADD_MENUITEM( MasterMenu, ID_ZOOM_REDRAW, _( "Redraw view" ),
zoom_redraw_xpm );
zoom = GetScreen()->GetZoom();
zoom = screen->GetZoom();
maxZoomIds = ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START;
maxZoomIds = ( (size_t) maxZoomIds < GetScreen()->m_ZoomList.GetCount() ) ?
maxZoomIds : GetScreen()->m_ZoomList.GetCount();
maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.GetCount() ) ?
maxZoomIds : screen->m_ZoomList.GetCount();
/* Populate zoom submenu. */
for( i = 0; i < (size_t) maxZoomIds; i++ )
{
if( ( GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar ) == 0 )
if( ( screen->m_ZoomList[i] % screen->m_ZoomScalar ) == 0 )
msg.Printf( wxT( "%u" ),
GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar );
screen->m_ZoomList[i] / screen->m_ZoomScalar );
else
msg.Printf( wxT( "%.1f" ),
(float) GetScreen()->m_ZoomList[i] /
GetScreen()->m_ZoomScalar );
(float) screen->m_ZoomList[i] /
screen->m_ZoomScalar );
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
wxEmptyString, wxITEM_CHECK );
if( zoom == GetScreen()->m_ZoomList[i] )
if( zoom == screen->m_ZoomList[i] )
zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
}
/* Create grid submenu as required. */
if( !GetScreen()->m_GridList.IsEmpty() )
if( !screen->m_GridList.IsEmpty() )
{
gridMenu = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu,
ID_POPUP_GRID_SELECT, _( "Grid Select" ),
grid_select_xpm );
grid = GetScreen()->GetGridSize();
grid = screen->GetGridSize();
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
for( i = 0; i < screen->m_GridList.GetCount(); i++ )
{
tmp = GetScreen()->m_GridList[i];
tmp = screen->m_GridList[i];
gridValue = To_User_Unit( g_UnitMetric, tmp.m_Size.x,
m_Parent->m_InternalUnits );
m_InternalUnits );
if( tmp.m_Id == ID_POPUP_GRID_USER )
{
......
......@@ -19,9 +19,17 @@
#include <boost/foreach.hpp>
/*********************/
/* class CMP_LIB_ENTRY */
/*********************/
/** class CMP_LIB_ENTRY
* Base class to describe library components and aliases.
* This class is not to be used directly.
* There are 2 derived classes
* class LIB_COMPONENT that describes a component in library
* class LIB_ALIAS that describes an alias of an existing component
* a LIB_COMPONENT object handle all info to draw a component
* (pins, graphic body items, fields, name, keywords and documentation)
* a LIB_ALIAS object use info of its LIB_COMPONENT parent
* and has just a name, keywords and documentation
*/
CMP_LIB_ENTRY::CMP_LIB_ENTRY( LibrEntryType aType, const wxString& aName,
CMP_LIBRARY* aLibrary ) :
......@@ -160,7 +168,12 @@ void LIB_ALIAS::SetComponent( LIB_COMPONENT* aComponent )
/* class LIB_COMPONENT */
/********************************/
/* This is a standard component (in library)
/**
* Library component object definition.
*
* A library component object is typically saved and loaded
* in a component library file (.lib).
* Library components are different from schematic components.
*/
LIB_COMPONENT::LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary ) :
CMP_LIB_ENTRY( ROOT, aName, aLibrary )
......
......@@ -134,9 +134,11 @@ extern int LibraryEntryCompare( const CMP_LIB_ENTRY* aItem1, const CMP_LIB_ENTRY
/**
* Library component object definition.
*
* A library component object is typically save and loaded in a component
* library file (.lib). Library components are different from schematic
* components.
* Library component object definition.
*
* A library component object is typically saved and loaded
* in a component library file (.lib).
* Library components are different from schematic components.
*/
class LIB_COMPONENT : public CMP_LIB_ENTRY
{
......
......@@ -221,6 +221,9 @@ bool CMP_LIBRARY::AddAlias( LIB_ALIAS* aAlias )
* so these alias will be added in library.
* Conflicts can happen if aliases are already existing.
* User is asked to choose what alias is removed (existing, or new)
* a special case is the library cache:
* user is not asked, and old aliases removed.
* this is not perfect, but sufficient to create a library cache project
* @param aComponent - Component to add.
* @return Added component if successful.
*/
......@@ -235,41 +238,47 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
// Conflict detection: See if already existing aliases exist,
// and if yes, ask user for continue or abort
wxString msg;
int conflict_count = 0;
for( size_t i = 0; i < newCmp->m_AliasList.GetCount(); i++ )
// Special case: if the library is the library cache of the project,
// old aliases are always removed to avoid conflict,
// and user is not prompted )
if( !IsCache() )
{
LIB_ALIAS* alias = FindAlias( newCmp->m_AliasList[ i ] );
if( alias == NULL )
break;
wxString msg;
int conflict_count = 0;
for( size_t i = 0; i < newCmp->m_AliasList.GetCount(); i++ )
{
LIB_ALIAS* alias = FindAlias( newCmp->m_AliasList[ i ] );
if( alias->GetComponent()->GetName().CmpNoCase( newCmp->GetName() ) != 0 )
if( alias == NULL )
continue;
if( alias->GetComponent()->GetName().CmpNoCase( newCmp->GetName() ) != 0 )
{
wxString msg1;
msg1.Printf( _("alias <%s> already exists and has root name<%s>"),
GetChars( alias->GetName() ),
GetChars( alias->GetComponent()->GetName() ) );
msg << msg1 << wxT("\n");
conflict_count++;
}
if( conflict_count > 20 )
break;
}
if( conflict_count ) // Conflict: ask user what he wants: remove all aliases or abort:
{
wxString title;
wxString msg1;
msg1.Printf( _("alias <%s> already exists and has root name<%s>"),
GetChars( alias->GetName() ),
GetChars( alias->GetComponent()->GetName() ) );
msg << msg1 << wxT("\n");
conflict_count++;
title.Printf( _( "Conflict in library <%s>"), GetChars( fileName.GetName()));
msg1.Printf( _("and appears in alias list of current component <%s>." ),
GetChars( newCmp->GetName() ) );
msg << wxT("\n\n") << msg1;
msg << wxT("\n\n") << _("All old aliases will be removed. Continue ?");
int diag = wxMessageBox(msg, title, wxYES | wxICON_QUESTION);
if( diag != wxYES )
return NULL;
}
if( conflict_count > 20 )
break;
}
if( conflict_count ) // Conflict: ask user what he wants remove all aliases or abort:
{
wxString title;
wxString msg1;
title.Printf( _( "Conflict in library <%s>"), GetChars( fileName.GetName()));
msg1.Printf( _("and appears in alias list of current component <%s>." ),
GetChars( newCmp->GetName() ) );
msg << wxT("\n\n") << msg1;
msg << wxT("\n\n") << _("All old aliases will be removed. Continue ?");
int diag = wxMessageBox(msg, title, wxYES | wxICON_QUESTION);
if( diag != wxYES )
return NULL;
}
for( size_t i = 0; i < newCmp->m_AliasList.GetCount(); i++ )
......@@ -301,7 +310,7 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
/** function RemoveEntryName
* Remove an /a aName entry from the library list names.
* Warning: this is a partiel remove, because if aname is an alias
* Warning: this is a partiel remove, because if aName is an alias
* it is not removed from its root component.
* this is for internal use only
* Use RemoveEntry( CMP_LIB_ENTRY* aEntry ) to remove safely an entry in library.
......@@ -349,9 +358,9 @@ void CMP_LIBRARY::RemoveEntryName( const wxString& aName )
root = alias->GetComponent();
/* Remove alias name from the root component alias list */
if( root == NULL )
if( root == NULL ) // Should not occur, but is not a fatal error
{
wxLogWarning( wxT( "No root component found for alias <%s> in library <%s>." ),
wxLogDebug( wxT( "No root component found for alias <%s> in library <%s>." ),
GetChars( aEntry->GetName() ),
GetChars( fileName.GetName() ) );
}
......@@ -359,12 +368,14 @@ void CMP_LIBRARY::RemoveEntryName( const wxString& aName )
{
int index = root->m_AliasList.Index( aEntry->GetName(), false );
if( index == wxNOT_FOUND )
wxLogWarning( wxT( "Alias <%s> not found in component <%s> alias list in \
if( index == wxNOT_FOUND ) // Should not occur, but is not a fatal error
{
wxLogDebug( wxT( "Alias <%s> not found in component <%s> alias list in \
library <%s>" ),
GetChars( aEntry->GetName() ),
GetChars( root->GetName() ),
GetChars( fileName.GetName() ) );
}
else
root->m_AliasList.RemoveAt( index );
}
......@@ -458,7 +469,7 @@ LIB_COMPONENT* CMP_LIBRARY::ReplaceComponent( LIB_COMPONENT* aOldComponent,
}
RemoveEntryName( aOldComponent->GetName() );
entries.push_back( (CMP_LIB_ENTRY*) newCmp );
entries.push_back( newCmp );
entries.sort();
SetModifyFlags( );
......
......@@ -159,10 +159,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
if( m_PartAliasList->GetStrings() != component->m_AliasList )
{
LIB_ALIAS* alias;
wxArrayString aliases = m_PartAliasList->GetStrings();
/* Add names not existing in the old alias list. */
/* Add names not existing in the current component alias list. */
for( i = 0; i < aliases.GetCount(); i++ )
{
index = component->m_AliasList.Index( aliases[ i ], false );
......@@ -170,16 +169,10 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
if( index != wxNOT_FOUND )
continue;
alias = new LIB_ALIAS( aliases[ i ], component );
if( !library->AddAlias( alias ) )
{
delete alias;
alias = NULL;
component->m_AliasList.Add( aliases[ i ] );
}
}
/* Remove names and library alias entries not in the new alias list. */
/* Remove names in the current component that are not in the new alias list. */
for( i = 0; i < component->m_AliasList.GetCount(); i++ )
{
index = aliases.Index( component->m_AliasList[ i ], false );
......@@ -187,10 +180,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
if( index == wxNOT_FOUND )
continue;
CMP_LIB_ENTRY* alias =
library->FindAlias( component->m_AliasList[ i ] );
if( alias != NULL )
library->RemoveEntry( alias );
component->m_AliasList.RemoveAt( i );
i--;
}
component->m_AliasList = aliases;
......
......@@ -308,14 +308,13 @@ static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
// Reset display settings of the new screen
// Assumes m_CurrentSheet has already been updated.
frame->ClearMsgPanel();
int pixelsPerUnitX = 1;
int pixelsPerUnitY = 1;
frame->DrawPanel->SetScrollbars( pixelsPerUnitX, pixelsPerUnitY,
frame->DrawPanel->SetScrollbars( NewScreen->m_ScrollPixelsPerUnitX,
NewScreen->m_ScrollPixelsPerUnitY,
NewScreen->m_ScrollbarNumber.x,
NewScreen->m_ScrollbarNumber.y,
NewScreen->m_ScrollbarPos.x,
NewScreen->m_ScrollbarPos.y, TRUE );
// update the References
frame->m_CurrentSheet->UpdateAllScreenReferences();
frame->SetSheetNumberAndCount();
......
......@@ -6,24 +6,17 @@
#include "hotkeys_basic.h"
// List of hot keys id.
// see also enum common_hotkey_id_commnand in hotkeys_basic.h
// for shared hotkeys id
enum hotkey_id_commnand {
HK_NOT_FOUND = 0,
HK_RESET_LOCAL_COORD,
HK_HELP,
HK_ZOOM_IN,
HK_ZOOM_OUT,
HK_ZOOM_REDRAW,
HK_ZOOM_CENTER,
HK_ZOOM_AUTO,
HK_NEXT_SEARCH,
HK_NEXT_SEARCH = HK_COMMON_END,
HK_DELETE,
HK_REPEAT_LAST,
HK_EDIT_PIN,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM,
HK_LIBEDIT_ROTATE_PIN,
HK_DELETE_PIN,
HK_UNDO,
HK_REDO,
HK_MOVEBLOCK_TO_DRAGBLOCK,
HK_ROTATE,
HK_EDIT,
......
......@@ -18,6 +18,7 @@
#include "class_library.h"
#include "kicad_device_context.h"
#include "hotkeys.h"
#include <boost/foreach.hpp>
......@@ -167,6 +168,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
SetShowDeMorgan( false );
m_drawSpecificConvert = true;
m_drawSpecificUnit = false;
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
// Give an icon
SetIcon( wxIcon( libedit_xpm ) );
......
......@@ -27,6 +27,7 @@
#include "dialog_erc.h"
#include "libeditfrm.h"
#include "libviewfrm.h"
#include "hotkeys.h"
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
......@@ -160,6 +161,7 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
m_previewSize = wxDefaultSize;
m_printMonochrome = true;
m_showSheetReference = true;
m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr;
CreateScreens();
......
......@@ -14,6 +14,7 @@
#include "protos.h"
#include "libviewfrm.h"
#include "class_library.h"
#include "hotkeys.h"
/**
......@@ -92,6 +93,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
// Give an icon
SetIcon( wxIcon( library_browse_xpm ) );
m_HotkeysZoomAndGridList = s_Viewlib_Hokeys_Descr;
m_CmpList = NULL;
m_LibList = NULL;
m_LibListWindow = NULL;
......
......@@ -17,6 +17,7 @@
#include "bitmaps.h"
#include "protos.h"
#include "gerbview_id.h"
#include "hotkeys.h"
/****************************************/
......@@ -128,6 +129,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
m_Draw_Axis = true; // true to show X and Y axis on screen
m_Draw_Sheet_Ref = FALSE; // TRUE for reference drawings.
m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr;
if( DrawPanel )
DrawPanel->m_Block_Enable = TRUE;
......@@ -415,7 +417,7 @@ void WinEDA_GerberFrame::ReFillLayerWidget()
m_auimgr.Update();
else
m_LayersManager->SetSize( bestz );
syncLayerWidget( );
}
......
......@@ -6,17 +6,12 @@
#include "hotkeys_basic.h"
// List of hot keys id.
// see also enum common_hotkey_id_commnand in hotkeys_basic.h
// for shared hotkeys id
enum hotkey_id_commnand {
HK_NOT_FOUND = 0,
HK_RESET_LOCAL_COORD,
HK_HELP,
HK_SWITCH_UNITS,
HK_SWITCH_UNITS = HK_COMMON_END,
HK_SWITCH_TRACK_DISPLAY_MODE,
HK_ZOOM_IN,
HK_ZOOM_OUT,
HK_ZOOM_REDRAW,
HK_ZOOM_CENTER,
HK_ZOOM_AUTO,
HK_SWITCH_LAYER_TO_NEXT,
HK_SWITCH_LAYER_TO_PREVIOUS
};
......
......@@ -66,9 +66,16 @@ public:
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units.
* (coordinates from last reset position)*/
wxPoint m_ScrollbarPos; // Position effective des Curseurs de scroll
wxSize m_ScrollbarNumber; /* Current scroll bar posiition in scroll
* units. */
// Scrollbars management:
int m_ScrollPixelsPerUnitX; /* Pixels per scroll unit in the horizontal direction. */
int m_ScrollPixelsPerUnitY; /* Pixels per scroll unit in the vertical direction. */
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll
* units.
* m_ScrollbarNumber * m_ScrollPixelsPerUnit = virtual draw area size in pixels
*/
wxPoint m_ScrollbarPos; /* Current scroll bar position in scroll
* units. */
wxPoint m_StartVisu; /* Coordinates in drawing units of the current
* view position (upper left corner of device)
*/
......
......@@ -159,7 +159,6 @@ public:
void SetGrid( const wxRealPoint& size );
wxRealPoint GetGrid();
void AddMenuZoom( wxMenu* MasterMenu );
bool OnRightClick( wxMouseEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
......
......@@ -75,4 +75,19 @@ void DisplayHotkeyList( WinEDA_DrawFrame* frame,
Ki_HotkeyInfo* GetDescriptorFromHotkey( int key, Ki_HotkeyInfo** List );
// common hotkeys event id
enum common_hotkey_id_commnand {
HK_NOT_FOUND = 0,
HK_RESET_LOCAL_COORD,
HK_HELP,
HK_ZOOM_IN,
HK_ZOOM_OUT,
HK_ZOOM_REDRAW,
HK_ZOOM_CENTER,
HK_ZOOM_AUTO,
HK_UNDO,
HK_REDO,
HK_COMMON_END
};
#endif // HOTKEYS_BASIC_H
......@@ -183,6 +183,7 @@ public:
wxPoint m_Auxiliary_Axis_Position; /* position of the auxiliary axis */
protected:
Ki_HotkeyInfoSectionDescriptor * m_HotkeysZoomAndGridList;
int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color
......@@ -218,6 +219,13 @@ public:
virtual void OnHotKey( wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct );
/** Function AddMenuZoomAndGrid (virtual)
* Add standard zoom commands and submenu zoom and grid selection to a popup menu
* uses zoom hotkeys info base to add hotkeys info to menu commands
* @param aMasterMenu = the menu to populate.
*/
virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
void Affiche_Message( const wxString& message );
void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event );
......
......@@ -7,18 +7,11 @@
#include "hotkeys_basic.h"
// List of hot keys id.
// see also enum common_hotkey_id_commnand in hotkeys_basic.h
// for shared hotkeys id
enum hotkey_id_commnand {
HK_NOT_FOUND = 0,
HK_RESET_LOCAL_COORD,
HK_HELP,
HK_ZOOM_IN,
HK_ZOOM_OUT,
HK_ZOOM_REDRAW,
HK_ZOOM_CENTER,
HK_ZOOM_AUTO,
HK_UNDO,
HK_REDO,
HK_DELETE,
HK_DELETE = HK_COMMON_END,
HK_BACK_SPACE,
HK_ROTATE_FOOTPRINT,
HK_MOVE_FOOTPRINT,
......
......@@ -16,6 +16,7 @@
#include "bitmaps.h"
#include "protos.h"
#include "pcbnew_id.h"
#include "hotkeys.h"
#include "3d_viewer.h"
......@@ -156,6 +157,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
m_FrameName = wxT( "ModEditFrame" );
m_Draw_Sheet_Ref = false; // true to show the frame references
m_Draw_Axis = true; // true to show X and Y axis on screen
m_HotkeysZoomAndGridList = s_Module_Editor_Hokeys_Descr;
// Give an icon
SetIcon( wxICON( icon_modedit ) );
......
......@@ -46,6 +46,7 @@
#include "layer_widget.h"
#include "dialog_design_rules.h"
#include "class_pcb_layer_widget.h"
#include "hotkeys.h"
......@@ -258,6 +259,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_TrackAndViasSizesList_Changed = false;
m_show_microwave_tools = false;
m_show_layer_manager_tools = true;
m_HotkeysZoomAndGridList = s_Board_Editor_Hokeys_Descr;
SetBoard( new BOARD( NULL, this ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment