Commit ea6aba82 authored by CHARRAS's avatar CHARRAS

Better Hotkey.cpp code for eeschema

parent c3a1b404
...@@ -4,6 +4,11 @@ Started 2007-June-11 ...@@ -4,6 +4,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-aug-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ eeschema
better hotkeys.cpp code.
2007-Aug-08 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Aug-08 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
......
...@@ -5,15 +5,14 @@ ...@@ -5,15 +5,14 @@
/* Fichier TRIGO.CPP */ /* Fichier TRIGO.CPP */
#include "fctsys.h" #include "fctsys.h"
#define global extern
#include "trigo.h" #include "trigo.h"
/*****************************/ /************************************************************************/
bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY ) bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY )
/*****************************/ /************************************************************************/
/* /*
* Calcul de la distance du curseur souris a un segment de droite : * Calcul de la distance du curseur souris a un segment de droite :
...@@ -291,6 +290,27 @@ void RotatePoint( int* pX, int* pY, int cx, int cy, int angle ) ...@@ -291,6 +290,27 @@ void RotatePoint( int* pX, int* pY, int cx, int cy, int angle )
} }
/********************************************/
void RotatePoint( wxPoint* point, int angle )
/********************************************/
/*
* Fonction surchargee!
* calcule les nouvelles coord du point point,
* pour une rotation d'angle angle ( en 1/10 degre)
*/
{
int ox, oy;
ox = point->x;
oy = point->y;
RotatePoint( &ox, &oy, angle );
point->x = ox;
point->y = oy;
}
/*****************************************************************/ /*****************************************************************/
void RotatePoint( wxPoint* point, const wxPoint& centre, int angle ) void RotatePoint( wxPoint* point, const wxPoint& centre, int angle )
/*****************************************************************/ /*****************************************************************/
...@@ -312,6 +332,7 @@ void RotatePoint( wxPoint* point, const wxPoint& centre, int angle ) ...@@ -312,6 +332,7 @@ void RotatePoint( wxPoint* point, const wxPoint& centre, int angle )
} }
/*************************************************************************/ /*************************************************************************/
void RotatePoint( double* pX, double* pY, double cx, double cy, int angle ) void RotatePoint( double* pX, double* pY, double cx, double cy, int angle )
/*************************************************************************/ /*************************************************************************/
......
...@@ -297,10 +297,6 @@ int hotkey = 0; ...@@ -297,10 +297,6 @@ int hotkey = 0;
m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur;
break; break;
case '\t': // Switch to drag mode, when block moving
((WinEDA_SchematicFrame*)this)->HandleBlockEndByPopUp(BLOCK_DRAG, DC);
break;
case WXK_NUMPAD8 : /* Deplacement curseur vers le haut */ case WXK_NUMPAD8 : /* Deplacement curseur vers le haut */
case WXK_UP : case WXK_UP :
MousePositionInPixels.y -= delta.y; MousePositionInPixels.y -= delta.y;
...@@ -325,33 +321,6 @@ int hotkey = 0; ...@@ -325,33 +321,6 @@ int hotkey = 0;
DrawPanel->MouseTo(MousePositionInPixels); DrawPanel->MouseTo(MousePositionInPixels);
break; break;
case WXK_INSERT:
case WXK_NUMPAD0:
if ( m_Ident == SCHEMATIC_FRAME )
{
if ( g_ItemToRepeat && (g_ItemToRepeat->m_Flags == 0) )
{
((WinEDA_SchematicFrame*)this)->RepeatDrawItem(DC);
}
else wxBell();
break;
}
if ( m_Ident == LIBEDITOR_FRAME )
{
if ( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0) &&
(LibItemToRepeat->m_StructType == COMPONENT_PIN_DRAW_TYPE) )
{
((WinEDA_LibeditFrame*)this)->RepeatPinItem(DC,
(LibDrawPin*) LibItemToRepeat);
}
else wxBell();
break;
}
case 0:
case WXK_DECIMAL:
break;
default: hotkey = g_KeyPressed; default: hotkey = g_KeyPressed;
break; break;
...@@ -367,8 +336,7 @@ int hotkey = 0; ...@@ -367,8 +336,7 @@ int hotkey = 0;
RedrawActiveWindow(DC, TRUE); RedrawActiveWindow(DC, TRUE);
} }
if ( (oldpos.x != m_CurrentScreen->m_Curseur.x) || if ( oldpos != m_CurrentScreen->m_Curseur )
(oldpos.y != m_CurrentScreen->m_Curseur.y) )
{ {
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
m_CurrentScreen->m_Curseur = oldpos; m_CurrentScreen->m_Curseur = oldpos;
......
This diff is collapsed.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
/* Prototype des fonctions de trigo.cpp */ /* Prototype des fonctions de trigo.cpp */
void RotatePoint(int *pX, int *pY, int angle); void RotatePoint(int *pX, int *pY, int angle);
void RotatePoint(int *pX, int *pY, int cx, int cy, int angle); void RotatePoint(int *pX, int *pY, int cx, int cy, int angle);
void RotatePoint(wxPoint* point, int angle );
void RotatePoint(wxPoint *point, const wxPoint & centre, int angle); void RotatePoint(wxPoint *point, const wxPoint & centre, int angle);
void RotatePoint(double *pX, double *pY, int angle); void RotatePoint(double *pX, double *pY, int angle);
void RotatePoint(double *pX, double *pY, double cx, double cy, int angle); void RotatePoint(double *pX, double *pY, double cx, double cy, int angle);
...@@ -22,37 +23,6 @@ int ArcTangente(int dy, int dx); ...@@ -22,37 +23,6 @@ int ArcTangente(int dy, int dx);
bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY ); bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY );
/*************************************************/
/* Table lookup de 1/COS(X) en fonction de tg(X) */
/*************************************************/
eda_global float invcostab[17]
#if defined MAIN
= { 1.0, 1/0.998, 1/0.9923, 1/0.9829, 1/0.97014, 1/0.9545,
1/0.93633, 1/0.91615, 1/0.8944, 1/0.8715, 1/0.848, 1/0.82404,
1/0.8, 1/0.7761, 1/0.75257, 1/0.7295, 1/0.707 }
#endif
;
/***************************************************/
/* Table lookup de 256*COS(X) en fonction de tg(X) */
/***************************************************/
eda_global long costab[17]
#if defined MAIN
= { 256, 255, 253, 251, 248, 244, 240, 234, 229,
223, 217, 211, 205, 198, 192, 187, 181 }
#endif
;
/***************************************************/
/* Table lookup de 256*SIN(X) en fonction de tg(X) */
/***************************************************/
eda_global long sintab[17]
#if defined MAIN
= { 0, 16, 32, 47, 62, 76, 90, 103, 114,
125, 136, 145, 154, 161, 168, 175, 181 }
#endif
;
/*******************/ /*******************/
/* Macro NEW_COORD */ /* Macro NEW_COORD */
/*******************/ /*******************/
......
...@@ -1120,9 +1120,8 @@ public: ...@@ -1120,9 +1120,8 @@ public:
int BestZoom( void ); // Retourne le meilleur zoom int BestZoom( void ); // Retourne le meilleur zoom
void SetToolbars( void ); void SetToolbars( void );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen( void ) { return (SCH_SCREEN*) m_CurrentScreen; } SCH_SCREEN* GetScreen( void ) { return (SCH_SCREEN*) m_CurrentScreen; }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
private: private:
......
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