Commit f5eae506 authored by CHARRAS's avatar CHARRAS

more work on hotkeys. many features are ok.

parent 90e28dd1
...@@ -4,6 +4,15 @@ Started 2007-June-11 ...@@ -4,6 +4,15 @@ 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-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ eeschema & pcbnew
more about programmable hotkeys.
Most existing hotkeys are programmable and displayed in popup menus or tools
Work still in progress but most features are ok.
some features are not fixed (mainly the configuration files path, which is
currently the home directory under unix systems and kicad/template under windows))
2007-Aug-29 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Aug-29 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
......
This diff is collapsed.
...@@ -294,6 +294,9 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -294,6 +294,9 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
switch( g_KeyPressed ) switch( g_KeyPressed )
{ {
case 0:
break;
case EDA_PANNING_UP_KEY: case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP ); OnZoom( ID_ZOOM_PANNING_UP );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
...@@ -315,23 +318,16 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -315,23 +318,16 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
break; break;
case EDA_ZOOM_IN_FROM_MOUSE: case EDA_ZOOM_IN_FROM_MOUSE:
case WXK_F1:
OnZoom( ID_ZOOM_PLUS_KEY ); OnZoom( ID_ZOOM_PLUS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
case EDA_ZOOM_OUT_FROM_MOUSE: case EDA_ZOOM_OUT_FROM_MOUSE:
case WXK_F2:
OnZoom( ID_ZOOM_MOINS_KEY ); OnZoom( ID_ZOOM_MOINS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
case WXK_F3:
OnZoom( ID_ZOOM_REDRAW_KEY );
break;
case EDA_ZOOM_CENTER_FROM_MOUSE: case EDA_ZOOM_CENTER_FROM_MOUSE:
case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY ); OnZoom( ID_ZOOM_CENTER_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
......
/***********************************/ /***********************************/
/* eeschema.cpp - module principal */ /* eeschema.cpp - module principal */
/***********************************/ /***********************************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -26,51 +26,57 @@ ...@@ -26,51 +26,57 @@
/* Routines locales */ /* Routines locales */
static void CreateScreens(void); static void CreateScreens( void );
// Global variables // Global variables
wxString g_Main_Title( wxT("EESchema") ); wxString g_Main_Title( wxT( "EESchema" ) );
/************************************/ /************************************/
/* Called to initialize the program */ /* Called to initialize the program */
/************************************/ /************************************/
// Create a new application object: this macro will allow wxWindows to create // Create a new application object: this macro will allow wxWindows to create
// the application object during program execution (it's better than using a // the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function // static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and // wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp) // not wxApp)
IMPLEMENT_APP(WinEDA_App) IMPLEMENT_APP( WinEDA_App )
bool WinEDA_App::OnInit(void) bool WinEDA_App::OnInit( void )
{ {
wxString FFileName; wxString FFileName;
EDA_Appl = this;
g_DebugLevel = 0; // Debug level */ EDA_Appl = this;
InitEDA_Appl( wxT("eeschema") ); g_DebugLevel = 0; // Debug level */
if ( m_Checker && m_Checker->IsAnotherRunning() ) InitEDA_Appl( wxT( "eeschema" ) );
if( m_Checker && m_Checker->IsAnotherRunning() )
{ {
if ( ! IsOK(NULL, _("Eeschema is already running, Continue?") ) ) if( !IsOK( NULL, _( "Eeschema is already running, Continue?" ) ) )
return false; return false;
} }
if(argc > 1 ) FFileName = argv[1]; if( argc > 1 )
FFileName = argv[1];
CreateScreens(); CreateScreens();
/* init EESCHEMA */ /* init EESCHEMA */
GetSettings(); // read current setup GetSettings(); // read current setup
SeedLayers(); SeedLayers();
Read_Hotkey_Config( SchematicFrame, false ); /* Must be called before creating the main frame
* in order to display the real hotkeys in menus
* or tool tips */
// Create main frame (schematic frame) : // Create main frame (schematic frame) :
SchematicFrame = new WinEDA_SchematicFrame(NULL, this, SchematicFrame = new WinEDA_SchematicFrame( NULL, this,
wxT("EESchema"), wxPoint(0,0), wxSize(600,400) ); wxT( "EESchema" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
SetTopWindow(SchematicFrame); SetTopWindow( SchematicFrame );
SchematicFrame->Show(TRUE); SchematicFrame->Show( TRUE );
if( CreateServer( SchematicFrame, KICAD_SCH_PORT_SERVICE_NUMBER ) ) if( CreateServer( SchematicFrame, KICAD_SCH_PORT_SERVICE_NUMBER ) )
{ {
...@@ -78,49 +84,47 @@ wxString FFileName; ...@@ -78,49 +84,47 @@ wxString FFileName;
// sends EESCHEMA a command // sends EESCHEMA a command
SetupServerFunction( RemoteCommand ); SetupServerFunction( RemoteCommand );
} }
SchematicFrame->Zoom_Automatique(TRUE); SchematicFrame->Zoom_Automatique( TRUE );
Read_Hotkey_Config(SchematicFrame, false);
/* Load file specified in the command line. */
/* Load file specified in the command line. */ if( !FFileName.IsEmpty() )
if( ! FFileName.IsEmpty() ) {
{ ChangeFileNameExt( FFileName, g_SchExtBuffer );
ChangeFileNameExt(FFileName, g_SchExtBuffer); wxSetWorkingDirectory( wxPathOnly( FFileName ) );
wxSetWorkingDirectory( wxPathOnly(FFileName) ); if( SchematicFrame->DrawPanel )
if ( SchematicFrame->DrawPanel ) if( SchematicFrame->LoadOneEEProject( FFileName, FALSE ) <= 0 )
if ( SchematicFrame->LoadOneEEProject(FFileName, FALSE) <= 0 ) SchematicFrame->DrawPanel->Refresh( TRUE ); // File not found or error
SchematicFrame->DrawPanel->Refresh(TRUE); // File not found or error }
} else
{
else Read_Config( wxEmptyString, TRUE ); // Read config file ici si pas de fichier a charger
{ if( SchematicFrame->DrawPanel )
Read_Config(wxEmptyString, TRUE); // Read config file ici si pas de fichier a charger SchematicFrame->DrawPanel->Refresh( TRUE );
if ( SchematicFrame->DrawPanel ) }
SchematicFrame->DrawPanel->Refresh(TRUE);
} return TRUE;
return TRUE;
} }
/******************************/ /******************************/
static void CreateScreens(void) static void CreateScreens( void )
/******************************/ /******************************/
/* /*
Fonction d'init des crans utiliss dans EESchema: * Fonction d'init des crans utiliss dans EESchema:
*/ */
{ {
/* creation des ecrans Sch , Lib */ /* creation des ecrans Sch , Lib */
if(ScreenSch == NULL ) if( ScreenSch == NULL )
ScreenSch = new SCH_SCREEN(SCHEMATIC_FRAME); ScreenSch = new SCH_SCREEN( SCHEMATIC_FRAME );
ScreenSch->m_FileName = g_DefaultSchematicFileName; ScreenSch->m_FileName = g_DefaultSchematicFileName;
ScreenSch->m_Date = GenDate(); ScreenSch->m_Date = GenDate();
ActiveScreen = ScreenSch; ActiveScreen = ScreenSch;
if(ScreenLib == NULL ) if( ScreenLib == NULL )
ScreenLib = new SCH_SCREEN(LIBEDITOR_FRAME); ScreenLib = new SCH_SCREEN( LIBEDITOR_FRAME );
ScreenLib->SetZoom(4); ScreenLib->SetZoom( 4 );
ScreenLib->m_UndoRedoCountMax = 10; ScreenLib->m_UndoRedoCountMax = 10;
} }
This diff is collapsed.
/***************/
/* hotkeys.h */
/***************/
#ifndef KOTKEYS_H
#define KOTKEYS_H
#include "hotkeys_basic.h"
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_NEXT_SEARCH,
HK_DELETE,
HK_REPEAT_LAST,
HK_MOVEBLOCK_TO_DRAGBLOCK,
HK_ROTATE_COMPONENT,
HK_MIRROR_X_COMPONENT,
HK_MIRROR_Y_COMPONENT,
HK_ORIENT_NORMAL_COMPONENT,
HK_MOVE_COMPONENT,
HK_ADD_NEW_COMPONENT,
HK_BEGIN_WIRE
};
// List of hotkey descriptors for schematic
extern Ki_HotkeyInfo* s_Schematic_Hotkey_List[];
// List of hotkey descriptors for libray editor
extern Ki_HotkeyInfo* s_LibEdit_Hotkey_List[];
#endif // KOTKEYS_H
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "protos.h" #include "protos.h"
#include "id.h" #include "id.h"
#include "hotkeys.h"
#include "bitmaps.h" #include "bitmaps.h"
...@@ -272,24 +273,31 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component ) ...@@ -272,24 +273,31 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component )
/* Add menu commands for a component /* Add menu commands for a component
*/ */
{ {
wxString msg;
EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry;
LibEntry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); LibEntry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( !Component->m_Flags ) if( !Component->m_Flags )
{ {
msg = AddHotkeyName( _( "Move Component" ), s_Schematic_Hotkey_List, HK_MOVE_COMPONENT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST,
_( "Move Component (M)" ), move_xpm ); msg, move_xpm );
} }
// add menu orient et sous menu: // add menu orient et sous menu:
wxMenu* orientmenu = new wxMenu; wxMenu* orientmenu = new wxMenu;
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hotkey_List, HK_ROTATE_COMPONENT );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE, ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE,
_( "Rotate + (R)" ), rotate_pos_xpm ); msg, rotate_pos_xpm );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), rotate_neg_xpm ); ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), rotate_neg_xpm );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_X_CMP, _( "Mirror -- (X)" ), mirror_V_xpm ); msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hotkey_List, HK_MIRROR_X_COMPONENT );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_Y_CMP, _( "Mirror || (Y)" ), mirror_H_xpm ); ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_X_CMP, msg, mirror_V_xpm );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ORIENT_NORMAL_CMP, _( "Normal (N)" ), normal_xpm ); msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hotkey_List, HK_MIRROR_Y_COMPONENT );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_Y_CMP, msg, mirror_H_xpm );
msg = AddHotkeyName( _( "Normal" ), s_Schematic_Hotkey_List, HK_ORIENT_NORMAL_COMPONENT );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ORIENT_NORMAL_CMP, msg, normal_xpm );
ADD_MENUITEM_WITH_SUBMENU( PopMenu, orientmenu, ADD_MENUITEM_WITH_SUBMENU( PopMenu, orientmenu,
ID_POPUP_SCH_GENERIC_ORIENT_CMP, _( ID_POPUP_SCH_GENERIC_ORIENT_CMP, _(
"Orient Component" ), orient_xpm ); "Orient Component" ), orient_xpm );
......
This diff is collapsed.
This diff is collapsed.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE #ifdef EDA_BASE
(wxT("(2007-08-21)")) (wxT("(2007-08-30)"))
#endif #endif
; ;
......
/*******************/ /*******************/
/* hotkeys_basic.h */ /* hotkeys_basic.h */
/*******************/ /*******************/
/* Some functions to handle hotkeys in kicad /* Some functions to handle hotkeys in kicad
*/ */
#ifndef HOTKEYS_BASIC_H #ifndef HOTKEYS_BASIC_H
#define HOTKEYS_BASIC_H #define HOTKEYS_BASIC_H
#define DEFAULT_HOTKEY_FILENAME_EXT wxT(".key") #define DEFAULT_HOTKEY_FILENAME_EXT wxT( ".key" )
/* define default path for config key file */ /* define default path for config key file */
#ifdef __WINDOWS__ #ifdef __WINDOWS__
#define DEFAULT_HOTKEY_FILENAME_PATH EDA_Appl->m_BinDir + wxT("../template/") #define DEFAULT_HOTKEY_FILENAME_PATH EDA_Appl->m_BinDir + wxT( "../template/" )
#else #else
#define DEFAULT_HOTKEY_FILENAME_PATH wxGetHomeDir() + wxT("/") #define DEFAULT_HOTKEY_FILENAME_PATH wxGetHomeDir() + wxT( "/" )
#endif #endif
/* Class to handle hotkey commnands. hotkeys have a default value /* Class to handle hotkey commnands. hotkeys have a default value
This class allows (for the future..) the real key code changed by user(from a key code list file, TODO) * This class allows (for the future..) the real key code changed by user(from a key code list file, TODO)
*/ */
class Ki_HotkeyInfo class Ki_HotkeyInfo
{ {
public: public:
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
wxString m_InfoMsg; // info message. wxString m_InfoMsg; // info message.
int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list) int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list)
public: public:
Ki_HotkeyInfo(const wxChar * infomsg, int idcommand, int keycode); Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode );
}; };
/* Functions: /* Functions:
*/ */
wxString ReturnKeyNameFromKeyCode(int keycode); wxString ReturnKeyNameFromKeyCode( int keycode );
void DisplayHotkeyList(WinEDA_DrawFrame * frame, Ki_HotkeyInfo ** List); wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId );
int GetCommandCodeFromHotkey(int key, Ki_HotkeyInfo ** List); wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId );
void DisplayHotkeyList( WinEDA_DrawFrame* frame, Ki_HotkeyInfo** List );
int GetCommandCodeFromHotkey( int key, Ki_HotkeyInfo** List );
#endif // HOTKEYS_BASIC_H #endif // HOTKEYS_BASIC_H
No preview for this file type
This diff is collapsed.
...@@ -25,16 +25,16 @@ ...@@ -25,16 +25,16 @@
/* classe D_PAD : constructeur */ /* classe D_PAD : constructeur */
/*******************************/ /*******************************/
D_PAD::D_PAD( MODULE* parent ) : D_PAD::D_PAD( MODULE* parent ) :
BOARD_ITEM( parent, TYPEPAD ) BOARD_ITEM( parent, TYPEPAD )
{ {
m_NumPadName = 0; m_NumPadName = 0;
m_Masque_Layer = CUIVRE_LAYER; m_Masque_Layer = CUIVRE_LAYER;
m_NetCode = 0; /* Numero de net pour comparaisons rapides */ m_NetCode = 0; /* Numero de net pour comparaisons rapides */
m_DrillShape = CIRCLE; // Drill shape = circle m_DrillShape = CIRCLE; // Drill shape = circle
m_Size.x = m_Size.y = 500; m_Size.x = m_Size.y = 500;
if( m_Parent && (m_Parent->m_StructType == TYPEMODULE) ) if( m_Parent && (m_Parent->m_StructType == TYPEMODULE) )
{ {
m_Pos = ( (MODULE*) m_Parent )->m_Pos; m_Pos = ( (MODULE*) m_Parent )->m_Pos;
...@@ -73,7 +73,6 @@ void D_PAD::ComputeRayon( void ) ...@@ -73,7 +73,6 @@ void D_PAD::ComputeRayon( void )
break; break;
case RECT: case RECT:
case SPECIAL_PAD:
case TRAPEZE: case TRAPEZE:
m_Rayon = (int) (sqrt( (float) m_Size.y * m_Size.y m_Rayon = (int) (sqrt( (float) m_Size.y * m_Size.y
+ (float) m_Size.x * m_Size.x ) / 2); + (float) m_Size.x * m_Size.x ) / 2);
...@@ -90,16 +89,16 @@ const wxPoint D_PAD::ReturnShapePos( void ) ...@@ -90,16 +89,16 @@ const wxPoint D_PAD::ReturnShapePos( void )
{ {
if( (m_Offset.x == 0) && (m_Offset.y == 0) ) if( (m_Offset.x == 0) && (m_Offset.y == 0) )
return m_Pos; return m_Pos;
wxPoint shape_pos; wxPoint shape_pos;
int dX, dY; int dX, dY;
dX = m_Offset.x; dX = m_Offset.x;
dY = m_Offset.y; dY = m_Offset.y;
RotatePoint( &dX, &dY, m_Orient ); RotatePoint( &dX, &dY, m_Orient );
shape_pos.x = m_Pos.x + dX; shape_pos.x = m_Pos.x + dX;
shape_pos.y = m_Pos.y + dY; shape_pos.y = m_Pos.y + dY;
return shape_pos; return shape_pos;
...@@ -410,7 +409,6 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -410,7 +409,6 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
break; break;
case RECT: case RECT:
case SPECIAL_PAD:
case TRAPEZE: case TRAPEZE:
{ {
int ddx, ddy; int ddx, ddy;
...@@ -464,7 +462,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -464,7 +462,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
} }
} }
break; break;
default: default:
break; break;
...@@ -486,7 +484,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -486,7 +484,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
switch( m_DrillShape ) switch( m_DrillShape )
{ {
case CIRCLE: case CIRCLE:
if( (hole / zoom) > 1 ) /* draw hole if its size is enought */ if( (hole / zoom) > 1 ) /* draw hole if its size is enought */
GRFilledCircle( &panel->m_ClipBox, DC, cx0, cy0, hole, 0, color, color ); GRFilledCircle( &panel->m_ClipBox, DC, cx0, cy0, hole, 0, color, color );
break; break;
...@@ -517,7 +515,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -517,7 +515,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
} }
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
/* Trace du symbole "No connect" ( / ou \ ou croix en X) si necessaire : */ /* Trace du symbole "No connect" ( / ou \ ou croix en X) si necessaire : */
if( m_Netname.IsEmpty() && DisplayOpt.DisplayPadNoConn ) if( m_Netname.IsEmpty() && DisplayOpt.DisplayPadNoConn )
{ {
...@@ -531,26 +529,26 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -531,26 +529,26 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
GRLine( &panel->m_ClipBox, DC, cx0 + dx0, cy0 - dx0, GRLine( &panel->m_ClipBox, DC, cx0 + dx0, cy0 - dx0,
cx0 - dx0, cy0 + dx0, 0, nc_color ); cx0 - dx0, cy0 + dx0, 0, nc_color );
} }
/* Trace de la reference */ /* Trace de la reference */
if( !frame->m_DisplayPadNum ) if( !frame->m_DisplayPadNum )
return; return;
dx = MIN( m_Size.x, m_Size.y ); /* dx = text size */ dx = MIN( m_Size.x, m_Size.y ); /* dx = text size */
if( (dx / zoom) > 12 ) /* size must be enought to draw 2 chars */ if( (dx / zoom) > 12 ) /* size must be enought to draw 2 chars */
{ {
wxString buffer; wxString buffer;
ReturnStringPadName( buffer ); ReturnStringPadName( buffer );
dy = buffer.Len(); dy = buffer.Len();
/* Draw text with an angle between -90 deg and + 90 deg */ /* Draw text with an angle between -90 deg and + 90 deg */
NORMALIZE_ANGLE_90( angle ); NORMALIZE_ANGLE_90( angle );
if( dy < 2 ) if( dy < 2 )
dy = 2; /* text min size is 2 char */ dy = 2; /* text min size is 2 char */
dx = (dx * 9 ) / (dy * 13 ); /* Text size ajusted to pad size */ dx = (dx * 9 ) / (dy * 13 ); /* Text size ajusted to pad size */
DrawGraphicText( panel, DC, wxPoint( ux0, uy0 ), DrawGraphicText( panel, DC, wxPoint( ux0, uy0 ),
WHITE, buffer, angle, wxSize( dx, dx ), WHITE, buffer, angle, wxSize( dx, dx ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
...@@ -795,7 +793,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -795,7 +793,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
MODULE* Module; MODULE* Module;
wxString Line; wxString Line;
int pos = 1; int pos = 1;
/* Pad messages */ /* Pad messages */
static const wxString Msg_Pad_Shape[6] = static const wxString Msg_Pad_Shape[6] =
{ wxT( "??? " ), wxT( "Circ" ), wxT( "Rect" ), wxT( "Oval" ), wxT( "trap" ), wxT( "spec" ) }; { wxT( "??? " ), wxT( "Circ" ), wxT( "Rect" ), wxT( "Oval" ), wxT( "trap" ), wxT( "spec" ) };
...@@ -805,7 +803,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -805,7 +803,7 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
wxT( "??? " ), wxT( "cmp " ), wxT( "cu " ), wxT( "cmp+cu " ), wxT( "int " ), wxT( "??? " ), wxT( "cmp " ), wxT( "cu " ), wxT( "cmp+cu " ), wxT( "int " ),
wxT( "cmp+int " ), wxT( "cu+int " ), wxT( "all " ), wxT( "No copp" ) wxT( "cmp+int " ), wxT( "cu+int " ), wxT( "all " ), wxT( "No copp" )
}; };
static const wxString Msg_Pad_Attribut[5] = static const wxString Msg_Pad_Attribut[5] =
{ wxT( "norm" ), wxT( "smd " ), wxT( "conn" ), wxT( "hole" ), wxT( "????" ) }; { wxT( "norm" ), wxT( "smd " ), wxT( "conn" ), wxT( "hole" ), wxT( "????" ) };
...@@ -910,16 +908,12 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -910,16 +908,12 @@ void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
pos += 6; pos += 6;
Affiche_1_Parametre( frame, pos, Msg_Pad_Shape[m_PadShape], wxEmptyString, DARKGREEN ); Affiche_1_Parametre( frame, pos, Msg_Pad_Shape[m_PadShape], wxEmptyString, DARKGREEN );
/* Affichage en couleur diff si pad stack ou non */
if( m_Attribut & PAD_STACK ) Affiche_1_Parametre( frame,
Affiche_1_Parametre( frame, -1, wxEmptyString, Msg_Pad_Attribut[m_Attribut & 15], RED ); -1,
else wxEmptyString,
Affiche_1_Parametre( frame, Msg_Pad_Attribut[m_Attribut & 15],
-1, DARKGREEN );
wxEmptyString,
Msg_Pad_Attribut[m_Attribut & 15],
DARKGREEN );
valeur_param( m_Size.x, Line ); valeur_param( m_Size.x, Line );
pos += 6; pos += 6;
...@@ -978,12 +972,12 @@ bool D_PAD::HitTest( const wxPoint& ref_pos ) ...@@ -978,12 +972,12 @@ bool D_PAD::HitTest( const wxPoint& ref_pos )
wxPoint shape_pos = ReturnShapePos(); wxPoint shape_pos = ReturnShapePos();
deltaX = ref_pos.x - shape_pos.x; deltaX = ref_pos.x - shape_pos.x;
deltaY = ref_pos.y - shape_pos.y; deltaY = ref_pos.y - shape_pos.y;
/* Test rapide: le point a tester doit etre a l'interieur du cercle exinscrit ... */ /* Test rapide: le point a tester doit etre a l'interieur du cercle exinscrit ... */
if( (abs( deltaX ) > m_Rayon ) if( (abs( deltaX ) > m_Rayon )
|| (abs( deltaY ) > m_Rayon) ) || (abs( deltaY ) > m_Rayon) )
return false; return false;
/* calcul des demi dim dx et dy */ /* calcul des demi dim dx et dy */
...@@ -1006,35 +1000,38 @@ bool D_PAD::HitTest( const wxPoint& ref_pos ) ...@@ -1006,35 +1000,38 @@ bool D_PAD::HitTest( const wxPoint& ref_pos )
return true; return true;
break; break;
} }
return false; return false;
} }
#if defined(DEBUG) #if defined (DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level * @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void D_PAD::Show( int nestLevel, std::ostream& os ) void D_PAD::Show( int nestLevel, std::ostream& os )
{ {
char padname[5] = { m_Padname[0], m_Padname[1], m_Padname[2], m_Padname[3], 0 }; char padname[5] = { m_Padname[0], m_Padname[1], m_Padname[2], m_Padname[3], 0 };
char layerMask[16]; char layerMask[16];
sprintf( layerMask, "0x%08X", m_Masque_Layer ); sprintf( layerMask, "0x%08X", m_Masque_Layer );
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" num=\"" << padname << '"' << " num=\"" << padname << '"' <<
" net=\"" << m_Netname.mb_str() << '"' << " net=\"" << m_Netname.mb_str() << '"' <<
" layerMask=\"" << layerMask << '"' << m_Pos << "/>\n"; " layerMask=\"" << layerMask << '"' << m_Pos << "/>\n";
// NestedSpace( nestLevel+1, os ) << m_Text.mb_str() << '\n'; // NestedSpace( nestLevel+1, os ) << m_Text.mb_str() << '\n';
// NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; // NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
} }
#endif #endif
This diff is collapsed.
...@@ -215,51 +215,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -215,51 +215,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed ) switch( g_KeyPressed )
{ {
case WXK_NUMPAD_SUBTRACT:
case WXK_SUBTRACT:
case '-':
ll = GetScreen()->m_Active_Layer;
if( ll > CMP_N )
break;
if( ll <= CUIVRE_N )
break;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 ) // Single layer
ll = CUIVRE_N;
if( ll == CMP_N )
ll = MAX( CUIVRE_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
else if( ll > CUIVRE_N )
ll--;
GetScreen()->m_Active_Layer = ll;
if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh( TRUE );
break;
case WXK_NUMPAD_ADD:
case WXK_ADD:
case '+':
ll = GetScreen()->m_Active_Layer;
if( ll >= CMP_N )
break;
ll++;
if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
ll = CMP_N;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 ) // Single layer
ll = CUIVRE_N;
GetScreen()->m_Active_Layer = ll;
if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh( TRUE );
break;
case WXK_NUMPAD0:
case WXK_PAGEUP:
SwitchLayer( DC, CMP_N );
break;
case WXK_NUMPAD9:
case WXK_PAGEDOWN:
SwitchLayer( DC, CUIVRE_N );
break;
case EDA_PANNING_UP_KEY: case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP ); OnZoom( ID_ZOOM_PANNING_UP );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
...@@ -281,51 +236,20 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -281,51 +236,20 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
break; break;
case EDA_ZOOM_IN_FROM_MOUSE: case EDA_ZOOM_IN_FROM_MOUSE:
case WXK_F1:
OnZoom( ID_ZOOM_PLUS_KEY ); OnZoom( ID_ZOOM_PLUS_KEY );
oldpos = curpos = GetScreen()->m_Curseur; oldpos = curpos = GetScreen()->m_Curseur;
break; break;
case EDA_ZOOM_OUT_FROM_MOUSE: case EDA_ZOOM_OUT_FROM_MOUSE:
case WXK_F2:
OnZoom( ID_ZOOM_MOINS_KEY ); OnZoom( ID_ZOOM_MOINS_KEY );
oldpos = curpos = GetScreen()->m_Curseur; oldpos = curpos = GetScreen()->m_Curseur;
break; break;
case WXK_F3:
OnZoom( ID_ZOOM_REDRAW_KEY );
break;
case EDA_ZOOM_CENTER_FROM_MOUSE: case EDA_ZOOM_CENTER_FROM_MOUSE:
case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY ); OnZoom( ID_ZOOM_CENTER_KEY );
oldpos = curpos = GetScreen()->m_Curseur; oldpos = curpos = GetScreen()->m_Curseur;
break; break;
case WXK_F5:
SwitchLayer( DC, LAYER_N_2 );
break;
case WXK_F6:
SwitchLayer( DC, LAYER_N_3 );
break;
case WXK_F7:
SwitchLayer( DC, LAYER_N_4 );
break;
case WXK_F8:
SwitchLayer( DC, LAYER_N_5 );
break;
case WXK_F9:
SwitchLayer( DC, LAYER_N_6 );
break;
case WXK_F10:
SwitchLayer( DC, LAYER_N_7 );
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP: case WXK_UP:
Mouse.y -= delta.y; Mouse.y -= delta.y;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -183,11 +183,11 @@ wxMenuBar * menuBar = GetMenuBar(); ...@@ -183,11 +183,11 @@ wxMenuBar * menuBar = GetMenuBar();
configmenu->Append(item); configmenu->Append(item);
configmenu->AppendSeparator(); configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, _("Create Eeschema &Hotkey config file"), item = new wxMenuItem(configmenu, ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, _("Create Pcbnew &Hotkey config file"),
_("Create or Recreate the hotkey config file from current hotkey list") ); _("Create or Recreate the hotkey config file from current hotkey list") );
item->SetBitmap(save_setup_xpm); item->SetBitmap(save_setup_xpm);
configmenu->Append(item); configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_PREFERENCES_READ_CONFIG_HOTKEYS, _("Reread &Eeschema Hotkey config file"), item = new wxMenuItem(configmenu, ID_PREFERENCES_READ_CONFIG_HOTKEYS, _("Reread &Pcbnew Hotkey config file"),
_("Reread the hotkey config file") ); _("Reread the hotkey config file") );
item->SetBitmap( reload_xpm); item->SetBitmap( reload_xpm);
configmenu->Append(item); configmenu->Append(item);
......
This diff is collapsed.
This diff is collapsed.
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