Commit 4a489895 authored by stambaughw's avatar stambaughw

More zoom clean ups and code cleaning.

parent 63724083
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA3D_DrawFrame::Process_Zoom )
WinEDA3D_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D, EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D,
WinEDA3D_DrawFrame::Process_Special_Functions ) WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_MENU( wxID_EXIT, WinEDA3D_DrawFrame::Exit3DFrame ) EVT_MENU( wxID_EXIT, WinEDA3D_DrawFrame::Exit3DFrame )
...@@ -172,7 +171,7 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event ) ...@@ -172,7 +171,7 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_ZOOM_PAGE_BUTT: case ID_ZOOM_PAGE:
for( ii = 0; ii < 4; ii++ ) for( ii = 0; ii < 4; ii++ )
g_Parm_3D_Visu.m_Rot[ii] = 0.0; g_Parm_3D_Visu.m_Rot[ii] = 0.0;
...@@ -181,17 +180,17 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event ) ...@@ -181,17 +180,17 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 ); trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
break; break;
case ID_ZOOM_IN_BUTT: case ID_ZOOM_IN:
g_Parm_3D_Visu.m_Zoom /= 1.2; g_Parm_3D_Visu.m_Zoom /= 1.2;
if( g_Parm_3D_Visu.m_Zoom <= 0.01 ) if( g_Parm_3D_Visu.m_Zoom <= 0.01 )
g_Parm_3D_Visu.m_Zoom = 0.01; g_Parm_3D_Visu.m_Zoom = 0.01;
break; break;
case ID_ZOOM_OUT_BUTT: case ID_ZOOM_OUT:
g_Parm_3D_Visu.m_Zoom *= 1.2; g_Parm_3D_Visu.m_Zoom *= 1.2;
break; break;
case ID_ZOOM_REDRAW_BUTT: case ID_ZOOM_REDRAW:
break; break;
default: default:
......
...@@ -39,16 +39,16 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar() ...@@ -39,16 +39,16 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
#endif #endif
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ), m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, BITMAP( zoom_in_xpm ),
_( "Zoom in" ) ); _( "Zoom in" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ), m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, BITMAP( zoom_out_xpm ),
_( "Zoom out" ) ); _( "Zoom out" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( zoom_redraw_xpm ), m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, BITMAP( zoom_redraw_xpm ),
_( "Redraw view" ) ); _( "Redraw view" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_auto_xpm ), m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, BITMAP( zoom_auto_xpm ),
_( "Zoom auto" ) ); _( "Zoom auto" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
......
...@@ -5,6 +5,21 @@ Started 2007-June-11 ...@@ -5,6 +5,21 @@ 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.
2009-Jan-07 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++all
* Don't pan or zoom on mouse wheel events when the cursor is not in the
drawing area.
* Reduce all zoom code to a single zoom command handler.
* Eliminate redundant zoom command identifiers.
* Move pop up zoom command handler from DrawPanel to DrawFrame.
* Change hot key zoom handlers to use command events.
* Added DrawFrame event table to replace COMMON_EVENTS_DRAWFRAME macro.
* Added locale path relative to binary path for development purposes.
* Minor code clean ups and duplicate header removal in files that were
updated.
2009-Jan-04 UPDATE Dick Hollenbeck <dick@softplc.com> 2009-Jan-04 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++all ++all
......
...@@ -15,6 +15,15 @@ ...@@ -15,6 +15,15 @@
#include <wx/fontdlg.h> #include <wx/fontdlg.h>
BEGIN_EVENT_TABLE( WinEDA_DrawFrame, WinEDA_BasicFrame )
EVT_MOUSEWHEEL( WinEDA_DrawFrame::OnMouseEvent )
EVT_MENU_OPEN( WinEDA_DrawFrame::OnMenuOpen )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
WinEDA_DrawFrame::OnZoom )
END_EVENT_TABLE()
/*******************************************************/ /*******************************************************/
/* Constructeur de WinEDA_DrawFrame: la fenetre generale */ /* Constructeur de WinEDA_DrawFrame: la fenetre generale */
/*******************************************************/ /*******************************************************/
...@@ -533,81 +542,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, ...@@ -533,81 +542,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
} }
/********************************************/
void WinEDA_DrawFrame::OnZoom( int zoom_type )
/********************************************/
/* Fonction de traitement du zoom
* Modifie le facteur de zoom et reaffiche l'ecran
* Pour les commandes par menu Popup ou par le clavier, le curseur est
* replac� au centre de l'ecran
*/
{
if( DrawPanel == NULL )
return;
BASE_SCREEN* screen = GetBaseScreen();
bool move_mouse_cursor = FALSE;
int x, y;
wxPoint old_pos;
DrawPanel->GetViewStart( &x, &y );
old_pos = GetBaseScreen()->m_Curseur;
switch( zoom_type )
{
case ID_POPUP_ZOOM_IN:
case ID_ZOOM_IN_KEY:
move_mouse_cursor = TRUE;
// fall thru
case ID_ZOOM_IN_BUTT:
if( zoom_type == ID_ZOOM_IN_BUTT )
GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
screen->SetPreviousZoom();
Recadre_Trace( move_mouse_cursor );
break;
case ID_POPUP_ZOOM_OUT:
case ID_ZOOM_OUT_KEY:
move_mouse_cursor = TRUE;
// fall thru
case ID_ZOOM_OUT_BUTT:
if( zoom_type == ID_ZOOM_OUT_BUTT )
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
screen->SetNextZoom();
Recadre_Trace( move_mouse_cursor );
break;
case ID_POPUP_ZOOM_REDRAW:
case ID_ZOOM_REDRAW_KEY:
case ID_ZOOM_REDRAW_BUTT:
DrawPanel->Refresh();
break;
case ID_POPUP_ZOOM_CENTER:
case ID_ZOOM_CENTER_KEY:
Recadre_Trace( TRUE );
break;
case ID_ZOOM_PAGE_BUTT:
case ID_ZOOM_AUTO:
case ID_POPUP_ZOOM_AUTO:
Zoom_Automatique( FALSE );
break;
default:
wxMessageBox( wxT( "WinEDA_DrawFrame::OnZoom switch Error" ) );
break;
}
Affiche_Status_Box();
}
/*****************************/ /*****************************/
/* default virtual fonctions */ /* default virtual fonctions */
/*****************************/ /*****************************/
......
...@@ -33,8 +33,6 @@ BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow ) ...@@ -33,8 +33,6 @@ BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll ) EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate ) EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
WinEDA_DrawPanel::Process_Popup_Zoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
WinEDA_DrawPanel::OnPopupGridSelect ) WinEDA_DrawPanel::OnPopupGridSelect )
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan ) EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
...@@ -50,7 +48,6 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, ...@@ -50,7 +48,6 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE ) wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE )
{ {
m_Parent = parent; m_Parent = parent;
m_Ident = m_Parent->m_Ident;
m_Scroll_unit = 1; m_Scroll_unit = 1;
m_ScrollButt_unit = 40; m_ScrollButt_unit = 40;
...@@ -902,10 +899,14 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event ) ...@@ -902,10 +899,14 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
// Auto pan if mouse is leave working aera: // Auto pan if mouse is leave working aera:
wxSize size = GetClientSize(); wxSize size = GetClientSize();
if( ( size.x < event.GetX() )
|| ( size.y < event.GetY() ) if( ( size.x < event.GetX() ) || ( size.y < event.GetY() )
|| ( event.GetX() <= 0) || ( event.GetY() <= 0 ) ) || ( event.GetX() <= 0) || ( event.GetY() <= 0 ) )
m_Parent->OnZoom( ID_POPUP_ZOOM_CENTER ); {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
}
} }
...@@ -918,16 +919,23 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event ) ...@@ -918,16 +919,23 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
*/ */
void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event ) void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
{ {
if( event.GetWheelRotation() == 0 ) wxRect rect = GetRect();
wxLogDebug( wxT( "OnMouseWheel() cursor position: (%d, %d)." ),
event.m_x, event.m_y );
/* Ignore scroll events if the cursor is outside the drawing area. */
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !rect.Contains( event.GetPosition() ) )
{ {
event.Skip(); event.Skip();
return; return;
} }
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
// This is a zoom in ou out command // This is a zoom in or out command
if( event.GetWheelRotation() > 0 ) if( event.GetWheelRotation() > 0 )
{ {
if( event.ShiftDown() && !event.ControlDown() ) if( event.ShiftDown() && !event.ControlDown() )
...@@ -1073,8 +1081,11 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1073,8 +1081,11 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
{ {
// The middle button has been relached, with no block command: // The middle button has been relached, with no block command:
// We use it for a zoom center command // We use it for a zoom center at cursor position command
g_KeyPressed = localkey = EDA_ZOOM_CENTER_FROM_MOUSE; wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED,
ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
} }
......
/* TODO ENGLISH BRIEF TODO */ /* TODO ENGLISH BRIEF TODO */
/*** /***
* @file edaapl.cpp * @file edaapl.cpp
* @brief methodes relative a la classe winEDA_App, communes * @brief methodes relative a la classe winEDA_App, communes
...@@ -9,12 +10,13 @@ ...@@ -9,12 +10,13 @@
#define COMMON_GLOBL #define COMMON_GLOBL
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
# include <pyhandler.h> # include <pyhandler.h>
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "wx/html/htmlwin.h" #include "wx/html/htmlwin.h"
#include "wx/fs_zip.h" #include "wx/fs_zip.h"
#include <wx/filename.h>
#include "common.h" #include "common.h"
#include "worksheet.h" #include "worksheet.h"
...@@ -27,10 +29,9 @@ ...@@ -27,10 +29,9 @@
#ifdef __UNIX__ #ifdef __UNIX__
# define TMP_FILE "/tmp/kicad.tmp" # define TMP_FILE "/tmp/kicad.tmp"
#endif #endif
/* Just add new languages to the list. This macro will properly recalculate /* Just add new languages to the list. This macro will properly recalculate
* the size of the array. */ * the size of the array. */
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / \ #define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / \
...@@ -50,156 +51,158 @@ ...@@ -50,156 +51,158 @@
* add a new item to s_Language_List[LANGUAGE_DESCR_COUNT] * add a new item to s_Language_List[LANGUAGE_DESCR_COUNT]
* and set LANGUAGE_DESCR_COUNT to the new value * and set LANGUAGE_DESCR_COUNT to the new value
*/ */
struct struct LANGUAGE_DESCR
LANGUAGE_DESCR
{ {
/* wxWidgets locale identifier (See wxWidgets doc) */ /* wxWidgets locale identifier (See wxWidgets doc) */
int m_WX_Lang_Identifier; int m_WX_Lang_Identifier;
/* KiCad identifier used in menu selection (See id.h) */
int m_KI_Lang_Identifier; /* KiCad identifier used in menu selection (See id.h) */
/* The menu language icons */ int m_KI_Lang_Identifier;
const char** m_Lang_Icon;
/* Labels used in menus */ /* The menu language icons */
const wxChar* m_Lang_Label; const char** m_Lang_Icon;
/* Set to true if the m_Lang_Label must not be translated */
bool m_DoNotTranslate; /* Labels used in menus */
const wxChar* m_Lang_Label;
/* Set to true if the m_Lang_Label must not be translated */
bool m_DoNotTranslate;
}; };
/** /**
* Language list struct * Language list struct
*/ */
static struct static struct LANGUAGE_DESCR s_Language_List[] =
LANGUAGE_DESCR s_Language_List[] =
{ {
/* Default language */ /* Default language */
{ {
wxLANGUAGE_DEFAULT, wxLANGUAGE_DEFAULT,
ID_LANGUAGE_DEFAULT, ID_LANGUAGE_DEFAULT,
lang_def_xpm, lang_def_xpm,
_( "Default" ) _( "Default" )
}, },
/* English language */ /* English language */
{ {
wxLANGUAGE_ENGLISH, wxLANGUAGE_ENGLISH,
ID_LANGUAGE_ENGLISH, ID_LANGUAGE_ENGLISH,
lang_en_xpm, lang_en_xpm,
wxT( "English" ), wxT( "English" ),
true true
}, },
/* French language */ /* French language */
{ {
wxLANGUAGE_FRENCH, wxLANGUAGE_FRENCH,
ID_LANGUAGE_FRENCH, ID_LANGUAGE_FRENCH,
lang_fr_xpm, lang_fr_xpm,
_( "French" ) _( "French" )
}, },
/* Spanish language */ /* Spanish language */
{ {
wxLANGUAGE_SPANISH, wxLANGUAGE_SPANISH,
ID_LANGUAGE_SPANISH, ID_LANGUAGE_SPANISH,
lang_es_xpm, lang_es_xpm,
_( "Spanish" ) _( "Spanish" )
}, },
/* Portugese language */ /* Portugese language */
{ {
wxLANGUAGE_PORTUGUESE, wxLANGUAGE_PORTUGUESE,
ID_LANGUAGE_PORTUGUESE, ID_LANGUAGE_PORTUGUESE,
lang_pt_xpm, lang_pt_xpm,
_( "Portuguese" ) _( "Portuguese" )
}, },
/* Italian language */ /* Italian language */
{ {
wxLANGUAGE_ITALIAN, wxLANGUAGE_ITALIAN,
ID_LANGUAGE_ITALIAN, ID_LANGUAGE_ITALIAN,
lang_it_xpm, lang_it_xpm,
_( "Italian" ) _( "Italian" )
}, },
/* German language */ /* German language */
{ {
wxLANGUAGE_GERMAN, wxLANGUAGE_GERMAN,
ID_LANGUAGE_GERMAN, ID_LANGUAGE_GERMAN,
lang_de_xpm, lang_de_xpm,
_( "German" ) _( "German" )
}, },
/* Slovenian language */ /* Slovenian language */
{ {
wxLANGUAGE_SLOVENIAN, wxLANGUAGE_SLOVENIAN,
ID_LANGUAGE_SLOVENIAN, ID_LANGUAGE_SLOVENIAN,
lang_sl_xpm, lang_sl_xpm,
_( "Slovenian" ) _( "Slovenian" )
}, },
/* Hungarian language */ /* Hungarian language */
{ {
wxLANGUAGE_HUNGARIAN, wxLANGUAGE_HUNGARIAN,
ID_LANGUAGE_HUNGARIAN, ID_LANGUAGE_HUNGARIAN,
lang_hu_xpm, lang_hu_xpm,
_( "Hungarian" ) _( "Hungarian" )
}, },
/* Polish language */ /* Polish language */
{ {
wxLANGUAGE_POLISH, wxLANGUAGE_POLISH,
ID_LANGUAGE_POLISH, ID_LANGUAGE_POLISH,
lang_pl_xpm, lang_pl_xpm,
_( "Polish" ) _( "Polish" )
}, },
/* Czech language */ /* Czech language */
{ {
wxLANGUAGE_CZECH, wxLANGUAGE_CZECH,
ID_LANGUAGE_CZECH, ID_LANGUAGE_CZECH,
lang_cs_xpm, lang_cs_xpm,
_( "Czech" ) _( "Czech" )
}, },
/* Russian language */ /* Russian language */
{ {
wxLANGUAGE_RUSSIAN, wxLANGUAGE_RUSSIAN,
ID_LANGUAGE_RUSSIAN, ID_LANGUAGE_RUSSIAN,
lang_ru_xpm, lang_ru_xpm,
_( "Russian" ) _( "Russian" )
}, },
/* Korean language */ /* Korean language */
{ {
wxLANGUAGE_KOREAN, wxLANGUAGE_KOREAN,
ID_LANGUAGE_KOREAN, ID_LANGUAGE_KOREAN,
lang_ko_xpm, lang_ko_xpm,
_( "Korean" ) _( "Korean" )
}, },
/* Chinese simplified */ /* Chinese simplified */
{ {
wxLANGUAGE_CHINESE_SIMPLIFIED, wxLANGUAGE_CHINESE_SIMPLIFIED,
ID_LANGUAGE_CHINESE_SIMPLIFIED, ID_LANGUAGE_CHINESE_SIMPLIFIED,
lang_chinese_xpm, lang_chinese_xpm,
_( "Chinese simplified" ) _( "Chinese simplified" )
}, },
/* Catalan language */ /* Catalan language */
{ {
wxLANGUAGE_CATALAN, wxLANGUAGE_CATALAN,
ID_LANGUAGE_CATALAN, ID_LANGUAGE_CATALAN,
lang_catalan_xpm, lang_catalan_xpm,
_( "Catalan" ) _( "Catalan" )
}, },
/* Dutch language */ /* Dutch language */
{ {
wxLANGUAGE_DUTCH, wxLANGUAGE_DUTCH,
ID_LANGUAGE_DUTCH, ID_LANGUAGE_DUTCH,
lang_nl_xpm, lang_nl_xpm,
_( "Dutch" ) _( "Dutch" )
} }
}; };
...@@ -208,16 +211,16 @@ LANGUAGE_DESCR s_Language_List[] = ...@@ -208,16 +211,16 @@ LANGUAGE_DESCR s_Language_List[] =
*/ */
WinEDA_App::WinEDA_App() WinEDA_App::WinEDA_App()
{ {
m_Checker = NULL; m_Checker = NULL;
m_LastProjectMaxCount = 10; m_LastProjectMaxCount = 10;
m_HtmlCtrl = NULL; m_HtmlCtrl = NULL;
m_EDA_CommonConfig = NULL; m_EDA_CommonConfig = NULL;
m_EDA_Config = NULL; m_EDA_Config = NULL;
m_Env_Defined = FALSE; m_Env_Defined = FALSE;
m_LanguageId = wxLANGUAGE_DEFAULT; m_LanguageId = wxLANGUAGE_DEFAULT;
m_Language_Menu = NULL; m_Language_Menu = NULL;
m_Locale = NULL; m_Locale = NULL;
m_PdfBrowserIsDefault = TRUE; m_PdfBrowserIsDefault = TRUE;
} }
...@@ -226,159 +229,140 @@ WinEDA_App::WinEDA_App() ...@@ -226,159 +229,140 @@ WinEDA_App::WinEDA_App()
*/ */
WinEDA_App::~WinEDA_App() WinEDA_App::~WinEDA_App()
{ {
SaveSettings(); SaveSettings();
/* delete user datas */ /* delete user datas */
delete g_Prj_Config; delete g_Prj_Config;
delete m_EDA_Config; delete m_EDA_Config;
delete m_EDA_CommonConfig; delete m_EDA_CommonConfig;
delete g_StdFont; delete g_StdFont;
delete g_DialogFont; delete g_DialogFont;
delete g_ItalicFont; delete g_ItalicFont;
delete g_FixedFont; delete g_FixedFont;
delete g_MsgFont; delete g_MsgFont;
if( m_Checker ) if( m_Checker )
delete m_Checker; delete m_Checker;
delete m_Locale; delete m_Locale;
} }
/** /**
* TODO brief * TODO brief
*/ */
void void WinEDA_App::InitEDA_Appl( const wxString& name )
WinEDA_App::InitEDA_Appl( const wxString& name )
{ {
wxString ident; wxString ident;
wxString EnvLang; wxString EnvLang;
ident = name + wxT( "-" ) + wxGetUserId(); ident = name + wxT( "-" ) + wxGetUserId();
m_Checker = new wxSingleInstanceChecker( ident ); m_Checker = new wxSingleInstanceChecker( ident );
/* Init kicad environment /* Init kicad environment
* the environment variable KICAD (if exists) gives the kicad path: * the environment variable KICAD (if exists) gives the kicad path:
* something like set KICAD=d:\kicad * something like set KICAD=d:\kicad
*/ */
m_Env_Defined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv ); m_Env_Defined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv );
if( m_Env_Defined ) // ensure m_KicadEnv ends by "/" if( m_Env_Defined ) // ensure m_KicadEnv ends by "/"
{ {
m_KicadEnv.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); m_KicadEnv.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
if( m_KicadEnv.Last() != '/' ) if( m_KicadEnv.Last() != '/' )
m_KicadEnv += UNIX_STRING_DIR_SEP; m_KicadEnv += UNIX_STRING_DIR_SEP;
} }
/* Prepare On Line Help. Use only lower case for help filenames, /* Prepare On Line Help. Use only lower case for help filenames, in order to
* in order to avoid problems with upper/lower case filenames under windows and unix */ * avoid problems with upper/lower case filenames under windows and unix */
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
m_HelpFileName = name.Lower() + wxT( ".html" ); m_HelpFileName = name.Lower() + wxT( ".html" );
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
m_HelpFileName = name.Lower() + wxT( ".pdf" ); m_HelpFileName = name.Lower() + wxT( ".pdf" );
#else #else
#error Help files format not defined #error Help files format not defined
#endif #endif
/* Init parameters for configuration */ /* Init parameters for configuration */
SetVendorName( wxT( "kicad" ) ); SetVendorName( wxT( "kicad" ) );
SetAppName( name ); SetAppName( name );
m_EDA_Config = new wxConfig( name ); m_EDA_Config = new wxConfig( name );
m_EDA_CommonConfig = new wxConfig( wxT( "kicad_common" ) ); m_EDA_CommonConfig = new wxConfig( wxT( "kicad_common" ) );
/* Create the fonts used in dialogs and messages */ /* Create the fonts used in dialogs and messages */
g_StdFontPointSize = FONT_DEFAULT_SIZE; g_StdFontPointSize = FONT_DEFAULT_SIZE;
g_MsgFontPointSize = FONT_DEFAULT_SIZE; g_MsgFontPointSize = FONT_DEFAULT_SIZE;
g_DialogFontPointSize = FONT_DEFAULT_SIZE; g_DialogFontPointSize = FONT_DEFAULT_SIZE;
g_FixedFontPointSize = FONT_DEFAULT_SIZE; g_FixedFontPointSize = FONT_DEFAULT_SIZE;
g_StdFont = new wxFont( g_StdFont = new wxFont( g_StdFontPointSize, wxFONTFAMILY_ROMAN,
g_StdFontPointSize, wxNORMAL, wxNORMAL );
wxFONTFAMILY_ROMAN,
wxNORMAL, g_MsgFont = new wxFont( g_StdFontPointSize, wxFONTFAMILY_ROMAN,
wxNORMAL ); wxNORMAL, wxNORMAL );
g_MsgFont = new wxFont( g_DialogFont = new wxFont( g_DialogFontPointSize, wxFONTFAMILY_ROMAN,
g_StdFontPointSize, wxNORMAL, wxNORMAL );
wxFONTFAMILY_ROMAN,
wxNORMAL, g_ItalicFont = new wxFont( g_DialogFontPointSize, wxFONTFAMILY_ROMAN,
wxNORMAL ); wxFONTSTYLE_ITALIC, wxNORMAL );
g_DialogFont = new wxFont( g_FixedFont = new wxFont( g_FixedFontPointSize, wxFONTFAMILY_MODERN,
g_DialogFontPointSize, wxNORMAL, wxNORMAL );
wxFONTFAMILY_ROMAN,
wxNORMAL, /* TODO installation des gestionnaires de visu d'images (pour help) TODO*/
wxNORMAL ); wxImage::AddHandler( new wxPNGHandler );
wxImage::AddHandler( new wxGIFHandler );
g_ItalicFont = new wxFont( wxImage::AddHandler( new wxJPEGHandler );
g_DialogFontPointSize, wxFileSystem::AddHandler( new wxZipFSHandler );
wxFONTFAMILY_ROMAN,
wxFONTSTYLE_ITALIC, // Analyse the command line & init binary path
wxNORMAL ); SetBinDir();
ReadPdfBrowserInfos();
g_FixedFont = new wxFont(
g_FixedFontPointSize, // Internationalisation: loading the kicad suitable Dictionnary
wxFONTFAMILY_MODERN, m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId,
wxNORMAL, wxLANGUAGE_DEFAULT );
wxNORMAL );
bool succes = SetLanguage( TRUE );
/* TODO installation des gestionnaires de visu d'images (pour help) TODO*/ if( !succes )
wxImage::AddHandler( new wxPNGHandler ); {
wxImage::AddHandler( new wxGIFHandler ); }
wxImage::AddHandler( new wxJPEGHandler );
wxFileSystem::AddHandler( new wxZipFSHandler ); /* Set locale option for separator used in float numbers */
SetLocaleTo_Default();
// Analyse the command line & init binary path
SetBinDir();
ReadPdfBrowserInfos();
// Internationalisation: loading the kicad suitable Dictionnary
m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId,
wxLANGUAGE_DEFAULT );
bool succes = SetLanguage( TRUE );
if( !succes )
{
}
/* Set locale option for separator used in float numbers */
SetLocaleTo_Default();
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
PyHandler::GetInstance()->SetAppName( name ); PyHandler::GetInstance()->SetAppName( name );
#endif #endif
} }
/** /**
* Init online help * Init online help
* @return none * @return none
*/ */
/*****************************************/ /*****************************************/
void void WinEDA_App::InitOnLineHelp()
WinEDA_App::InitOnLineHelp()
/*****************************************/ /*****************************************/
{ {
wxString fullfilename = FindKicadHelpPath(); wxString fullfilename = FindKicadHelpPath();
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
m_HelpFileName = fullfilename + wxT( ".html" ); m_HelpFileName = fullfilename + wxT( ".html" );
fullfilename += wxT( "kicad.hhp" ); fullfilename += wxT( "kicad.hhp" );
if( wxFileExists( fullfilename ) ) if( wxFileExists( fullfilename ) )
{ {
m_HtmlCtrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS | m_HtmlCtrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS |
wxHF_PRINT | wxHF_OPEN_FILES wxHF_PRINT | wxHF_OPEN_FILES
/*| wxHF_SEARCH */ ); /*| wxHF_SEARCH */ );
m_HtmlCtrl->UseConfig( m_EDA_CommonConfig ); m_HtmlCtrl->UseConfig( m_EDA_CommonConfig );
m_HtmlCtrl->SetTitleFormat( wxT( "Kicad Help" ) ); m_HtmlCtrl->SetTitleFormat( wxT( "Kicad Help" ) );
m_HtmlCtrl->AddBook( fullfilename ); m_HtmlCtrl->AddBook( fullfilename );
} }
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
m_HtmlCtrl = NULL; m_HtmlCtrl = NULL;
#else #else
#error Help files format not defined #error Help files format not defined
#endif #endif
} }
...@@ -388,73 +372,73 @@ WinEDA_App::InitOnLineHelp() ...@@ -388,73 +372,73 @@ WinEDA_App::InitOnLineHelp()
* @return TODO * @return TODO
*/ */
/*******************************/ /*******************************/
bool bool WinEDA_App::SetBinDir()
WinEDA_App::SetBinDir()
/*******************************/ /*******************************/
{ {
/* Apple MacOSx */ /* Apple MacOSx */
#ifdef __APPLE__ #ifdef __APPLE__
/* Derive path from location of the app bundle */ /* Derive path from location of the app bundle */
CFBundleRef mainBundle = CFBundleGetMainBundle(); CFBundleRef mainBundle = CFBundleGetMainBundle();
if( mainBundle == NULL ) if( mainBundle == NULL )
return false; return false;
CFURLRef urlref = CFBundleCopyBundleURL( mainBundle ); CFURLRef urlref = CFBundleCopyBundleURL( mainBundle );
if( urlref == NULL ) if( urlref == NULL )
return false; return false;
CFStringRef str = CFURLCopyFileSystemPath( urlref, kCFURLPOSIXPathStyle ); CFStringRef str = CFURLCopyFileSystemPath( urlref, kCFURLPOSIXPathStyle );
if( str == NULL ) if( str == NULL )
return false; return false;
char* native_str = NULL; char* native_str = NULL;
int len = CFStringGetMaximumSizeForEncoding( CFStringGetLength( str ), int len = CFStringGetMaximumSizeForEncoding( CFStringGetLength( str ),
kCFStringEncodingUTF8 ) + 1; kCFStringEncodingUTF8 ) + 1;
native_str = new char[len]; native_str = new char[len];
CFStringGetCString( str, native_str, len, kCFStringEncodingUTF8 ); CFStringGetCString( str, native_str, len, kCFStringEncodingUTF8 );
m_BinDir = CONV_FROM_UTF8( native_str ); m_BinDir = CONV_FROM_UTF8( native_str );
delete[] native_str; delete[] native_str;
/* Linux and Unix */ /* Linux and Unix */
#elif defined (__UNIX__) #elif defined (__UNIX__)
// Under Linux, if argv[0] doesn't the complete path to the executable,
// it's necessary to obtain it using "which <filename>". // Under Linux, if argv[0] doesn't the complete path to the executable,
FILE* ftmp; // it's necessary to obtain it using "which <filename>".
FILE* ftmp;
char Line[1024];
char FileName[1024]; char Line[1024];
wxString str_arg0; char FileName[1024];
int ii; wxString str_arg0;
int ii;
FileName[0] = 0;
str_arg0 = argv[0]; FileName[0] = 0;
if( strchr( (const char*) argv[0], '/' ) == NULL ) // no path str_arg0 = argv[0];
{ if( strchr( (const char*) argv[0], '/' ) == NULL ) // no path
sprintf( FileName, "which %s > %s", CONV_TO_UTF8( str_arg0 ), TMP_FILE ); {
ii = system( FileName ); sprintf( FileName, "which %s > %s", CONV_TO_UTF8( str_arg0 ), TMP_FILE );
ii = system( FileName );
if( ( ftmp = fopen( TMP_FILE, "rt" ) ) != NULL )
{ if( ( ftmp = fopen( TMP_FILE, "rt" ) ) != NULL )
fgets( Line, 1000, ftmp ); {
fclose( ftmp ); fgets( Line, 1000, ftmp );
remove( TMP_FILE ); fclose( ftmp );
} remove( TMP_FILE );
m_BinDir = CONV_FROM_UTF8( Line ); }
} m_BinDir = CONV_FROM_UTF8( Line );
else }
m_BinDir = argv[0]; else
m_BinDir = argv[0];
#else #else
m_BinDir = argv[0]; m_BinDir = argv[0];
#endif /* __UNIX__ */ #endif /* __UNIX__ */
m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
while( m_BinDir.Last() != '/' ) while( m_BinDir.Last() != '/' )
m_BinDir.RemoveLast(); m_BinDir.RemoveLast();
return TRUE; return TRUE;
} }
...@@ -463,98 +447,98 @@ WinEDA_App::SetBinDir() ...@@ -463,98 +447,98 @@ WinEDA_App::SetBinDir()
* @return none * @return none
*/ */
/*********************************/ /*********************************/
void void WinEDA_App::GetSettings()
WinEDA_App::GetSettings()
/*********************************/ /*********************************/
{ {
wxString Line, Ident; wxString Line, Ident;
unsigned ii; unsigned ii;
m_HelpSize.x = 500; m_HelpSize.x = 500;
m_HelpSize.y = 400; m_HelpSize.y = 400;
if( m_EDA_CommonConfig ) if( m_EDA_CommonConfig )
{ {
m_LanguageId = m_EDA_CommonConfig->Read( wxT( "Language" ), m_LanguageId = m_EDA_CommonConfig->Read( wxT( "Language" ),
wxLANGUAGE_DEFAULT ); wxLANGUAGE_DEFAULT );
g_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) ); g_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) );
g_ConfigFileLocationChoice = m_EDA_CommonConfig->Read( HOTKEY_CFG_PATH_OPT, 0L ); g_ConfigFileLocationChoice = m_EDA_CommonConfig->Read( HOTKEY_CFG_PATH_OPT,
} 0L );
}
if( !m_EDA_Config )
return; if( !m_EDA_Config )
return;
/* Last 10 project settings */
for( ii = 0; ii < 10; ii++ ) /* Last 10 project settings */
{ for( ii = 0; ii < 10; ii++ )
Ident = wxT( "LastProject" ); {
Ident = wxT( "LastProject" );
if( ii )
Ident << ii; if( ii )
Ident << ii;
if( m_EDA_Config->Read( Ident, &Line ) )
m_LastProject.Add( Line ); if( m_EDA_Config->Read( Ident, &Line ) )
} m_LastProject.Add( Line );
}
/* Set default font sizes */
g_StdFontPointSize = m_EDA_Config->Read( wxT( "SdtFontSize" ), /* Set default font sizes */
FONT_DEFAULT_SIZE ); g_StdFontPointSize = m_EDA_Config->Read( wxT( "SdtFontSize" ),
g_MsgFontPointSize = m_EDA_Config->Read( wxT( "MsgFontSize" ), FONT_DEFAULT_SIZE );
FONT_DEFAULT_SIZE ); g_MsgFontPointSize = m_EDA_Config->Read( wxT( "MsgFontSize" ),
g_DialogFontPointSize = m_EDA_Config->Read( wxT( "DialogFontSize" ), FONT_DEFAULT_SIZE );
FONT_DEFAULT_SIZE ); g_DialogFontPointSize = m_EDA_Config->Read( wxT( "DialogFontSize" ),
g_FixedFontPointSize = m_EDA_Config->Read( wxT( "FixedFontSize" ), FONT_DEFAULT_SIZE );
FONT_DEFAULT_SIZE ); g_FixedFontPointSize = m_EDA_Config->Read( wxT( "FixedFontSize" ),
FONT_DEFAULT_SIZE );
/* Sdt font type */
Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString ); /* Sdt font type */
if( !Line.IsEmpty() ) Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString );
g_StdFont->SetFaceName( Line ); if( !Line.IsEmpty() )
g_StdFont->SetFaceName( Line );
/* Sdt font style */
ii = m_EDA_Config->Read( wxT( "SdtFontStyle" ), wxFONTFAMILY_ROMAN ); /* Sdt font style */
g_StdFont->SetStyle( ii ); ii = m_EDA_Config->Read( wxT( "SdtFontStyle" ), wxFONTFAMILY_ROMAN );
g_StdFont->SetStyle( ii );
/* Sdt font weight */
ii = m_EDA_Config->Read( wxT( "SdtFontWeight" ), wxNORMAL ); /* Sdt font weight */
g_StdFont->SetWeight( ii ); ii = m_EDA_Config->Read( wxT( "SdtFontWeight" ), wxNORMAL );
g_StdFont->SetPointSize( g_StdFontPointSize ); g_StdFont->SetWeight( ii );
g_StdFont->SetPointSize( g_StdFontPointSize );
/* Msg font type */
Line = m_EDA_Config->Read( wxT( "MsgFontType" ), wxEmptyString ); /* Msg font type */
if( !Line.IsEmpty() ) Line = m_EDA_Config->Read( wxT( "MsgFontType" ), wxEmptyString );
g_MsgFont->SetFaceName( Line ); if( !Line.IsEmpty() )
g_MsgFont->SetFaceName( Line );
/* Msg font style */
ii = m_EDA_Config->Read( wxT( "MsgFontStyle" ), wxFONTFAMILY_ROMAN ); /* Msg font style */
g_MsgFont->SetStyle( ii ); ii = m_EDA_Config->Read( wxT( "MsgFontStyle" ), wxFONTFAMILY_ROMAN );
g_MsgFont->SetStyle( ii );
/* Msg font weight */
ii = m_EDA_Config->Read( wxT( "MsgFontWeight" ), wxNORMAL ); /* Msg font weight */
g_MsgFont->SetWeight( ii ); ii = m_EDA_Config->Read( wxT( "MsgFontWeight" ), wxNORMAL );
g_MsgFont->SetPointSize( g_MsgFontPointSize ); g_MsgFont->SetWeight( ii );
g_MsgFont->SetPointSize( g_MsgFontPointSize );
Line = m_EDA_Config->Read( wxT( "DialogFontType" ), wxEmptyString );
if( !Line.IsEmpty() ) Line = m_EDA_Config->Read( wxT( "DialogFontType" ), wxEmptyString );
g_DialogFont->SetFaceName( Line ); if( !Line.IsEmpty() )
g_DialogFont->SetFaceName( Line );
ii = m_EDA_Config->Read( wxT( "DialogFontStyle" ), wxFONTFAMILY_ROMAN );
g_DialogFont->SetStyle( ii ); ii = m_EDA_Config->Read( wxT( "DialogFontStyle" ), wxFONTFAMILY_ROMAN );
ii = m_EDA_Config->Read( wxT( "DialogFontWeight" ), wxNORMAL ); g_DialogFont->SetStyle( ii );
g_DialogFont->SetWeight( ii ); ii = m_EDA_Config->Read( wxT( "DialogFontWeight" ), wxNORMAL );
g_DialogFont->SetPointSize( g_DialogFontPointSize ); g_DialogFont->SetWeight( ii );
g_DialogFont->SetPointSize( g_DialogFontPointSize );
g_FixedFont->SetPointSize( g_FixedFontPointSize );
g_FixedFont->SetPointSize( g_FixedFontPointSize );
m_EDA_Config->Read( wxT( "ShowPageLimits" ), &g_ShowPageLimits );
m_EDA_Config->Read( wxT( "ShowPageLimits" ), &g_ShowPageLimits );
if( m_EDA_Config->Read( wxT( "WorkingDir" ), &Line ) )
{ if( m_EDA_Config->Read( wxT( "WorkingDir" ), &Line ) )
if( wxDirExists( Line ) ) {
wxSetWorkingDirectory( Line ); if( wxDirExists( Line ) )
} wxSetWorkingDirectory( Line );
m_EDA_Config->Read( wxT( "BgColor" ), &g_DrawBgColor ); }
m_EDA_Config->Read( wxT( "BgColor" ), &g_DrawBgColor );
} }
...@@ -563,67 +547,51 @@ WinEDA_App::GetSettings() ...@@ -563,67 +547,51 @@ WinEDA_App::GetSettings()
* @return none * @return none
*/ */
/**********************************/ /**********************************/
void void WinEDA_App::SaveSettings()
WinEDA_App::SaveSettings()
/**********************************/ /**********************************/
{ {
unsigned int i; unsigned int i;
if( m_EDA_Config == NULL ) if( m_EDA_Config == NULL )
return; return;
/* Sdt font settings */ /* Sdt font settings */
m_EDA_Config->Write( wxT( "SdtFontSize" ), m_EDA_Config->Write( wxT( "SdtFontSize" ), g_StdFontPointSize );
g_StdFontPointSize ); m_EDA_Config->Write( wxT( "SdtFontType" ), g_StdFont->GetFaceName() );
m_EDA_Config->Write( wxT( "SdtFontType" ), m_EDA_Config->Write( wxT( "SdtFontStyle" ), g_StdFont->GetStyle() );
g_StdFont->GetFaceName() ); m_EDA_Config->Write( wxT( "SdtFontWeight" ), g_StdFont->GetWeight() );
m_EDA_Config->Write( wxT( "SdtFontStyle" ),
g_StdFont->GetStyle() ); /* Msg font settings */
m_EDA_Config->Write( wxT( "SdtFontWeight" ), m_EDA_Config->Write( wxT( "MsgFontSize" ), g_MsgFontPointSize );
g_StdFont->GetWeight() ); m_EDA_Config->Write( wxT( "MsgFontType" ), g_MsgFont->GetFaceName() );
m_EDA_Config->Write( wxT( "MsgFontStyle" ), g_MsgFont->GetStyle() );
/* Msg font settings */ m_EDA_Config->Write( wxT( "MsgFontWeight" ), g_MsgFont->GetWeight() );
m_EDA_Config->Write( wxT( "MsgFontSize" ),
g_MsgFontPointSize ); /* Dialog font settings */
m_EDA_Config->Write( wxT( "MsgFontType" ), m_EDA_Config->Write( wxT( "DialogFontSize" ), g_DialogFontPointSize );
g_MsgFont->GetFaceName() ); m_EDA_Config->Write( wxT( "DialogFontType" ), g_DialogFont->GetFaceName() );
m_EDA_Config->Write( wxT( "MsgFontStyle" ), m_EDA_Config->Write( wxT( "DialogFontStyle" ), g_DialogFont->GetStyle() );
g_MsgFont->GetStyle() ); m_EDA_Config->Write( wxT( "DialogFontWeight" ), g_DialogFont->GetWeight() );
m_EDA_Config->Write( wxT( "MsgFontWeight" ),
g_MsgFont->GetWeight() ); /* Misc settings */
m_EDA_Config->Write( wxT( "FixedFontSize" ), g_FixedFontPointSize );
/* Dialog font settings */
m_EDA_Config->Write( wxT( "DialogFontSize" ), m_EDA_Config->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits );
g_DialogFontPointSize );
m_EDA_Config->Write( wxT( "DialogFontType" ), m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() );
g_DialogFont->GetFaceName() );
m_EDA_Config->Write( wxT( "DialogFontStyle" ), /* Save last 10 project list */
g_DialogFont->GetStyle() ); for( i = 0; i < 10; i++ )
m_EDA_Config->Write( wxT( "DialogFontWeight" ), {
g_DialogFont->GetWeight() ); wxString msg = wxT( "LastProject" );
if( i )
/* Misc settings */ msg << i;
m_EDA_Config->Write( wxT( "FixedFontSize" ),
g_FixedFontPointSize ); if( i < m_LastProject.GetCount() )
m_EDA_Config->Write( msg, m_LastProject[i] );
m_EDA_Config->Write( wxT( "ShowPageLimits" ), else
g_ShowPageLimits ); m_EDA_Config->Write( msg, wxEmptyString );
}
m_EDA_Config->Write( wxT( "WorkingDir" ),
wxGetCwd() );
/* Save last 10 project list */
for( i = 0; i < 10; i++ )
{
wxString msg = wxT( "LastProject" );
if( i )
msg << i;
if( i < m_LastProject.GetCount() )
m_EDA_Config->Write( msg, m_LastProject[i] );
else
m_EDA_Config->Write( msg, wxEmptyString );
}
} }
...@@ -636,42 +604,79 @@ WinEDA_App::SaveSettings() ...@@ -636,42 +604,79 @@ WinEDA_App::SaveSettings()
* @return TODO * @return TODO
*/ */
/*********************************************/ /*********************************************/
bool bool WinEDA_App::SetLanguage( bool first_time )
WinEDA_App::SetLanguage( bool first_time )
/*********************************************/ /*********************************************/
{ {
// dictionary file name without extend (full name is kicad.mo) // dictionary file name without extend (full name is kicad.mo)
wxString DictionaryName( wxT( "kicad" ) ); wxString DictionaryName( wxT( "kicad" ) );
// Real path is kicad/internat/xx_XX or kicad/internat/xx
wxString BaseDictionaryPath( wxT( "internat" ) ); // Real path is kicad/internat/xx_XX or kicad/internat/xx
wxString dic_path; wxString BaseDictionaryPath( wxT( "internat" ) );
wxString dic_path;
if( m_Locale != NULL ) bool retv = true;
delete m_Locale;
m_Locale = new wxLocale(); if( m_Locale != NULL )
m_Locale->Init( m_LanguageId ); delete m_Locale;
dic_path = ReturnKicadDatasPath() + BaseDictionaryPath; m_Locale = new wxLocale();
wxLogDebug( wxT( "Adding prefix <" ) + dic_path + dic_path = ReturnKicadDatasPath() + BaseDictionaryPath;
wxT( "> to language lookup path." ) );
wxLogDebug( wxT( "Adding prefix <" ) + dic_path +
m_Locale->AddCatalogLookupPathPrefix( dic_path ); wxT( "> to language lookup path." ) );
if( !first_time ) m_Locale->AddCatalogLookupPathPrefix( dic_path );
{
if( m_EDA_CommonConfig ) /*
m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId ); * Add binary path minus the current subdirectory ( typically /bin ) to
} * the locale search path. This way the locales can be found when using
* custom CMake install paths.
if( !m_Locale->IsLoaded( DictionaryName ) ) *
m_Locale->AddCatalog( DictionaryName ); * FIXME: This should be changed when configurable data path support is
SetLanguageList( NULL ); * added to Kicad.
*/
return m_Locale->IsOk(); if( !m_BinDir.IsEmpty() )
{
wxFileName fn( m_BinDir, wxEmptyString );
dic_path = fn.GetPath();
int n = dic_path.Find( wxFileName::GetPathSeparator(), true );
if( n != wxNOT_FOUND )
{
dic_path = dic_path( 0, n );
}
wxLogDebug( wxT( "Adding prefix <" ) + dic_path +
wxT( "> to language lookup path." ) );
m_Locale->AddCatalogLookupPathPrefix( dic_path );
}
if( !m_Locale->Init( m_LanguageId, wxLOCALE_CONV_ENCODING ) )
{
wxLogDebug( wxT( "Failed to initialize " ) + m_Locale->GetName() );
delete m_Locale;
m_Locale = new wxLocale();
m_LanguageId = wxLANGUAGE_DEFAULT;
m_Locale->Init();
retv = false;
}
if( !first_time )
{
if( m_EDA_CommonConfig )
m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId );
}
if( !m_Locale->IsLoaded( DictionaryName ) )
m_Locale->AddCatalog( DictionaryName );
if( !retv )
return retv;
return m_Locale->IsOk();
} }
/** /**
* Return in m_LanguageId the wxWidgets language identifier Id * Return in m_LanguageId the wxWidgets language identifier Id
* from the kicad menu id (internal menu identifier) * from the kicad menu id (internal menu identifier)
...@@ -679,76 +684,79 @@ WinEDA_App::SetLanguage( bool first_time ) ...@@ -679,76 +684,79 @@ WinEDA_App::SetLanguage( bool first_time )
* @return none * @return none
*/ */
/**************************************************/ /**************************************************/
void void WinEDA_App::SetLanguageIdentifier( int menu_id )
WinEDA_App::SetLanguageIdentifier( int menu_id )
/**************************************************/ /**************************************************/
{ {
unsigned int ii; unsigned int ii;
wxLogDebug( wxT( "Select language ID %d from %d possible languages." ), wxLogDebug( wxT( "Select language ID %d from %d possible languages." ),
menu_id, menu_id, LANGUAGE_DESCR_COUNT );
LANGUAGE_DESCR_COUNT );
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) {
{ if( menu_id == s_Language_List[ii].m_KI_Lang_Identifier )
if( menu_id == s_Language_List[ii].m_KI_Lang_Identifier ) {
{ m_LanguageId = s_Language_List[ii].m_WX_Lang_Identifier;
m_LanguageId = s_Language_List[ii].m_WX_Lang_Identifier; break;
break; }
} }
}
} }
/** /**
* Create menu list for language choice. * Create menu list for language choice.
* @param MasterMenu TODO * @param MasterMenu TODO
* @return TODO * @return TODO
*/ */
/*********************************************************/ /*********************************************************/
wxMenu* wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
/*********************************************************/ /*********************************************************/
{ {
wxMenuItem* item; wxMenuItem* item;
unsigned int ii; unsigned int ii;
if( m_Language_Menu == NULL ) if( m_Language_Menu == NULL )
{ {
m_Language_Menu = new wxMenu; m_Language_Menu = new wxMenu;
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{ {
wxString MenuLabel = s_Language_List[ii].m_DoNotTranslate ? wxString MenuLabel = s_Language_List[ii].m_DoNotTranslate ?
s_Language_List[ii].m_Lang_Label : s_Language_List[ii].m_Lang_Label :
wxGetTranslation( s_Language_List[ii].m_Lang_Label ); wxGetTranslation(
s_Language_List[ii].m_Lang_Label );
item = new wxMenuItem( m_Language_Menu, s_Language_List[ii].m_KI_Lang_Identifier,
MenuLabel, wxEmptyString, wxITEM_CHECK ); item = new wxMenuItem( m_Language_Menu,
s_Language_List[ii].m_KI_Lang_Identifier,
SETBITMAPS( s_Language_List[ii].m_Lang_Icon ); MenuLabel,
m_Language_Menu->Append( item ); wxEmptyString,
} wxITEM_CHECK );
}
SETBITMAPS( s_Language_List[ii].m_Lang_Icon );
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) m_Language_Menu->Append( item );
{ }
if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier ) }
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, true );
else for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, false ); {
} if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier )
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier,
if( MasterMenu ) true );
{ else
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu, m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier,
m_Language_Menu, false );
ID_LANGUAGE_CHOICE, }
_( "Language" ),
_( "Select application language (only for testing!)" ), if( MasterMenu )
language_xpm ); {
} ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu,
return m_Language_Menu; m_Language_Menu,
ID_LANGUAGE_CHOICE,
_( "Language" ),
_( "Select application language (only for testing!)" ),
language_xpm );
}
return m_Language_Menu;
} }
...@@ -757,13 +765,11 @@ WinEDA_App::SetLanguageList( wxMenu* MasterMenu ) ...@@ -757,13 +765,11 @@ WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
* @return TODO * @return TODO
*/ */
/**********************/ /**********************/
int int WinEDA_App::OnRun()
WinEDA_App::OnRun()
/**********************/ /**********************/
{ {
# ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
PyHandler::GetInstance()->RunScripts(); PyHandler::GetInstance()->RunScripts();
# endif #endif
return wxApp::OnRun(); return wxApp::OnRun();
} }
...@@ -118,98 +118,128 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) ...@@ -118,98 +118,128 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect )
/*****************************************************************/ /*****************************************************************/
void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event ) void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
/*****************************************************************/
/* Handle only the Popup command zoom and grid level
*/
{ {
int id = event.GetId(); if( DrawPanel == NULL )
{
wxLogDebug( wxT( "No DrawPanel object definedin " \
"WinEDA_DrawFrame::OnZoom()." ) );
return;
}
bool zoom_at_cursor = false;
int id = event.GetId();
BASE_SCREEN* screen = GetBaseScreen();
switch( id ) switch( id )
{ {
case ID_POPUP_ZOOM_IN: case ID_POPUP_ZOOM_IN:
zoom_at_cursor = true;
// fall thru
case ID_ZOOM_IN:
if( id == ID_ZOOM_IN )
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
screen->SetPreviousZoom();
Recadre_Trace( zoom_at_cursor );
break;
case ID_POPUP_ZOOM_OUT: case ID_POPUP_ZOOM_OUT:
zoom_at_cursor = true;
// fall thru
case ID_ZOOM_OUT:
if( id == ID_ZOOM_OUT )
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
screen->SetNextZoom();
Recadre_Trace( zoom_at_cursor );
break;
case ID_ZOOM_REDRAW:
DrawPanel->Refresh();
break;
case ID_POPUP_ZOOM_CENTER: case ID_POPUP_ZOOM_CENTER:
case ID_POPUP_ZOOM_AUTO: Recadre_Trace( true );
case ID_POPUP_ZOOM_REDRAW: break;
m_Parent->OnZoom( id );
case ID_ZOOM_PAGE:
Zoom_Automatique( false );
break; break;
case ID_POPUP_ZOOM_SELECT: case ID_POPUP_ZOOM_SELECT:
break; break;
case ID_POPUP_CANCEL: case ID_POPUP_CANCEL:
MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_ZOOM_LEVEL_1: case ID_POPUP_ZOOM_LEVEL_1:
GetScreen()->SetZoom( 1 ); screen->SetZoom( 1 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_2: case ID_POPUP_ZOOM_LEVEL_2:
GetScreen()->SetZoom( 2 ); screen->SetZoom( 2 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_4: case ID_POPUP_ZOOM_LEVEL_4:
GetScreen()->SetZoom( 4 ); screen->SetZoom( 4 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_8: case ID_POPUP_ZOOM_LEVEL_8:
GetScreen()->SetZoom( 8 ); screen->SetZoom( 8 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_16: case ID_POPUP_ZOOM_LEVEL_16:
GetScreen()->SetZoom( 16 ); screen->SetZoom( 16 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_32: case ID_POPUP_ZOOM_LEVEL_32:
GetScreen()->SetZoom( 32 ); screen->SetZoom( 32 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_64: case ID_POPUP_ZOOM_LEVEL_64:
GetScreen()->SetZoom( 64 ); screen->SetZoom( 64 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_128: case ID_POPUP_ZOOM_LEVEL_128:
GetScreen()->SetZoom( 128 ); screen->SetZoom( 128 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_256: case ID_POPUP_ZOOM_LEVEL_256:
GetScreen()->SetZoom( 256 ); screen->SetZoom( 256 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_512: case ID_POPUP_ZOOM_LEVEL_512:
GetScreen()->SetZoom( 512 ); screen->SetZoom( 512 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_1024: case ID_POPUP_ZOOM_LEVEL_1024:
GetScreen()->SetZoom( 1024 ); screen->SetZoom( 1024 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
case ID_POPUP_ZOOM_LEVEL_2048: case ID_POPUP_ZOOM_LEVEL_2048:
GetScreen()->SetZoom( 2048 ); screen->SetZoom( 2048 );
m_Parent->Recadre_Trace( TRUE ); Recadre_Trace( true );
break; break;
default: default:
DisplayError( this, wxLogDebug( wxT( "WinEDA_DrawFram::OnZoom() unhandled ID %d" ), id );
wxT( "WinEDA_DrawPanel::Process_Popup_Zoom() ID error" ) ); return;
break;
} }
m_Parent->Affiche_Status_Box(); Affiche_Status_Box();
} }
void WinEDA_DrawPanel::OnPopupGridSelect( wxCommandEvent& event ) void WinEDA_DrawPanel::OnPopupGridSelect( wxCommandEvent& event )
...@@ -239,15 +269,14 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) ...@@ -239,15 +269,14 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
zoom_center_xpm ); zoom_center_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_IN, _( "Zoom in" ), zoom_in_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_POPUP_ZOOM_OUT, _( "Zoom out" ), zoom_out_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_AUTO, _( "Zoom auto" ), ADD_MENUITEM( MasterMenu, ID_ZOOM_PAGE, _( "Zoom auto" ), zoom_auto_xpm );
zoom_auto_xpm );
wxMenu* zoom_choice = new wxMenu; wxMenu* zoom_choice = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, zoom_choice, ADD_MENUITEM_WITH_SUBMENU( MasterMenu, zoom_choice,
ID_POPUP_ZOOM_SELECT, _( "Zoom select" ), ID_POPUP_ZOOM_SELECT, _( "Zoom select" ),
zoom_select_xpm ); zoom_select_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_REDRAW, _( "Redraw view" ), ADD_MENUITEM( MasterMenu, ID_ZOOM_REDRAW, _( "Redraw view" ),
zoom_redraw_xpm ); zoom_redraw_xpm );
/* Create the basic zoom list: */ /* Create the basic zoom list: */
...@@ -299,29 +328,3 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) ...@@ -299,29 +328,3 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
MasterMenu->AppendSeparator(); MasterMenu->AppendSeparator();
ADD_MENUITEM( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), cancel_xpm ); ADD_MENUITEM( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), cancel_xpm );
} }
/**********************************************************/
void WinEDA_DrawFrame::Process_Zoom( wxCommandEvent& event )
/**********************************************************/
/* Handle the Zoom commands from the zoom tools in the main toolbar.
* Calls the active window Zoom function
*/
{
int id = event.GetId();
switch( id )
{
case ID_ZOOM_IN_BUTT:
case ID_ZOOM_OUT_BUTT:
case ID_ZOOM_REDRAW_BUTT:
case ID_ZOOM_PAGE_BUTT:
OnZoom( id );
break;
default:
DisplayError( this, wxT( "WinEDA_DrawFrame::Process_Zoom id Error" ) );
break;
}
}
...@@ -16,12 +16,10 @@ ...@@ -16,12 +16,10 @@
/* Construction de la table des evenements pour WinEDA_DrawFrame */ /* Construction de la table des evenements pour WinEDA_DrawFrame */
/*****************************************************************/ /*****************************************************************/
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_DrawFrame )
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
EVT_SIZE( WinEDA_DrawFrame::OnSize ) EVT_SIZE( WinEDA_DrawFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DisplayFrame::OnZoom )
WinEDA_DisplayFrame::Process_Zoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay ) EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame ) EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -119,19 +117,19 @@ void WinEDA_DisplayFrame::ReCreateHToolbar() ...@@ -119,19 +117,19 @@ void WinEDA_DisplayFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ), wxBitmap( zoom_in_xpm ),
_( "zoom + (F1)" ) ); _( "zoom + (F1)" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ), wxBitmap( zoom_out_xpm ),
_( "zoom - (F2)" ) ); _( "zoom - (F2)" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), wxBitmap( zoom_redraw_xpm ),
_( "redraw (F3)" ) ); _( "redraw (F3)" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ), wxBitmap( zoom_auto_xpm ),
_( "1:1 zoom" ) ); _( "1:1 zoom" ) );
...@@ -183,6 +181,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -183,6 +181,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
int flagcurseur = 0; int flagcurseur = 0;
int zoom = GetScreen()->GetZoom(); int zoom = GetScreen()->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
curpos = DrawPanel->CursorRealPosition( Mouse ); curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
...@@ -199,24 +199,28 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -199,24 +199,28 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed ) switch( g_KeyPressed )
{ {
case WXK_F1: case WXK_F1:
OnZoom( ID_ZOOM_IN_KEY ); cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2; flagcurseur = 2;
curpos = GetScreen()->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case WXK_F2: case WXK_F2:
OnZoom( ID_ZOOM_OUT_KEY ); cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2; flagcurseur = 2;
curpos = GetScreen()->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case WXK_F3: case WXK_F3:
OnZoom( ID_ZOOM_REDRAW_KEY ); cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2; flagcurseur = 2;
break; break;
case WXK_F4: case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY ); cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2; flagcurseur = 2;
curpos = GetScreen()->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
......
...@@ -57,8 +57,7 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -57,8 +57,7 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop! if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
screen->AddToDrawList( this ); screen->AddToDrawList( this );
g_ItemToRepeat = this; g_ItemToRepeat = this;
if( frame->m_Ident == SCHEMATIC_FRAME ) frame->SaveCopyInUndoList( this, IS_NEW );
frame->SaveCopyInUndoList( this, IS_NEW );
} }
m_Flags = 0; m_Flags = 0;
......
...@@ -244,21 +244,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi ...@@ -244,21 +244,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
case 0: case 0:
break; break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = screen->m_Curseur;
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;
...@@ -355,21 +340,6 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -355,21 +340,6 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
case 0: case 0:
break; break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = screen->m_Curseur;
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;
...@@ -465,21 +435,6 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -465,21 +435,6 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
case 0: case 0:
break; break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = screen->m_Curseur;
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;
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
...@@ -145,6 +143,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -145,6 +143,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive * Commands are case insensitive
*/ */
{ {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool ItemInEdit = GetScreen()->GetCurItem() bool ItemInEdit = GetScreen()->GetCurItem()
&& GetScreen()->GetCurItem()->m_Flags; && GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
...@@ -172,7 +173,6 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -172,7 +173,6 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
return; return;
break;
case HK_HELP: // Display Current hotkey list case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr ); DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
...@@ -183,19 +183,23 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -183,19 +183,23 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY ); cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_OUT: case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY ); cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_REDRAW: case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY ); cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_CENTER: case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY ); cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_UNDO: case HK_UNDO:
...@@ -413,6 +417,9 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -413,6 +417,9 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive * Commands are case insensitive
*/ */
{ {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool ItemInEdit = GetScreen()->GetCurItem() bool ItemInEdit = GetScreen()->GetCurItem()
&& GetScreen()->GetCurItem()->m_Flags; && GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
...@@ -451,19 +458,23 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -451,19 +458,23 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY ); cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_OUT: case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY ); cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_REDRAW: case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY ); cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_CENTER: case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY ); cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_UNDO: case HK_UNDO:
......
...@@ -20,13 +20,11 @@ ...@@ -20,13 +20,11 @@
/*****************************/ /*****************************/
/* class WinEDA_LibeditFrame */ /* class WinEDA_LibeditFrame */
/*****************************/ /*****************************/
BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame )
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_LibeditFrame::OnSize ) EVT_SIZE( WinEDA_LibeditFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_LibeditFrame::OnZoom )
WinEDA_LibeditFrame::Process_Zoom )
// Tools et boutons de Libedit: // Tools et boutons de Libedit:
......
...@@ -168,7 +168,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -168,7 +168,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
wxMenu* viewMenu = new wxMenu; wxMenu* viewMenu = new wxMenu;
msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_IN); HK_ZOOM_IN);
item = new wxMenuItem( viewMenu, ID_ZOOM_IN_BUTT, item = new wxMenuItem( viewMenu, ID_ZOOM_IN,
msg, _( "Zoom in" ), msg, _( "Zoom in" ),
wxITEM_NORMAL ); wxITEM_NORMAL );
item->SetBitmap( zoom_in_xpm ); item->SetBitmap( zoom_in_xpm );
...@@ -176,13 +176,13 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -176,13 +176,13 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_OUT ); HK_ZOOM_OUT );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT_BUTT, item = new wxMenuItem( viewMenu, ID_ZOOM_OUT,
msg, _( "Zoom out" ), msg, _( "Zoom out" ),
wxITEM_NORMAL ); wxITEM_NORMAL );
item->SetBitmap( zoom_out_xpm ); item->SetBitmap( zoom_out_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE_BUTT, item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE,
_( "Zoom auto" ), _( "Zoom auto" ), _( "Zoom auto" ), _( "Zoom auto" ),
wxITEM_NORMAL ); wxITEM_NORMAL );
item->SetBitmap( zoom_auto_xpm ); item->SetBitmap( zoom_auto_xpm );
...@@ -192,7 +192,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -192,7 +192,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_REDRAW ); HK_ZOOM_REDRAW );
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW_BUTT, item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW,
msg, _( "Zoom auto" ), msg, _( "Zoom auto" ),
wxITEM_NORMAL ); wxITEM_NORMAL );
item->SetBitmap( zoom_redraw_xpm ); item->SetBitmap( zoom_redraw_xpm );
......
...@@ -29,99 +29,95 @@ ...@@ -29,99 +29,95 @@
/* class WinEDA_SchematicFrame */ /* class WinEDA_SchematicFrame */
/*******************************/ /*******************************/
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
COMMON_EVENTS_DRAWFRAME EVT_SOCKET( EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV,
ID_EDA_SOCKET_EVENT_SERV, WinEDA_DrawFrame::OnSockRequestServer )
WinEDA_DrawFrame:: EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_DrawFrame::OnSockRequest )
OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_DrawFrame::OnSockRequest ) EVT_CLOSE( WinEDA_SchematicFrame::OnCloseWindow )
EVT_SIZE( WinEDA_SchematicFrame::OnSize )
EVT_CLOSE( WinEDA_SchematicFrame::OnCloseWindow )
EVT_SIZE( WinEDA_SchematicFrame::OnSize ) EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_SchematicFrame::OnLoadFile )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_SchematicFrame::OnLoadFile ) EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) EVT_TOOL_RANGE( ID_SCHEMATIC_MAIN_TOOLBAR_START,
ID_SCHEMATIC_MAIN_TOOLBAR_END,
EVT_TOOL_RANGE( ID_SCHEMATIC_MAIN_TOOLBAR_START, WinEDA_SchematicFrame::Process_Special_Functions )
ID_SCHEMATIC_MAIN_TOOLBAR_END,
WinEDA_SchematicFrame::Process_Special_Functions ) EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END,
WinEDA_DrawFrame::ProcessFontPreferences )
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END,
WinEDA_DrawFrame::ProcessFontPreferences ) EVT_MENU( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET, WinEDA_SchematicFrame::Save_File )
EVT_MENU( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET_AS, WinEDA_SchematicFrame::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET, WinEDA_SchematicFrame::Save_File ) EVT_TOOL( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET_AS, WinEDA_SchematicFrame::Save_File ) EVT_MENU( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter )
EVT_TOOL( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File ) EVT_MENU( ID_GEN_PLOT_PS, WinEDA_SchematicFrame::ToPlot_PS )
EVT_MENU( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter ) EVT_MENU( ID_GEN_PLOT_HPGL, WinEDA_SchematicFrame::ToPlot_HPGL )
EVT_MENU( ID_GEN_PLOT_PS, WinEDA_SchematicFrame::ToPlot_PS ) EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
EVT_MENU( ID_GEN_PLOT_HPGL, WinEDA_SchematicFrame::ToPlot_HPGL ) EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print ) EVT_MENU( ID_GEN_COPY_BLOCK_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard ) EVT_MENU( ID_EXIT, WinEDA_SchematicFrame::OnExit )
EVT_MENU( ID_GEN_COPY_BLOCK_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
EVT_MENU( ID_EXIT, WinEDA_SchematicFrame::OnExit ) EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
ID_CONFIG_AND_PREFERENCES_END,
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START, WinEDA_SchematicFrame::Process_Config )
ID_CONFIG_AND_PREFERENCES_END, EVT_TOOL( ID_COLORS_SETUP, WinEDA_SchematicFrame::Process_Config )
WinEDA_SchematicFrame::Process_Config ) EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_SchematicFrame::Process_Config )
EVT_TOOL( ID_COLORS_SETUP, WinEDA_SchematicFrame::Process_Config )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_SchematicFrame::Process_Config ) EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_SchematicFrame::OnZoom )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL( ID_TO_LIBRARY, WinEDA_SchematicFrame::OnOpenLibraryEditor )
WinEDA_SchematicFrame::Process_Zoom ) EVT_TOOL( ID_TO_LIBVIEW, WinEDA_SchematicFrame::OnOpenLibraryViewer )
EVT_TOOL( ID_TO_LIBRARY, WinEDA_SchematicFrame::OnOpenLibraryEditor ) EVT_TOOL( ID_TO_PCB, WinEDA_SchematicFrame::OnOpenPcbnew )
EVT_TOOL( ID_TO_LIBVIEW, WinEDA_SchematicFrame::OnOpenLibraryViewer ) EVT_TOOL( ID_TO_CVPCB, WinEDA_SchematicFrame::OnOpenCvpcb )
EVT_TOOL( ID_TO_PCB, WinEDA_SchematicFrame::OnOpenPcbnew ) EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
EVT_TOOL( ID_TO_CVPCB, WinEDA_SchematicFrame::OnOpenCvpcb ) EVT_TOOL( ID_HIERARCHY, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( wxID_CUT, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings ) EVT_TOOL( wxID_COPY, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_HIERARCHY, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( wxID_PASTE, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( wxID_CUT, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( ID_UNDO_BUTT, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( wxID_COPY, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate )
EVT_TOOL( wxID_PASTE, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter )
EVT_TOOL( ID_UNDO_BUTT, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc )
EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate ) EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist )
EVT_TOOL( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter ) EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials )
EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc ) EVT_TOOL( ID_FIND_ITEMS, WinEDA_SchematicFrame::OnFindItems )
EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist ) EVT_TOOL( ID_BACKANNO_ITEMS, WinEDA_SchematicFrame::OnLoadStuffFile )
EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_SchematicFrame::OnFindItems ) EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_TOOL( ID_BACKANNO_ITEMS, WinEDA_SchematicFrame::OnLoadStuffFile ) EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
// Tools et boutons de Schematique, Vertical toolbar: // Tools et boutons de Schematique, Vertical toolbar:
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
ID_SCHEMATIC_VERTICAL_TOOLBAR_END, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
WinEDA_SchematicFrame::Process_Special_Functions ) WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL_RCLICKED( ID_LABEL_BUTT, WinEDA_SchematicFrame::ToolOnRightClick ) EVT_TOOL_RCLICKED( ID_LABEL_BUTT, WinEDA_SchematicFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_GLABEL_BUTT, WinEDA_SchematicFrame::ToolOnRightClick ) EVT_TOOL_RCLICKED( ID_GLABEL_BUTT, WinEDA_SchematicFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_HIERLABEL_BUTT, EVT_TOOL_RCLICKED( ID_HIERLABEL_BUTT,
WinEDA_SchematicFrame::ToolOnRightClick ) WinEDA_SchematicFrame::ToolOnRightClick )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE, EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
WinEDA_SchematicFrame::Process_Special_Functions ) WinEDA_SchematicFrame::Process_Special_Functions )
// Tools et boutons de Schematique, Options toolbar: // Tools et boutons de Schematique, Options toolbar:
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_SchematicFrame::OnSelectOptionToolbar ) WinEDA_SchematicFrame::OnSelectOptionToolbar )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_SchematicFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_SchematicFrame::Process_Special_Functions )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -359,7 +355,7 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -359,7 +355,7 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
} }
if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty() if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty()
&& (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) ) && (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) )
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName ); SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE ); ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE );
...@@ -430,7 +426,7 @@ void WinEDA_SchematicFrame::SetToolbars() ...@@ -430,7 +426,7 @@ void WinEDA_SchematicFrame::SetToolbars()
{ {
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ? _( "Grid not show" ) : _( "Show Grid" ) ); m_Draw_Grid ? _( "Grid not show" ) : _( "Show Grid" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : FALSE ); g_UnitMetric == MILLIMETRE ? TRUE : FALSE );
...@@ -441,15 +437,13 @@ void WinEDA_SchematicFrame::SetToolbars() ...@@ -441,15 +437,13 @@ void WinEDA_SchematicFrame::SetToolbars()
g_CursorShape ); g_CursorShape );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, g_ShowAllPins ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, g_ShowAllPins );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS,
g_ShowAllPins ? _( "No show Hidden Pins" ) : _( g_ShowAllPins ? _( "No show Hidden Pins" ) : _(
"Show Hidden Pins" ) ); "Show Hidden Pins" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT,
g_HVLines ); g_HVLines );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT,
g_HVLines ? _( g_HVLines ? _( "Allows any direction for wires and busses" ) :
"Allows any direction for wires and busses" ) : _( "Allows horizontal and vertical wires and busses only" ) );
_(
"Allows horizontal and vertical wires and busses only" ) );
} }
DisplayUnitsMsg(); DisplayUnitsMsg();
...@@ -640,9 +634,9 @@ void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event ) ...@@ -640,9 +634,9 @@ void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
else else
{ {
m_LibeditFrame = new WinEDA_LibeditFrame( this, m_LibeditFrame = new WinEDA_LibeditFrame( this,
wxT( "Library Editor" ), wxT( "Library Editor" ),
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
ActiveScreen = g_ScreenLib; ActiveScreen = g_ScreenLib;
m_LibeditFrame->AdjustScrollBars(); m_LibeditFrame->AdjustScrollBars();
} }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/********************************************/ /********************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -13,8 +12,6 @@ ...@@ -13,8 +12,6 @@
#include "protos.h" #include "protos.h"
#include "hotkeys.h" #include "hotkeys.h"
#define BITMAP wxBitmap
#ifdef __UNIX__ #ifdef __UNIX__
#define LISTBOX_WIDTH 140 #define LISTBOX_WIDTH 140
#else #else
...@@ -41,52 +38,52 @@ void WinEDA_LibeditFrame::ReCreateVToolbar() ...@@ -41,52 +38,52 @@ void WinEDA_LibeditFrame::ReCreateVToolbar()
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
BITMAP( cursor_xpm ), wxBitmap( cursor_xpm ),
_( "deselect current tool" ), wxITEM_CHECK ); _( "deselect current tool" ), wxITEM_CHECK );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE ); m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString,
BITMAP( pin_xpm ), wxBitmap( pin_xpm ),
_( "Add Pins" ), wxITEM_CHECK ); _( "Add Pins" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString,
BITMAP( add_text_xpm ), wxBitmap( add_text_xpm ),
_( "Add graphic text" ), wxITEM_CHECK ); _( "Add graphic text" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString,
BITMAP( add_rectangle_xpm ), wxBitmap( add_rectangle_xpm ),
_( "Add rectangles" ), wxITEM_CHECK ); _( "Add rectangles" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString,
BITMAP( add_circle_xpm ), wxBitmap( add_circle_xpm ),
_( "Add circles" ), wxITEM_CHECK ); _( "Add circles" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString,
BITMAP( add_arc_xpm ), wxBitmap( add_arc_xpm ),
_( "Add arcs" ), wxITEM_CHECK ); _( "Add arcs" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString,
BITMAP( add_polygon_xpm ), wxBitmap( add_polygon_xpm ),
_( "Add lines and polygons" ), wxITEM_CHECK ); _( "Add lines and polygons" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString,
BITMAP( anchor_xpm ), wxBitmap( anchor_xpm ),
_( "Move part anchor" ), wxITEM_CHECK ); _( "Move part anchor" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString,
BITMAP( import_xpm ), wxBitmap( import_xpm ),
_( "Import existing drawings" ), wxITEM_CHECK ); _( "Import existing drawings" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString,
BITMAP( export_xpm ), wxBitmap( export_xpm ),
_( "Export current drawing" ), wxITEM_CHECK ); _( "Export current drawing" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString,
BITMAP( delete_body_xpm ), wxBitmap( delete_body_xpm ),
_( "Delete items" ), wxITEM_CHECK ); _( "Delete items" ), wxITEM_CHECK );
m_VToolBar->Realize(); m_VToolBar->Realize();
...@@ -113,115 +110,115 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() ...@@ -113,115 +110,115 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
SetToolBar( m_HToolBar ); SetToolBar( m_HToolBar );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString, BITMAP( save_library_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString, wxBitmap( save_library_xpm ),
_( "Save current loaded library on disk (file update)" ) ); _( "Save current loaded library on disk (file update)" ) );
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString, BITMAP( library_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString, wxBitmap( library_xpm ),
_( "Select working library" ) ); _( "Select working library" ) );
m_HToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString, BITMAP( delete_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString, wxBitmap( delete_xpm ),
_( "Delete component in current library" ) ); _( "Delete component in current library" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, BITMAP( new_component_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, wxBitmap( new_component_xpm ),
_( "New component" ) ); _( "New component" ) );
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_PART, BITMAP( add_component_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxBitmap( add_component_xpm ),
_( "Select component to edit" ) ); _( "Select component to edit" ) );
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString, m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString,
BITMAP( save_part_in_mem_xpm ), wxBitmap( save_part_in_mem_xpm ),
_( "Save current component into current loaded library (in memory)" ) ); _( "Save current component into current loaded library (in memory)" ) );
m_HToolBar->AddTool( ID_LIBEDIT_IMPORT_PART, wxEmptyString, BITMAP( import_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_IMPORT_PART, wxEmptyString, wxBitmap( import_xpm ),
_( "import component" ) ); _( "import component" ) );
m_HToolBar->AddTool( ID_LIBEDIT_EXPORT_PART, wxEmptyString, BITMAP( export_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_EXPORT_PART, wxEmptyString, wxBitmap( export_xpm ),
_( "export component" ) ); _( "export component" ) );
m_HToolBar->AddTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, m_HToolBar->AddTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
wxEmptyString, BITMAP( new_library_xpm ), wxEmptyString, wxBitmap( new_library_xpm ),
_( "Create a new library an save current component into" ) ); _( "Create a new library an save current component into" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO ); msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO );
m_HToolBar->AddTool( ID_LIBEDIT_UNDO, wxEmptyString, BITMAP( undo_xpm ), msg ); m_HToolBar->AddTool( ID_LIBEDIT_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg );
msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO ); msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO );
m_HToolBar->AddTool( ID_LIBEDIT_REDO, wxEmptyString, BITMAP( redo_xpm ), msg ); m_HToolBar->AddTool( ID_LIBEDIT_REDO, wxEmptyString, wxBitmap( redo_xpm ), msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, BITMAP( part_properties_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxBitmap( part_properties_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Edit component properties" ) ); _( "Edit component properties" ) );
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, BITMAP( add_text_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxBitmap( add_text_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Add, remove fields and edit fields properties" ) ); _( "Add, remove fields and edit fields properties" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, BITMAP( erc_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxBitmap( erc_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Test duplicate pins" ) ); _( "Test duplicate pins" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN ); msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ), m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
msg ); msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Libedit_Hokeys_Descr, HK_ZOOM_OUT ); msg = AddHotkeyName( _( "Zoom out" ), s_Libedit_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ), m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
msg ); msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW ); msg = AddHotkeyName( _( "Redraw view" ), s_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( zoom_redraw_xpm ), m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ),
msg ); msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
BITMAP( zoom_auto_xpm ), wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) ); _( "Zoom auto" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
BITMAP( morgan1_xpm ), wxBitmap( morgan1_xpm ),
_( "show as \"De Morgan\" normal part" ), wxITEM_CHECK ); _( "show as \"De Morgan\" normal part" ), wxITEM_CHECK );
m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT, m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT,
(CurrentConvert <= 1) ? TRUE : FALSE ); (CurrentConvert <= 1) ? TRUE : FALSE );
m_HToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
BITMAP( morgan2_xpm ), wxBitmap( morgan2_xpm ),
_( "show as \"De Morgan\" convert part" ), wxITEM_CHECK ); _( "show as \"De Morgan\" convert part" ), wxITEM_CHECK );
m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT, m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT,
(CurrentConvert >= 2) ? TRUE : FALSE ); (CurrentConvert >= 2) ? TRUE : FALSE );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, BITMAP( datasheet_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxBitmap( datasheet_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Documents" ) ); _( "Documents" ) );
m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE ); m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_SelpartBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_PART_NUMBER, m_SelpartBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) ); wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) );
m_HToolBar->AddControl( m_SelpartBox ); m_HToolBar->AddControl( m_SelpartBox );
m_SelAliasBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_ALIAS, m_SelAliasBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_ALIAS,
wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) ); wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) );
m_HToolBar->AddControl( m_SelAliasBox ); m_HToolBar->AddControl( m_SelAliasBox );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, BITMAP( pin2pin_xpm ), m_HToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxBitmap( pin2pin_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Edit pins part per part (Carefully use!)" ) ); _( "Edit pins part per part (Carefully use!)" ) );
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn ); m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes // after adding the buttons to the toolbar, must call Realize() to reflect the changes
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/*****************************************************/ /*****************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -13,8 +12,6 @@ ...@@ -13,8 +12,6 @@
#include "protos.h" #include "protos.h"
#include "hotkeys.h" #include "hotkeys.h"
#define BITMAP wxBitmap
#include "bitmaps.h" #include "bitmaps.h"
#include "id.h" #include "id.h"
...@@ -35,94 +32,94 @@ void WinEDA_SchematicFrame::ReCreateHToolbar() ...@@ -35,94 +32,94 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
SetToolBar( m_HToolBar ); SetToolBar( m_HToolBar );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, BITMAP( new_xpm ), m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, wxBitmap( new_xpm ),
_( "New schematic project" ) ); _( "New schematic project" ) );
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, BITMAP( open_xpm ), m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, wxBitmap( open_xpm ),
_( "Open schematic project" ) ); _( "Open schematic project" ) );
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, BITMAP( save_project_xpm ), m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, wxBitmap( save_project_xpm ),
_( "Save schematic project" ) ); _( "Save schematic project" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, BITMAP( sheetset_xpm ), m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, wxBitmap( sheetset_xpm ),
_( "Page settings" ) ); _( "Page settings" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, BITMAP( libedit_xpm ), m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, wxBitmap( libedit_xpm ),
_( "Library editor" ) ); _( "Library editor" ) );
m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, BITMAP( library_browse_xpm ), m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, wxBitmap( library_browse_xpm ),
_( "Library browser" ) ); _( "Library browser" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString, BITMAP( hierarchy_nav_xpm ), m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString, wxBitmap( hierarchy_nav_xpm ),
_( "Schematic hierarchy navigator" ) ); _( "Schematic hierarchy navigator" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_CUT, wxEmptyString, BITMAP( cut_button ), m_HToolBar->AddTool( wxID_CUT, wxEmptyString, wxBitmap( cut_button ),
_( "Cut selected item" ) ); _( "Cut selected item" ) );
m_HToolBar->AddTool( wxID_COPY, wxEmptyString, BITMAP( copy_button ), m_HToolBar->AddTool( wxID_COPY, wxEmptyString, wxBitmap( copy_button ),
_( "Copy selected item" ) ); _( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, BITMAP( paste_xpm ), m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, wxBitmap( paste_xpm ),
_( "Paste" ) ); _( "Paste" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO ); msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO );
m_HToolBar->AddTool( ID_SCHEMATIC_UNDO, wxEmptyString, BITMAP( undo_xpm ), msg ); m_HToolBar->AddTool( ID_SCHEMATIC_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg );
msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO ); msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO );
m_HToolBar->AddTool( ID_SCHEMATIC_REDO, wxEmptyString, BITMAP( redo_xpm ), msg ); m_HToolBar->AddTool( ID_SCHEMATIC_REDO, wxEmptyString, wxBitmap( redo_xpm ), msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, BITMAP( print_button ), m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ),
_( "Print schematic" ) ); _( "Print schematic" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TO_CVPCB, wxEmptyString, BITMAP( cvpcb_xpm ), m_HToolBar->AddTool( ID_TO_CVPCB, wxEmptyString, wxBitmap( cvpcb_xpm ),
_( "Run Cvpcb" ) ); _( "Run Cvpcb" ) );
m_HToolBar->AddTool( ID_TO_PCB, wxEmptyString, BITMAP( pcbnew_xpm ), m_HToolBar->AddTool( ID_TO_PCB, wxEmptyString, wxBitmap( pcbnew_xpm ),
_( "Run pcbnew" ) ); _( "Run pcbnew" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr, HK_ZOOM_IN ); msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ), m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
msg ); msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr, HK_ZOOM_OUT ); msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ), m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
msg ); msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( zoom_redraw_xpm ), m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ),
msg ); msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_auto_xpm ), m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) ); _( "Zoom auto" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, BITMAP( find_xpm ), m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ),
_( "Find components and texts" ) ); _( "Find components and texts" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, BITMAP( netlist_xpm ), m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
_( "Netlist generation" ) ); _( "Netlist generation" ) );
m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, BITMAP( annotate_xpm ), m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, wxBitmap( annotate_xpm ),
_( "Schematic Annotation" ) ); _( "Schematic Annotation" ) );
m_HToolBar->AddTool( ID_GET_ERC, wxEmptyString, BITMAP( erc_xpm ), m_HToolBar->AddTool( ID_GET_ERC, wxEmptyString, wxBitmap( erc_xpm ),
_( "Schematic Electric Rules Check" ) ); _( "Schematic Electric Rules Check" ) );
m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, BITMAP( tools_xpm ), m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, wxBitmap( tools_xpm ),
_( "Bill of material and/or Crossreferences" ) ); _( "Bill of material and/or Crossreferences" ) );
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, BITMAP( backanno_xpm ), m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, wxBitmap( backanno_xpm ),
_( "Backannotate footprint" ) ); _( "Backannotate footprint" ) );
// after adding the tools to the toolbar, must call Realize() to reflect the changes // after adding the tools to the toolbar, must call Realize() to reflect the changes
m_HToolBar->Realize(); m_HToolBar->Realize();
...@@ -143,88 +140,88 @@ void WinEDA_SchematicFrame::ReCreateVToolbar() ...@@ -143,88 +140,88 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
BITMAP( cursor_xpm ), wxEmptyString, wxITEM_CHECK ); wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE ); m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_VToolBar->AddTool( ID_HIERARCHY_PUSH_POP_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_HIERARCHY_PUSH_POP_BUTT, wxEmptyString,
BITMAP( hierarchy_cursor_xpm ), wxBitmap( hierarchy_cursor_xpm ),
_( "Hierarchy Push/Pop" ), wxITEM_CHECK ); _( "Hierarchy Push/Pop" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_COMPONENT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_COMPONENT_BUTT, wxEmptyString,
BITMAP( add_component_xpm ), wxBitmap( add_component_xpm ),
_( "Place a component" ), wxITEM_CHECK ); _( "Place a component" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PLACE_POWER_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_PLACE_POWER_BUTT, wxEmptyString,
BITMAP( add_power_xpm ), wxBitmap( add_power_xpm ),
_( "Place a power port" ), wxITEM_CHECK ); _( "Place a power port" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_WIRE_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_WIRE_BUTT, wxEmptyString,
BITMAP( add_line_xpm ), wxBitmap( add_line_xpm ),
_( "Place a wire" ), wxITEM_CHECK ); _( "Place a wire" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_BUS_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_BUS_BUTT, wxEmptyString,
BITMAP( add_bus_xpm ), wxBitmap( add_bus_xpm ),
_( "Place a bus" ), wxITEM_CHECK ); _( "Place a bus" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_WIRETOBUS_ENTRY_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_WIRETOBUS_ENTRY_BUTT, wxEmptyString,
BITMAP( add_line2bus_xpm ), wxBitmap( add_line2bus_xpm ),
_( "Place a wire to bus entry" ), wxITEM_CHECK ); _( "Place a wire to bus entry" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_BUSTOBUS_ENTRY_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_BUSTOBUS_ENTRY_BUTT, wxEmptyString,
BITMAP( add_bus2bus_xpm ), wxBitmap( add_bus2bus_xpm ),
_( "Place a bus to bus entry" ), wxITEM_CHECK ); _( "Place a bus to bus entry" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_NOCONN_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_NOCONN_BUTT, wxEmptyString,
BITMAP( noconn_button ), wxBitmap( noconn_button ),
_( "Place no connect flag" ), wxITEM_CHECK ); _( "Place no connect flag" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_LABEL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LABEL_BUTT, wxEmptyString,
BITMAP( add_line_label_xpm ), wxBitmap( add_line_label_xpm ),
_( "Place net name" ), wxITEM_CHECK ); _( "Place net name" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString,
BITMAP( add_glabel_xpm ), wxBitmap( add_glabel_xpm ),
_( "Place a global label.\nWarning: all global labels with the same name are connected in whole hierarchy" ), _( "Place a global label.\nWarning: all global labels with the same name are connected in whole hierarchy" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
BITMAP( add_junction_xpm ), wxBitmap( add_junction_xpm ),
_( "Place a junction" ), wxITEM_CHECK ); _( "Place a junction" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
BITMAP( add_hierarchical_label_xpm ), wxBitmap( add_hierarchical_label_xpm ),
_( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ), _( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_VToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString,
BITMAP( add_hierarchical_subsheet_xpm ), wxBitmap( add_hierarchical_subsheet_xpm ),
_( "Place hierarchical sheet" ), wxITEM_CHECK ); _( "Place hierarchical sheet" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_IMPORT_GLABEL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_IMPORT_GLABEL_BUTT, wxEmptyString,
BITMAP( import_hierarchical_label_xpm ), wxBitmap( import_hierarchical_label_xpm ),
_( "Place a pin sheet , imported from a hierarchical label in sheet" ), _( "Place a pin sheet , imported from a hierarchical label in sheet" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_VToolBar->AddTool( ID_SHEET_LABEL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_SHEET_LABEL_BUTT, wxEmptyString,
BITMAP( add_hierar_pin_xpm ), wxBitmap( add_hierar_pin_xpm ),
_( "Place hierarchical pin to sheet" ), wxITEM_CHECK ); _( "Place hierarchical pin to sheet" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString,
BITMAP( add_dashed_line_xpm ), wxBitmap( add_dashed_line_xpm ),
_( "Place graphic line or polygon" ), wxITEM_CHECK ); _( "Place graphic line or polygon" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString,
BITMAP( add_text_xpm ), wxBitmap( add_text_xpm ),
_( "Place graphic text (comment)" ), wxITEM_CHECK ); _( "Place graphic text (comment)" ), wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxEmptyString,
BITMAP( delete_body_xpm ), wxBitmap( delete_body_xpm ),
_( "Delete items" ), wxITEM_CHECK ); _( "Delete items" ), wxITEM_CHECK );
m_VToolBar->Realize(); m_VToolBar->Realize();
...@@ -246,29 +243,29 @@ void WinEDA_SchematicFrame::ReCreateOptToolbar() ...@@ -246,29 +243,29 @@ void WinEDA_SchematicFrame::ReCreateOptToolbar()
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE ); m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
BITMAP( grid_xpm ), wxBitmap( grid_xpm ),
_( "Display Grid OFF" ), wxITEM_CHECK ); _( "Display Grid OFF" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
BITMAP( unit_inch_xpm ), wxBitmap( unit_inch_xpm ),
_( "Units in inches" ), wxITEM_CHECK ); _( "Units in inches" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
BITMAP( unit_mm_xpm ), wxBitmap( unit_mm_xpm ),
_( "Units in millimeters" ), wxITEM_CHECK ); _( "Units in millimeters" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
BITMAP( cursor_shape_xpm ), wxBitmap( cursor_shape_xpm ),
_( "Change Cursor Shape" ), wxITEM_CHECK ); _( "Change Cursor Shape" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_HIDDEN_PINS, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_HIDDEN_PINS, wxEmptyString,
BITMAP( hidden_pin_xpm ), wxBitmap( hidden_pin_xpm ),
_( "Show Hidden Pins" ), wxITEM_CHECK ); _( "Show Hidden Pins" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, wxEmptyString,
BITMAP( lines90_xpm ), wxBitmap( lines90_xpm ),
_( "HV orientation for Wires and Bus" ), wxITEM_CHECK ); _( "HV orientation for Wires and Bus" ), wxITEM_CHECK );
m_OptionsToolBar->Realize(); m_OptionsToolBar->Realize();
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/****************************************************************/ /****************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -14,8 +13,6 @@ ...@@ -14,8 +13,6 @@
#include "protos.h" #include "protos.h"
#define BITMAP wxBitmap
#include "bitmaps.h" #include "bitmaps.h"
#include "id.h" #include "id.h"
...@@ -24,126 +21,138 @@ ...@@ -24,126 +21,138 @@
void WinEDA_ViewlibFrame::ReCreateHToolbar() void WinEDA_ViewlibFrame::ReCreateHToolbar()
/****************************************************/ /****************************************************/
{ {
int ii; int ii;
EDA_LibComponentStruct * RootLibEntry = NULL, * CurrentLibEntry = NULL; EDA_LibComponentStruct* RootLibEntry = NULL, * CurrentLibEntry = NULL;
bool asdeMorgan = FALSE, state; bool asdeMorgan = FALSE, state;
if ( (g_CurrentViewLibraryName != wxEmptyString) && (g_CurrentViewComponentName != wxEmptyString) ) if( (g_CurrentViewLibraryName != wxEmptyString)
{ && (g_CurrentViewComponentName != wxEmptyString) )
RootLibEntry = FindLibPart(g_CurrentViewComponentName.GetData(), {
g_CurrentViewLibraryName.GetData(), FIND_ROOT); RootLibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
if ( RootLibEntry && LookForConvertPart(RootLibEntry) > 1 ) g_CurrentViewLibraryName.GetData(),
asdeMorgan = TRUE; FIND_ROOT );
CurrentLibEntry = FindLibPart(g_CurrentViewComponentName.GetData(), if( RootLibEntry && LookForConvertPart( RootLibEntry ) > 1 )
g_CurrentViewLibraryName.GetData(), FIND_ALIAS); asdeMorgan = TRUE;
} CurrentLibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(),
if ( m_HToolBar == NULL ) FIND_ALIAS );
{ }
m_HToolBar = new WinEDA_Toolbar(TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE);
SetToolBar(m_HToolBar); if( m_HToolBar == NULL )
{
// Set up toolbar m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN,
m_HToolBar->AddTool(ID_LIBVIEW_SELECT_LIB, wxEmptyString, this,
BITMAP(library_xpm), ID_H_TOOLBAR,
_("Select library to browse")); TRUE );
SetToolBar( m_HToolBar );
m_HToolBar->AddTool(ID_LIBVIEW_SELECT_PART, wxEmptyString,
BITMAP(add_component_xpm), // Set up toolbar
_("Select part to browse")); m_HToolBar->AddTool( ID_LIBVIEW_SELECT_LIB, wxEmptyString,
wxBitmap( library_xpm ),
m_HToolBar->AddSeparator(); _( "Select library to browse" ) );
m_HToolBar->AddTool(ID_LIBVIEW_PREVIOUS, wxEmptyString,
BITMAP(lib_previous_xpm), m_HToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
_("Display previous part")); wxBitmap( add_component_xpm ),
_( "Select part to browse" ) );
m_HToolBar->AddTool(ID_LIBVIEW_NEXT, wxEmptyString,
BITMAP(lib_next_xpm), m_HToolBar->AddSeparator();
_("Display next part")); m_HToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString,
wxBitmap( lib_previous_xpm ),
m_HToolBar->AddSeparator(); _( "Display previous part" ) );
m_HToolBar->AddTool(ID_ZOOM_IN_BUTT, wxEmptyString,
BITMAP(zoom_in_xpm), m_HToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString,
_("Zoom in")); wxBitmap( lib_next_xpm ),
_( "Display next part" ) );
m_HToolBar->AddTool(ID_ZOOM_OUT_BUTT, wxEmptyString,
BITMAP(zoom_out_xpm), m_HToolBar->AddSeparator();
_("Zoom out")); m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ),
m_HToolBar->AddTool(ID_ZOOM_REDRAW_BUTT, wxEmptyString, _( "Zoom in" ) );
BITMAP(zoom_redraw_xpm),
_("Redraw view")); m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ),
m_HToolBar->AddTool(ID_ZOOM_PAGE_BUTT, wxEmptyString, _( "Zoom out" ) );
BITMAP(zoom_auto_xpm),
_("Best zoom")); m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ),
m_HToolBar->AddSeparator(); _( "Redraw view" ) );
m_HToolBar->AddTool(ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
BITMAP(morgan1_xpm), m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
_("Show as \"De Morgan\" normal part"), wxITEM_CHECK); wxBitmap( zoom_auto_xpm ),
_( "Best zoom" ) );
m_HToolBar->AddTool(ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
BITMAP(morgan2_xpm), m_HToolBar->AddSeparator();
_("Show as \"De Morgan\" convert part"), wxITEM_CHECK); m_HToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
wxBitmap( morgan1_xpm ),
m_HToolBar->AddSeparator(); _( "Show as \"De Morgan\" normal part" ),
wxITEM_CHECK );
SelpartBox = new WinEDAChoiceBox(m_HToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize(150,-1)); m_HToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
m_HToolBar->AddControl(SelpartBox); wxBitmap( morgan2_xpm ),
_( "Show as \"De Morgan\" convert part" ),
m_HToolBar->AddSeparator(); wxITEM_CHECK );
m_HToolBar->AddTool(ID_LIBVIEW_VIEWDOC, wxEmptyString, BITMAP(datasheet_xpm),
_("View component documents") ); m_HToolBar->AddSeparator();
m_HToolBar->EnableTool(ID_LIBVIEW_VIEWDOC, FALSE);
SelpartBox =
if ( m_Semaphore ) // The lib browser is called from a "load component" command new WinEDAChoiceBox( m_HToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
{ wxDefaultPosition, wxSize( 150, -1 ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddControl( SelpartBox );
m_HToolBar->AddTool(ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, wxEmptyString,
BITMAP(export_xpm), m_HToolBar->AddSeparator();
_("Insert component in schematic") ); m_HToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString,
} wxBitmap( datasheet_xpm ),
_( "View component documents" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, FALSE );
// the changes
m_HToolBar->Realize(); if( m_Semaphore ) // The lib browser is called from a "load component" command
} {
m_HToolBar->AddSeparator();
// Must be AFTER Realize(): m_HToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
m_HToolBar->ToggleTool(ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
(g_ViewConvert <= 1) ? TRUE : FALSE); wxBitmap( export_xpm ),
m_HToolBar->ToggleTool(ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, _( "Insert component in schematic" ) );
(g_ViewConvert >= 2) ? TRUE : FALSE ); }
m_HToolBar->EnableTool(ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan);
m_HToolBar->EnableTool(ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan); // after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
int jj = 1; m_HToolBar->Realize();
if( RootLibEntry ) jj = MAX(RootLibEntry->m_UnitCount, 1); }
SelpartBox->Clear();
for ( ii = 0; ii < jj ; ii ++ ) // Must be AFTER Realize():
{ m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,
wxString msg; (g_ViewConvert <= 1) ? TRUE : FALSE );
msg.Printf( _("Part %c"), 'A' + ii); m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
SelpartBox->Append(msg); (g_ViewConvert >= 2) ? TRUE : FALSE );
} m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan );
SelpartBox->SetSelection(0); m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan );
state = FALSE;
if ( CurrentLibEntry && jj > 1 ) state = TRUE; int jj = 1;
SelpartBox->Enable(state); if( RootLibEntry )
jj = MAX( RootLibEntry->m_UnitCount, 1 );
state = FALSE; SelpartBox->Clear();
if( CurrentLibEntry && (CurrentLibEntry->m_DocFile != wxEmptyString) ) for( ii = 0; ii < jj; ii++ )
state = TRUE; {
m_HToolBar->EnableTool(ID_LIBVIEW_VIEWDOC, state); wxString msg;
msg.Printf( _( "Part %c" ), 'A' + ii );
SelpartBox->Append( msg );
}
SelpartBox->SetSelection( 0 );
state = FALSE;
if( CurrentLibEntry && jj > 1 )
state = TRUE;
SelpartBox->Enable( state );
state = FALSE;
if( CurrentLibEntry && (CurrentLibEntry->m_DocFile != wxEmptyString) )
state = TRUE;
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, state );
} }
/****************************************************/ /****************************************************/
void WinEDA_ViewlibFrame::ReCreateVToolbar() void WinEDA_ViewlibFrame::ReCreateVToolbar()
/****************************************************/ /****************************************************/
{ {
} }
...@@ -18,25 +18,24 @@ ...@@ -18,25 +18,24 @@
/*****************************/ /*****************************/
/* class WinEDA_ViewlibFrame */ /* class WinEDA_ViewlibFrame */
/*****************************/ /*****************************/
BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ViewlibFrame::OnSize ) EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate ) EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL, EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
WinEDA_ViewlibFrame::Process_Special_Functions ) WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DrawFrame::OnZoom )
WinEDA_DrawFrame::Process_Zoom )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart ) WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER, EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
WinEDA_ViewlibFrame::Process_Special_Functions ) WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList ) EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList ) EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -153,8 +152,8 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv ) ...@@ -153,8 +152,8 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
if( DrawPanel ) if( DrawPanel )
{ {
DrawPanel->SetSize( m_LibListSize.x + m_CmpListSize.x, 0, DrawPanel->SetSize( m_LibListSize.x + m_CmpListSize.x, 0,
size.x - Vtoolbar_size.x - m_LibListSize.x - m_CmpListSize.x, size.x - Vtoolbar_size.x - m_LibListSize.x - m_CmpListSize.x,
size.y ); size.y );
} }
if( m_LibList ) if( m_LibList )
...@@ -195,7 +194,7 @@ int WinEDA_ViewlibFrame::BestZoom() ...@@ -195,7 +194,7 @@ int WinEDA_ViewlibFrame::BestZoom()
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
size -= wxSize( 100, 100 ); // reserve a 100 mils margin size -= wxSize( 100, 100 ); // reserve a 100 mils margin
ii = (double) itemsize.x / size.x; ii = itemsize.x / size.x;
jj = itemsize.y / size.y; jj = itemsize.y / size.y;
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
......
...@@ -71,21 +71,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -71,21 +71,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed ) switch( g_KeyPressed )
{ {
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = GetScreen()->m_Curseur;
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;
......
...@@ -21,13 +21,11 @@ ...@@ -21,13 +21,11 @@
/* class WinEDA_GerberFrame for GerbView*/ /* class WinEDA_GerberFrame for GerbView*/
/****************************************/ /****************************************/
BEGIN_EVENT_TABLE( WinEDA_GerberFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize ) EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_GerberFrame::OnZoom )
WinEDA_GerberFrame::Process_Zoom )
EVT_TOOL( ID_LOAD_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_LOAD_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_APPEND_FILE, WinEDA_GerberFrame::Files_io )
......
...@@ -84,6 +84,9 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -84,6 +84,9 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
*/ */
{ {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...) // Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 ) if( (hotkey & GR_KB_CTRL) != 0 )
hotkey += 'A' - 1; hotkey += 'A' - 1;
...@@ -99,34 +102,35 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -99,34 +102,35 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
return; return;
break;
case HK_HELP: // Display Current hotkey list case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_Gerbview_Hokeys_Descr ); DisplayHotkeyList( this, s_Gerbview_Hokeys_Descr );
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY ); cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_OUT: case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY ); cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_REDRAW: case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY ); cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_CENTER: case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY ); cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */ case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
g_UnitMetric = (g_UnitMetric == INCHES ) ? MILLIMETRE : INCHES; g_UnitMetric = (g_UnitMetric == INCHES ) ? MILLIMETRE : INCHES;
break; break;
......
...@@ -209,27 +209,27 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -209,27 +209,27 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, wxBitmap( new_xpm ), m_HToolBar->AddTool( ID_NEW_BOARD, wxBitmap( new_xpm ),
wxNullBitmap, FALSE, wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "New World" ) ); _( "New World" ) );
m_HToolBar->AddTool( ID_LOAD_FILE, wxBitmap( open_xpm ), m_HToolBar->AddTool( ID_LOAD_FILE, wxBitmap( open_xpm ),
wxNullBitmap, FALSE, wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Open existing Layer" ) ); _( "Open existing Layer" ) );
#if 0 #if 0
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxBitmap( save_button ), m_HToolBar->AddTool( ID_SAVE_PROJECT, wxBitmap( save_button ),
wxNullBitmap, FALSE, wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Save World" ) ); _( "Save World" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SHEET_SET, wxBitmap( sheetset_xpm ), m_HToolBar->AddTool( ID_SHEET_SET, wxBitmap( sheetset_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "page settings (size, texts)" ) ); _( "page settings (size, texts)" ) );
#endif #endif
...@@ -237,70 +237,70 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -237,70 +237,70 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
#if 0 #if 0
m_HToolBar->AddTool( wxID_CUT, wxBitmap( cut_button ), m_HToolBar->AddTool( wxID_CUT, wxBitmap( cut_button ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Cut selected item" ) ); _( "Cut selected item" ) );
m_HToolBar->AddTool( wxID_COPY, wxBitmap( copy_button ), m_HToolBar->AddTool( wxID_COPY, wxBitmap( copy_button ),
wxNullBitmap, FALSE, wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Copy selected item" ) ); _( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, wxBitmap( paste_xpm ), m_HToolBar->AddTool( wxID_PASTE, wxBitmap( paste_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Paste" ) ); _( "Paste" ) );
#endif #endif
m_HToolBar->AddTool( ID_UNDO_BUTT, wxBitmap( undelete_xpm ), m_HToolBar->AddTool( ID_UNDO_BUTT, wxBitmap( undelete_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Undelete" ) ); _( "Undelete" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxBitmap( print_button ), m_HToolBar->AddTool( ID_GEN_PRINT, wxBitmap( print_button ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Print World" ) ); _( "Print World" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_IN ); msg = AddHotkeyName( _( "Zoom in" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxBitmap( zoom_in_xpm ), m_HToolBar->AddTool( ID_ZOOM_IN, wxBitmap( zoom_in_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
msg ); msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_OUT ); msg = AddHotkeyName( _( "Zoom out" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxBitmap( zoom_out_xpm ), m_HToolBar->AddTool( ID_ZOOM_OUT, wxBitmap( zoom_out_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
msg ); msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_REDRAW ); msg = AddHotkeyName( _( "Redraw view" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxBitmap( zoom_redraw_xpm ), m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxBitmap( zoom_redraw_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
msg ); msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxBitmap( zoom_auto_xpm ), m_HToolBar->AddTool( ID_ZOOM_PAGE, wxBitmap( zoom_auto_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Zoom auto" ) ); _( "Zoom auto" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_FIND_ITEMS, wxBitmap( find_xpm ), m_HToolBar->AddTool( ID_FIND_ITEMS, wxBitmap( find_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Find D-codes" ) ); _( "Find D-codes" ) );
wxArrayString choices; wxArrayString choices;
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
...@@ -360,37 +360,37 @@ create or update the right vertical toolbar ...@@ -360,37 +360,37 @@ create or update the right vertical toolbar
#if 0 #if 0
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_COMPONENT_BUTT, m_VToolBar->AddTool( ID_COMPONENT_BUTT,
wxBitmap( component_button ), wxBitmap( component_button ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Add Flashes" ) ); _( "Add Flashes" ) );
m_VToolBar->AddTool( ID_BUS_BUTT, m_VToolBar->AddTool( ID_BUS_BUTT,
wxBitmap( bus_button ), wxBitmap( bus_button ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Add Lines" ) ); _( "Add Lines" ) );
m_VToolBar->AddTool( ID_JUNCTION_BUTT, m_VToolBar->AddTool( ID_JUNCTION_BUTT,
wxBitmap( junction_xpm ), wxBitmap( junction_xpm ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Add layer alignment target" ) ); _( "Add layer alignment target" ) );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT,
wxBitmap( tool_text_xpm ), wxBitmap( tool_text_xpm ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Add Text" ) ); _( "Add Text" ) );
#endif #endif
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT,
wxBitmap( delete_body_xpm ), wxBitmap( delete_body_xpm ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Delete items" ) ); _( "Delete items" ) );
m_VToolBar->Realize(); m_VToolBar->Realize();
SetToolbars(); SetToolbars();
...@@ -411,16 +411,16 @@ create or update the left vertical toolbar (option toolbar ...@@ -411,16 +411,16 @@ create or update the left vertical toolbar (option toolbar
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE ); m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxBitmap( grid_xpm ), m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxBitmap( grid_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Display Grid OFF" ) ); _( "Display Grid OFF" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxBitmap( polar_coord_xpm ), m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxBitmap( polar_coord_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Display Polar Coord ON" ) ); _( "Display Polar Coord ON" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
wxBitmap( unit_inch_xpm ), wxBitmap( unit_inch_xpm ),
...@@ -431,42 +431,41 @@ create or update the left vertical toolbar (option toolbar ...@@ -431,42 +431,41 @@ create or update the left vertical toolbar (option toolbar
_( "Units in millimeters" ), wxITEM_CHECK ); _( "Units in millimeters" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxBitmap( cursor_shape_xpm ), m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxBitmap( cursor_shape_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Change Cursor Shape" ) ); _( "Change Cursor Shape" ) );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
wxBitmap( pad_sketch_xpm ), wxBitmap( pad_sketch_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Show Spots in Sketch Mode" ) ); _( "Show Spots in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
wxBitmap( showtrack_xpm ), wxBitmap( showtrack_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Show Lines in Sketch Mode" ) ); _( "Show Lines in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
wxBitmap( opt_show_polygon_xpm ), wxBitmap( opt_show_polygon_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Show Polygons in Sketch Mode" ) ); _( "Show Polygons in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES,
wxBitmap( show_dcodenumber_xpm ), wxBitmap( show_dcodenumber_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Show dcode number" ) ); _( "Show dcode number" ) );
m_OptionsToolBar->Realize(); m_OptionsToolBar->Realize();
SetToolbars(); SetToolbars();
} }
...@@ -40,7 +40,6 @@ WX_DECLARE_OBJARRAY( GRID_TYPE, GridArray ); ...@@ -40,7 +40,6 @@ WX_DECLARE_OBJARRAY( GRID_TYPE, GridArray );
class WinEDA_DrawPanel : public wxScrolledWindow class WinEDA_DrawPanel : public wxScrolledWindow
{ {
public: public:
int m_Ident;
WinEDA_DrawFrame* m_Parent; WinEDA_DrawFrame* m_Parent;
EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the visible area in internal units) EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the visible area in internal units)
wxPoint m_CursorStartPos; // utile dans controles du mouvement curseur wxPoint m_CursorStartPos; // utile dans controles du mouvement curseur
...@@ -114,7 +113,6 @@ public: ...@@ -114,7 +113,6 @@ public:
void AddMenuZoom( wxMenu* MasterMenu ); void AddMenuZoom( wxMenu* MasterMenu );
bool OnRightClick( wxMouseEvent& event ); bool OnRightClick( wxMouseEvent& event );
void Process_Popup_Zoom( wxCommandEvent& event );
void OnPopupGridSelect( wxCommandEvent& event ); void OnPopupGridSelect( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
wxPoint CursorRealPosition( const wxPoint& ScreenPos ); wxPoint CursorRealPosition( const wxPoint& ScreenPos );
......
...@@ -223,8 +223,6 @@ enum main_id { ...@@ -223,8 +223,6 @@ enum main_id {
ID_POPUP_ZOOM_OUT, ID_POPUP_ZOOM_OUT,
ID_POPUP_ZOOM_SELECT, ID_POPUP_ZOOM_SELECT,
ID_POPUP_ZOOM_CENTER, ID_POPUP_ZOOM_CENTER,
ID_POPUP_ZOOM_AUTO,
ID_POPUP_ZOOM_REDRAW,
ID_POPUP_ZOOM_LEVEL_1, ID_POPUP_ZOOM_LEVEL_1,
ID_POPUP_ZOOM_LEVEL_2, ID_POPUP_ZOOM_LEVEL_2,
ID_POPUP_ZOOM_LEVEL_4, ID_POPUP_ZOOM_LEVEL_4,
...@@ -370,21 +368,10 @@ enum main_id { ...@@ -370,21 +368,10 @@ enum main_id {
ID_TO_LIBRARY, ID_TO_LIBRARY,
ID_TO_LIBVIEW, ID_TO_LIBVIEW,
ID_ZOOM_IN_BUTT, // Gestion zoom: id consecutifs ID_ZOOM_IN, // Gestion zoom: id consecutifs
ID_ZOOM_OUT_BUTT, ID_ZOOM_OUT,
ID_ZOOM_REDRAW_BUTT, ID_ZOOM_REDRAW,
ID_ZOOM_PAGE_BUTT, ID_ZOOM_PAGE,
ID_ZOOM_WINDOW_BUTT,
ID_ZOOM_IN_KEY,
ID_ZOOM_OUT_KEY,
ID_ZOOM_REDRAW_KEY,
ID_ZOOM_CENTER_KEY,
ID_ZOOM_AUTO,
ID_ZOOM_UNUSED0,
ID_ZOOM_UNUSED1,
ID_ZOOM_UNUSED2,
ID_ZOOM_UNUSED3,
ID_ZOOM_ENDLIST,
/* Panning command event IDs. */ /* Panning command event IDs. */
ID_PAN_UP, ID_PAN_UP,
......
...@@ -174,8 +174,6 @@ public: ...@@ -174,8 +174,6 @@ public:
class WinEDA_DrawFrame : public WinEDA_BasicFrame class WinEDA_DrawFrame : public WinEDA_BasicFrame
{ {
public: public:
WinEDA_DrawPanel* DrawPanel; // Draw area WinEDA_DrawPanel* DrawPanel; // Draw area
WinEDA_MsgPanel* MsgPanel; // Zone d'affichage de caracteristiques WinEDA_MsgPanel* MsgPanel; // Zone d'affichage de caracteristiques
...@@ -260,7 +258,7 @@ public: ...@@ -260,7 +258,7 @@ public:
// void OnChar(wxKeyEvent& event); // void OnChar(wxKeyEvent& event);
void SetToolbarBgColor( int color_num ); void SetToolbarBgColor( int color_num );
void OnZoom( int zoom_type ); virtual void OnZoom( wxCommandEvent& event );
void OnGrid( int grid_type ); void OnGrid( int grid_type );
void Recadre_Trace( bool ToMouse ); void Recadre_Trace( bool ToMouse );
void PutOnGrid( wxPoint* coord ); /* set the coordiante "coord" to the nearest grid coordinate */ void PutOnGrid( wxPoint* coord ); /* set the coordiante "coord" to the nearest grid coordinate */
...@@ -314,13 +312,9 @@ public: ...@@ -314,13 +312,9 @@ public:
/* interprocess communication */ /* interprocess communication */
void OnSockRequest( wxSocketEvent& evt ); void OnSockRequest( wxSocketEvent& evt );
void OnSockRequestServer( wxSocketEvent& evt ); void OnSockRequestServer( wxSocketEvent& evt );
};
#define COMMON_EVENTS_DRAWFRAME \
EVT_MOUSEWHEEL( WinEDA_DrawFrame::OnMouseEvent ) \
EVT_MENU_OPEN( WinEDA_DrawFrame::OnMenuOpen ) \
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
DECLARE_EVENT_TABLE();
};
/****************************************************/ /****************************************************/
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
/*******************************/ /*******************************/
BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame ) BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame )
COMMON_EVENTS_DRAWFRAME
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END, ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection ) WinEDA_BasePcbFrame::ProcessItemSelection )
......
...@@ -891,7 +891,7 @@ EDA_Rect MODULE::GetBoundingBox() ...@@ -891,7 +891,7 @@ EDA_Rect MODULE::GetBoundingBox()
/*******************************************************/ /*******************************************************/
void MODULE::Display_Infos( WinEDA_DrawFrame* frame ) void MODULE::Display_Infos( WinEDA_BasePcbFrame* frame )
/*******************************************************/ /*******************************************************/
{ {
int nbpad; int nbpad;
......
...@@ -195,7 +195,7 @@ public: ...@@ -195,7 +195,7 @@ public:
* about this object into the frame's message panel. * about this object into the frame's message panel.
* @param frame A WinEDA_DrawFrame in which to print status information. * @param frame A WinEDA_DrawFrame in which to print status information.
*/ */
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_BasePcbFrame* frame );
/** /**
......
...@@ -530,21 +530,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -530,21 +530,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed ) switch( g_KeyPressed )
{ {
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
oldpos = curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
oldpos = curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
oldpos = curpos = GetScreen()->m_Curseur;
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;
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "id.h" #include "id.h"
...@@ -172,6 +170,9 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -172,6 +170,9 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
*/ */
{ {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool PopupOn = (GetCurItem() && GetCurItem()->m_Flags); bool PopupOn = (GetCurItem() && GetCurItem()->m_Flags);
bool ItemFree = (GetCurItem()==0 || GetCurItem()->m_Flags==0); bool ItemFree = (GetCurItem()==0 || GetCurItem()->m_Flags==0);
...@@ -269,19 +270,23 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -269,19 +270,23 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY ); cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_OUT: case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY ); cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_REDRAW: case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY ); cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_CENTER: case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY ); cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break; break;
...@@ -534,6 +539,9 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -534,6 +539,9 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
if( hotkey == 0 ) if( hotkey == 0 )
return; return;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */ /* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') ) if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a'; hotkey += 'A' - 'a';
...@@ -564,19 +572,23 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -564,19 +572,23 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY ); cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_OUT: case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY ); cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_REDRAW: case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY ); cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_ZOOM_CENTER: case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY ); cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break; break;
} }
} }
......
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
/********************************/ /********************************/
/* class WinEDA_ModuleEditFrame */ /* class WinEDA_ModuleEditFrame */
/********************************/ /********************************/
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
COMMON_EVENTS_DRAWFRAME
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END, ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection ) WinEDA_BasePcbFrame::ProcessItemSelection )
...@@ -29,8 +28,7 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, wxFrame ) ...@@ -29,8 +28,7 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, wxFrame )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom ) EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid ) EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ModuleEditFrame::OnZoom )
WinEDA_ModuleEditFrame::Process_Zoom )
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB, EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
/*******************************/ /*******************************/
BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
COMMON_EVENTS_DRAWFRAME
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer ) EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest ) EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest )
...@@ -29,8 +28,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) ...@@ -29,8 +28,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_PcbFrame::OnSize ) EVT_SIZE( WinEDA_PcbFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_PcbFrame::OnZoom )
WinEDA_PcbFrame::Process_Zoom )
EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io )
......
...@@ -104,20 +104,20 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar() ...@@ -104,20 +104,20 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom in" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_IN ); HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ), msg ); wxBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom out" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_OUT ); HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ), msg ); wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Redraw view" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_REDRAW ); HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg ); wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ), wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) ); _( "Zoom auto" ) );
......
...@@ -260,20 +260,20 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -260,20 +260,20 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom in" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_IN ); HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, wxBitmap( zoom_in_xpm ), m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
msg ); msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom out" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_OUT ); HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ), msg ); wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Redraw view" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_REDRAW ); HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg ); wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ), wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) ); _( "Zoom auto" ) );
...@@ -286,9 +286,9 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -286,9 +286,9 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ), m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
_( "Read netlist" ) ); _( "Read netlist" ) );
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ), m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ),
_( "Pcb Design Rules Check" ) ); _( "Pcb Design Rules Check" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
...@@ -370,14 +370,14 @@ void WinEDA_PcbFrame::ReCreateOptToolbar() ...@@ -370,14 +370,14 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString,
wxBitmap( show_zone_xpm ), wxNullBitmap, wxBitmap( show_zone_xpm ), wxNullBitmap,
_( "Show filled areas in zones" ) ); _( "Show filled areas in zones" ) );
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString,
wxBitmap( show_zone_disable_xpm ), wxNullBitmap, wxBitmap( show_zone_disable_xpm ), wxNullBitmap,
_( "Do not show filled areas in zones" )); _( "Do not show filled areas in zones" ));
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString,
wxBitmap( show_zone_outline_only_xpm ), wxNullBitmap, wxBitmap( show_zone_outline_only_xpm ), wxNullBitmap,
_( "Show outlines of filled areas only in zones" ) ); _( "Show outlines of filled areas only in zones" ) );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
...@@ -573,8 +573,8 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() ...@@ -573,8 +573,8 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
// Set up toolbar // Set up toolbar
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 20, -1 ) ); wxSize( LISTBOX_WIDTH + 20, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox ); m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_SelTrackWidthBox_Changed = TRUE; m_SelTrackWidthBox_Changed = TRUE;
......
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