Commit 6a26a7f9 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Use logical cursor position and other minor changes.

* Remove unused member variable m_SizeVisu from base screen object.
* Move nearest grid position code into base screen object.
* Add get cursor position method to base screen object.
* Add position parameter to OnHotKey method in base draw frame and all
  derived objects.
* Pass logical position on left mouse button click and double click
  events instead of device position.
* Pass logical position to on right mouse button click instead of device
  position.
* Use logical event position parameter for locating items in EESchema
  instead of the stored position.
* Remove unused position parameter when displaying component edit dialog
  in EESchema.
* Comment out debugging macro in eeschema/template_field_names.cpp that was
  preventing debug builds using wxWidgets 2.8.x.
parent 0093f4f6
......@@ -390,6 +390,39 @@ int BASE_SCREEN::GetGridId()
}
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize )
{
wxPoint pt;
wxRealPoint gridSize;
if( aGridSize )
gridSize = *aGridSize;
else
gridSize = GetGridSize();
wxPoint gridOrigin = m_GridOrigin;
double offset = fmod( gridOrigin.x, gridSize.x );
int x = wxRound( (aPosition.x - offset) / gridSize.x );
pt.x = wxRound( x * gridSize.x + offset );
offset = fmod( gridOrigin.y, gridSize.y );
int y = wxRound( (aPosition.y - offset) / gridSize.y );
pt.y = wxRound ( y * gridSize.y + offset );
return pt;
}
wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize )
{
if( aOnGrid )
return GetNearestGridPosition( m_Curseur, aGridSize );
return m_Curseur;
}
/* free the undo and the redo lists
*/
void BASE_SCREEN::ClearUndoRedoList()
......
......@@ -176,7 +176,7 @@ void EDA_DRAW_FRAME::ReCreateMenuBar()
// Virtual function
void EDA_DRAW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
void EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
{
}
......
......@@ -778,14 +778,17 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
wxPoint pos;
wxMenu MasterMenu;
pos = event.GetPosition();
INSTALL_UNBUFFERED_DC( dc, this );
pos = event.GetLogicalPosition( dc );
if( !m_Parent->OnRightClick( pos, &MasterMenu ) )
return false;
m_Parent->AddMenuZoomAndGrid( &MasterMenu );
m_IgnoreMouseEvents = TRUE;
pos = event.GetPosition();
m_IgnoreMouseEvents = true;
PopupMenu( &MasterMenu, pos );
MouseToCursorSchema();
m_IgnoreMouseEvents = false;
......@@ -940,14 +943,14 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
localrealbutt |= localbutt; /* compensation default wxGTK */
INSTALL_UNBUFFERED_DC( DC, this );
DC.SetBackground( *wxBLACK_BRUSH );
/* Compute the cursor position in screen (device) units. */
wxPoint pos = CalcUnscrolledPosition( event.GetPosition() );
/* Compute the cursor position in drawing (logical) units. */
screen->m_MousePosition = CursorRealPosition( pos );
INSTALL_UNBUFFERED_DC( DC, this );
DC.SetBackground( *wxBLACK_BRUSH );
screen->m_MousePosition = event.GetLogicalPosition( DC );
int kbstat = 0;
......@@ -967,7 +970,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// Calling Double Click and Click functions :
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{
m_Parent->OnLeftDClick( &DC, pos );
m_Parent->OnLeftDClick( &DC, screen->m_MousePosition );
// inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new
......@@ -979,7 +982,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// A block command is in progress: a left up is the end of block
// or this is the end of a double click, already seen
if( screen->m_BlockLocate.m_State==STATE_NO_BLOCK && !s_IgnoreNextLeftButtonRelease )
m_Parent->OnLeftClick( &DC, pos );
m_Parent->OnLeftClick( &DC, screen->m_MousePosition );
s_IgnoreNextLeftButtonRelease = false;
}
......@@ -1217,7 +1220,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
}
}
/* Some key commands use the current mouse position: refresh it */
// Some key commands use the current mouse position: refresh it.
pos = wxGetMousePosition() - GetScreenPosition();
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
......
......@@ -51,21 +51,9 @@ void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
*/
void EDA_DRAW_FRAME::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize )
{
wxRealPoint grid_size;
wxCHECK_RET( aCoord != NULL, wxT( "Cannot pull NULL coordinate pointer on grid." ) );
if( aGridSize )
grid_size = *aGridSize;
else
grid_size = GetBaseScreen()->GetGridSize();
const wxPoint& grid_origin = GetBaseScreen()->GetGridOrigin();
double offset = fmod( grid_origin.x, grid_size.x );
int tmp = wxRound( (aCoord->x - offset) / grid_size.x );
aCoord->x = wxRound( tmp * grid_size.x + offset );
offset = fmod( grid_origin.y, grid_size.y );
tmp = wxRound( (aCoord->y - offset) / grid_size.y );
aCoord->y = wxRound ( tmp * grid_size.y + offset );
*aCoord = GetBaseScreen()->GetNearestGridPosition( *aCoord, aGridSize );
}
......
This diff is collapsed.
......@@ -27,51 +27,46 @@ int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow;
wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize;
void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, wxPoint& pos, SCH_COMPONENT* aComponent )
void InstallCmpeditFrame( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aComponent )
{
if( aComponent == NULL ) // Null component not accepted
return;
parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
aParent->DrawPanel->m_IgnoreMouseEvents = TRUE;
if( aComponent->Type() != SCH_COMPONENT_T )
{
DisplayError( parent,
DisplayError( aParent,
wxT( "InstallCmpeditFrame() error: This item is not a component" ) );
return;
}
else
{
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC* dialog =
new DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( parent );
dialog->InitBuffers( aComponent );
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC dialog( aParent );
wxSize sizeNow = dialog->GetSize();
dialog.InitBuffers( aComponent );
// this relies on wxDefaultSize being -1,-1, be careful here.
if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|| sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
{
dialog->SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize );
}
wxSize sizeNow = dialog.GetSize();
// make sure the chipnameTextCtrl is wide enough to hold any
// unusually long chip names:
EnsureTextCtrlWidth( dialog->chipnameTextCtrl );
// this relies on wxDefaultSize being -1,-1, be careful here.
if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|| sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
{
dialog.SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize );
}
dialog->ShowModal();
// make sure the chipnameTextCtrl is wide enough to hold any
// unusually long chip names:
EnsureTextCtrlWidth( dialog.chipnameTextCtrl );
// Some of the field values are long and are not always fully visible
// because the window comes up too narrow.
// Remember user's manual window resizing efforts here so it comes up
// wide enough next time.
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog->GetSize();
dialog.ShowModal();
dialog->Destroy();
}
// Some of the field values are long and are not always fully visible because the
// window comes up too narrow. Remember user's manual window resizing efforts here
// so it comes up wide enough next time.
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog.GetSize();
parent->DrawPanel->MouseToCursorSchema();
parent->DrawPanel->m_IgnoreMouseEvents = false;
aParent->DrawPanel->MouseToCursorSchema();
aParent->DrawPanel->m_IgnoreMouseEvents = false;
}
......
......@@ -16,9 +16,7 @@
*/
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
{
friend void InstallCmpeditFrame( SCH_EDIT_FRAME* parent,
wxPoint& pos,
SCH_COMPONENT* aComponent );
friend void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, SCH_COMPONENT* aComponent );
SCH_EDIT_FRAME* m_Parent;
SCH_COMPONENT* m_Cmp;
......
This diff is collapsed.
......@@ -100,9 +100,10 @@ public:
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void LoadSettings();
void SaveSettings();
......
This diff is collapsed.
......@@ -48,7 +48,7 @@ static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_
*
* This menu is then added to the list of zoom commands.
*/
bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
......@@ -66,7 +66,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
// Try to locate items at cursor position.
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = SchematicGeneralLocateAndDisplay( false );
DrawStruct = LocateAndShowItem( aPosition, false );
if( DrawStruct && (DrawStruct->Type() == SCH_SHEET_T) )
{
......
......@@ -40,7 +40,7 @@ void IncrementLabelMember( wxString& name );
/****************/
/* EDITPART.CPP */
/****************/
void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, wxPoint& pos, SCH_COMPONENT* m_Cmp );
void InstallCmpeditFrame( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aComponent );
void SnapLibItemPoint( int OrigX,
int OrigY,
......
......@@ -484,7 +484,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( screen->GetCurItem() == NULL )
break;
InstallCmpeditFrame( this, pos, (SCH_COMPONENT*) screen->GetCurItem() );
InstallCmpeditFrame( this, (SCH_COMPONENT*) screen->GetCurItem() );
break;
case ID_POPUP_SCH_MIROR_X_CMP:
......
......@@ -153,8 +153,8 @@ int TEMPLATES::AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
{
if( m_Fields[i].m_Name == aFieldName.m_Name )
{
D(printf("inserting template fieldname:'%s' at %d\n",
aFieldName.m_Name.utf8_str(), i );)
// D(printf("inserting template fieldname:'%s' at %d\n",
// aFieldName.m_Name.utf8_str(), i );)
m_Fields[i] = aFieldName;
return i; // return the container index
......
......@@ -69,7 +69,7 @@ public:
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void LoadSettings();
void SaveSettings();
......
......@@ -13,7 +13,7 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
}
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
wxPoint oldpos;
......
......@@ -370,7 +370,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
bool Read_GERBER_File( const wxString& GERBER_FullFileName,
const wxString& D_Code_FullFileName );
void GeneralControle( wxDC* DC, wxPoint Mouse );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
/**
......
......@@ -57,48 +57,45 @@ class BASE_SCREEN : public EDA_ITEM
GRIDS m_grids; ///< List of valid grid sizes.
EDA_ITEM* m_drawList; ///< Object list for the screen.
wxString m_fileName; ///< File used to load the screen.
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
char m_FlagModified; ///< Indicates current drawing has been modified.
char m_FlagSave; ///< Indicates automatic file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
public:
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units.
* (coordinates from last reset position)*/
* in user units. (coordinates from last reset position)*/
// 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)
*/
wxSize m_SizeVisu; /* taille en pixels de l'ecran (fenetre de visu
* Utile pour recadrer les affichages lors de la
* navigation dans la hierarchie */
bool m_Center; /* Center on screen. If TRUE (0.0) is centered
* on screen coordinates can be < 0 and
* > 0 except for schematics.
* FALSE: when coordinates can only be >= 0
* Schematic */
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)
*/
bool m_Center; /* Center on screen. If TRUE (0.0) is centered
* on screen coordinates can be < 0 and
* > 0 except for schematics.
* FALSE: when coordinates can only be >= 0
* Schematic */
bool m_FirstRedraw;
// Undo/redo list of commands
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo
* command (old data) */
UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo
* command (old data) */
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */
UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo command (old data) */
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
/* block control */
BLOCK_SELECTOR m_BlockLocate; /* Block description for block
* commands */
BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */
/* Page description */
Ki_PageDescr* m_CurrentSheetDesc;
......@@ -114,23 +111,12 @@ public:
wxString m_Commentaire3;
wxString m_Commentaire4;
private:
char m_FlagRefreshReq; /* indicates that the screen should
* be redrawn */
char m_FlagModified; // indicates current drawing has
// been modified
char m_FlagSave; // Perform automatica file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
/* Grid and zoom values. */
public:
wxPoint m_GridOrigin;
wxArrayInt m_ZoomList; /* Array of standard zoom coefficients. */
int m_Zoom; /* Current zoom coefficient. */
int m_ZoomScalar; /* Allow zooming to non-integer increments.
*/
int m_ZoomScalar; /* Allow zooming to non-integer increments. */
bool m_IsPrinting;
public:
......@@ -369,6 +355,25 @@ public:
return useMouse ? m_MousePosition : m_Curseur;
}
/**
* Function GetCursorPosition
* returns the current cursor position in logical (drawing) units.
* @param aOnGrid Returns the nearest grid position at the current cursor position.
* @param aGridSize Custom grid size instead of the current grid size. Only valid
* if \a aOnGrid is true.
* @return The current cursor position.
*/
wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL );
/**
* Function GetNearestGridPosition
* returns the nearest \a aGridSize location to \a aPosition.
* @param aPosition The position to check.
* @param aGridSize The grid size to locate to if provided. If NULL then the current
* grid size is used.
* @return The nearst grid position.
*/
wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL );
/**
* Function GetClass
......
......@@ -109,7 +109,7 @@ public:
void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
PARAM_CFG_ARRAY& GetProjectFileParameters( void );
void SaveProjectFile( wxWindow* displayframe, bool askoverwrite = true );
......@@ -172,7 +172,8 @@ public:
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem = NULL );
SCH_FIELD* GetCurrentField() { return m_CurrentField; }
......@@ -200,15 +201,14 @@ public:
void InstallConfigFrame( wxCommandEvent& event );
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnLeftClick( wxDC* aDC, const wxPoint& aPosition );
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition );
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
int BestZoom();
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
SCH_ITEM* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
bool IncludePin );
SCH_ITEM* LocateAndShowItem( const wxPoint& aPosition, bool aIncludePin = true );
SCH_ITEM* LocateItem( const wxPoint& aPosition, bool aIncludePin );
/**
* Function FillFootprintFieldForAllInstancesofComponent
......
......@@ -267,11 +267,12 @@ public:
* Function OnHotKey.
* ** Commands are case insensitive **
* Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aPosition The cursor position in logical (drawing) units.
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/
void OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_ITEM* aItem );
void OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
/**
* Function OnHotkeyDeleteItem
......@@ -366,7 +367,7 @@ public:
void ReFillLayerWidget();
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
/**
* Function ShowDesignRulesEditor
......
......@@ -269,7 +269,8 @@ public:
void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event );
virtual void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
virtual void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem = NULL );
/**
* Function AddMenuZoomAndGrid (virtual)
......@@ -373,9 +374,9 @@ public:
* called on every mouse and key event.
*</p>
* @param aDC A device context.
* @param aPosition The cursor position in logical (drawing) units.
* @param aPosition The current cursor position in logical (drawing) units.
*/
virtual void GeneralControle( wxDC* aDC, wxPoint aPosition ) { /* dummy */ }
virtual void GeneralControle( wxDC* aDC, const wxPoint& aPosition ) { /* dummy */ }
virtual void OnSize( wxSizeEvent& event );
void OnEraseBackground( wxEraseEvent& SizeEvent );
......
......@@ -226,7 +226,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
}
void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
wxPoint oldpos;
......@@ -370,7 +370,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
if( hotkey )
{
OnHotKey( aDC, hotkey, NULL );
OnHotKey( aDC, hotkey, aPosition );
}
if( GetScreen()->IsRefreshReq() )
......
......@@ -22,12 +22,14 @@
/**
* Function OnHotKey.
* ** Commands are case insensitive **
* Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
* Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aPosition The current cursor position in logical (drawing) units.
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/
void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_ITEM* aItem )
void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
EDA_ITEM* aItem )
{
if( aHotkeyCode == 0 )
return;
......
......@@ -20,14 +20,13 @@
*/
/*****************************************************************************************/
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStruct )
{
/*****************************************************************************************/
/* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive
*/
if( hotkey == 0 )
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem )
{
if( aHotKey == 0 )
return;
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
......@@ -37,13 +36,13 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStru
cmd.SetEventObject( this );
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( hotkey, common_Hotkey_List );
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, module_edit_Hotkey_List );
HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List );
if( HK_Descr == NULL )
return;
......
......@@ -40,13 +40,14 @@ public:
void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem = NULL );
bool OnHotkeyEditItem( int aIdCommand );
bool OnHotkeyDeleteItem( int aIdCommand );
bool OnHotkeyMoveItem( int aIdCommand );
bool OnHotkeyRotateItem( int aIdCommand );
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
/**
* Function LoadModuleFromBoard
......
......@@ -455,7 +455,7 @@ void WinEDA_ModuleEditFrame::Show3D_Frame( wxCommandEvent& event )
}
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
wxPoint oldpos;
......@@ -529,7 +529,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
if( hotkey )
{
OnHotKey( aDC, hotkey, NULL );
OnHotKey( aDC, hotkey, aPosition );
}
if( GetScreen()->IsRefreshReq() )
......
This diff is collapsed.
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