Commit 21faf9d3 authored by stambaughw's avatar stambaughw

Integrate wxFileHistory, add missing header files to fix Linux build, initial...

Integrate wxFileHistory, add missing header files to fix Linux build, initial search path work, and general housekeeping.
parent 5c4c584b
...@@ -5,6 +5,23 @@ Started 2007-June-11 ...@@ -5,6 +5,23 @@ 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-11 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++All
* Replace Kicad file history implementation with wxFileHistory.
* Laid groundwork for search paths using wxPathList in EDA_Appl.
* Made ReCreateMenuBar actually recreate the menu bar. Now language updates
to menus can be changed without restarting program.
* Lots of general housekeeping, simplification, and code beautifying.
++EESchema
* Fix zoom and pan bug in library viewer panel due to incorrect DrawPanel
rectangle.
* Add zoom accelerator keys to library viewer (works in GTK, not Windows).
* Add Postscript header to new print dialog so Linux build works.
++PcbNew
* Add Postscript header to new print dialog so Linux build works.
2009-Jan-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2009-Jan-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
++All: ++All:
......
...@@ -32,7 +32,6 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype, ...@@ -32,7 +32,6 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype,
m_Ident = idtype; m_Ident = idtype;
SetFont( *g_StdFont ); SetFont( *g_StdFont );
m_MenuBar = NULL; // menu du haut d'ecran
m_HToolBar = NULL; m_HToolBar = NULL;
m_FrameIsActive = TRUE; m_FrameIsActive = TRUE;
m_MsgFrameHeight = MSG_PANEL_DEFAULT_HEIGHT; m_MsgFrameHeight = MSG_PANEL_DEFAULT_HEIGHT;
...@@ -169,48 +168,40 @@ void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName ) ...@@ -169,48 +168,40 @@ void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
/* Met a jour la liste des anciens projets /* Met a jour la liste des anciens projets
*/ */
{ {
unsigned ii; wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
ReCreateMenuBar();
}
if( FullFileName.IsEmpty() )
return;
//suppression d'une ancienne trace eventuelle du meme fichier /**
for( ii = 0; ii < wxGetApp().m_LastProject.GetCount(); ) * Fetch the file name from the file history list.
*/
wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
const wxString& type )
{
wxString fn, msg;
size_t i;
int baseId = wxGetApp().m_fileHistory.GetBaseId();
wxASSERT( cmdId >= baseId
&& cmdId < baseId + ( int )wxGetApp().m_fileHistory.GetCount() );
i = ( size_t )( cmdId - baseId );
if( i < wxGetApp().m_fileHistory.GetCount() )
{ {
if( wxGetApp().m_LastProject[ii].IsEmpty() ) fn = wxGetApp().m_fileHistory.GetHistoryFile( i );
break; if( !wxFileName::FileExists( fn ) )
#ifdef __WINDOWS__
if( wxGetApp().m_LastProject[ii].CmpNoCase( FullFileName ) == 0 )
#else
if( wxGetApp().m_LastProject[ii] == FullFileName )
#endif
{ {
wxGetApp().m_LastProject.RemoveAt( ii ); msg = type + _( " file <" ) + fn + _( "> was not found." );
DisplayError( this, msg );
wxGetApp().m_fileHistory.RemoveFileFromHistory( i );
fn = wxEmptyString;
ReCreateMenuBar();
} }
else
ii++;
} }
while( wxGetApp().m_LastProject.GetCount() >= wxGetApp().m_LastProjectMaxCount ) return fn;
{
wxGetApp().m_LastProject.RemoveAt( wxGetApp().m_LastProject.GetCount() - 1 );
}
wxGetApp().m_LastProject.Insert( FullFileName, 0 );
ReCreateMenuBar();
}
/**************************************************/
wxString WinEDA_BasicFrame::GetLastProject( int rang )
/**************************************************/
{
if( rang < 0 )
rang = 0;
if( (unsigned) rang >= wxGetApp().m_LastProject.GetCount() )
return wxEmptyString;
return wxGetApp().m_LastProject[rang];
} }
......
...@@ -47,7 +47,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -47,7 +47,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
DrawPanel = NULL; DrawPanel = NULL;
MsgPanel = NULL; MsgPanel = NULL;
m_CurrentScreen = NULL; m_CurrentScreen = NULL;
m_MenuBar = NULL; // main meun frame
m_ID_current_state = 0; m_ID_current_state = 0;
m_HTOOL_current_state = 0; m_HTOOL_current_state = 0;
m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines
...@@ -60,10 +59,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -60,10 +59,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
// Internal units per inch // Internal units per inch
// = 1000 for schema, = 10000 for PCB // = 1000 for schema, = 10000 for PCB
m_InternalUnits = EESCHEMA_INTERNAL_UNIT; m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
if( ( m_Ident == PCB_FRAME ) || ( m_Ident == GERBER_FRAME )
|| ( m_Ident == CVPCB_DISPLAY_FRAME )
|| ( m_Ident == MODULE_EDITOR_FRAME ) )
m_InternalUnits = PCB_INTERNAL_UNIT;
minsize.x = 470; minsize.x = 470;
minsize.y = 350 + m_MsgFrameHeight; minsize.y = 350 + m_MsgFrameHeight;
...@@ -91,17 +86,12 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -91,17 +86,12 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_FramePos.x = m_FramePos.y = 0; m_FramePos.x = m_FramePos.y = 0;
m_FrameSize.y -= m_MsgFrameHeight; m_FrameSize.y -= m_MsgFrameHeight;
if( m_Ident != DISPLAY3D_FRAME ) DrawPanel = new WinEDA_DrawPanel( this, -1, wxPoint( 0, 0 ), m_FrameSize );
{ MsgPanel = new WinEDA_MsgPanel( this, -1, wxPoint( 0, m_FrameSize.y ),
DrawPanel = new WinEDA_DrawPanel( this, -1, wxPoint( 0, 0 ), wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
m_FrameSize ); MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
MsgPanel = new WinEDA_MsgPanel( this, -1, wxPoint( 0, m_FrameSize.y ), ColorRefs[LIGHTGRAY].m_Green,
wxSize( m_FrameSize.x, ColorRefs[LIGHTGRAY].m_Blue ) );
m_MsgFrameHeight ) );
MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
ColorRefs[LIGHTGRAY].m_Green,
ColorRefs[LIGHTGRAY].m_Blue ) );
}
} }
...@@ -588,22 +578,16 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -588,22 +578,16 @@ void WinEDA_DrawFrame::AdjustScrollBars()
int zoom = screen->GetZoom(); int zoom = screen->GetZoom();
int xUnit, yUnit; int xUnit, yUnit;
if( screen == NULL ) if( screen == NULL || DrawPanel == NULL )
return;
if( DrawPanel == NULL )
return; return;
draw_size = screen->ReturnPageSize();
// La zone d'affichage est reglee a une taille double de la feuille de travail: // La zone d'affichage est reglee a une taille double de la feuille de travail:
draw_size.x *= 2; draw_size.y *= 2; draw_size = screen->ReturnPageSize() * 2;
// On utilise le centre de l'ecran comme position de reference, donc // On utilise le centre de l'ecran comme position de reference, donc
// la surface de trace doit etre augmentee // la surface de trace doit etre augmentee
panel_size = DrawPanel->GetClientSize(); panel_size = DrawPanel->GetClientSize() * zoom;
panel_size.x *= zoom; panel_size.y *= zoom; draw_size += panel_size / 2;
draw_size.x += panel_size.x / 2;
draw_size.y += panel_size.y / 2;
if( screen->m_Center ) if( screen->m_Center )
...@@ -622,8 +606,7 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -622,8 +606,7 @@ void WinEDA_DrawFrame::AdjustScrollBars()
screen->m_DrawOrg.y -= screen->m_DrawOrg.y % 256; screen->m_DrawOrg.y -= screen->m_DrawOrg.y % 256;
// Calcul du nombre de scrolls (en unites de scrool ) // Calcul du nombre de scrolls (en unites de scrool )
scrollbar_number.x = draw_size.x / (DrawPanel->m_Scroll_unit * zoom); scrollbar_number = draw_size / (DrawPanel->m_Scroll_unit * zoom);
scrollbar_number.y = draw_size.y / (DrawPanel->m_Scroll_unit * zoom);
xUnit = yUnit = DrawPanel->m_Scroll_unit; xUnit = yUnit = DrawPanel->m_Scroll_unit;
...@@ -631,13 +614,12 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -631,13 +614,12 @@ void WinEDA_DrawFrame::AdjustScrollBars()
xUnit = 1; xUnit = 1;
if( yUnit <= 1 ) if( yUnit <= 1 )
yUnit = 1; yUnit = 1;
xUnit *= zoom; yUnit *= zoom; xUnit *= zoom;
yUnit *= zoom;
// Calcul de la position, curseur place au centre d'ecran // Calcul de la position, curseur place au centre d'ecran
scrollbar_pos = screen->m_Curseur; scrollbar_pos = screen->m_Curseur;
scrollbar_pos -= screen->m_DrawOrg;
scrollbar_pos.x -= screen->m_DrawOrg.x;
scrollbar_pos.y -= screen->m_DrawOrg.y;
scrollbar_pos.x -= panel_size.x / 2; scrollbar_pos.x -= panel_size.x / 2;
scrollbar_pos.y -= panel_size.y / 2; scrollbar_pos.y -= panel_size.y / 2;
...@@ -698,7 +680,12 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event ) ...@@ -698,7 +680,12 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
int id = event.GetId(); int id = event.GetId();
wxGetApp().SetLanguageIdentifier( id ); wxGetApp().SetLanguageIdentifier( id );
wxGetApp().SetLanguage(); if ( wxGetApp().SetLanguage() )
{
wxLogDebug( wxT( "Recreating menu bar due to language change." ) );
ReCreateMenuBar();
Refresh();
}
} }
......
...@@ -97,12 +97,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color ) ...@@ -97,12 +97,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
* Draw the schematic cursor which is usually on grid * Draw the schematic cursor which is usually on grid
*/ */
{ {
if( m_CursorLevel != 0 ) if( m_CursorLevel != 0 || DC == NULL )
{
return;
}
if( DC == NULL )
return; return;
wxPoint Cursor = GetScreen()->m_Curseur; wxPoint Cursor = GetScreen()->m_Curseur;
...@@ -201,36 +196,6 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC ) ...@@ -201,36 +196,6 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC )
} }
/*********************************************************************/
wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos )
/*********************************************************************/
/** Function CalcAbsolutePosition
* @return absolute position in pixels, considering the scroll amount
* @param rel_pos = relative position (screen position) in pixel
* ( relative position = position in the panel draw area on screen )
*/
{
wxPoint pos;
#ifdef WX_ZOOM
CalcUnscrolledPosition( rel_pos.x, rel_pos.y, &pos.x, &pos.y );
#else
int ii, jj;
GetViewStart( &pos.x, &pos.y ); // pos is the origin in scroll units
GetScrollPixelsPerUnit( &ii, &jj );
pos.x *= ii;
pos.y *= jj; // pos is the origin in pixel units
pos.x += rel_pos.x;
pos.y += rel_pos.y;
#endif
return pos;
}
/**********************************************************************/ /**********************************************************************/
wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
/**********************************************************************/ /**********************************************************************/
...@@ -240,9 +205,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) ...@@ -240,9 +205,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
* @param ScreenPos = absolute position in pixels * @param ScreenPos = absolute position in pixels
*/ */
{ {
wxPoint curpos = GetScreen()->CursorRealPosition( ScreenPos ); return GetScreen()->CursorRealPosition( ScreenPos );
return curpos;
} }
...@@ -268,13 +231,12 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) ...@@ -268,13 +231,12 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
display_rect.Inflate( -PIXEL_MARGIN, -PIXEL_MARGIN ); display_rect.Inflate( -PIXEL_MARGIN, -PIXEL_MARGIN );
// Conversion en coord physiques // Conversion en coord physiques
pos = CalcAbsolutePosition( display_rect.GetPosition() ); pos = CalcUnscrolledPosition( display_rect.GetPosition() );
pos.x *= GetZoom(); pos.x *= GetZoom();
pos.y *= GetZoom(); pos.y *= GetZoom();
pos.x += GetScreen()->m_DrawOrg.x; pos += GetScreen()->m_DrawOrg;
pos.y += GetScreen()->m_DrawOrg.y;
display_rect.SetX( pos.x ); display_rect.SetX( pos.x );
display_rect.SetY( pos.y ); display_rect.SetY( pos.y );
...@@ -385,18 +347,13 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void ) ...@@ -385,18 +347,13 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )
wxSize size; wxSize size;
wxPoint realpos; wxPoint realpos;
size = GetClientSize(); size = GetClientSize() / 2;
realpos = CalcUnscrolledPosition( wxPoint( size.x, size.y ) );
size.x /= 2;
size.y /= 2;
realpos = CalcAbsolutePosition( wxPoint( size.x, size.y ) );
realpos.x *= GetZoom(); realpos.x *= GetZoom();
realpos.y *= GetZoom(); realpos.y *= GetZoom();
realpos.x += GetScreen()->m_DrawOrg.x; realpos += GetScreen()->m_DrawOrg;
realpos.y += GetScreen()->m_DrawOrg.y;
return realpos; return realpos;
} }
...@@ -428,11 +385,9 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse ) ...@@ -428,11 +385,9 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
#ifdef WX_ZOOM #ifdef WX_ZOOM
CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y ); CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y );
#else #else
mouse = Mouse; mouse = Mouse - GetScreen()->m_StartVisu;
mouse.x -= GetScreen()->m_StartVisu.x;
mouse.y -= GetScreen()->m_StartVisu.y;
#endif #endif
GRMouseWarp( this, mouse ); WarpPointer( mouse.x, mouse.y );
} }
...@@ -541,13 +496,11 @@ void WinEDA_DrawPanel::SetBoundaryBox() ...@@ -541,13 +496,11 @@ void WinEDA_DrawPanel::SetBoundaryBox()
m_ClipBox.SetSize( GetClientSize() ); m_ClipBox.SetSize( GetClientSize() );
#ifdef WX_ZOOM #ifdef WX_ZOOM
m_ClipBox.m_Pos.x *= GetZoom(); m_ClipBox.m_Pos.x *= GetZoom();
m_ClipBox.m_Pos.y *= GetZoom(); m_ClipBox.m_Pos.y *= GetZoom();
m_ClipBox.m_Size.x *= GetZoom(); m_ClipBox.m_Size *= GetZoom();
m_ClipBox.m_Size.y *= GetZoom();
#else #else
m_ClipBox.m_Pos.x -= GetScreen()->m_StartVisu.x; m_ClipBox.m_Pos -= GetScreen()->m_StartVisu;
m_ClipBox.m_Pos.y -= GetScreen()->m_StartVisu.y;
#endif #endif
m_ScrollButt_unit = MIN( Screen->m_SizeVisu.x, Screen->m_SizeVisu.y ) / 4; m_ScrollButt_unit = MIN( Screen->m_SizeVisu.x, Screen->m_SizeVisu.y ) / 4;
...@@ -767,13 +720,9 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -767,13 +720,9 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
org.x *= zoom; org.x *= zoom;
org.y *= zoom; org.y *= zoom;
org.x += screen->m_DrawOrg.x; org += screen->m_DrawOrg;
org.y += screen->m_DrawOrg.y;
size = GetClientSize();
size.x *= zoom; size = GetClientSize() * zoom;
size.y *= zoom;
pasx = screen->m_Grid.x * m_Parent->m_InternalUnits; pasx = screen->m_Grid.x * m_Parent->m_InternalUnits;
pasy = screen->m_Grid.y * m_Parent->m_InternalUnits; pasy = screen->m_Grid.y * m_Parent->m_InternalUnits;
...@@ -868,8 +817,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event ) ...@@ -868,8 +817,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
wxPoint pos; wxPoint pos;
wxMenu MasterMenu; wxMenu MasterMenu;
pos.x = event.GetX(); pos = event.GetPosition();
pos.y = event.GetY();
if( !m_Parent->OnRightClick( pos, &MasterMenu ) ) if( !m_Parent->OnRightClick( pos, &MasterMenu ) )
return false; return false;
...@@ -921,13 +869,20 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event ) ...@@ -921,13 +869,20 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
{ {
wxRect rect = GetRect(); wxRect rect = GetRect();
wxLogDebug( wxT( "OnMouseWheel() cursor position: (%d, %d)." ), /* This fixes a bad rectangle horizontal position returned by the
event.m_x, event.m_y ); * schematic library veiwer panel. It may have something to do with
* the sash window. */
rect.Offset( -rect.x, -rect.y );
/* Ignore scroll events if the cursor is outside the drawing area. */ /* Ignore scroll events if the cursor is outside the drawing area. */
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled() if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !rect.Contains( event.GetPosition() ) ) || !rect.Contains( event.GetPosition() ) )
{ {
wxLogDebug( wxT( "OnMouseWheel() position(%d, %d) " \
"rectangle(%d, %d, %d, %d)" ),
event.GetPosition().x, event.GetPosition().y,
rect.x, rect.y, rect.width, rect.height );
event.Skip(); event.Skip();
return; return;
} }
...@@ -1029,7 +984,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1029,7 +984,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
localrealbutt |= localbutt; /* compensation defaut wxGTK */ localrealbutt |= localbutt; /* compensation defaut wxGTK */
/* Compute absolute m_MousePosition in pixel units: */ /* Compute absolute m_MousePosition in pixel units: */
screen->m_MousePositionInPixels = CalcAbsolutePosition( wxPoint( event.GetX(), event.GetY() ) ); screen->m_MousePositionInPixels = CalcUnscrolledPosition( event.GetPosition() );
/* Compute absolute m_MousePosition in user units: */ /* Compute absolute m_MousePosition in user units: */
screen->m_MousePosition = CursorRealPosition( screen->m_MousePositionInPixels ); screen->m_MousePosition = CursorRealPosition( screen->m_MousePositionInPixels );
...@@ -1126,7 +1081,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1126,7 +1081,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) ) if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
{ {
if( (screen->BlockLocate.m_Command == BLOCK_IDLE) if( (screen->BlockLocate.m_Command == BLOCK_IDLE)
|| (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) || (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
{ {
screen->BlockLocate.SetOrigin( m_CursorStartPos ); screen->BlockLocate.SetOrigin( m_CursorStartPos );
} }
...@@ -1140,9 +1095,9 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1140,9 +1095,9 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
} }
} }
else if( (m_CanStartBlock >= 0 ) else if( (m_CanStartBlock >= 0 )
&& ( event.LeftIsDown() || event.MiddleIsDown() ) && ( event.LeftIsDown() || event.MiddleIsDown() )
&& ManageCurseur == NULL && ManageCurseur == NULL
&& ForceCloseManageCurseur == NULL ) && ForceCloseManageCurseur == NULL )
{ // Mouse is dragging: if no block in progress: start a block command { // Mouse is dragging: if no block in progress: start a block command
if( screen->BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->BlockLocate.m_State == STATE_NO_BLOCK )
{ // Start a block command { // Start a block command
...@@ -1245,8 +1200,9 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1245,8 +1200,9 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
/****************************************************/ /****************************************************/
{ {
long key, localkey; long key, localkey;
bool escape = FALSE; bool escape = FALSE;
wxPoint pos;
key = localkey = event.GetKeyCode(); key = localkey = event.GetKeyCode();
...@@ -1295,27 +1251,17 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) ...@@ -1295,27 +1251,17 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
} }
} }
/* some key commands use the mouse position: refresh it */ /* Some key commands use the current mouse position: refresh it */
#if wxCHECK_VERSION( 2, 8, 0 ) pos = CalcUnscrolledPosition( wxGetMousePosition() - GetScreenPosition() );
wxPoint mouse_pos = wxGetMousePosition(); // Get the mouse position on screen
wxPoint win_pos = GetScreenPosition(); // get the draw area (panel)position on screen
mouse_pos -= win_pos; // mouse_pos = is the mouse position relative to the panel
/* Compute absolute m_MousePosition in pixel units (i.e. considering the current scrool) : */
Screen->m_MousePositionInPixels = CalcAbsolutePosition( mouse_pos );
/* Compute absolute m_MousePosition in user units: */
Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels );
#else /* Compute absolute mouse position in pixel units (i.e. considering the
current scrool) : */
Screen->m_MousePositionInPixels = pos;
/* if wxGetMousePosition() does not exist, /* Compute absolute mouse position in user units: */
* m_Cursor should be ok, use it to calculate the cursor position on screen Screen->m_MousePosition = CursorRealPosition( pos );
*/
Screen->m_MousePositionInPixels = CursorScreenPosition();
#endif
m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels ); m_Parent->GeneralControle( &DC, pos );
#if 0 #if 0
event.Skip(); // Allow menu shortcut processing event.Skip(); // Allow menu shortcut processing
......
...@@ -16,7 +16,10 @@ ...@@ -16,7 +16,10 @@
#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/dir.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/stdpaths.h>
#include <wx/apptrait.h>
#include "common.h" #include "common.h"
#include "worksheet.h" #include "worksheet.h"
...@@ -212,13 +215,11 @@ static struct LANGUAGE_DESCR s_Language_List[] = ...@@ -212,13 +215,11 @@ static struct LANGUAGE_DESCR s_Language_List[] =
WinEDA_App::WinEDA_App() WinEDA_App::WinEDA_App()
{ {
m_Checker = NULL; m_Checker = NULL;
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_Locale = NULL; m_Locale = NULL;
m_PdfBrowserIsDefault = TRUE; m_PdfBrowserIsDefault = TRUE;
} }
...@@ -281,7 +282,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) ...@@ -281,7 +282,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
/* Init parameters for configuration */ /* Init parameters for configuration */
SetVendorName( wxT( "kicad" ) ); SetVendorName( wxT( "kicad" ) );
SetAppName( name ); SetAppName( name.Lower() );
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" ) );
...@@ -314,6 +315,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) ...@@ -314,6 +315,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
// Analyse the command line & init binary path // Analyse the command line & init binary path
SetBinDir(); SetBinDir();
SetDefaultSearchPaths();
ReadPdfBrowserInfos(); ReadPdfBrowserInfos();
// Internationalisation: loading the kicad suitable Dictionnary // Internationalisation: loading the kicad suitable Dictionnary
...@@ -438,9 +440,57 @@ bool WinEDA_App::SetBinDir() ...@@ -438,9 +440,57 @@ bool WinEDA_App::SetBinDir()
while( m_BinDir.Last() != '/' ) while( m_BinDir.Last() != '/' )
m_BinDir.RemoveLast(); m_BinDir.RemoveLast();
wxLogDebug( wxT( "Executable path the Kicad way: " ) + m_BinDir );
wxLogDebug( wxT( "Executable path the wxWidgets way: " ) +
GetTraits()->GetStandardPaths().GetExecutablePath() );
return TRUE; return TRUE;
} }
/**
* Set search paths for libraries, modules, internationalization files, etc.
*/
void WinEDA_App::SetDefaultSearchPaths( void )
{
size_t i;
wxString path;
wxFileName fn( m_BinDir, wxEmptyString );
/* User environment variable path. */
if( ::wxGetEnv( wxT( "KICAD_SEARCH_PATH" ), NULL ) )
m_searchPaths.AddEnvList( wxT( "KICAD_SEARCH_PATH" ) );
/* Hard coded path defined by the application. */
m_searchPaths.Add( ReturnKicadDatasPath() );
/* Standard application data path if it is different from the binary
* path. */
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
/* Up on level relative to binary path with "share" appended. */
fn.RemoveLastDir();
fn.AppendDir( wxT( "share" ) );
#ifndef __WXMSW__
fn.AppendDir( wxT( "kicad" ) );
#endif
m_searchPaths.Add( fn.GetPath() );
/* Remove all non-existant paths from the list. */
for( i = 0; i < m_searchPaths.GetCount(); i++ )
{
wxLogDebug( wxT( "Checking if search path <" ) +
m_searchPaths[i] + wxT( "> exists." ) );
if( !wxFileName::IsDirReadable( m_searchPaths[i] ) )
{
wxLogDebug( wxT( "Removing non-existant path <" ) +
m_searchPaths[i] + wxT( "> from search path list." ) );
m_searchPaths.RemoveAt( i );
i -= 1;
}
}
}
/** /**
* Get application settings * Get application settings
...@@ -450,7 +500,7 @@ bool WinEDA_App::SetBinDir() ...@@ -450,7 +500,7 @@ bool WinEDA_App::SetBinDir()
void WinEDA_App::GetSettings() void WinEDA_App::GetSettings()
/*********************************/ /*********************************/
{ {
wxString Line, Ident; wxString Line, entry;
unsigned ii; unsigned ii;
m_HelpSize.x = 500; m_HelpSize.x = 500;
...@@ -468,16 +518,27 @@ void WinEDA_App::GetSettings() ...@@ -468,16 +518,27 @@ void WinEDA_App::GetSettings()
if( !m_EDA_Config ) if( !m_EDA_Config )
return; return;
/* Last 10 project settings */ m_fileHistory.Load( *m_EDA_Config );
for( ii = 0; ii < 10; ii++ )
{
Ident = wxT( "LastProject" );
if( ii )
Ident << ii;
if( m_EDA_Config->Read( Ident, &Line ) ) /* Load the last file history settings from legacy version if this is the
m_LastProject.Add( Line ); * first time wxFileHistory was used to manage the file history. */
if( m_fileHistory.GetCount() == ( size_t )0 )
{
for( ii = 0; ii < ( unsigned )m_fileHistory.GetMaxFiles(); ii++ )
{
entry = wxT( "LastProject" );
if( ii != 0 )
entry << ii;
if( m_EDA_Config->Read( entry, &Line ) )
{
if( Line != wxEmptyString && wxFileName::FileExists( Line ) )
m_fileHistory.AddFileToHistory( Line );
else
m_EDA_Config->Write( entry, wxEmptyString );
Line = wxEmptyString;
}
}
} }
/* Set default font sizes */ /* Set default font sizes */
...@@ -550,8 +611,6 @@ void WinEDA_App::GetSettings() ...@@ -550,8 +611,6 @@ void WinEDA_App::GetSettings()
void WinEDA_App::SaveSettings() void WinEDA_App::SaveSettings()
/**********************************/ /**********************************/
{ {
unsigned int i;
if( m_EDA_Config == NULL ) if( m_EDA_Config == NULL )
return; return;
...@@ -580,18 +639,8 @@ void WinEDA_App::SaveSettings() ...@@ -580,18 +639,8 @@ void WinEDA_App::SaveSettings()
m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() ); m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() );
/* Save last 10 project list */ /* Save the file history list */
for( i = 0; i < 10; i++ ) m_fileHistory.Save( *m_EDA_Config );
{
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 );
}
} }
...@@ -607,52 +656,34 @@ void WinEDA_App::SaveSettings() ...@@ -607,52 +656,34 @@ void WinEDA_App::SaveSettings()
bool WinEDA_App::SetLanguage( bool first_time ) bool WinEDA_App::SetLanguage( bool first_time )
/*********************************************/ /*********************************************/
{ {
size_t i;
wxString path;
bool retv = true;
// 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" ) );
wxString dic_path;
bool retv = true;
if( m_Locale != NULL ) if( m_Locale != NULL )
delete m_Locale; delete m_Locale;
m_Locale = new wxLocale(); m_Locale = new wxLocale();
dic_path = ReturnKicadDatasPath() + BaseDictionaryPath; /* Add defined search paths to locale paths */
if( !m_searchPaths.IsEmpty() )
wxLogDebug( wxT( "Adding prefix <" ) + dic_path +
wxT( "> to language lookup path." ) );
m_Locale->AddCatalogLookupPathPrefix( dic_path );
/*
* 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.
*
* FIXME: This should be changed when configurable data path support is
* added to Kicad.
*/
if( !m_BinDir.IsEmpty() )
{ {
wxFileName fn( m_BinDir, wxEmptyString ); for( i = 0; i < m_searchPaths.GetCount(); i++ )
dic_path = fn.GetPath();
int n = dic_path.Find( wxFileName::GetPathSeparator(), true );
if( n != wxNOT_FOUND )
{ {
dic_path = dic_path( 0, n ); wxFileName fn( m_searchPaths[i], wxEmptyString );
fn.AppendDir( wxT( "internat" ) );
path = fn.GetPath();
wxLogDebug( wxT( "Adding locale lookup path: " ) + path );
m_Locale->AddCatalogLookupPathPrefix( path );
} }
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 ) ) if( !m_Locale->Init( m_LanguageId, wxLOCALE_CONV_ENCODING ) )
{ {
wxLogDebug( wxT( "Failed to initialize " ) + m_Locale->GetName() ); wxLogDebug( wxT( "Failed to initialize " ) +
wxLocale::GetLanguageInfo( m_LanguageId )->Description );
delete m_Locale; delete m_Locale;
m_Locale = new wxLocale(); m_Locale = new wxLocale();
...@@ -661,11 +692,8 @@ bool WinEDA_App::SetLanguage( bool first_time ) ...@@ -661,11 +692,8 @@ bool WinEDA_App::SetLanguage( bool first_time )
retv = false; retv = false;
} }
if( !first_time ) if( !first_time && m_EDA_CommonConfig )
{ m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId );
if( m_EDA_CommonConfig )
m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId );
}
if( !m_Locale->IsLoaded( DictionaryName ) ) if( !m_Locale->IsLoaded( DictionaryName ) )
m_Locale->AddCatalog( DictionaryName ); m_Locale->AddCatalog( DictionaryName );
...@@ -712,51 +740,45 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id ) ...@@ -712,51 +740,45 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id )
wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu ) wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
/*********************************************************/ /*********************************************************/
{ {
wxMenu* menu;
wxMenuItem* item; wxMenuItem* item;
unsigned int ii; unsigned int ii;
if( m_Language_Menu == NULL ) item = MasterMenu->FindItem( ID_LANGUAGE_CHOICE );
if( item == NULL )
{ {
m_Language_Menu = new wxMenu; 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 label = s_Language_List[ii].m_DoNotTranslate ?
s_Language_List[ii].m_Lang_Label : s_Language_List[ii].m_Lang_Label :
wxGetTranslation( wxGetTranslation( s_Language_List[ii].m_Lang_Label );
s_Language_List[ii].m_Lang_Label );
item = new wxMenuItem( m_Language_Menu, item = new wxMenuItem( menu,
s_Language_List[ii].m_KI_Lang_Identifier, s_Language_List[ii].m_KI_Lang_Identifier,
MenuLabel, label, wxEmptyString, wxITEM_CHECK );
wxEmptyString,
wxITEM_CHECK );
SETBITMAPS( s_Language_List[ii].m_Lang_Icon ); SETBITMAPS( s_Language_List[ii].m_Lang_Icon );
m_Language_Menu->Append( item ); menu->Append( item );
} }
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu, menu,
ID_LANGUAGE_CHOICE,
_( "Language" ),
_( "Select application language (only for testing!)" ),
language_xpm );
} }
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{ {
if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier ) if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier )
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, true );
true );
else else
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, false );
false );
}
if( MasterMenu )
{
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu,
m_Language_Menu,
ID_LANGUAGE_CHOICE,
_( "Language" ),
_( "Select application language (only for testing!)" ),
language_xpm );
} }
return m_Language_Menu; return menu;
} }
......
...@@ -337,17 +337,6 @@ bool GetGRForceBlackPenState( void ) ...@@ -337,17 +337,6 @@ bool GetGRForceBlackPenState( void )
return ForceBlackPen; return ForceBlackPen;
} }
/************************************************************/
/* routines de controle et positionnement du curseur souris */
/************************************************************/
/* positionne la souris au point de coord pos */
void GRMouseWarp( WinEDA_DrawPanel* panel, const wxPoint& pos )
{
if( panel == NULL )
return;
panel->WarpPointer( pos.x, pos.y );
}
/**********************************************/ /**********************************************/
/* Routine pour selectionner le mode de trace */ /* Routine pour selectionner le mode de trace */
......
...@@ -50,24 +50,14 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) ...@@ -50,24 +50,14 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
* @param coord = coordinate to adjust * @param coord = coordinate to adjust
*/ */
{ {
double tmp;
wxSize grid_size = GetBaseScreen()->GetGrid(); wxSize grid_size = GetBaseScreen()->GetGrid();
if( !GetBaseScreen()->m_UserGridIsON ) if( !GetBaseScreen()->m_UserGridIsON )
{ {
tmp = (double) coord->x / (double) grid_size.x; coord->x = ( (int) round( (double) coord->x /
coord->x = ( (int) round( tmp ) ) * grid_size.x; (double) grid_size.x ) ) * grid_size.x;
coord->y = ( (int) round( (double) coord->y /
tmp = (double) coord->y / (double) grid_size.y; (double) grid_size.y ) ) * grid_size.y;
coord->y = ( (int) round( tmp ) ) * grid_size.y;
}
else
{
double pasx = (double) ( grid_size.x * m_InternalUnits );
double pasy = (double) ( grid_size.y * m_InternalUnits );
coord->x = (int) round( pasx * ( (double) coord->x / pasx ) );
coord->y = (int) round( pasy * ( (double) coord->y / pasy ) );
} }
} }
......
...@@ -30,7 +30,6 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) : ...@@ -30,7 +30,6 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) :
m_ListCmp = NULL; m_ListCmp = NULL;
m_FootprintList = NULL; m_FootprintList = NULL;
DrawFrame = NULL; DrawFrame = NULL;
m_FilesMenu = NULL;
m_HToolBar = NULL; m_HToolBar = NULL;
// Give an icon // Give an icon
...@@ -121,9 +120,7 @@ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event ) ...@@ -121,9 +120,7 @@ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event )
/* Event table for WinEDA_CvpcbFrame */ /* Event table for WinEDA_CvpcbFrame */
/*************************************/ /*************************************/
BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
EVT_MENU_RANGE( ID_LOAD_PROJECT, EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_CvpcbFrame::LoadNetList )
ID_LOAD_FILE_10,
WinEDA_CvpcbFrame::LoadNetList )
// Menu events // Menu events
EVT_MENU( ID_SAVE_PROJECT, EVT_MENU( ID_SAVE_PROJECT,
...@@ -387,39 +384,28 @@ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event ) ...@@ -387,39 +384,28 @@ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event )
* Lit la netliste * Lit la netliste
*/ */
{ {
int id = event.GetId();
wxString fullfilename;
wxString oldfilename;
bool newfile; bool newfile;
wxString oldfilename;
wxString fn;
fn = GetFileFromHistory( event.GetId(), _( "Gerber" ) );
if( !NetInNameBuffer.IsEmpty() ) if( !NetInNameBuffer.IsEmpty() )
{ {
oldfilename = NetInNameBuffer; oldfilename = NetInNameBuffer;
} }
switch( id ) if( fn != wxEmptyString )
{ {
case ID_LOAD_FILE_1: newfile = ReadInputNetList( fn );
case ID_LOAD_FILE_2:
case ID_LOAD_FILE_3:
case ID_LOAD_FILE_4:
case ID_LOAD_FILE_5:
case ID_LOAD_FILE_6:
case ID_LOAD_FILE_7:
case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10:
id -= ID_LOAD_FILE_1;
fullfilename = GetLastProject( id );
break;
}
newfile = ReadInputNetList( fullfilename ); if( newfile && !oldfilename.IsEmpty() )
if( newfile && !oldfilename.IsEmpty() ) {
{ SetLastProject( NetInNameBuffer );
SetLastProject( NetInNameBuffer ); }
ReCreateMenuBar();
} }
ReCreateMenuBar();
} }
......
...@@ -34,9 +34,6 @@ public: ...@@ -34,9 +34,6 @@ public:
WinEDA_DisplayFrame* DrawFrame; WinEDA_DisplayFrame* DrawFrame;
WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran
private:
wxMenu* m_FilesMenu;
// Constructor and destructor // Constructor and destructor
public: public:
WinEDA_CvpcbFrame( const wxString &title, WinEDA_CvpcbFrame( const wxString &title,
......
...@@ -187,8 +187,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -187,8 +187,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
curpos = DrawPanel->CursorRealPosition( Mouse ); curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
delta.x = GetScreen()->GetGrid().x / zoom; delta = GetScreen()->GetGrid() / zoom;
delta.y = GetScreen()->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
if( delta.y <= 0 ) if( delta.y <= 0 )
...@@ -233,28 +233,28 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -233,28 +233,28 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
case WXK_UP: case WXK_UP:
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y - delta.y, DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y - delta.y,
&Mouse.x, &Mouse.y ); &Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD2: /* cursor moved down */ case WXK_NUMPAD2: /* cursor moved down */
case WXK_DOWN: case WXK_DOWN:
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y + delta.y, DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y + delta.y,
&Mouse.x, &Mouse.y ); &Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD4: /* cursor moved left */ case WXK_NUMPAD4: /* cursor moved left */
case WXK_LEFT: case WXK_LEFT:
DrawPanel->CalcScrolledPosition( Mouse.x - delta.x, Mouse.y, DrawPanel->CalcScrolledPosition( Mouse.x - delta.x, Mouse.y,
&Mouse.x, &Mouse.y ); &Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD6: /* cursor moved right */ case WXK_NUMPAD6: /* cursor moved right */
case WXK_RIGHT: case WXK_RIGHT:
DrawPanel->CalcScrolledPosition( Mouse.x + delta.x, Mouse.y, DrawPanel->CalcScrolledPosition( Mouse.x + delta.x, Mouse.y,
&Mouse.x, &Mouse.y ); &Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
} }
} }
...@@ -269,8 +269,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -269,8 +269,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
RedrawActiveWindow( DC, TRUE ); RedrawActiveWindow( DC, TRUE );
} }
if( ( oldpos.x != GetScreen()->m_Curseur.x ) if( oldpos != GetScreen()->m_Curseur )
|| ( oldpos.y != GetScreen()->m_Curseur.y ) )
{ {
if( flagcurseur != 2 ) if( flagcurseur != 2 )
{ {
......
...@@ -99,100 +99,73 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar() ...@@ -99,100 +99,73 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
/* Creation des menus de la fenetre principale /* Creation des menus de la fenetre principale
*/ */
{ {
int ii; wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar;
/* Destroy the existing menu bar so it can be rebuilt. This allows
if( menuBar == NULL ) * language changes of the menu text on the fly. */
{ if( menuBar )
menuBar = new wxMenuBar(); SetMenuBar( NULL );
// Associate the menu bar with the frame menuBar = new wxMenuBar();
SetMenuBar( menuBar );
wxMenu* filesMenu = new wxMenu;
m_FilesMenu = new wxMenu; item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT,
wxMenuItem* item = new wxMenuItem( m_FilesMenu, ID_LOAD_PROJECT, _( "&Open" ),
_( "&Open" ), _( "Open a NetList file" ) );
_( "Open a NetList file" ) ); item->SetBitmap( open_xpm );
item->SetBitmap( open_xpm ); filesMenu->Append( item );
m_FilesMenu->Append( item );
filesMenu->AppendSeparator();
m_FilesMenu->AppendSeparator(); item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT, _( "&Save As..." ),
_( "&Save As..." ), _( "Save New NetList and Footprints List files" ) );
_( "Save New NetList and Footprints List files" ) ); item->SetBitmap( save_xpm );
item->SetBitmap( save_xpm ); filesMenu->Append( item );
m_FilesMenu->Append( item );
filesMenu->AppendSeparator();
m_FilesMenu->AppendSeparator(); item = new wxMenuItem( filesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
item = new wxMenuItem( m_FilesMenu, ID_CVPCB_QUIT, _( "E&xit" ), _( "Quit Cvpcb" ) );
_( "Quit Cvpcb" ) ); item->SetBitmap( exit_xpm );
item->SetBitmap( exit_xpm ); filesMenu->Append( item );
m_FilesMenu->Append( item );
// Creation des selections des anciens fichiers
// Creation des selections des anciens fichiers wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
m_FilesMenu->AppendSeparator();
for( ii = 0; ii < 10; ii++ ) // Menu Configuration:
{ wxMenu* configmenu = new wxMenu;
if( GetLastProject( ii ).IsEmpty() ) item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
break; _( "Setting Libraries, Directories and others..." ) );
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) ); item->SetBitmap( config_xpm );
} configmenu->Append( item );
// Menu Configuration: // Font selection and setup
wxMenu* configmenu = new wxMenu; AddFontSelectionMenu( configmenu );
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
_( "Setting Libraries, Directories and others..." ) ); wxGetApp().SetLanguageList( configmenu );
item->SetBitmap( config_xpm );
configmenu->Append( item ); configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE,
// Font selection and setup _( "&Save config" ),
AddFontSelectionMenu( configmenu ); _( "Save configuration in current dir" ) );
item->SetBitmap( save_setup_xpm );
wxGetApp().SetLanguageList( configmenu ); configmenu->Append( item );
configmenu->AppendSeparator(); // Menu Help:
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, wxMenu* helpMenu = new wxMenu;
_( "&Save config" ), item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ),
_( "Save configuration in current dir" ) ); _( "Open the cvpcb manual" ) );
item->SetBitmap( save_setup_xpm ); item->SetBitmap( help_xpm );
configmenu->Append( item ); helpMenu->Append( item );
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
// Menu Help: _( "&About cvpcb" ),
wxMenu* helpMenu = new wxMenu; _( "About cvpcb schematic to pcb converter" ) );
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ), item->SetBitmap( info_xpm );
_( "Open the cvpcb manual" ) ); helpMenu->Append( item );
item->SetBitmap( help_xpm );
helpMenu->Append( item ); menuBar->Append( filesMenu, _( "&File" ) );
item = menuBar->Append( configmenu, _( "&Preferences" ) );
new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE, menuBar->Append( helpMenu, _( "&Help" ) );
_( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) ); // Associate the menu bar with the frame
item->SetBitmap( info_xpm ); SetMenuBar( menuBar );
helpMenu->Append( item );
menuBar->Append( m_FilesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
}
else // simple mise a jour de la liste des fichiers anciens
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
}
} }
...@@ -737,7 +737,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) ...@@ -737,7 +737,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
g_ItemToRepeat->m_Flags = 0; g_ItemToRepeat->m_Flags = 0;
// GetScreen()->Curseur = new_pos; // GetScreen()->Curseur = new_pos;
// GRMouseWarp(DrawPanel, DrawPanel->CursorScreenPosition() ); // DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
} }
} }
......
...@@ -231,8 +231,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi ...@@ -231,8 +231,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom; delta = screen->GetGrid() / zoom;
delta.y = screen->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -300,8 +299,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi ...@@ -300,8 +299,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
if( hotkey ) if( hotkey )
{ {
if( screen->GetCurItem() if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
&& screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() ); OnHotKey( DC, hotkey, screen->GetCurItem() );
else else
OnHotKey( DC, hotkey, NULL ); OnHotKey( DC, hotkey, NULL );
...@@ -327,8 +325,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -327,8 +325,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom; delta = screen->GetGrid() / zoom;
delta.y = screen->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -396,8 +393,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -396,8 +393,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
if( hotkey ) if( hotkey )
{ {
if( screen->GetCurItem() if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
&& screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() ); OnHotKey( DC, hotkey, screen->GetCurItem() );
else else
OnHotKey( DC, hotkey, NULL ); OnHotKey( DC, hotkey, NULL );
...@@ -422,8 +418,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -422,8 +418,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom; delta = screen->GetGrid() / zoom;
delta.y = screen->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -491,8 +486,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -491,8 +486,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
if( hotkey ) if( hotkey )
{ {
if( screen->GetCurItem() if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
&& screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() ); OnHotKey( DC, hotkey, screen->GetCurItem() );
else else
OnHotKey( DC, hotkey, NULL ); OnHotKey( DC, hotkey, NULL );
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "program.h" #include "program.h"
#include "general.h" #include "general.h"
#include <wx/dcps.h>
#include "dialog_print_using_printer_base.h" #include "dialog_print_using_printer_base.h"
......
...@@ -430,7 +430,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) ...@@ -430,7 +430,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE );
// GetScreen()->Curseur.x = ox; GetScreen()->Curseur.x = oy; // GetScreen()->Curseur.x = ox; GetScreen()->Curseur.x = oy;
// GRMouseWarp(DrawPanel, DrawPanel->CursorScreenPosition() ); // DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
} }
} }
......
...@@ -185,7 +185,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -185,7 +185,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
if( mouseWarp ) if( mouseWarp )
GRMouseWarp( DrawPanel, curpos ); DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
...@@ -359,7 +359,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -359,7 +359,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType )
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
GRMouseWarp( DrawPanel, curpos ); DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
} }
...@@ -589,7 +589,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -589,7 +589,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
if( mouseWarp ) if( mouseWarp )
GRMouseWarp( DrawPanel, curpos ); DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
......
...@@ -26,417 +26,318 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -26,417 +26,318 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
/* create or update the menubar for the schematic frame /* create or update the menubar for the schematic frame
*/ */
{ {
int ii;
wxMenuBar* menuBar = GetMenuBar();
wxString msg; wxString msg;
wxMenuItem *item;
if( menuBar == NULL ) wxMenuBar *menuBar = GetMenuBar();
{
menuBar = new wxMenuBar(); /* Destroy the existing menu bar so it can be rebuilt. This allows
* language changes of the menu text on the fly. */
m_FilesMenu = new wxMenu; if( menuBar )
SetMenuBar( NULL );
// Menu File:
wxMenuItem* item = new wxMenuItem( m_FilesMenu, ID_NEW_PROJECT, menuBar = new wxMenuBar();
_( "&New" ),
_( "New schematic project" ) ); wxMenu* filesMenu = new wxMenu;
item->SetBitmap( new_xpm );
m_FilesMenu->Append( item ); // Menu File:
item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New" ),
item = new wxMenuItem( m_FilesMenu, ID_LOAD_PROJECT, _( "New schematic project" ) );
_( "&Open" ), item->SetBitmap( new_xpm );
_( "Open an existing schematic project" ) ); filesMenu->Append( item );
item->SetBitmap( open_xpm );
m_FilesMenu->Append( item ); item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open" ),
_( "Open an existing schematic project" ) );
m_FilesMenu->AppendSeparator(); item->SetBitmap( open_xpm );
item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT, filesMenu->Append( item );
_( "&Save Project" ),
_( "Save all sheets in the schematic project" ) ); filesMenu->AppendSeparator();
item->SetBitmap( save_project_xpm ); item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save Project" ),
m_FilesMenu->Append( item ); _( "Save all sheets in the schematic project" ) );
item->SetBitmap( save_project_xpm );
m_FilesMenu->AppendSeparator(); filesMenu->Append( item );
item = new wxMenuItem( m_FilesMenu, ID_SAVE_ONE_SHEET,
_( "&Save" ), filesMenu->AppendSeparator();
_( "Save only current schematic sheet" ) ); item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET, _( "&Save" ),
item->SetBitmap( save_xpm ); _( "Save only current schematic sheet" ) );
m_FilesMenu->Append( item ); item->SetBitmap( save_xpm );
filesMenu->Append( item );
item = new wxMenuItem( m_FilesMenu, ID_SAVE_ONE_SHEET_AS,
_( "Save &as.." ), item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET_AS, _( "Save &as.." ),
_( "Save current schematic sheet as.." ) ); _( "Save current schematic sheet as.." ) );
item->SetBitmap( save_as_xpm ); item->SetBitmap( save_as_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// Print and Plot section: // Print and Plot section:
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_GEN_PRINT, item = new wxMenuItem( filesMenu, ID_GEN_PRINT, _( "P&rint" ),
_( "P&rint" ), _( "Print schematic sheet" ) ); _( "Print schematic sheet" ) );
item->SetBitmap( print_button ); item->SetBitmap( print_button );
m_FilesMenu->Append( item ); filesMenu->Append( item );
/* Plot Submenu */ /* Plot Submenu */
wxMenu* choice_plot_fmt = new wxMenu; wxMenu* choice_plot_fmt = new wxMenu;
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS, item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS,
_( "Plot PostScript" ), _( "Plot schematic sheet in PostScript format" ) ); _( "Plot PostScript" ),
item->SetBitmap( plot_PS_xpm ); _( "Plot schematic sheet in PostScript format" ) );
choice_plot_fmt->Append( item ); item->SetBitmap( plot_PS_xpm );
choice_plot_fmt->Append( item );
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_HPGL,
_( "Plot HPGL" ), _( "Plot schematic sheet in HPGL format" ) ); item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_HPGL, _( "Plot HPGL" ),
item->SetBitmap( plot_HPG_xpm ); _( "Plot schematic sheet in HPGL format" ) );
choice_plot_fmt->Append( item ); item->SetBitmap( plot_HPG_xpm );
choice_plot_fmt->Append( item );
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG,
_( "Plot SVG" ), _( "Plot schematic sheet in SVG format" ) ); item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG, _( "Plot SVG" ),
item->SetBitmap( plot_xpm ); _( "Plot schematic sheet in SVG format" ) );
choice_plot_fmt->Append( item ); item->SetBitmap( plot_xpm );
choice_plot_fmt->Append( item );
#ifdef __WINDOWS__ #ifdef __WINDOWS__
/* Under windows, one can draw to the clipboard */ /* Under windows, one can draw to the clipboard */
item = new wxMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD, item = new wxMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
_( "Plot to Clipboard" ), _( "Export drawings to clipboard" ) ); _( "Plot to Clipboard" ),
item->SetBitmap( copy_button ); _( "Export drawings to clipboard" ) );
choice_plot_fmt->Append( item ); item->SetBitmap( copy_button );
choice_plot_fmt->Append( item );
#endif #endif
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( m_FilesMenu, choice_plot_fmt, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, choice_plot_fmt,
ID_GEN_PLOT, _( "&Plot" ), ID_GEN_PLOT, _( "&Plot" ),
_( "Plot schematic sheet in HPGL, PostScript or SVG format" ), plot_xpm ); _( "Plot schematic sheet in HPGL, PostScript or SVG format" ), plot_xpm );
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_EXIT, _( "E&xit" ), _( "Quit Eeschema" ) ); item = new wxMenuItem( filesMenu, ID_EXIT, _( "E&xit" ),
item->SetBitmap( exit_xpm ); _( "Quit Eeschema" ) );
m_FilesMenu->Append( item ); item->SetBitmap( exit_xpm );
filesMenu->Append( item );
// Create the list of last edited schematic files
m_FilesMenu->AppendSeparator(); /* Add the file history */
int max_file = wxGetApp().m_LastProjectMaxCount; wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
for( ii = 0; ii < max_file; ii++ )
{ // Menu Edit:
if( GetLastProject( ii ).IsEmpty() ) wxMenu* editMenu = new wxMenu;
break; msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr, HK_UNDO );
item = new wxMenuItem( m_FilesMenu, ID_LOAD_FILE_1 + ii, item = new wxMenuItem( editMenu, ID_SCHEMATIC_UNDO, msg,
GetLastProject( ii ) ); _( "Undo last edition" ), wxITEM_NORMAL );
m_FilesMenu->Append( item ); item->SetBitmap( undo_xpm );
} editMenu->Append( item );
// Menu Edit: msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr, HK_REDO );
wxMenu* editMenu = new wxMenu; item = new wxMenuItem( editMenu, ID_SCHEMATIC_REDO, msg,
msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr, _( "Redo the last undo command" ), wxITEM_NORMAL );
HK_UNDO ); item->SetBitmap( redo_xpm );
item = new wxMenuItem( editMenu, ID_SCHEMATIC_UNDO, editMenu->Append( item );
msg, _( "Undo last edition" ),
wxITEM_NORMAL ); editMenu->AppendSeparator();
item->SetBitmap( undo_xpm );
editMenu->Append( item ); item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT,
_( "Delete" ), _( "Delete items" ), wxITEM_NORMAL );
msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr, item->SetBitmap( delete_body_xpm );
HK_REDO ); editMenu->Append( item );
item = new wxMenuItem( editMenu, ID_SCHEMATIC_REDO,
msg, _( "Redo the last undo command" ), editMenu->AppendSeparator();
wxITEM_NORMAL );
item->SetBitmap( redo_xpm ); item = new wxMenuItem( editMenu, ID_FIND_ITEMS, _( "Find" ),
editMenu->Append( item ); _( "Find components and texts" ), wxITEM_NORMAL );
item->SetBitmap( find_xpm );
editMenu->AppendSeparator(); editMenu->Append( item );
item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT, editMenu->AppendSeparator();
_( "Delete" ), _( "Delete items" ),
wxITEM_NORMAL ); item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS, _( "Backannotate" ),
item->SetBitmap( delete_body_xpm ); _( "Back annotated footprint fields" ),
editMenu->Append( item ); wxITEM_NORMAL );
item->SetBitmap( backanno_xpm );
editMenu->AppendSeparator(); editMenu->Append( item );
item = new wxMenuItem( editMenu, ID_FIND_ITEMS, // Menu View:
_( "Find" ), _( "Find components and texts" ), wxMenu* viewMenu = new wxMenu;
wxITEM_NORMAL ); msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr, HK_ZOOM_IN);
item->SetBitmap( find_xpm ); item = new wxMenuItem( viewMenu, ID_ZOOM_IN, msg, _( "Zoom in" ),
editMenu->Append( item ); wxITEM_NORMAL );
item->SetBitmap( zoom_in_xpm );
editMenu->AppendSeparator(); viewMenu->Append( item );
item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS, msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr,
_( "Backannotate" ), _( "Back annotated footprint fields" ), HK_ZOOM_OUT );
wxITEM_NORMAL ); item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, msg, _( "Zoom out" ),
item->SetBitmap( backanno_xpm ); wxITEM_NORMAL );
editMenu->Append( item ); item->SetBitmap( zoom_out_xpm );
viewMenu->Append( item );
// Menu View:
wxMenu* viewMenu = new wxMenu; item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, _( "Zoom auto" ),
msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr, _( "Zoom auto" ), wxITEM_NORMAL );
HK_ZOOM_IN); item->SetBitmap( zoom_auto_xpm );
item = new wxMenuItem( viewMenu, ID_ZOOM_IN, viewMenu->Append( item );
msg, _( "Zoom in" ),
wxITEM_NORMAL ); viewMenu->AppendSeparator();
item->SetBitmap( zoom_in_xpm );
viewMenu->Append( item ); msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_REDRAW );
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr, item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, msg, _( "Zoom auto" ),
HK_ZOOM_OUT ); wxITEM_NORMAL );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, item->SetBitmap( zoom_redraw_xpm );
msg, _( "Zoom out" ), viewMenu->Append( item );
wxITEM_NORMAL );
item->SetBitmap( zoom_out_xpm ); // Place Menu
viewMenu->Append( item ); //TODO: Unify the ID names!
wxMenu* placeMenu = new wxMenu;
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE,
_( "Zoom auto" ), _( "Zoom auto" ), item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, _( "&Component" ),
wxITEM_NORMAL ); _( "Place the component" ), wxITEM_NORMAL );
item->SetBitmap( zoom_auto_xpm ); item->SetBitmap( add_component_xpm );
viewMenu->Append( item ); placeMenu->Append( item );
viewMenu->AppendSeparator(); item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, _( "&Power port" ),
_( "Place the power port" ), wxITEM_NORMAL );
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr, item->SetBitmap( add_power_xpm );
HK_ZOOM_REDRAW ); placeMenu->Append( item );
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW,
msg, _( "Zoom auto" ), item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, _( "&Wire" ),
wxITEM_NORMAL ); _( "Place the wire" ), wxITEM_NORMAL );
item->SetBitmap( zoom_redraw_xpm ); item->SetBitmap( add_line_xpm );
viewMenu->Append( item ); placeMenu->Append( item );
// Place Menu item = new wxMenuItem( placeMenu, ID_BUS_BUTT, _( "&Bus" ),
//TODO: Unify the ID names! _( "Place bus" ), wxITEM_NORMAL );
wxMenu* placeMenu = new wxMenu; item->SetBitmap( add_bus_xpm );
placeMenu->Append( item );
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT,
_( "&Component" ), _( "Place the component" ), item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT,
wxITEM_NORMAL ); _( "W&ire to bus entry" ),
item->SetBitmap( add_component_xpm ); _( "Place a wire to bus entry" ), wxITEM_NORMAL );
placeMenu->Append( item ); item->SetBitmap( add_line2bus_xpm );
placeMenu->Append( item );
item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT,
_( "&Power port" ), _( "Place the power port" ), item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT,
wxITEM_NORMAL ); _( "B&us to bus entry" ),
item->SetBitmap( add_power_xpm ); _( "Place a bus to bus entry" ), wxITEM_NORMAL );
placeMenu->Append( item ); item->SetBitmap( add_bus2bus_xpm );
placeMenu->Append( item );
item = new wxMenuItem( placeMenu, ID_WIRE_BUTT,
_( "&Wire" ), _( "Place the wire" ), item = new wxMenuItem( placeMenu, ID_NOCONN_BUTT, _( "No connect flag" ),
wxITEM_NORMAL ); _( "Place a no connect flag" ), wxITEM_NORMAL );
item->SetBitmap( add_line_xpm ); item->SetBitmap( noconn_button );
placeMenu->Append( item ); placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_LABEL_BUTT, _( "Net name" ),
placeMenu, _( "Place net name" ), wxITEM_NORMAL );
ID_BUS_BUTT, item->SetBitmap( add_line_label_xpm );
_( "&Bus" ), placeMenu->Append( item );
_( "Place bus" ),
wxITEM_NORMAL item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, _( "Global label" ),
); _( "Place a global label. Warning: all global labels with the same name are connected in whole hierarchy" ),
item->SetBitmap( add_bus_xpm ); wxITEM_NORMAL );
placeMenu->Append( item ); item->SetBitmap( add_glabel_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu, item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, _( "Place Junction" ),
ID_WIRETOBUS_ENTRY_BUTT, _( "Place junction" ), wxITEM_NORMAL );
_( "W&ire to bus entry" ), item->SetBitmap( add_junction_xpm );
_( "Place a wire to bus entry" ), placeMenu->Append( item );
wxITEM_NORMAL
); placeMenu->AppendSeparator();
item->SetBitmap( add_line2bus_xpm );
placeMenu->Append( item ); item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT,
_( "Hierarchical label" ),
item = new wxMenuItem( _( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ),
placeMenu, wxITEM_NORMAL );
ID_BUSTOBUS_ENTRY_BUTT, item->SetBitmap( add_hierarchical_label_xpm );
_( "B&us to bus entry" ), placeMenu->Append( item );
_( "Place a bus to bus entry" ),
wxITEM_NORMAL item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT,
); _( "Hierarchical sheet" ),
item->SetBitmap( add_bus2bus_xpm ); _( "Create a hierarchical sheet" ), wxITEM_NORMAL );
placeMenu->Append( item ); item->SetBitmap( add_hierarchical_subsheet_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu, item = new wxMenuItem( placeMenu, ID_IMPORT_GLABEL_BUTT,
ID_NOCONN_BUTT, _( "Import Hierarchical Label" ),
_( "No connect flag" ), _( "Place a pin sheet created by importing a hierarchical label from sheet" ),
_( "Place a no connect flag" ), wxITEM_NORMAL );
wxITEM_NORMAL item->SetBitmap( import_hierarchical_label_xpm );
); placeMenu->Append( item );
item->SetBitmap( noconn_button );
placeMenu->Append( item ); item = new wxMenuItem( placeMenu, ID_SHEET_LABEL_BUTT,
_( "Add Hierarchical Pin to Sheet" ),
item = new wxMenuItem( _( "Place a hierarchical pin to sheet" ),
placeMenu, wxITEM_NORMAL );
ID_LABEL_BUTT, item->SetBitmap( add_hierar_pin_xpm );
_( "Net name" ), placeMenu->Append( item );
_( "Place net name" ),
wxITEM_NORMAL placeMenu->AppendSeparator();
);
item->SetBitmap( add_line_label_xpm ); item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT,
placeMenu->Append( item ); _( "Graphic line or polygon" ),
_( "Place graphic lines or polygons" ),
item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, wxITEM_NORMAL );
_( "Global label" ), item->SetBitmap( add_dashed_line_xpm );
_( "Place a global label. Warning: all global labels with the same name are connected in whole hierarchy" ), placeMenu->Append( item );
wxITEM_NORMAL
); item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT,
item->SetBitmap( add_glabel_xpm ); _( "Graphic text (comment)" ),
placeMenu->Append( item ); _( "Place graphic text (comment)" ),
wxITEM_NORMAL );
item = new wxMenuItem( item->SetBitmap( add_text_xpm );
placeMenu, placeMenu->Append( item );
ID_JUNCTION_BUTT,
_( "Place Junction" ), // Menu Configuration:
_( "Place junction" ), wxMenu* configmenu = new wxMenu;
wxITEM_NORMAL item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
); _( "Library preferences" ) );
item->SetBitmap( add_junction_xpm ); item->SetBitmap( library_xpm );
placeMenu->Append( item ); configmenu->Append( item );
placeMenu->AppendSeparator(); item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Color preferences" ) );
item = new wxMenuItem( item->SetBitmap( palette_xpm );
placeMenu, configmenu->Append( item );
ID_HIERLABEL_BUTT,
_( "Hierarchical label" ), // Options
_( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ), item = new wxMenuItem( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
wxITEM_NORMAL _( "General options..." ) );
); item->SetBitmap( preference_xpm );
item->SetBitmap( add_hierarchical_label_xpm ); configmenu->Append( item );
placeMenu->Append( item );
// Font selection and setup
item = new wxMenuItem( AddFontSelectionMenu( configmenu );
placeMenu,
ID_SHEET_SYMBOL_BUTT, wxGetApp().SetLanguageList( configmenu );
_( "Hierarchical sheet" ),
_( "Create a hierarchical sheet" ), configmenu->AppendSeparator();
wxITEM_NORMAL item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ),
); _( "Save application preferences" ) );
item->SetBitmap( add_hierarchical_subsheet_xpm ); item->SetBitmap( save_setup_xpm );
placeMenu->Append( item ); configmenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ),
placeMenu, _( "Read application preferences" ) );
ID_IMPORT_GLABEL_BUTT, item->SetBitmap( read_setup_xpm );
_( "Import Hierarchical Label" ), configmenu->Append( item );
_( "Place a pin sheet created by importing a hierarchical label from sheet" ),
wxITEM_NORMAL configmenu->AppendSeparator();
); AddHotkeyConfigMenu( configmenu );
item->SetBitmap( import_hierarchical_label_xpm );
placeMenu->Append( item ); // Menu Help:
wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
placeMenu, _( "Open the eeschema manual" ) );
ID_SHEET_LABEL_BUTT, item->SetBitmap( help_xpm );
_( "Add Hierarchical Pin to Sheet" ), helpMenu->Append( item );
_( "Place a hierarchical pin to sheet" ),
wxITEM_NORMAL item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About" ),
); _( "About eeschema schematic designer" ) );
item->SetBitmap( add_hierar_pin_xpm ); item->SetBitmap( info_xpm );
placeMenu->Append( item ); helpMenu->Append( item );
placeMenu->AppendSeparator();
menuBar->Append( filesMenu, _( "&File" ) );
item = new wxMenuItem( menuBar->Append( editMenu, _( "&Edit" ) );
placeMenu, menuBar->Append( viewMenu, _( "&View" ) );
ID_LINE_COMMENT_BUTT, menuBar->Append( placeMenu, _( "&Place" ) );
_( "Graphic line or polygon" ), menuBar->Append( configmenu, _( "&Preferences" ) );
_( "Place graphic lines or polygons" ), menuBar->Append( helpMenu, _( "&Help" ) );
wxITEM_NORMAL
); // Associate the menu bar with the frame
item->SetBitmap( add_dashed_line_xpm ); SetMenuBar( menuBar );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_TEXT_COMMENT_BUTT,
_( "Graphic text (comment)" ),
_( "Place graphic text (comment)" ),
wxITEM_NORMAL
);
item->SetBitmap( add_text_xpm );
placeMenu->Append( item );
// Menu Configuration:
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ,
_( "&Library" ),
_( "Library preferences" ) );
item->SetBitmap( library_xpm );
configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_COLORS_SETUP,
_( "&Colors" ),
_( "Color preferences" ) );
item->SetBitmap( palette_xpm );
configmenu->Append( item );
// Options
item = new wxMenuItem( configmenu, ID_OPTIONS_SETUP,
_( "&Options" ),
_( "General options..." ) );
item->SetBitmap( preference_xpm );
configmenu->Append( item );
// Font selection and setup
AddFontSelectionMenu( configmenu );
wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ),
_( "Save application preferences" ) );
item->SetBitmap( save_setup_xpm );
configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ),
_( "Read application preferences" ) );
item->SetBitmap( read_setup_xpm );
configmenu->Append( item );
configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP,
_( "&Contents" ), _( "Open the eeschema manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT,
_( "&About" ), _( "About eeschema schematic designer" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
menuBar->Append( m_FilesMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame
SetMenuBar( menuBar );
}
else // Update the list of last edited schematic files
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
{
SAFE_DELETE( item );
}
}
}
for( ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
item = new wxMenuItem( m_FilesMenu, ID_LOAD_FILE_1 + ii,
GetLastProject( ii ) );
m_FilesMenu->Append( item );
}
}
} }
...@@ -40,8 +40,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame ) ...@@ -40,8 +40,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject ) EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10, EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_SchematicFrame::OnLoadFile )
WinEDA_SchematicFrame::OnLoadFile )
EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject ) EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
...@@ -576,10 +575,15 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event ) ...@@ -576,10 +575,15 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
{ {
int i = event.GetId() - ID_LOAD_FILE_1; wxString fn;
LoadOneEEProject( GetLastProject( i ).GetData(), false ); fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
SetToolbars();
if( fn != wxEmptyString )
{
LoadOneEEProject( fn, false );
SetToolbars();
}
} }
......
...@@ -26,7 +26,7 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame ) ...@@ -26,7 +26,7 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
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, ID_ZOOM_PAGE, WinEDA_DrawFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ViewlibFrame::OnZoom )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart ) WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
...@@ -39,6 +39,25 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame ) ...@@ -39,6 +39,25 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
END_EVENT_TABLE() END_EVENT_TABLE()
/*
* This emulates the zoom menu entries found in the other Kicad applications.
* The library viewer does not have any menus so add an accelerator table to
* the main frame.
*
* FIXME: For some reason this doesn't work correctly in windows. Works fine
* in GTK2 in Linux. Not tested on Mac. Adding EVT_MENU_RANGE() to
* event table doesn't solve the problem either.
*/
static wxAcceleratorEntry accels[] = {
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F1, ID_ZOOM_IN ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_ZOOM_PAGE )
};
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
/******************************************************************************/ /******************************************************************************/
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
LibraryStruct* Library, LibraryStruct* Library,
...@@ -47,6 +66,8 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -47,6 +66,8 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
wxDefaultPosition, wxDefaultSize ) wxDefaultPosition, wxDefaultSize )
/******************************************************************************/ /******************************************************************************/
{ {
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
m_FrameName = wxT( "ViewlibFrame" ); m_FrameName = wxT( "ViewlibFrame" );
m_Draw_Axis = TRUE; // TRUE to dispaly Axis m_Draw_Axis = TRUE; // TRUE to dispaly Axis
...@@ -58,6 +79,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -58,6 +79,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
m_CmpList = NULL; m_CmpList = NULL;
m_LibList = NULL; m_LibList = NULL;
m_Semaphore = semaphore; m_Semaphore = semaphore;
if( m_Semaphore ) if( m_Semaphore )
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP ); SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
...@@ -92,6 +114,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -92,6 +114,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
if( m_LibList ) if( m_LibList )
ReCreateListLib(); ReCreateListLib();
DisplayLibInfos(); DisplayLibInfos();
SetAcceleratorTable( table );
BestZoom(); BestZoom();
Show( TRUE ); Show( TRUE );
} }
......
...@@ -15,7 +15,24 @@ ...@@ -15,7 +15,24 @@
static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName, wxDC* DC ); static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName, wxDC* DC );
/********************************************************/ void WinEDA_GerberFrame::OnFileHistory( wxCommandEvent& event )
{
wxString fn;
fn = GetFileFromHistory( event.GetId(), _( "Printed circuit board" ) );
if( fn != wxEmptyString && Clear_Pcb( true ) )
{
wxClientDC dc( DrawPanel );
DrawPanel->CursorOff( &dc );
LoadOneGerberFile( fn, &dc, false );
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
}
}
/***************
***************************************/
void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
/********************************************************/ /********************************************************/
...@@ -64,24 +81,6 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) ...@@ -64,24 +81,6 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq();
break; break;
case ID_LOAD_FILE_1:
case ID_LOAD_FILE_2:
case ID_LOAD_FILE_3:
case ID_LOAD_FILE_4:
case ID_LOAD_FILE_5:
case ID_LOAD_FILE_6:
case ID_LOAD_FILE_7:
case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10:
if( Clear_Pcb( TRUE ) )
{
LoadOneGerberFile(
GetLastProject( id - ID_LOAD_FILE_1 ).GetData(),
&dc, FALSE );
}
break;
case ID_GERBVIEW_LOAD_DRILL_FILE: case ID_GERBVIEW_LOAD_DRILL_FILE:
DisplayError( this, _( "Not yet available..." ) ); DisplayError( this, _( "Not yet available..." ) );
break; break;
......
...@@ -49,8 +49,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame ) ...@@ -49,8 +49,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW,
WinEDA_GerberFrame::ExportDataInPcbnewFormat ) WinEDA_GerberFrame::ExportDataInPcbnewFormat )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10, EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_GerberFrame::OnFileHistory )
WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
......
...@@ -59,6 +59,8 @@ bool WinEDA_App::OnInit() ...@@ -59,6 +59,8 @@ bool WinEDA_App::OnInit()
frame->Show( TRUE ); // Show GerbView mainframe frame->Show( TRUE ); // Show GerbView mainframe
frame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame frame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame
Read_Config();
if( argc > 1 ) if( argc > 1 )
{ {
wxString fileName = MakeFileName( wxEmptyString, wxString fileName = MakeFileName( wxEmptyString,
...@@ -75,8 +77,6 @@ bool WinEDA_App::OnInit() ...@@ -75,8 +77,6 @@ bool WinEDA_App::OnInit()
if( path != wxEmptyString ) if( path != wxEmptyString )
wxSetWorkingDirectory( path ); wxSetWorkingDirectory( path );
Read_Config();
// Load all files specified on the command line. // Load all files specified on the command line.
for( int i = 1; i<argc; ++i ) for( int i = 1; i<argc; ++i )
{ {
...@@ -93,8 +93,6 @@ bool WinEDA_App::OnInit() ...@@ -93,8 +93,6 @@ bool WinEDA_App::OnInit()
} }
} }
} }
else
Read_Config();
return TRUE; return TRUE;
} }
...@@ -23,165 +23,128 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -23,165 +23,128 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
/* Cree ou reinitialise le menu du haut d'ecran /* Cree ou reinitialise le menu du haut d'ecran
*/ */
{ {
int ii; wxMenuBar *menuBar = GetMenuBar();
wxMenuBar* menuBar = GetMenuBar();
if( menuBar == NULL ) /* Destroy the existing menu bar so it can be rebuilt. This allows
{ * language changes of the menu text on the fly. */
menuBar = new wxMenuBar(); if( menuBar )
SetMenuBar( NULL );
m_FilesMenu = new wxMenu;
m_FilesMenu->Append( ID_MENU_LOAD_FILE, menuBar = new wxMenuBar();
_( "Clear and Load Gerber file" ),
_( "Clear all layers and Load new Gerber file" ), wxMenu* filesMenu = new wxMenu;
FALSE ); filesMenu->Append( ID_MENU_LOAD_FILE, _( "Clear and Load Gerber file" ),
_( "Clear all layers and Load new Gerber file" ),
m_FilesMenu->Append( ID_MENU_APPEND_FILE, FALSE );
_( "Load Gerber file" ),
_( "Load new Gerber file on currrent layer" ), filesMenu->Append( ID_MENU_APPEND_FILE, _( "Load Gerber file" ),
FALSE ); _( "Load new Gerber file on currrent layer" ),
FALSE );
m_FilesMenu->Append( ID_MENU_INC_LAYER_AND_APPEND_FILE,
_( "Inc Layer and load Gerber file" ), filesMenu->Append( ID_MENU_INC_LAYER_AND_APPEND_FILE,
_( "Increment layer number, and Load Gerber file" ), _( "Inc Layer and load Gerber file" ),
FALSE ); _( "Increment layer number, and Load Gerber file" ),
FALSE );
m_FilesMenu->Append( ID_GERBVIEW_LOAD_DCODE_FILE,
_( "Load DCodes" ), filesMenu->Append( ID_GERBVIEW_LOAD_DCODE_FILE, _( "Load DCodes" ),
_( "Load D-Codes File" ), _( "Load D-Codes File" ), FALSE );
FALSE );
#if 0 #if 0
m_FilesMenu->Append( ID_GERBVIEW_LOAD_DRILL_FILE, filesMenu->Append( ID_GERBVIEW_LOAD_DRILL_FILE, _( "Load drill" ),
_( "Load drill" ), _( "Load excellon drill file" ), FALSE );
_( "Load excellon drill file" ),
FALSE );
#endif #endif
m_FilesMenu->Append( ID_MENU_NEW_BOARD, filesMenu->Append( ID_MENU_NEW_BOARD, _( "&New" ),
_( "&New" ), _( "Clear all layers" ), FALSE );
_( "Clear all layers" ),
FALSE );
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_GERBVIEW_EXPORT_TO_PCBNEW, filesMenu->Append( ID_GERBVIEW_EXPORT_TO_PCBNEW, _( "&Export to Pcbnew" ),
_( "&Export to Pcbnew" ), _( "Export data in pcbnew format" ), FALSE );
_( "Export data in pcbnew format" ),
FALSE );
#if 0 #if 0
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_MENU_SAVE_BOARD, filesMenu->Append( ID_MENU_SAVE_BOARD, _( "&Save layers" ),
_( "&Save layers" ), _( "Save current layers (GERBER format)" ), FALSE );
_( "Save current layers (GERBER format)" ),
FALSE );
m_FilesMenu->Append( ID_MENU_SAVE_BOARD_AS,
_( "Save layers as.." ),
_( "Save current layers as.." ),
FALSE );
#endif
m_FilesMenu->AppendSeparator(); filesMenu->Append( ID_MENU_SAVE_BOARD_AS, _( "Save layers as.." ),
_( "Save current layers as.." ), FALSE );
#endif
m_FilesMenu->Append( ID_GEN_PRINT, _( "P&rint" ), _( "Print gerber" ) ); filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_GEN_PLOT,
_( "Plot" ), _( "Plotting in various formats" ) );
m_FilesMenu->AppendSeparator(); filesMenu->Append( ID_GEN_PRINT, _( "P&rint" ), _( "Print gerber" ) );
m_FilesMenu->Append( ID_EXIT, _( "E&xit" ), _( "Quit Gerbview" ) ); filesMenu->Append( ID_GEN_PLOT, _( "Plot" ),
_( "Plotting in various formats" ) );
// Creation des selections des anciens fichiers filesMenu->AppendSeparator();
m_FilesMenu->AppendSeparator(); filesMenu->Append( ID_EXIT, _( "E&xit" ), _( "Quit Gerbview" ) );
for( int ii = 0; ii < 10; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
// Configuration: wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
wxMenu* configmenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&File ext" ),
_( "Setting Files extension" ), config_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Select Colors and Display for layers" ), palette_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
_( " Select general options" ), preference_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_PCB_LOOK_SETUP, _( "Display" ), // Configuration:
_( " Select how items are displayed" ), display_options_xpm ); wxMenu* configmenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&File ext" ),
_( "Setting Files extension" ), config_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Select Colors and Display for layers" ),
palette_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
_( " Select general options" ), preference_xpm );
// Font selection and setup ADD_MENUITEM_WITH_HELP( configmenu, ID_PCB_LOOK_SETUP, _( "Display" ),
AddFontSelectionMenu( configmenu ); _( " Select how items are displayed" ),
display_options_xpm );
wxGetApp().SetLanguageList( configmenu ); // Font selection and setup
AddFontSelectionMenu( configmenu );
configmenu->AppendSeparator(); wxGetApp().SetLanguageList( configmenu );
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ),
_( "Save application preferences" ), save_setup_xpm );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu ); ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ),
_( "Save application preferences" ),
save_setup_xpm );
configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu );
// Menu drill ( generation fichiers percage) // Menu drill ( generation fichiers percage)
/* wxMenu *drill_menu = new wxMenu; /* wxMenu *drill_menu = new wxMenu;
* postprocess_menu->Append(ID_PCB_GEN_DRILL_FILE, "Create &Drill file", * postprocess_menu->Append(ID_PCB_GEN_DRILL_FILE, "Create &Drill file",
* "Gen Drill (EXCELLON] file and/or Drill sheet"); * "Gen Drill (EXCELLON] file and/or Drill sheet");
*/ */
// Menu d'outils divers // Menu d'outils divers
wxMenu* miscellaneous_menu = new wxMenu; wxMenu* miscellaneous_menu = new wxMenu;
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES, ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES,
_( "&List DCodes" ), _( "&List DCodes" ),
_( "List and edit D-codes" ), show_dcodenumber_xpm ); _( "List and edit D-codes" ), show_dcodenumber_xpm );
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_SOURCE, _( "&Show source" ), ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_SOURCE,
_( "Show source file for the current layer" ), tools_xpm ); _( "&Show source" ),
miscellaneous_menu->AppendSeparator(); _( "Show source file for the current layer" ),
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_PCB_GLOBAL_DELETE, _( "&Delete layer" ), tools_xpm );
_( "Delete current layer" ), general_deletions_xpm ); miscellaneous_menu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_PCB_GLOBAL_DELETE,
// Menu Help: _( "&Delete layer" ),
wxMenu* helpMenu = new wxMenu; _( "Delete current layer" ), general_deletions_xpm );
ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the gerbview manual" ), help_xpm ); // Menu Help:
ADD_MENUITEM_WITH_HELP(helpMenu, wxMenu* helpMenu = new wxMenu;
ID_KICAD_ABOUT, _( "&About gerbview" ), ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "About gerbview gerber and drill viewer" ), _( "Open the gerbview manual" ), help_xpm );
info_xpm ); ADD_MENUITEM_WITH_HELP(helpMenu, ID_KICAD_ABOUT, _( "&About gerbview" ),
_( "About gerbview gerber and drill viewer" ),
menuBar->Append( m_FilesMenu, _( "&File" ) ); info_xpm );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) );
// menuBar->Append(drill_menu, _("&Drill")); // menuBar->Append(drill_menu, _("&Drill"));
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar( menuBar ); SetMenuBar( menuBar );
}
else // Only an update of the files list
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
}
} }
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
#define eda_global extern #define eda_global extern
#endif #endif
/* Use wxFileHistory for most recently used file handling. */
#include <wx/docview.h>
/**********************************************/ /**********************************************/
/* Class representing the entire Application */ /* Class representing the entire Application */
...@@ -36,8 +39,6 @@ public: ...@@ -36,8 +39,6 @@ public:
wxString m_BinDir; /* Chemin ou reside l'executable wxString m_BinDir; /* Chemin ou reside l'executable
* (utilis si KICAD non dfini)*/ * (utilis si KICAD non dfini)*/
wxArrayString m_LastProject; /* liste des derniers projets chargs */
unsigned int m_LastProjectMaxCount; /* Max histhory file length */
wxString m_KicadEnv; /* Chemin de kicad dfini dans la wxString m_KicadEnv; /* Chemin de kicad dfini dans la
* variable d'environnement KICAD, * variable d'environnement KICAD,
* typiquement /usr/local/kicad ou * typiquement /usr/local/kicad ou
...@@ -46,9 +47,10 @@ public: ...@@ -46,9 +47,10 @@ public:
wxLocale* m_Locale; // Gestion de la localisation wxLocale* m_Locale; // Gestion de la localisation
int m_LanguageId; // indicateur de choix du langage ( 0 = defaut) int m_LanguageId; // indicateur de choix du langage ( 0 = defaut)
wxMenu* m_Language_Menu; // List menu for languages
wxString m_PdfBrowser; // Name of the selected browser, for browsing pdf datasheets wxString m_PdfBrowser; // Name of the selected browser, for browsing pdf datasheets
bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used) bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used)
wxPathList m_searchPaths;
wxFileHistory m_fileHistory;
public: public:
WinEDA_App(); WinEDA_App();
...@@ -57,6 +59,7 @@ public: ...@@ -57,6 +59,7 @@ public:
int OnRun(); int OnRun();
bool SetBinDir(); bool SetBinDir();
void SetDefaultSearchPaths( void );
void InitEDA_Appl( const wxString& name ); void InitEDA_Appl( const wxString& name );
bool SetLanguage( bool first_time = FALSE ); bool SetLanguage( bool first_time = FALSE );
wxMenu* SetLanguageList( wxMenu* MasterMenu ); wxMenu* SetLanguageList( wxMenu* MasterMenu );
...@@ -66,7 +69,6 @@ public: ...@@ -66,7 +69,6 @@ public:
// Sauvegarde de configurations et options: // Sauvegarde de configurations et options:
void GetSettings(); void GetSettings();
void SaveSettings(); void SaveSettings();
void SetLastProject( const wxString& FullFileName );
void WriteProjectConfig( const wxString& local_config_filename, void WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, const wxString& GroupName,
PARAM_CFG_BASE** List ); PARAM_CFG_BASE** List );
......
...@@ -80,7 +80,6 @@ public: ...@@ -80,7 +80,6 @@ public:
void PrepareGraphicContext( wxDC* DC ); void PrepareGraphicContext( wxDC* DC );
wxPoint CalcAbsolutePosition( const wxPoint& rel_pos );
bool IsPointOnDisplay( wxPoint ref_pos ); bool IsPointOnDisplay( wxPoint ref_pos );
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
......
...@@ -59,7 +59,6 @@ int GRMapX(int x); ...@@ -59,7 +59,6 @@ int GRMapX(int x);
int GRMapY(int y); int GRMapY(int y);
class WinEDA_DrawPanel; class WinEDA_DrawPanel;
void GRMouseWarp(WinEDA_DrawPanel * panel, const wxPoint& pos); /* positionne la souris au point de coord pos */
/* routines generales */ /* routines generales */
void GRSetDrawMode(wxDC * DC, int mode); void GRSetDrawMode(wxDC * DC, int mode);
......
...@@ -57,8 +57,6 @@ public: ...@@ -57,8 +57,6 @@ public:
private: private:
wxMenu* m_FilesMenu;
SCH_CMP_FIELD* m_CurrentField; SCH_CMP_FIELD* m_CurrentField;
int m_TextFieldSize; int m_TextFieldSize;
......
...@@ -336,7 +336,6 @@ public: ...@@ -336,7 +336,6 @@ public:
private: private:
bool m_SelTrackWidthBox_Changed; bool m_SelTrackWidthBox_Changed;
bool m_SelViaSizeBox_Changed; bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu;
DRC* m_drc; ///< the DRC controller, see drc.cpp DRC* m_drc; ///< the DRC controller, see drc.cpp
...@@ -419,6 +418,7 @@ public: ...@@ -419,6 +418,7 @@ public:
void InstallDrillFrame( wxCommandEvent& event ); void InstallDrillFrame( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event ); void ToPostProcess( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
void Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
int LoadOnePcbFile( const wxString& FileName, bool Append ); int LoadOnePcbFile( const wxString& FileName, bool Append );
int ReadPcbFile( FILE* File, bool Append ); int ReadPcbFile( FILE* File, bool Append );
...@@ -762,8 +762,6 @@ class WinEDA_GerberFrame : public WinEDA_BasePcbFrame ...@@ -762,8 +762,6 @@ class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
public: public:
WinEDAChoiceBox* m_SelLayerBox; WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelLayerTool; WinEDAChoiceBox* m_SelLayerTool;
private:
wxMenu* m_FilesMenu;
public: public:
WinEDA_GerberFrame( wxWindow* father, const wxString& title, WinEDA_GerberFrame( wxWindow* father, const wxString& title,
...@@ -817,6 +815,7 @@ public: ...@@ -817,6 +815,7 @@ public:
int garde, int tracevia, int modetrace ); int garde, int tracevia, int modetrace );
void Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
int LoadOneGerberFile( const wxString& FileName, wxDC* DC, int mode ); int LoadOneGerberFile( const wxString& FileName, wxDC* DC, int mode );
int ReadGerberFile( wxDC* DC, FILE* File, bool Append ); int ReadGerberFile( wxDC* DC, FILE* File, bool Append );
bool Read_GERBER_File( wxDC* DC, bool Read_GERBER_File( wxDC* DC,
......
...@@ -127,7 +127,6 @@ public: ...@@ -127,7 +127,6 @@ public:
wxSize m_FrameSize; wxSize m_FrameSize;
int m_MsgFrameHeight; int m_MsgFrameHeight;
WinEDA_MenuBar* m_MenuBar; // menu du haut d'ecran
WinEDA_Toolbar* m_HToolBar; // Standard horizontal Toolbar WinEDA_Toolbar* m_HToolBar; // Standard horizontal Toolbar
bool m_FrameIsActive; bool m_FrameIsActive;
wxString m_FrameName; // name used for writting and reading setup wxString m_FrameName; // name used for writting and reading setup
...@@ -161,7 +160,7 @@ public: ...@@ -161,7 +160,7 @@ public:
void SetLanguage( wxCommandEvent& event ); void SetLanguage( wxCommandEvent& event );
void ProcessFontPreferences( int id ); void ProcessFontPreferences( int id );
wxString GetLastProject( int rang ); wxString GetFileFromHistory( int cmdId, const wxString& type );
void SetLastProject( const wxString& FullFileName ); void SetLastProject( const wxString& FullFileName );
void DisplayActivity( int PerCent, const wxString& Text ); void DisplayActivity( int PerCent, const wxString& Text );
virtual void ReCreateMenuBar(); virtual void ReCreateMenuBar();
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
*/ */
/*****************************************************************************/ /*****************************************************************************/
#include "wx/spinctrl.h"
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -78,9 +76,8 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame ) ...@@ -78,9 +76,8 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame )
ID_LANGUAGE_CHOICE_END, ID_LANGUAGE_CHOICE_END,
WinEDA_MainFrame::SetLanguage ) WinEDA_MainFrame::SetLanguage )
EVT_MENU_RANGE( ID_LOAD_PROJECT, EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9,
ID_LOAD_FILE_10, WinEDA_MainFrame::OnFileHistory )
WinEDA_MainFrame::Process_Files )
/* Button events */ /* Button events */
EVT_BUTTON( ID_TO_PCB, EVT_BUTTON( ID_TO_PCB,
...@@ -109,238 +106,173 @@ END_EVENT_TABLE() ...@@ -109,238 +106,173 @@ END_EVENT_TABLE()
void WinEDA_MainFrame::ReCreateMenuBar() void WinEDA_MainFrame::ReCreateMenuBar()
/*****************************************************************************/ /*****************************************************************************/
{ {
int ii, jj; wxMenuItem *item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar *menuBar = GetMenuBar();
/* Destroy the existing menu bar so it can be rebuilt. This allows
* language changes of the menu text on the fly. */
if( menuBar )
SetMenuBar( NULL );
menuBar = new wxMenuBar();
// Check if menubar is empty // Check if menubar is empty
if( menuBar == NULL ) wxMenu* filesMenu = new wxMenu;
{
m_MenuBar = menuBar = new wxMenuBar();
m_FilesMenu = new wxMenu;
// Open project
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open" ),
_( "Open an existing project" ) );
item->SetBitmap( open_project_xpm );
filesMenu->Append( item );
// Open project // New project
wxMenuItem* item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New" ),
ID_LOAD_PROJECT, _( "Start a new project" ) );
_( "&Open" ), item->SetBitmap( new_project_xpm );
_( "Open an existing project" ) ); filesMenu->Append( item );
item->SetBitmap( open_project_xpm );
m_FilesMenu->Append( item );
// New project // Save project
item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save" ),
ID_NEW_PROJECT, _( "Save current project" ) );
_( "&New" ), item->SetBitmap( save_project_xpm );
_( "Start a new project" ) ); filesMenu->Append( item );
item->SetBitmap( new_project_xpm );
m_FilesMenu->Append( item );
// Separator
filesMenu->AppendSeparator();
// Save project
item = new wxMenuItem( m_FilesMenu, // Archive project
ID_SAVE_PROJECT, item = new wxMenuItem( filesMenu, ID_SAVE_AND_ZIP_FILES,
_( "&Save" ), _( "&Archive" ),
_( "Save current project" ) ); _( "Archive project files in zip archive" ) );
item->SetBitmap( save_project_xpm ); item->SetBitmap( zip_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// Unarchive project
// Separator item = new wxMenuItem( filesMenu, ID_READ_ZIP_ARCHIVE,
m_FilesMenu->AppendSeparator(); _( "&Unarchive" ),
_( "Unarchive project files from zip file" ) );
item->SetBitmap( unzip_xpm );
// Archive project filesMenu->Append( item );
item = new wxMenuItem( m_FilesMenu,
ID_SAVE_AND_ZIP_FILES, // Separator
_( "&Archive" ), filesMenu->AppendSeparator();
_( "Archive project files in zip archive" ) );
item->SetBitmap( zip_xpm ); // Exit
m_FilesMenu->Append( item ); item = new wxMenuItem( filesMenu, ID_EXIT, _( "E&xit" ),
_( "Quit kicad" ) );
item->SetBitmap( exit_xpm );
// Unarchive project filesMenu->Append( item );
item = new wxMenuItem( m_FilesMenu,
ID_READ_ZIP_ARCHIVE, /* Add the file history */
_( "&Unarchive" ), wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
_( "Unarchive project files from zip file" ) );
item->SetBitmap( unzip_xpm ); /**********************************************************************/
m_FilesMenu->Append( item ); wxMenu* browseMenu = new wxMenu();
/**********************************************************************/
// Separator // Editor
m_FilesMenu->AppendSeparator(); item = new wxMenuItem( browseMenu, ID_TO_EDITOR, _( "Text E&ditor" ),
_( "Open prefered text editor" ) );
item->SetBitmap( editor_xpm );
// Exit browseMenu->Append( item );
item = new wxMenuItem( m_FilesMenu,
ID_EXIT, // Browse files
_( "E&xit" ), item = new wxMenuItem( browseMenu, ID_BROWSE_AN_SELECT_FILE,
_( "Quit kicad" ) ); _( "&Browse Files" ),
item->SetBitmap( exit_xpm ); _( "Read or edit files with text editor" ) );
m_FilesMenu->Append( item ); item->SetBitmap( browse_files_xpm );
browseMenu->Append( item );
// Create last 10 project entries /**********************************************************************/
m_FilesMenu->AppendSeparator(); wxMenu* PreferencesMenu = new wxMenu;
for( ii = 0; ii < 10; ii++ ) /**********************************************************************/
{
m_MenuBar = menuBar = new wxMenuBar(); // Fonts
item = new wxMenuItem( PreferencesMenu, ID_PREFERENCES_FONT_INFOSCREEN,
if( GetLastProject( ii ).IsEmpty() ) _( "Fonts" ), _( "Font preferences" ) );
break; item->SetBitmap( fonts_xpm );
PreferencesMenu->Append( item );
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
} // Prefered text editor
item = new wxMenuItem( PreferencesMenu, ID_SELECT_PREFERED_EDITOR,
/*************************************************************************/ _( "&Text Editor" ),
wxMenu* browseMenu = new wxMenu(); _( "Select your prefered text editor" ) );
/*************************************************************************/ item->SetBitmap( editor_xpm );
PreferencesMenu->Append( item );
// Editor
item = new wxMenuItem( browseMenu, // Entry in menu // Submenu Pdf Browser selection: system browser or user
ID_TO_EDITOR, // Entry ID // selected browser (and its name)
_( "Text E&ditor" ), // Entry text /**********************************************************************/
_( "Open prefered text editor" ) ); // Status bar text wxMenu* SubMenuPdfBrowserChoice = new wxMenu;
item->SetBitmap( editor_xpm ); // Entry XPM Bitmap /**********************************************************************/
browseMenu->Append( item ); // Append wxMenuItem to menu
// Default PDF viewer
item = new wxMenuItem( SubMenuPdfBrowserChoice,
// Browse files ID_SELECT_DEFAULT_PDF_BROWSER,
item = new wxMenuItem( browseMenu, _( "Default PDF Viewer" ),
ID_BROWSE_AN_SELECT_FILE, _( "Use the default (system) PDF viewer used to browse datasheets" ),
_( "&Browse Files" ), wxITEM_CHECK );
_( "Read or edit files with text editor" ) ); SETBITMAPS( datasheet_xpm );
item->SetBitmap( browse_files_xpm ); SubMenuPdfBrowserChoice->Append( item );
browseMenu->Append( item ); SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER,
wxGetApp().m_PdfBrowserIsDefault );
/*************************************************************************/
wxMenu* PreferencesMenu = new wxMenu; // Favourite PDF viewer
/*************************************************************************/ item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER,
// Fonts _( "Favourite PDF Viewer" ),
item = new wxMenuItem( PreferencesMenu, _( "Use your favourite PDF viewer used to browse datasheets" ),
ID_PREFERENCES_FONT_INFOSCREEN, wxITEM_CHECK );
_( "Fonts" ), SETBITMAPS( preference_xpm );
_( "Font preferences" ) ); SubMenuPdfBrowserChoice->Append( item );
item->SetBitmap( fonts_xpm ); SubMenuPdfBrowserChoice->AppendSeparator();
PreferencesMenu->Append( item ); SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER,
!wxGetApp().m_PdfBrowserIsDefault );
// Prefered text editor
item = new wxMenuItem( PreferencesMenu, item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_EDITOR, ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_( "&Text Editor" ), _( "Select Pdf Viewer" ),
_( "Select your prefered text editor" ) ); _( "Select your favourite PDF viewer used to browse datasheets" ) );
item->SetBitmap( editor_xpm ); item->SetBitmap( datasheet_xpm );
PreferencesMenu->Append( item ); SubMenuPdfBrowserChoice->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( PreferencesMenu,
// Submenu Pdf Browser selection: system browser or user SubMenuPdfBrowserChoice,
// selected browser (and its name) -1, _( "Pdf Viewer" ),
/*************************************************************************/ _( "Pdf viewer preferences" ),
wxMenu* SubMenuPdfBrowserChoice = new wxMenu; datasheet_xpm );
/*************************************************************************/
PreferencesMenu->AppendSeparator();
// Default PDF viewer wxGetApp().SetLanguageList( PreferencesMenu );
item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_DEFAULT_PDF_BROWSER,
_( "Default PDF Viewer" ), /**********************************************************************/
_( "Use the default (system) PDF viewer used to browse datasheets" ), wxMenu* helpMenu = new wxMenu;
wxITEM_CHECK ); /**********************************************************************/
SETBITMAPS( datasheet_xpm );
SubMenuPdfBrowserChoice->Append( item ); // Contents
SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER, item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
wxGetApp().m_PdfBrowserIsDefault ); _( "Open the kicad manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
// Favourite PDF viewer
item = new wxMenuItem( SubMenuPdfBrowserChoice, // About Kicad
ID_SELECT_PREFERED_PDF_BROWSER, item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About" ),
_( "Favourite PDF Viewer" ), _( "About kicad project manager" ) );
_( "Use your favourite PDF viewer used to browse datasheets" ), item->SetBitmap( info_xpm );
wxITEM_CHECK ); helpMenu->Append( item );
SETBITMAPS( preference_xpm );
SubMenuPdfBrowserChoice->Append( item ); // Append menus to menuBar
SubMenuPdfBrowserChoice->AppendSeparator(); menuBar->Append( filesMenu, _( "&File" ) );
SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER, menuBar->Append( browseMenu, _( "&Browse" ) );
!wxGetApp().m_PdfBrowserIsDefault ); menuBar->Append( PreferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
item = new wxMenuItem( SubMenuPdfBrowserChoice, SetMenuBar( menuBar );
ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_( "Select Pdf Viewer" ),
_( "Select your favourite PDF viewer used to browse datasheets" ) );
item->SetBitmap( datasheet_xpm );
SubMenuPdfBrowserChoice->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( PreferencesMenu,
SubMenuPdfBrowserChoice,
-1, _( "Pdf Viewer" ),
_( "Pdf viewer preferences" ),
datasheet_xpm );
PreferencesMenu->AppendSeparator();
wxGetApp().SetLanguageList( PreferencesMenu );
/*************************************************************************/
wxMenu* helpMenu = new wxMenu;
/*************************************************************************/
// Contents
item = new wxMenuItem( helpMenu,
ID_GENERAL_HELP,
_( "&Contents" ),
_( "Open the kicad manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
// About Kicad
item = new wxMenuItem( helpMenu,
ID_KICAD_ABOUT,
_( "&About" ),
_( "About kicad project manager" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
// Append menus to menuBar
menuBar->Append( m_FilesMenu, _( "&File" ) );
menuBar->Append( browseMenu, _( "&Browse" ) );
menuBar->Append( PreferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame
SetMenuBar( menuBar );
}
else // TODO (ENGLISH!) simple mise a jour de la liste des fichiers anciens
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( jj = 0, ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + jj, GetLastProject( ii ) );
jj++;
}
}
} }
......
...@@ -27,6 +27,21 @@ ...@@ -27,6 +27,21 @@
static void Create_NewPrj_Config( const wxString PrjFullFileName ); static void Create_NewPrj_Config( const wxString PrjFullFileName );
void WinEDA_MainFrame::OnFileHistory( wxCommandEvent& event )
{
wxString fn;
fn = GetFileFromHistory( event.GetId(), _( "Printed circuit board" ) );
if( fn != wxEmptyString )
{
m_PrjFileName = fn;
Load_Prj_Config();
}
ReCreateMenuBar();
}
/***********************************************************/ /***********************************************************/
void WinEDA_MainFrame::Process_Files( wxCommandEvent& event ) void WinEDA_MainFrame::Process_Files( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
...@@ -46,22 +61,6 @@ void WinEDA_MainFrame::Process_Files( wxCommandEvent& event ) ...@@ -46,22 +61,6 @@ void WinEDA_MainFrame::Process_Files( wxCommandEvent& event )
Save_Prj_Config(); Save_Prj_Config();
break; break;
case ID_LOAD_FILE_1:
case ID_LOAD_FILE_2:
case ID_LOAD_FILE_3:
case ID_LOAD_FILE_4:
case ID_LOAD_FILE_5:
case ID_LOAD_FILE_6:
case ID_LOAD_FILE_7:
case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10:
m_PrjFileName = GetLastProject( id - ID_LOAD_FILE_1 );
SetLastProject( m_PrjFileName );
ReCreateMenuBar();
Load_Prj_Config();
break;
case ID_NEW_PROJECT: case ID_NEW_PROJECT:
IsNew = TRUE; IsNew = TRUE;
......
...@@ -385,12 +385,14 @@ bool WinEDA_App::OnInit() ...@@ -385,12 +385,14 @@ bool WinEDA_App::OnInit()
if( argc > 1 ) if( argc > 1 )
frame->m_PrjFileName = argv[1]; frame->m_PrjFileName = argv[1];
else if( m_EDA_Config ) else if( m_fileHistory.GetCount() )
{ {
frame->m_PrjFileName = m_EDA_Config->Read( wxT( "LastProject" ), frame->m_PrjFileName = m_fileHistory.GetHistoryFile( 0 );
nameless_project ); if( !wxFileName::FileExists( frame->m_PrjFileName ) )
m_fileHistory.RemoveFileFromHistory( 0 );
} }
else
if( !wxFileName::FileExists( frame->m_PrjFileName ) )
frame->m_PrjFileName = nameless_project; frame->m_PrjFileName = nameless_project;
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
......
...@@ -46,9 +46,6 @@ public: ...@@ -46,9 +46,6 @@ public:
int m_LeftWin_Width; int m_LeftWin_Width;
int m_CommandWin_Height; int m_CommandWin_Height;
private:
wxMenu* m_FilesMenu;
public: public:
// Constructor and destructor // Constructor and destructor
...@@ -65,6 +62,7 @@ public: ...@@ -65,6 +62,7 @@ public:
void Load_Prj_Config(); void Load_Prj_Config();
void Save_Prj_Config(); void Save_Prj_Config();
void Process_Fct( wxCommandEvent& event ); void Process_Fct( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
void Process_Files( wxCommandEvent& event ); void Process_Files( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
......
...@@ -147,8 +147,11 @@ void WinEDA_MainFrame::Process_Preferences( wxCommandEvent& event ) ...@@ -147,8 +147,11 @@ void WinEDA_MainFrame::Process_Preferences( wxCommandEvent& event )
void WinEDA_MainFrame::SetLanguage( wxCommandEvent& event ) void WinEDA_MainFrame::SetLanguage( wxCommandEvent& event )
/********************************************************/ /********************************************************/
{ {
int id = event.GetId(); wxGetApp().SetLanguageIdentifier( event.GetId() );
if ( wxGetApp().SetLanguage() )
wxGetApp().SetLanguageIdentifier( id ); {
wxGetApp().SetLanguage(); wxLogDebug( wxT( "Recreating menu bar due to language change." ) );
ReCreateMenuBar();
Refresh();
}
} }
...@@ -23,7 +23,7 @@ void WinEDA_MainFrame::Load_Prj_Config() ...@@ -23,7 +23,7 @@ void WinEDA_MainFrame::Load_Prj_Config()
{ {
if( !wxFileExists( m_PrjFileName ) ) if( !wxFileExists( m_PrjFileName ) )
{ {
wxString msg = _( "Project File <" ) + m_PrjFileName + wxString msg = _( "Kicad project file <" ) + m_PrjFileName +
_( "> not found" ); _( "> not found" );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
...@@ -32,7 +32,7 @@ void WinEDA_MainFrame::Load_Prj_Config() ...@@ -32,7 +32,7 @@ void WinEDA_MainFrame::Load_Prj_Config()
wxSetWorkingDirectory( wxPathOnly( m_PrjFileName ) ); wxSetWorkingDirectory( wxPathOnly( m_PrjFileName ) );
SetTitle( g_Main_Title + wxT( " " ) + GetBuildVersion() + wxT( " " ) + SetTitle( g_Main_Title + wxT( " " ) + GetBuildVersion() + wxT( " " ) +
m_PrjFileName ); m_PrjFileName );
ReCreateMenuBar(); SetLastProject( m_PrjFileName );
m_LeftWin->ReCreateTreePrj(); m_LeftWin->ReCreateTreePrj();
wxString msg = _( "\nWorking dir: " ) + wxGetCwd(); wxString msg = _( "\nWorking dir: " ) + wxGetCwd();
......
...@@ -41,7 +41,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father, ...@@ -41,7 +41,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
long style) : long style) :
WinEDA_DrawFrame( father, idtype, title, pos, size, style ) WinEDA_DrawFrame( father, idtype, title, pos, size, style )
{ {
m_InternalUnits = 10000; // Internal unit = 1/10000 inch m_InternalUnits = PCB_INTERNAL_UNIT; // Internal unit = 1/10000 inch
m_Pcb = NULL; m_Pcb = NULL;
m_DisplayPadFill = TRUE; // How to draw pads m_DisplayPadFill = TRUE; // How to draw pads
...@@ -128,7 +128,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos ) ...@@ -128,7 +128,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
// Put cursor on item position // Put cursor on item position
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
screen->m_Curseur = aPos; screen->m_Curseur = aPos;
GRMouseWarp( DrawPanel, screen->m_Curseur ); DrawPanel->MouseTo( screen->m_Curseur );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
/* controle.cpp */ /* controle.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -516,11 +515,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -516,11 +515,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
} }
curpos = DrawPanel->CursorRealPosition( Mouse ); curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
delta.x = (int) round( (double) GetScreen()->GetGrid().x / zoom ); delta = GetScreen()->GetGrid() / zoom;
delta.y = (int) round( (double) GetScreen()->GetGrid().y / zoom );
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -592,10 +589,11 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -592,10 +589,11 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{ {
// If there's no intrusion and DRC is active, we pass the cursor // If there's no intrusion and DRC is active, we pass the cursor
// "as is", and let ShowNewTrackWhenMovingCursor figure out what to do. // "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
if( !Drc_On || !g_CurrentTrackSegment if( !Drc_On || !g_CurrentTrackSegment
|| g_CurrentTrackSegment != this->GetCurItem() || g_CurrentTrackSegment != this->GetCurItem()
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment->GetNet(), || !LocateIntrusion( m_Pcb->m_Track,
g_CurrentTrackSegment->m_Width ) ) g_CurrentTrackSegment->GetNet(),
g_CurrentTrackSegment->m_Width ) )
{ {
GetScreen()->m_Curseur = on_grid; GetScreen()->m_Curseur = on_grid;
} }
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include <wx/dcps.h>
#include "dialog_print_using_printer_base.h" #include "dialog_print_using_printer_base.h"
#include "pcbnew.h" #include "pcbnew.h"
......
...@@ -10,6 +10,30 @@ ...@@ -10,6 +10,30 @@
#include "id.h" #include "id.h"
void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
{
wxString fn;
wxClientDC dc( DrawPanel );
fn = GetFileFromHistory( event.GetId(), _( "Printed circuit board" ) );
if( fn != wxEmptyString )
{
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->PrepareGraphicContext( &dc );
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
LoadOnePcbFile( fn, false );
ReCreateAuxiliaryToolbar();
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
}
}
/****************************************************/ /****************************************************/
void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
/****************************************************/ /****************************************************/
...@@ -84,22 +108,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -84,22 +108,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
break; break;
case ID_LOAD_FILE_1:
case ID_LOAD_FILE_2:
case ID_LOAD_FILE_3:
case ID_LOAD_FILE_4:
case ID_LOAD_FILE_5:
case ID_LOAD_FILE_6:
case ID_LOAD_FILE_7:
case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10:
wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) );
LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(),
false );
ReCreateAuxiliaryToolbar();
break;
case ID_SAVE_BOARD: case ID_SAVE_BOARD:
case ID_MENU_SAVE_BOARD: case ID_MENU_SAVE_BOARD:
SavePcbFile( GetScreen()->m_FileName ); SavePcbFile( GetScreen()->m_FileName );
......
...@@ -21,332 +21,313 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -21,332 +21,313 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
/***********************************************/ /***********************************************/
/* Cree ou reinitialise le menu du haut d'ecran /* Cree ou reinitialise le menu du haut d'ecran
*/ */
{ {
int ii; wxMenuItem* item;
wxMenuBar * menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
if( menuBar == NULL ) /* Destroy the existing menu bar so it can be rebuilt. This allows
{ * language changes of the menu text on the fly. */
menuBar = new wxMenuBar(); if( menuBar )
SetMenuBar( NULL );
//////////////////
// Menu "Files" // menuBar = new wxMenuBar();
////////////////// wxMenu* filesMenu = new wxMenu;
// New wxMenu (FilesMenu) // New board
m_FilesMenu = new wxMenu; item = new wxMenuItem( filesMenu, ID_MENU_NEW_BOARD, _( "&New Board" ),
_( "Clear old board and initialize a new one" ) );
// New board item->SetBitmap( new_xpm );
wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_MENU_NEW_BOARD, filesMenu->Append( item );
_("&New Board"),
_("Clear old board and initialize a new one")); // Load board
item->SetBitmap(new_xpm); item = new wxMenuItem( filesMenu, ID_MENU_LOAD_FILE, _( "&Load Board" ),
m_FilesMenu->Append(item); _( "Delete old board and load new board" ) );
item->SetBitmap( open_xpm );
// Load board filesMenu->Append( item );
item = new wxMenuItem(m_FilesMenu, ID_MENU_LOAD_FILE,
_("&Load Board"), // Append board
_("Delete old board and load new board")); item = new wxMenuItem( filesMenu, ID_MENU_APPEND_FILE, _( "Append Board" ),
item->SetBitmap(open_xpm); _( "Add board to old board" ) );
m_FilesMenu->Append(item); item->SetBitmap( import_xpm );
filesMenu->Append( item );
// Append board
item = new wxMenuItem(m_FilesMenu, ID_MENU_APPEND_FILE,
_("Append Board"), item = new wxMenuItem( filesMenu, ID_MENU_RECOVER_BOARD, _( "&Rescue" ),
_("Add board to old board")); _( "Clear old board and get last rescue file" ) );
item->SetBitmap(import_xpm); item->SetBitmap( hammer_xpm );
m_FilesMenu->Append(item); filesMenu->Append( item );
item = new wxMenuItem( filesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD,
item = new wxMenuItem(m_FilesMenu, ID_MENU_RECOVER_BOARD, _( "&Previous Version" ),
_("&Rescue"), _( "Clear old board and get old version of board" ) );
_("Clear old board and get last rescue file")); item->SetBitmap( jigsaw_xpm );
item->SetBitmap(hammer_xpm); filesMenu->Append( item );
m_FilesMenu->Append(item);
// Add save menu
item = new wxMenuItem(m_FilesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD, filesMenu->AppendSeparator();
_("&Previous Version"), item = new wxMenuItem( filesMenu, ID_MENU_SAVE_BOARD,
_("Clear old board and get old version of board") ); _( "&Save Board\tCtrl-S" ), _( "Save current board" ) );
item->SetBitmap(jigsaw_xpm); item->SetBitmap( save_xpm );
m_FilesMenu->Append(item); filesMenu->Append( item );
// Add save menu item = new wxMenuItem( filesMenu, ID_MENU_SAVE_BOARD_AS,
m_FilesMenu->AppendSeparator(); _( "Save Board as..." ),
item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD, _( "Save current board as.." ) );
_("&Save Board Ctrl-S"), item->SetBitmap( save_as_xpm );
_("Save current board") ); filesMenu->Append( item );
item->SetBitmap(save_xpm);
m_FilesMenu->Append(item); // Add print menu
filesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD_AS, item = new wxMenuItem( filesMenu, ID_GEN_PRINT, _( "P&rint" ),
_("Save Board as..."), _( "Print pcb board" ) );
_("Save current board as..") ); item->SetBitmap( print_button );
item->SetBitmap(save_as_xpm); filesMenu->Append( item );
m_FilesMenu->Append(item);
item = new wxMenuItem( filesMenu, ID_GEN_PLOT_SVG, _( "Print S&VG" ),
// Add print menu _( "Plot pcb board in SVG format" ) );
m_FilesMenu->AppendSeparator(); item->SetBitmap( print_button );
item = new wxMenuItem(m_FilesMenu, ID_GEN_PRINT, filesMenu->Append( item );
_("P&rint"), _("Print pcb board"));
item->SetBitmap(print_button); // Add plot menu
m_FilesMenu->Append(item); item = new wxMenuItem( filesMenu, ID_GEN_PLOT, _( "&Plot" ),
_( "Plot (HPGL, PostScript, or Gerber format)" ) );
item = new wxMenuItem(m_FilesMenu, ID_GEN_PLOT_SVG, item->SetBitmap( plot_xpm );
_("Print S&VG"), _("Plot pcb board in SVG format")); filesMenu->Append( item );
item->SetBitmap(print_button);
m_FilesMenu->Append(item); // Add Export menu
filesMenu->AppendSeparator();
// Add plot menu wxMenu* submenuexport = new wxMenu();
item = new wxMenuItem(m_FilesMenu, ID_GEN_PLOT, _("&Plot"),
_("Plot (HPGL, PostScript, or Gerber format)")); item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_SPECCTRA,
item->SetBitmap(plot_xpm); _( "&Specctra DSN" ),
m_FilesMenu->Append(item); _( "Export the current board to a \"Specctra DSN\" file" ) );
item->SetBitmap( export_xpm );
// Add Export menu submenuexport->Append( item );
m_FilesMenu->AppendSeparator();
wxMenu * submenuexport = new wxMenu(); item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT,
_( "&GenCAD" ), _( "Export GenCAD Format" ) );
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_SPECCTRA, item->SetBitmap( export_xpm );
_("&Specctra DSN"), _("Export the current board to a \"Specctra DSN\" file") ); submenuexport->Append( item );
item->SetBitmap(export_xpm);
submenuexport->Append(item); item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT,
_( "&Module Report" ),
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT, _( "Create a board report (footprint report)" ) );
_("&GenCAD"), _("Export GenCAD Format") ); item->SetBitmap( tools_xpm );
item->SetBitmap(export_xpm); submenuexport->Append( item );
submenuexport->Append(item); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuexport,
ID_GEN_EXPORT_FILE, _( "&Export" ),
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT, _( "Export board" ), export_xpm );
_("&Module Report"), _("Create a board report (footprint report)") );
item->SetBitmap(tools_xpm);
submenuexport->Append(item); //-----<Add import menu>-----------------------------------------------
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuexport, // no separator, keep it next to Import
ID_GEN_EXPORT_FILE, _("&Export"), _("Export board"), export_xpm); wxMenu* submenuImport = new wxMenu();
item = new wxMenuItem( submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION,
//-----<Add import menu>----------------------------------------------- _( "&Specctra Session" ),
// no separator, keep it next to Import _( "Import a routed \"Specctra Session\" (*.ses) file" ) );
wxMenu * submenuImport = new wxMenu(); item->SetBitmap( import_xpm ); // @todo need better bitmap
submenuImport->Append( item );
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION,
_("&Specctra Session"), _("Import a routed \"Specctra Session\" (*.ses) file") ); /* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in specctra_import.cpp
item->SetBitmap(import_xpm); // @todo need better bitmap * item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
submenuImport->Append(item); * _("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
* item->SetBitmap(export_xpm); // @todo need better bitmap
/* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in specctra_import.cpp * submenuImport->Append(item);
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN, */
_("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
item->SetBitmap(export_xpm); // @todo need better bitmap ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuImport,
submenuImport->Append(item); ID_GEN_IMPORT_FILE, _( "Import" ),
*/ _( "Import files" ), import_xpm );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuImport, //-----</Add import menu>----------------------------------------------
ID_GEN_IMPORT_FILE, _("Import"), _("Import files"), import_xpm);
//-----</Add import menu>---------------------------------------------- // Add archive footprints menu
filesMenu->AppendSeparator();
// Add archive footprints menu wxMenu* submenuarchive = new wxMenu();
m_FilesMenu->AppendSeparator(); item = new wxMenuItem( submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES,
wxMenu * submenuarchive = new wxMenu(); _( "Add New Footprints" ),
item = new wxMenuItem(submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES, _( "Archive new footprints only in a library (keep other footprints in this lib)" ) );
_("Add New Footprints"), item->SetBitmap( library_update_xpm );
_("Archive new footprints only in a library (keep other footprints in this lib)") ); submenuarchive->Append( item );
item->SetBitmap(library_update_xpm); item = new wxMenuItem( submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES,
submenuarchive->Append(item); _( "Create Footprint Archive" ),
item = new wxMenuItem(submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES, _( "Archive all footprints in a library(old lib will be deleted)" ) );
_("Create Footprint Archive"), item->SetBitmap( library_xpm );
_("Archive all footprints in a library(old lib will be deleted)") ); submenuarchive->Append( item );
item->SetBitmap(library_xpm); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuarchive,
submenuarchive->Append(item); ID_MENU_ARCHIVE_MODULES,
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuarchive, _( "Archive Footprints" ),
ID_MENU_ARCHIVE_MODULES, _( "Archive or add footprints in a library file" ),
_("Archive Footprints"), library_xpm );
_("Archive or add footprints in a library file"), library_xpm);
// Add exit menu
// Add exit menu filesMenu->AppendSeparator();
m_FilesMenu->AppendSeparator(); item = new wxMenuItem( filesMenu, ID_EXIT, _( "E&xit" ),
item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit PCBNEW") ); _( "Quit PCBNEW" ) );
item->SetBitmap(exit_xpm); item->SetBitmap( exit_xpm );
m_FilesMenu->Append(item); filesMenu->Append( item );
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
// Creation des selections des anciens fichiers
m_FilesMenu->AppendSeparator(); ///////////////////////////////////
int max_file = wxGetApp().m_LastProjectMaxCount; // Configuration et preferences: //
for ( ii = 0; ii < max_file; ii++ ) ///////////////////////////////////
{ wxMenu* configmenu = new wxMenu;
if ( GetLastProject(ii).IsEmpty() ) break; item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); _( "Setting libraries, directories and others..." ) );
} item->SetBitmap( library_xpm );
configmenu->Append( item );
///////////////////////////////////
// Configuration et preferences: // item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
/////////////////////////////////// _( "Select colors and display for board items" ) );
wxMenu * configmenu = new wxMenu; item->SetBitmap( palette_xpm );
item = new wxMenuItem(configmenu, ID_CONFIG_REQ, _("&Library"), configmenu->Append( item );
_("Setting libraries, directories and others..."));
item->SetBitmap(library_xpm); item = new wxMenuItem( configmenu, ID_OPTIONS_SETUP, _( "&General" ),
configmenu->Append(item); _( "Select general options for PCBNEW" ) );
item->SetBitmap( preference_xpm );
item = new wxMenuItem(configmenu, ID_COLORS_SETUP, _("&Colors"), configmenu->Append( item );
_("Select colors and display for board items"));
item->SetBitmap(palette_xpm); item = new wxMenuItem( configmenu, ID_PCB_LOOK_SETUP, _( "&Display" ),
configmenu->Append(item); _( "Select what items are displayed" ) );
item->SetBitmap( display_options_xpm );
item = new wxMenuItem(configmenu, ID_OPTIONS_SETUP, _("&General"), configmenu->Append( item );
_("Select general options for PCBNEW"));
item->SetBitmap(preference_xpm); // Font selection and setup
configmenu->Append(item); AddFontSelectionMenu( configmenu );
item = new wxMenuItem(configmenu, ID_PCB_LOOK_SETUP, _("&Display"), wxGetApp().SetLanguageList( configmenu );
_("Select what items are displayed"));
item->SetBitmap(display_options_xpm); configmenu->AppendSeparator();
configmenu->Append(item); item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save Preferences" ),
_( "Save application preferences" ) );
// Font selection and setup item->SetBitmap( save_setup_xpm );
AddFontSelectionMenu(configmenu); configmenu->Append( item );
wxGetApp().SetLanguageList(configmenu); item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read Preferences" ),
_( "Read application preferences" ) );
configmenu->AppendSeparator(); item->SetBitmap( read_setup_xpm );
item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save Preferences"), configmenu->Append( item );
_("Save application preferences"));
item->SetBitmap(save_setup_xpm); configmenu->AppendSeparator();
configmenu->Append(item); AddHotkeyConfigMenu( configmenu );
item = new wxMenuItem(configmenu, ID_CONFIG_READ, _("&Read Preferences"), /////////////////////////////
_("Read application preferences")); // Ajustage de dimensions: //
item->SetBitmap(read_setup_xpm); /////////////////////////////
configmenu->Append(item); wxMenu* sizes_menu = new wxMenu;
configmenu->AppendSeparator(); item = new wxMenuItem( sizes_menu, ID_PCB_TRACK_SIZE_SETUP,
AddHotkeyConfigMenu( configmenu ); _( "Tracks and Vias" ),
_( "Adjust size and width for tracks and vias" ) );
///////////////////////////// item->SetBitmap( showtrack_xpm );
// Ajustage de dimensions: // sizes_menu->Append( item );
/////////////////////////////
wxMenu * sizes_menu = new wxMenu; item = new wxMenuItem( sizes_menu, ID_PCB_USER_GRID_SETUP, _( "Grid" ),
_( "Adjust User Grid" ) );
item = new wxMenuItem(sizes_menu, ID_PCB_TRACK_SIZE_SETUP, _("Tracks and Vias"), item->SetBitmap( grid_xpm );
_("Adjust size and width for tracks and vias")); sizes_menu->Append( item );
item->SetBitmap(showtrack_xpm);
sizes_menu->Append(item); item = new wxMenuItem( sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP,
_( "Texts and Drawings" ),
item = new wxMenuItem(sizes_menu, ID_PCB_USER_GRID_SETUP, _("Grid"), _( "Adjust width for texts and drawings" ) );
_("Adjust User Grid")); item->SetBitmap( options_text_xpm );
item->SetBitmap(grid_xpm); sizes_menu->Append( item );
sizes_menu->Append(item);
item = new wxMenuItem( sizes_menu, ID_PCB_PAD_SETUP, _( "Pads" ),
item = new wxMenuItem(sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP, _("Texts and Drawings"), _( "Adjust size,shape,layers... for pads" ) );
_("Adjust width for texts and drawings")); item->SetBitmap( pad_xpm );
item->SetBitmap(options_text_xpm); sizes_menu->Append( item );
sizes_menu->Append(item);
sizes_menu->AppendSeparator();
item = new wxMenuItem(sizes_menu, ID_PCB_PAD_SETUP, _("Pads"), item = new wxMenuItem( sizes_menu, ID_CONFIG_SAVE, _( "&Save Setup" ),
_("Adjust size,shape,layers... for pads")); _( "Save options in current directory" ) );
item->SetBitmap(pad_xpm); item->SetBitmap( save_xpm );
sizes_menu->Append(item); sizes_menu->Append( item );
sizes_menu->AppendSeparator(); //////////////////////////////////////////////////////////////////
item = new wxMenuItem(sizes_menu, ID_CONFIG_SAVE, _("&Save Setup"), // Menu postprocess ( generation fichiers percage, placement... //
_("Save options in current directory")); //////////////////////////////////////////////////////////////////
item->SetBitmap(save_xpm); wxMenu* postprocess_menu = new wxMenu;
sizes_menu->Append(item); item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE,
_( "Generate &Modules Position" ),
////////////////////////////////////////////////////////////////// _( "Generate modules position file" ) );
// Menu postprocess ( generation fichiers percage, placement... // item->SetBitmap( post_compo_xpm );
////////////////////////////////////////////////////////////////// postprocess_menu->Append( item );
wxMenu *postprocess_menu = new wxMenu;
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE, item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_DRILL_FILE,
_("Generate &Modules Position"), _( "Create &Drill File" ),
_("Generate modules position file")); _( "Generate excellon2 drill file" ) );
item->SetBitmap(post_compo_xpm); item->SetBitmap( post_drill_xpm );
postprocess_menu->Append(item); postprocess_menu->Append( item );
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_DRILL_FILE, _("Create &Drill File"), item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_CMP_FILE,
_("Generate excellon2 drill file")); _( "Create &Component File" ),
item->SetBitmap(post_drill_xpm); _( "Recreate .cmp file for CvPcb" ) );
postprocess_menu->Append(item); item->SetBitmap( save_cmpstuff_xpm );
postprocess_menu->Append( item );
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_CMP_FILE, _("Create &Component File"),
_("Recreate .cmp file for CvPcb")); //////////////////////////
item->SetBitmap(save_cmpstuff_xpm); // Menu d'outils divers //
postprocess_menu->Append(item); //////////////////////////
wxMenu* miscellaneous_menu = new wxMenu;
////////////////////////// item = new wxMenuItem( miscellaneous_menu, ID_PCB_GLOBAL_DELETE,
// Menu d'outils divers // _( "Global &Deletions" ),
////////////////////////// _( "Delete tracks, modules, texts... on board" ) );
wxMenu *miscellaneous_menu = new wxMenu; item->SetBitmap( general_deletions_xpm );
item = new wxMenuItem(miscellaneous_menu, ID_PCB_GLOBAL_DELETE, _("Global &Deletions"), miscellaneous_menu->Append( item );
_("Delete tracks, modules, texts... on board"));
item->SetBitmap(general_deletions_xpm); item =
miscellaneous_menu->Append(item); new wxMenuItem( miscellaneous_menu, ID_MENU_LIST_NETS, _( "&List Nets" ),
_( "List nets (names and id)" ) );
item = new wxMenuItem(miscellaneous_menu, ID_MENU_LIST_NETS, _("&List Nets"), item->SetBitmap( tools_xpm );
_("List nets (names and id)")); miscellaneous_menu->Append( item );
item->SetBitmap(tools_xpm);
miscellaneous_menu->Append(item); item = new wxMenuItem( miscellaneous_menu, ID_MENU_PCB_CLEAN,
_( "&Track Operations" ),
item = new wxMenuItem(miscellaneous_menu, ID_MENU_PCB_CLEAN, _("&Track Operations"), _( "Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias" ) );
_("Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias")); item->SetBitmap( delete_body_xpm );
item->SetBitmap(delete_body_xpm); miscellaneous_menu->Append( item );
miscellaneous_menu->Append(item);
item = new wxMenuItem( miscellaneous_menu, ID_MENU_PCB_SWAP_LAYERS,
item = new wxMenuItem(miscellaneous_menu, ID_MENU_PCB_SWAP_LAYERS, _("&Swap Layers"), _( "&Swap Layers" ),
_("Swap tracks on copper layers or drawings on others layers")); _( "Swap tracks on copper layers or drawings on others layers" ) );
item->SetBitmap(swap_layer_xpm); item->SetBitmap( swap_layer_xpm );
miscellaneous_menu->Append(item); miscellaneous_menu->Append( item );
//////////////// ////////////////
// Menu Help: // // Menu Help: //
//////////////// ////////////////
wxMenu *helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem(helpMenu , ID_GENERAL_HELP, _("&Contents"), _("Open the PCBNEW manual")); item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
item->SetBitmap(help_xpm); _( "Open the PCBNEW manual" ) );
helpMenu->Append(item); item->SetBitmap( help_xpm );
helpMenu->Append( item );
item = new wxMenuItem(helpMenu , ID_KICAD_ABOUT, _("&About PCBNEW"), _("About PCBNEW printed circuit board designer"));
item->SetBitmap(info_xpm); item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About PCBNEW" ),
helpMenu->Append(item); _( "About PCBNEW printed circuit board designer" ) );
item->SetBitmap( info_xpm );
////////////////////// helpMenu->Append( item );
// Menu Display 3D: //
////////////////////// //////////////////////
wxMenu *Display3DMenu = new wxMenu; // Menu Display 3D: //
item = new wxMenuItem(Display3DMenu , ID_MENU_PCB_SHOW_3D_FRAME, _("3D Display"), _("Show board in 3D viewer")); //////////////////////
item->SetBitmap(show_3d_xpm); wxMenu* Display3DMenu = new wxMenu;
Display3DMenu->Append(item); item = new wxMenuItem( Display3DMenu, ID_MENU_PCB_SHOW_3D_FRAME,
_( "3D Display" ), _( "Show board in 3D viewer" ) );
menuBar->Append(m_FilesMenu, _("&File")); item->SetBitmap( show_3d_xpm );
menuBar->Append(configmenu, _("&Preferences")); Display3DMenu->Append( item );
menuBar->Append(sizes_menu, _("&Dimensions"));
menuBar->Append(miscellaneous_menu, _("&Miscellaneous")); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append(postprocess_menu, _("P&ostprocess")); menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append(Display3DMenu, _("&3D Display")); menuBar->Append( sizes_menu, _( "&Dimensions" ) );
menuBar->Append(helpMenu, _("&Help")); menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) );
menuBar->Append( postprocess_menu, _( "P&ostprocess" ) );
// Associate the menu bar with the frame menuBar->Append( Display3DMenu, _( "&3D Display" ) );
SetMenuBar(menuBar); menuBar->Append( helpMenu, _( "&Help" ) );
}
// Associate the menu bar with the frame
else // simple mise a jour de la liste des fichiers anciens SetMenuBar( menuBar );
{
wxMenuItem * item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for ( ii = max_file-1; ii >=0 ; ii-- )
{
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) )
{
item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii);
if ( item ) delete item;
}
}
for ( ii = 0; ii < max_file; ii++ )
{
if ( GetLastProject(ii).IsEmpty() ) break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) );
}
}
} }
...@@ -211,10 +211,10 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -211,10 +211,10 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_SelTrackWidthBox_Changed = FALSE; m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox_Changed = FALSE;
m_drc = new DRC( this ); // these 2 objects point to each other
SetBoard( new BOARD( NULL, this ) ); SetBoard( new BOARD( NULL, this ) );
m_drc = new DRC( this ); // these 2 objects point to each other
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum; m_DisplayPadNum = DisplayOpt.DisplayPadNum;
......
...@@ -184,30 +184,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -184,30 +184,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
/* Create the main horizontal toolbar for the board editor */ /* Create the main horizontal toolbar for the board editor */
{ {
int ii;
wxString msg; wxString msg;
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
{ {
// simple mise a jour de la liste des fichiers anciens
wxMenuItem* item;
for( ii = 9; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( ii = 0; ii < 10; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
D(printf("ReCreateHToolbar\n");) D(printf("ReCreateHToolbar\n");)
SetToolbars(); SetToolbars();
return; return;
......
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