Integrate wxFileHistory, add missing header files to fix Linux build, initial search path work, and general housekeeping.

This commit is contained in:
stambaughw 2009-01-17 20:31:19 +00:00
parent 5c4c584b93
commit 21faf9d370
42 changed files with 1189 additions and 1511 deletions

View File

@ -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:

View File

@ -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 )
/* Met a jour la liste des anciens projets /* Met a jour la liste des anciens projets
*/ */
{ {
unsigned ii; wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
if( FullFileName.IsEmpty() )
return;
//suppression d'une ancienne trace eventuelle du meme fichier
for( ii = 0; ii < wxGetApp().m_LastProject.GetCount(); )
{
if( wxGetApp().m_LastProject[ii].IsEmpty() )
break;
#ifdef __WINDOWS__
if( wxGetApp().m_LastProject[ii].CmpNoCase( FullFileName ) == 0 )
#else
if( wxGetApp().m_LastProject[ii] == FullFileName )
#endif
{
wxGetApp().m_LastProject.RemoveAt( ii );
}
else
ii++;
}
while( wxGetApp().m_LastProject.GetCount() >= wxGetApp().m_LastProjectMaxCount )
{
wxGetApp().m_LastProject.RemoveAt( wxGetApp().m_LastProject.GetCount() - 1 );
}
wxGetApp().m_LastProject.Insert( FullFileName, 0 );
ReCreateMenuBar(); ReCreateMenuBar();
} }
/**************************************************/ /**
wxString WinEDA_BasicFrame::GetLastProject( int rang ) * Fetch the file name from the file history list.
/**************************************************/ */
wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
const wxString& type )
{ {
if( rang < 0 ) wxString fn, msg;
rang = 0; size_t i;
if( (unsigned) rang >= wxGetApp().m_LastProject.GetCount() ) int baseId = wxGetApp().m_fileHistory.GetBaseId();
return wxEmptyString;
return wxGetApp().m_LastProject[rang]; wxASSERT( cmdId >= baseId
&& cmdId < baseId + ( int )wxGetApp().m_fileHistory.GetCount() );
i = ( size_t )( cmdId - baseId );
if( i < wxGetApp().m_fileHistory.GetCount() )
{
fn = wxGetApp().m_fileHistory.GetHistoryFile( i );
if( !wxFileName::FileExists( fn ) )
{
msg = type + _( " file <" ) + fn + _( "> was not found." );
DisplayError( this, msg );
wxGetApp().m_fileHistory.RemoveFileFromHistory( i );
fn = wxEmptyString;
ReCreateMenuBar();
}
}
return fn;
} }

View File

@ -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,
// 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,
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()
int zoom = screen->GetZoom(); int zoom = screen->GetZoom();
int xUnit, yUnit; int xUnit, yUnit;
if( screen == NULL ) if( screen == NULL || DrawPanel == NULL )
return; return;
if( DrawPanel == NULL )
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()
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()
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 )
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();
}
} }

View File

@ -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 )
} }
/*********************************************************************/
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 )
* @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 )
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 )
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 )
#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()
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 )
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 = GetClientSize() * zoom;
size.x *= 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 )
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 )
{ {
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 )
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 )
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 )
} }
} }
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 )
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 )
} }
} }
/* 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) : */ /* Compute absolute mouse position in pixel units (i.e. considering the
Screen->m_MousePositionInPixels = CalcAbsolutePosition( mouse_pos ); current scrool) : */
Screen->m_MousePositionInPixels = pos;
/* Compute absolute m_MousePosition in user units: */ /* Compute absolute mouse position in user units: */
Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels ); Screen->m_MousePosition = CursorRealPosition( pos );
#else m_Parent->GeneralControle( &DC, pos );
/* if wxGetMousePosition() does not exist,
* m_Cursor should be ok, use it to calculate the cursor position on screen
*/
Screen->m_MousePositionInPixels = CursorScreenPosition();
#endif
m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels );
#if 0 #if 0
event.Skip(); // Allow menu shortcut processing event.Skip(); // Allow menu shortcut processing

View File

@ -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[] =
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 )
/* 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 )
// 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()
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()
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()
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++ )
/* Load the last file history settings from legacy version if this is the
* first time wxFileHistory was used to manage the file history. */
if( m_fileHistory.GetCount() == ( size_t )0 )
{ {
Ident = wxT( "LastProject" ); for( ii = 0; ii < ( unsigned )m_fileHistory.GetMaxFiles(); ii++ )
{
entry = wxT( "LastProject" );
if( ii != 0 )
entry << ii;
if( ii ) if( m_EDA_Config->Read( entry, &Line ) )
Ident << ii; {
if( Line != wxEmptyString && wxFileName::FileExists( Line ) )
if( m_EDA_Config->Read( Ident, &Line ) ) m_fileHistory.AddFileToHistory( Line );
m_LastProject.Add( 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()
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()
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()
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 )
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 )
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 );
} }
}
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu, menu,
{
if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier )
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier,
true );
else
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier,
false );
}
if( MasterMenu )
{
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu,
m_Language_Menu,
ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE,
_( "Language" ), _( "Language" ),
_( "Select application language (only for testing!)" ), _( "Select application language (only for testing!)" ),
language_xpm ); language_xpm );
} }
return m_Language_Menu; for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier )
menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, true );
else
menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, false );
}
return menu;
} }

View File

@ -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 */

View File

@ -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 ) );
} }
} }

View File

@ -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 )
/* 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 )
* 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: if( newfile && !oldfilename.IsEmpty() )
case ID_LOAD_FILE_4: {
case ID_LOAD_FILE_5: SetLastProject( NetInNameBuffer );
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 ); ReCreateMenuBar();
if( newfile && !oldfilename.IsEmpty() )
{
SetLastProject( NetInNameBuffer );
ReCreateMenuBar();
}
} }

View File

@ -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,

View File

@ -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 )
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 )
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 )
{ {

View File

@ -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
* language changes of the menu text on the fly. */
if( menuBar )
SetMenuBar( NULL );
if( menuBar == NULL ) menuBar = new wxMenuBar();
{
menuBar = new wxMenuBar();
// Associate the menu bar with the frame wxMenu* filesMenu = new wxMenu;
SetMenuBar( menuBar ); item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a NetList file" ) );
item->SetBitmap( open_xpm );
filesMenu->Append( item );
m_FilesMenu = new wxMenu; filesMenu->AppendSeparator();
wxMenuItem* item = new wxMenuItem( m_FilesMenu, ID_LOAD_PROJECT, item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Open" ), _( "&Save As..." ),
_( "Open a NetList file" ) ); _( "Save New NetList and Footprints List files" ) );
item->SetBitmap( open_xpm ); item->SetBitmap( save_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT, item = new wxMenuItem( filesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
_( "&Save As..." ), _( "Quit Cvpcb" ) );
_( "Save New NetList and Footprints List files" ) ); item->SetBitmap( exit_xpm );
item->SetBitmap( save_xpm ); filesMenu->Append( item );
m_FilesMenu->Append( item );
m_FilesMenu->AppendSeparator(); // Creation des selections des anciens fichiers
item = new wxMenuItem( m_FilesMenu, ID_CVPCB_QUIT, _( "E&xit" ), wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
_( "Quit Cvpcb" ) );
item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item );
// Creation des selections des anciens fichiers // Menu Configuration:
m_FilesMenu->AppendSeparator(); wxMenu* configmenu = new wxMenu;
for( ii = 0; ii < 10; ii++ ) item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
{ _( "Setting Libraries, Directories and others..." ) );
if( GetLastProject( ii ).IsEmpty() ) item->SetBitmap( config_xpm );
break; configmenu->Append( item );
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
// 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..." ) );
item->SetBitmap( config_xpm );
configmenu->Append( item );
// Font selection and setup wxGetApp().SetLanguageList( configmenu );
AddFontSelectionMenu( configmenu );
wxGetApp().SetLanguageList( configmenu ); configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE,
_( "&Save config" ),
_( "Save configuration in current dir" ) );
item->SetBitmap( save_setup_xpm );
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,
_( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
// Menu Help: menuBar->Append( filesMenu, _( "&File" ) );
wxMenu* helpMenu = new wxMenu; menuBar->Append( configmenu, _( "&Preferences" ) );
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ), menuBar->Append( helpMenu, _( "&Help" ) );
_( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item =
new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
_( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
menuBar->Append( m_FilesMenu, _( "&File" ) ); // Associate the menu bar with the frame
menuBar->Append( configmenu, _( "&Preferences" ) ); SetMenuBar( menuBar );
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 ) );
}
}
} }

View File

@ -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() );
} }
} }

View File

@ -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
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
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
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
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
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 );

View File

@ -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"

View File

@ -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() );
} }
} }

View File

@ -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 )
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(
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 );

View File

@ -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;
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; menuBar = new wxMenuBar();
// Menu File: wxMenu* filesMenu = new wxMenu;
wxMenuItem* item = new wxMenuItem( m_FilesMenu, ID_NEW_PROJECT,
_( "&New" ),
_( "New schematic project" ) );
item->SetBitmap( new_xpm );
m_FilesMenu->Append( item );
item = new wxMenuItem( m_FilesMenu, ID_LOAD_PROJECT, // Menu File:
_( "&Open" ), item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New" ),
_( "Open an existing schematic project" ) ); _( "New schematic project" ) );
item->SetBitmap( open_xpm ); item->SetBitmap( new_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
m_FilesMenu->AppendSeparator(); item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open" ),
item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT, _( "Open an existing schematic project" ) );
_( "&Save Project" ), item->SetBitmap( open_xpm );
_( "Save all sheets in the schematic project" ) ); filesMenu->Append( item );
item->SetBitmap( save_project_xpm );
m_FilesMenu->Append( item );
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_SAVE_ONE_SHEET, item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save Project" ),
_( "&Save" ), _( "Save all sheets in the schematic project" ) );
_( "Save only current schematic sheet" ) ); item->SetBitmap( save_project_xpm );
item->SetBitmap( save_xpm ); filesMenu->Append( item );
m_FilesMenu->Append( item );
item = new wxMenuItem( m_FilesMenu, ID_SAVE_ONE_SHEET_AS, filesMenu->AppendSeparator();
_( "Save &as.." ), item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET, _( "&Save" ),
_( "Save current schematic sheet as.." ) ); _( "Save only current schematic sheet" ) );
item->SetBitmap( save_as_xpm ); item->SetBitmap( save_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// Print and Plot section: item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET_AS, _( "Save &as.." ),
m_FilesMenu->AppendSeparator(); _( "Save current schematic sheet as.." ) );
item = new wxMenuItem( m_FilesMenu, ID_GEN_PRINT, item->SetBitmap( save_as_xpm );
_( "P&rint" ), _( "Print schematic sheet" ) ); filesMenu->Append( item );
item->SetBitmap( print_button );
m_FilesMenu->Append( item );
/* Plot Submenu */ // Print and Plot section:
wxMenu* choice_plot_fmt = new wxMenu; filesMenu->AppendSeparator();
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS, item = new wxMenuItem( filesMenu, ID_GEN_PRINT, _( "P&rint" ),
_( "Plot PostScript" ), _( "Plot schematic sheet in PostScript format" ) ); _( "Print schematic sheet" ) );
item->SetBitmap( plot_PS_xpm ); item->SetBitmap( print_button );
choice_plot_fmt->Append( item ); filesMenu->Append( item );
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_HPGL, /* Plot Submenu */
_( "Plot HPGL" ), _( "Plot schematic sheet in HPGL format" ) ); wxMenu* choice_plot_fmt = new wxMenu;
item->SetBitmap( plot_HPG_xpm ); item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS,
choice_plot_fmt->Append( item ); _( "Plot PostScript" ),
_( "Plot schematic sheet in PostScript format" ) );
item->SetBitmap( plot_PS_xpm );
choice_plot_fmt->Append( item );
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG, item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_HPGL, _( "Plot HPGL" ),
_( "Plot SVG" ), _( "Plot schematic sheet in SVG format" ) ); _( "Plot schematic sheet in HPGL format" ) );
item->SetBitmap( plot_xpm ); item->SetBitmap( plot_HPG_xpm );
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG, _( "Plot SVG" ),
_( "Plot schematic sheet in SVG format" ) );
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 /* Add the file history */
m_FilesMenu->AppendSeparator(); wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
int max_file = wxGetApp().m_LastProjectMaxCount;
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 );
}
// Menu Edit: // Menu Edit:
wxMenu* editMenu = new wxMenu; wxMenu* editMenu = new wxMenu;
msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr, HK_UNDO );
HK_UNDO ); item = new wxMenuItem( editMenu, ID_SCHEMATIC_UNDO, msg,
item = new wxMenuItem( editMenu, ID_SCHEMATIC_UNDO, _( "Undo last edition" ), wxITEM_NORMAL );
msg, _( "Undo last edition" ), item->SetBitmap( undo_xpm );
wxITEM_NORMAL ); editMenu->Append( item );
item->SetBitmap( undo_xpm );
editMenu->Append( item );
msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr, HK_REDO );
HK_REDO ); item = new wxMenuItem( editMenu, ID_SCHEMATIC_REDO, msg,
item = new wxMenuItem( editMenu, ID_SCHEMATIC_REDO, _( "Redo the last undo command" ), wxITEM_NORMAL );
msg, _( "Redo the last undo command" ), item->SetBitmap( redo_xpm );
wxITEM_NORMAL ); editMenu->Append( item );
item->SetBitmap( redo_xpm );
editMenu->Append( item );
editMenu->AppendSeparator(); editMenu->AppendSeparator();
item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT, item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT,
_( "Delete" ), _( "Delete items" ), _( "Delete" ), _( "Delete items" ), wxITEM_NORMAL );
wxITEM_NORMAL ); item->SetBitmap( delete_body_xpm );
item->SetBitmap( delete_body_xpm ); editMenu->Append( item );
editMenu->Append( item );
editMenu->AppendSeparator(); editMenu->AppendSeparator();
item = new wxMenuItem( editMenu, ID_FIND_ITEMS, item = new wxMenuItem( editMenu, ID_FIND_ITEMS, _( "Find" ),
_( "Find" ), _( "Find components and texts" ), _( "Find components and texts" ), wxITEM_NORMAL );
wxITEM_NORMAL ); item->SetBitmap( find_xpm );
item->SetBitmap( find_xpm ); editMenu->Append( item );
editMenu->Append( item );
editMenu->AppendSeparator(); editMenu->AppendSeparator();
item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS, item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS, _( "Backannotate" ),
_( "Backannotate" ), _( "Back annotated footprint fields" ), _( "Back annotated footprint fields" ),
wxITEM_NORMAL ); wxITEM_NORMAL );
item->SetBitmap( backanno_xpm ); item->SetBitmap( backanno_xpm );
editMenu->Append( item ); editMenu->Append( item );
// Menu View: // Menu View:
wxMenu* viewMenu = new wxMenu; wxMenu* viewMenu = new wxMenu;
msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr, HK_ZOOM_IN);
HK_ZOOM_IN); item = new wxMenuItem( viewMenu, ID_ZOOM_IN, msg, _( "Zoom in" ),
item = new wxMenuItem( viewMenu, ID_ZOOM_IN, wxITEM_NORMAL );
msg, _( "Zoom in" ), item->SetBitmap( zoom_in_xpm );
wxITEM_NORMAL ); viewMenu->Append( item );
item->SetBitmap( zoom_in_xpm );
viewMenu->Append( item );
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_OUT ); HK_ZOOM_OUT );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, msg, _( "Zoom out" ),
msg, _( "Zoom out" ), wxITEM_NORMAL );
wxITEM_NORMAL ); item->SetBitmap( zoom_out_xpm );
item->SetBitmap( zoom_out_xpm ); viewMenu->Append( item );
viewMenu->Append( item );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, _( "Zoom auto" ),
_( "Zoom auto" ), _( "Zoom auto" ), _( "Zoom auto" ), wxITEM_NORMAL );
wxITEM_NORMAL ); item->SetBitmap( zoom_auto_xpm );
item->SetBitmap( zoom_auto_xpm ); viewMenu->Append( item );
viewMenu->Append( item );
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_REDRAW ); HK_ZOOM_REDRAW );
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, msg, _( "Zoom auto" ),
msg, _( "Zoom auto" ), wxITEM_NORMAL );
wxITEM_NORMAL ); item->SetBitmap( zoom_redraw_xpm );
item->SetBitmap( zoom_redraw_xpm ); viewMenu->Append( item );
viewMenu->Append( item );
// Place Menu // Place Menu
//TODO: Unify the ID names! //TODO: Unify the ID names!
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, _( "&Component" ),
_( "&Component" ), _( "Place the component" ), _( "Place the component" ), wxITEM_NORMAL );
wxITEM_NORMAL ); item->SetBitmap( add_component_xpm );
item->SetBitmap( add_component_xpm ); placeMenu->Append( item );
placeMenu->Append( item );
item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, _( "&Power port" ),
_( "&Power port" ), _( "Place the power port" ), _( "Place the power port" ), wxITEM_NORMAL );
wxITEM_NORMAL ); item->SetBitmap( add_power_xpm );
item->SetBitmap( add_power_xpm ); placeMenu->Append( item );
placeMenu->Append( item );
item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, _( "&Wire" ),
_( "&Wire" ), _( "Place the wire" ), _( "Place the wire" ), wxITEM_NORMAL );
wxITEM_NORMAL ); item->SetBitmap( add_line_xpm );
item->SetBitmap( add_line_xpm ); placeMenu->Append( item );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_BUS_BUTT, _( "&Bus" ),
placeMenu, _( "Place bus" ), wxITEM_NORMAL );
ID_BUS_BUTT, item->SetBitmap( add_bus_xpm );
_( "&Bus" ), placeMenu->Append( item );
_( "Place bus" ),
wxITEM_NORMAL
);
item->SetBitmap( add_bus_xpm );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT,
placeMenu, _( "W&ire to bus entry" ),
ID_WIRETOBUS_ENTRY_BUTT, _( "Place a wire to bus entry" ), wxITEM_NORMAL );
_( "W&ire to bus entry" ), item->SetBitmap( add_line2bus_xpm );
_( "Place a wire to bus entry" ), placeMenu->Append( item );
wxITEM_NORMAL
);
item->SetBitmap( add_line2bus_xpm );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT,
placeMenu, _( "B&us to bus entry" ),
ID_BUSTOBUS_ENTRY_BUTT, _( "Place a bus to bus entry" ), wxITEM_NORMAL );
_( "B&us to bus entry" ), item->SetBitmap( add_bus2bus_xpm );
_( "Place a bus to bus entry" ), placeMenu->Append( item );
wxITEM_NORMAL
);
item->SetBitmap( add_bus2bus_xpm );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_NOCONN_BUTT, _( "No connect flag" ),
placeMenu, _( "Place a no connect flag" ), wxITEM_NORMAL );
ID_NOCONN_BUTT, item->SetBitmap( noconn_button );
_( "No connect flag" ), placeMenu->Append( item );
_( "Place a no connect flag" ),
wxITEM_NORMAL
);
item->SetBitmap( noconn_button );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_LABEL_BUTT, _( "Net name" ),
placeMenu, _( "Place net name" ), wxITEM_NORMAL );
ID_LABEL_BUTT, item->SetBitmap( add_line_label_xpm );
_( "Net name" ), placeMenu->Append( item );
_( "Place net name" ),
wxITEM_NORMAL
);
item->SetBitmap( add_line_label_xpm );
placeMenu->Append( item );
item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, _( "Global label" ),
_( "Global label" ), _( "Place a global label. Warning: all global labels with the same name are connected in whole hierarchy" ),
_( "Place a global label. Warning: all global labels with the same name are connected in whole hierarchy" ), wxITEM_NORMAL );
wxITEM_NORMAL item->SetBitmap( add_glabel_xpm );
); placeMenu->Append( item );
item->SetBitmap( add_glabel_xpm );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, _( "Place Junction" ),
placeMenu, _( "Place junction" ), wxITEM_NORMAL );
ID_JUNCTION_BUTT, item->SetBitmap( add_junction_xpm );
_( "Place Junction" ), placeMenu->Append( item );
_( "Place junction" ),
wxITEM_NORMAL
);
item->SetBitmap( add_junction_xpm );
placeMenu->Append( item );
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT,
placeMenu, _( "Hierarchical label" ),
ID_HIERLABEL_BUTT, _( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ),
_( "Hierarchical label" ), wxITEM_NORMAL );
_( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ), item->SetBitmap( add_hierarchical_label_xpm );
wxITEM_NORMAL placeMenu->Append( item );
);
item->SetBitmap( add_hierarchical_label_xpm );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT,
placeMenu, _( "Hierarchical sheet" ),
ID_SHEET_SYMBOL_BUTT, _( "Create a hierarchical sheet" ), wxITEM_NORMAL );
_( "Hierarchical sheet" ), item->SetBitmap( add_hierarchical_subsheet_xpm );
_( "Create a hierarchical sheet" ), placeMenu->Append( item );
wxITEM_NORMAL
);
item->SetBitmap( add_hierarchical_subsheet_xpm );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_IMPORT_GLABEL_BUTT,
placeMenu, _( "Import Hierarchical Label" ),
ID_IMPORT_GLABEL_BUTT, _( "Place a pin sheet created by importing a hierarchical label from sheet" ),
_( "Import Hierarchical Label" ), wxITEM_NORMAL );
_( "Place a pin sheet created by importing a hierarchical label from sheet" ), item->SetBitmap( import_hierarchical_label_xpm );
wxITEM_NORMAL placeMenu->Append( item );
);
item->SetBitmap( import_hierarchical_label_xpm );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_SHEET_LABEL_BUTT,
placeMenu, _( "Add Hierarchical Pin to Sheet" ),
ID_SHEET_LABEL_BUTT, _( "Place a hierarchical pin to sheet" ),
_( "Add Hierarchical Pin to Sheet" ), wxITEM_NORMAL );
_( "Place a hierarchical pin to sheet" ), item->SetBitmap( add_hierar_pin_xpm );
wxITEM_NORMAL placeMenu->Append( item );
);
item->SetBitmap( add_hierar_pin_xpm );
placeMenu->Append( item );
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT,
placeMenu, _( "Graphic line or polygon" ),
ID_LINE_COMMENT_BUTT, _( "Place graphic lines or polygons" ),
_( "Graphic line or polygon" ), wxITEM_NORMAL );
_( "Place graphic lines or polygons" ), item->SetBitmap( add_dashed_line_xpm );
wxITEM_NORMAL placeMenu->Append( item );
);
item->SetBitmap( add_dashed_line_xpm );
placeMenu->Append( item );
item = new wxMenuItem( item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT,
placeMenu, _( "Graphic text (comment)" ),
ID_TEXT_COMMENT_BUTT, _( "Place graphic text (comment)" ),
_( "Graphic text (comment)" ), wxITEM_NORMAL );
_( "Place graphic text (comment)" ), item->SetBitmap( add_text_xpm );
wxITEM_NORMAL placeMenu->Append( item );
);
item->SetBitmap( add_text_xpm );
placeMenu->Append( item );
// Menu Configuration: // Menu Configuration:
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
_( "&Library" ), _( "Library preferences" ) );
_( "Library preferences" ) ); item->SetBitmap( library_xpm );
item->SetBitmap( library_xpm ); configmenu->Append( item );
configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_COLORS_SETUP, item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "&Colors" ), _( "Color preferences" ) );
_( "Color preferences" ) ); item->SetBitmap( palette_xpm );
item->SetBitmap( palette_xpm ); configmenu->Append( item );
configmenu->Append( item );
// Options // Options
item = new wxMenuItem( configmenu, ID_OPTIONS_SETUP, item = new wxMenuItem( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
_( "&Options" ), _( "General options..." ) );
_( "General options..." ) ); item->SetBitmap( preference_xpm );
item->SetBitmap( preference_xpm ); configmenu->Append( item );
configmenu->Append( item );
// Font selection and setup // Font selection and setup
AddFontSelectionMenu( configmenu ); AddFontSelectionMenu( configmenu );
wxGetApp().SetLanguageList( configmenu ); wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ), item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ),
_( "Save application preferences" ) ); _( "Save application preferences" ) );
item->SetBitmap( save_setup_xpm ); item->SetBitmap( save_setup_xpm );
configmenu->Append( item ); 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(); item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ),
AddHotkeyConfigMenu( configmenu ); _( "Read application preferences" ) );
item->SetBitmap( read_setup_xpm );
configmenu->Append( item );
// Menu Help: configmenu->AppendSeparator();
wxMenu* helpMenu = new wxMenu; AddHotkeyConfigMenu( configmenu );
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, // Menu Help:
_( "&About" ), _( "About eeschema schematic designer" ) ); wxMenu* helpMenu = new wxMenu;
item->SetBitmap( info_xpm ); item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
helpMenu->Append( item ); _( "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( filesMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( configmenu, _( "&Preferences" ) );
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 // 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 );
}
}
} }

View File

@ -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 )
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();
}
} }

View File

@ -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 )
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,
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,
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,
if( m_LibList ) if( m_LibList )
ReCreateListLib(); ReCreateListLib();
DisplayLibInfos(); DisplayLibInfos();
SetAcceleratorTable( table );
BestZoom(); BestZoom();
Show( TRUE ); Show( TRUE );
} }

View File

@ -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 )
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;

View File

@ -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 )

View File

@ -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()
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()
} }
} }
} }
else
Read_Config();
return TRUE; return TRUE;
} }

View File

@ -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; menuBar = new wxMenuBar();
m_FilesMenu->Append( ID_MENU_LOAD_FILE,
_( "Clear and Load Gerber file" ),
_( "Clear all layers and Load new Gerber file" ),
FALSE );
m_FilesMenu->Append( ID_MENU_APPEND_FILE, wxMenu* filesMenu = new wxMenu;
_( "Load Gerber file" ), filesMenu->Append( ID_MENU_LOAD_FILE, _( "Clear and Load Gerber file" ),
_( "Load new Gerber file on currrent layer" ), _( "Clear all layers and Load new Gerber file" ),
FALSE ); FALSE );
m_FilesMenu->Append( ID_MENU_INC_LAYER_AND_APPEND_FILE, filesMenu->Append( ID_MENU_APPEND_FILE, _( "Load Gerber file" ),
_( "Inc Layer and load Gerber file" ), _( "Load new Gerber file on currrent layer" ),
_( "Increment layer number, and Load Gerber file" ), FALSE );
FALSE );
m_FilesMenu->Append( ID_GERBVIEW_LOAD_DCODE_FILE, filesMenu->Append( ID_MENU_INC_LAYER_AND_APPEND_FILE,
_( "Load DCodes" ), _( "Inc Layer and load Gerber file" ),
_( "Load D-Codes File" ), _( "Increment layer number, and Load Gerber file" ),
FALSE ); FALSE );
filesMenu->Append( ID_GERBVIEW_LOAD_DCODE_FILE, _( "Load DCodes" ),
_( "Load D-Codes File" ), 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, filesMenu->Append( ID_MENU_SAVE_BOARD_AS, _( "Save layers as.." ),
_( "Save layers as.." ), _( "Save current layers as.." ), FALSE );
_( "Save current layers as.." ),
FALSE );
#endif #endif
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_GEN_PRINT, _( "P&rint" ), _( "Print gerber" ) ); filesMenu->Append( ID_GEN_PRINT, _( "P&rint" ), _( "Print gerber" ) );
m_FilesMenu->Append( ID_GEN_PLOT, filesMenu->Append( ID_GEN_PLOT, _( "Plot" ),
_( "Plot" ), _( "Plotting in various formats" ) ); _( "Plotting in various formats" ) );
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_EXIT, _( "E&xit" ), _( "Quit Gerbview" ) ); filesMenu->Append( ID_EXIT, _( "E&xit" ), _( "Quit Gerbview" ) );
// Creation des selections des anciens fichiers wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
m_FilesMenu->AppendSeparator();
for( int ii = 0; ii < 10; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
// Configuration: // Configuration:
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&File ext" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&File ext" ),
_( "Setting Files extension" ), config_xpm ); _( "Setting Files extension" ), config_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_COLORS_SETUP, _( "&Colors" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Select Colors and Display for layers" ), palette_xpm ); _( "Select Colors and Display for layers" ),
ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ), palette_xpm );
_( " Select general options" ), preference_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" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_PCB_LOOK_SETUP, _( "Display" ),
_( " Select how items are displayed" ), display_options_xpm ); _( " Select how items are displayed" ),
display_options_xpm );
// Font selection and setup // Font selection and setup
AddFontSelectionMenu( configmenu ); AddFontSelectionMenu( configmenu );
wxGetApp().SetLanguageList( configmenu ); wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ),
_( "Save application preferences" ), save_setup_xpm ); _( "Save application preferences" ),
save_setup_xpm );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu ); 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,
_( "&Delete layer" ),
_( "Delete current layer" ), general_deletions_xpm );
// Menu Help: // Menu Help:
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the gerbview manual" ), help_xpm ); _( "Open the gerbview manual" ), help_xpm );
ADD_MENUITEM_WITH_HELP(helpMenu, ADD_MENUITEM_WITH_HELP(helpMenu, ID_KICAD_ABOUT, _( "&About gerbview" ),
ID_KICAD_ABOUT, _( "&About gerbview" ), _( "About gerbview gerber and drill viewer" ),
_( "About gerbview gerber and drill viewer" ), info_xpm );
info_xpm );
menuBar->Append( m_FilesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) ); 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 ) );
}
}
} }

View File

@ -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:
wxString m_BinDir; /* Chemin ou reside l'executable wxString m_BinDir; /* Chemin ou reside l'executable
* (utilisé si KICAD non défini)*/ * (utilisé si KICAD non défini)*/
wxArrayString m_LastProject; /* liste des derniers projets chargés */
unsigned int m_LastProjectMaxCount; /* Max histhory file length */
wxString m_KicadEnv; /* Chemin de kicad défini dans la wxString m_KicadEnv; /* Chemin de kicad défini 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:
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:
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:
// 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 );

View File

@ -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 );

View File

@ -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);

View File

@ -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;

View File

@ -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:
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
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:
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,

View File

@ -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:
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();

View File

@ -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 )
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()
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(); // Open project
m_FilesMenu = new wxMenu; item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open" ),
_( "Open an existing project" ) );
item->SetBitmap( open_project_xpm );
filesMenu->Append( item );
// New project
item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New" ),
_( "Start a new project" ) );
item->SetBitmap( new_project_xpm );
filesMenu->Append( item );
// Open project // Save project
wxMenuItem* item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save" ),
ID_LOAD_PROJECT, _( "Save current project" ) );
_( "&Open" ), item->SetBitmap( save_project_xpm );
_( "Open an existing project" ) ); filesMenu->Append( item );
item->SetBitmap( open_project_xpm );
m_FilesMenu->Append( item ); // Separator
filesMenu->AppendSeparator();
// New project // Archive project
item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_SAVE_AND_ZIP_FILES,
ID_NEW_PROJECT, _( "&Archive" ),
_( "&New" ), _( "Archive project files in zip archive" ) );
_( "Start a new project" ) ); item->SetBitmap( zip_xpm );
item->SetBitmap( new_project_xpm ); filesMenu->Append( item );
m_FilesMenu->Append( item );
// Unarchive project
item = new wxMenuItem( filesMenu, ID_READ_ZIP_ARCHIVE,
_( "&Unarchive" ),
_( "Unarchive project files from zip file" ) );
item->SetBitmap( unzip_xpm );
filesMenu->Append( item );
// Separator
filesMenu->AppendSeparator();
// Exit
item = new wxMenuItem( filesMenu, ID_EXIT, _( "E&xit" ),
_( "Quit kicad" ) );
item->SetBitmap( exit_xpm );
filesMenu->Append( item );
/* Add the file history */
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
/**********************************************************************/
wxMenu* browseMenu = new wxMenu();
/**********************************************************************/
// Editor
item = new wxMenuItem( browseMenu, ID_TO_EDITOR, _( "Text E&ditor" ),
_( "Open prefered text editor" ) );
item->SetBitmap( editor_xpm );
browseMenu->Append( item );
// Browse files
item = new wxMenuItem( browseMenu, ID_BROWSE_AN_SELECT_FILE,
_( "&Browse Files" ),
_( "Read or edit files with text editor" ) );
item->SetBitmap( browse_files_xpm );
browseMenu->Append( item );
/**********************************************************************/
wxMenu* PreferencesMenu = new wxMenu;
/**********************************************************************/
// Fonts
item = new wxMenuItem( PreferencesMenu, ID_PREFERENCES_FONT_INFOSCREEN,
_( "Fonts" ), _( "Font preferences" ) );
item->SetBitmap( fonts_xpm );
PreferencesMenu->Append( item );
// Prefered text editor
item = new wxMenuItem( PreferencesMenu, ID_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ),
_( "Select your prefered text editor" ) );
item->SetBitmap( editor_xpm );
PreferencesMenu->Append( item );
// Submenu Pdf Browser selection: system browser or user
// selected browser (and its name)
/**********************************************************************/
wxMenu* SubMenuPdfBrowserChoice = new wxMenu;
/**********************************************************************/
// Default PDF viewer
item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_DEFAULT_PDF_BROWSER,
_( "Default PDF Viewer" ),
_( "Use the default (system) PDF viewer used to browse datasheets" ),
wxITEM_CHECK );
SETBITMAPS( datasheet_xpm );
SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER,
wxGetApp().m_PdfBrowserIsDefault );
// Save project // Favourite PDF viewer
item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SAVE_PROJECT, ID_SELECT_PREFERED_PDF_BROWSER,
_( "&Save" ), _( "Favourite PDF Viewer" ),
_( "Save current project" ) ); _( "Use your favourite PDF viewer used to browse datasheets" ),
item->SetBitmap( save_project_xpm ); wxITEM_CHECK );
m_FilesMenu->Append( item ); SETBITMAPS( preference_xpm );
SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->AppendSeparator();
SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER,
!wxGetApp().m_PdfBrowserIsDefault );
// Separator item = new wxMenuItem( SubMenuPdfBrowserChoice,
m_FilesMenu->AppendSeparator(); 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 );
// Archive project /**********************************************************************/
item = new wxMenuItem( m_FilesMenu, wxMenu* helpMenu = new wxMenu;
ID_SAVE_AND_ZIP_FILES, /**********************************************************************/
_( "&Archive" ),
_( "Archive project files in zip archive" ) );
item->SetBitmap( zip_xpm );
m_FilesMenu->Append( item );
// Contents
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the kicad manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
// Unarchive project // About Kicad
item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About" ),
ID_READ_ZIP_ARCHIVE, _( "About kicad project manager" ) );
_( "&Unarchive" ), item->SetBitmap( info_xpm );
_( "Unarchive project files from zip file" ) ); helpMenu->Append( item );
item->SetBitmap( unzip_xpm );
m_FilesMenu->Append( item );
// Append menus to menuBar
menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( browseMenu, _( "&Browse" ) );
menuBar->Append( PreferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// Separator SetMenuBar( menuBar );
m_FilesMenu->AppendSeparator();
// Exit
item = new wxMenuItem( m_FilesMenu,
ID_EXIT,
_( "E&xit" ),
_( "Quit kicad" ) );
item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item );
// Create last 10 project entries
m_FilesMenu->AppendSeparator();
for( ii = 0; ii < 10; ii++ )
{
m_MenuBar = menuBar = new wxMenuBar();
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
/*************************************************************************/
wxMenu* browseMenu = new wxMenu();
/*************************************************************************/
// Editor
item = new wxMenuItem( browseMenu, // Entry in menu
ID_TO_EDITOR, // Entry ID
_( "Text E&ditor" ), // Entry text
_( "Open prefered text editor" ) ); // Status bar text
item->SetBitmap( editor_xpm ); // Entry XPM Bitmap
browseMenu->Append( item ); // Append wxMenuItem to menu
// Browse files
item = new wxMenuItem( browseMenu,
ID_BROWSE_AN_SELECT_FILE,
_( "&Browse Files" ),
_( "Read or edit files with text editor" ) );
item->SetBitmap( browse_files_xpm );
browseMenu->Append( item );
/*************************************************************************/
wxMenu* PreferencesMenu = new wxMenu;
/*************************************************************************/
// Fonts
item = new wxMenuItem( PreferencesMenu,
ID_PREFERENCES_FONT_INFOSCREEN,
_( "Fonts" ),
_( "Font preferences" ) );
item->SetBitmap( fonts_xpm );
PreferencesMenu->Append( item );
// Prefered text editor
item = new wxMenuItem( PreferencesMenu,
ID_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ),
_( "Select your prefered text editor" ) );
item->SetBitmap( editor_xpm );
PreferencesMenu->Append( item );
// Submenu Pdf Browser selection: system browser or user
// selected browser (and its name)
/*************************************************************************/
wxMenu* SubMenuPdfBrowserChoice = new wxMenu;
/*************************************************************************/
// Default PDF viewer
item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_DEFAULT_PDF_BROWSER,
_( "Default PDF Viewer" ),
_( "Use the default (system) PDF viewer used to browse datasheets" ),
wxITEM_CHECK );
SETBITMAPS( datasheet_xpm );
SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER,
wxGetApp().m_PdfBrowserIsDefault );
// Favourite PDF viewer
item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER,
_( "Favourite PDF Viewer" ),
_( "Use your favourite PDF viewer used to browse datasheets" ),
wxITEM_CHECK );
SETBITMAPS( preference_xpm );
SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->AppendSeparator();
SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER,
!wxGetApp().m_PdfBrowserIsDefault );
item = new wxMenuItem( SubMenuPdfBrowserChoice,
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++;
}
}
} }

View File

@ -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 )
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;

View File

@ -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();

View File

@ -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:
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 );

View File

@ -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();
}
} }

View File

@ -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()
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();

View File

@ -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 )
// 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 );
} }

View File

@ -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 )
} }
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 )
{ {
// 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;
} }

View File

@ -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"

View File

@ -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 )
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 );

View File

@ -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 );
////////////////// menuBar = new wxMenuBar();
// Menu "Files" // 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" ) );
item->SetBitmap( new_xpm );
filesMenu->Append( item );
// New board // Load board
wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_MENU_NEW_BOARD, item = new wxMenuItem( filesMenu, ID_MENU_LOAD_FILE, _( "&Load Board" ),
_("&New Board"), _( "Delete old board and load new board" ) );
_("Clear old board and initialize a new one")); item->SetBitmap( open_xpm );
item->SetBitmap(new_xpm); filesMenu->Append( item );
m_FilesMenu->Append(item);
// Load board // Append board
item = new wxMenuItem(m_FilesMenu, ID_MENU_LOAD_FILE, item = new wxMenuItem( filesMenu, ID_MENU_APPEND_FILE, _( "Append Board" ),
_("&Load Board"), _( "Add board to old board" ) );
_("Delete old board and load new board")); item->SetBitmap( import_xpm );
item->SetBitmap(open_xpm); filesMenu->Append( item );
m_FilesMenu->Append(item);
// Append board
item = new wxMenuItem(m_FilesMenu, ID_MENU_APPEND_FILE,
_("Append Board"),
_("Add board to old board"));
item->SetBitmap(import_xpm);
m_FilesMenu->Append(item);
item = new wxMenuItem(m_FilesMenu, ID_MENU_RECOVER_BOARD, item = new wxMenuItem( filesMenu, ID_MENU_RECOVER_BOARD, _( "&Rescue" ),
_("&Rescue"), _( "Clear old board and get last rescue file" ) );
_("Clear old board and get last rescue file")); item->SetBitmap( hammer_xpm );
item->SetBitmap(hammer_xpm); filesMenu->Append( item );
m_FilesMenu->Append(item);
item = new wxMenuItem(m_FilesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD, item = new wxMenuItem( filesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD,
_("&Previous Version"), _( "&Previous Version" ),
_("Clear old board and get old version of board") ); _( "Clear old board and get old version of board" ) );
item->SetBitmap(jigsaw_xpm); item->SetBitmap( jigsaw_xpm );
m_FilesMenu->Append(item); filesMenu->Append( item );
// Add save menu // Add save menu
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD, item = new wxMenuItem( filesMenu, ID_MENU_SAVE_BOARD,
_("&Save Board Ctrl-S"), _( "&Save Board\tCtrl-S" ), _( "Save current board" ) );
_("Save current board") ); item->SetBitmap( save_xpm );
item->SetBitmap(save_xpm); filesMenu->Append( item );
m_FilesMenu->Append(item);
item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD_AS, item = new wxMenuItem( filesMenu, ID_MENU_SAVE_BOARD_AS,
_("Save Board as..."), _( "Save Board as..." ),
_("Save current board as..") ); _( "Save current board as.." ) );
item->SetBitmap(save_as_xpm); item->SetBitmap( save_as_xpm );
m_FilesMenu->Append(item); filesMenu->Append( item );
// Add print menu // Add print menu
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 pcb board")); _( "Print pcb board" ) );
item->SetBitmap(print_button); item->SetBitmap( print_button );
m_FilesMenu->Append(item); filesMenu->Append( item );
item = new wxMenuItem(m_FilesMenu, ID_GEN_PLOT_SVG, item = new wxMenuItem( filesMenu, ID_GEN_PLOT_SVG, _( "Print S&VG" ),
_("Print S&VG"), _("Plot pcb board in SVG format")); _( "Plot pcb board in SVG format" ) );
item->SetBitmap(print_button); item->SetBitmap( print_button );
m_FilesMenu->Append(item); filesMenu->Append( item );
// Add plot menu // Add plot menu
item = new wxMenuItem(m_FilesMenu, ID_GEN_PLOT, _("&Plot"), item = new wxMenuItem( filesMenu, ID_GEN_PLOT, _( "&Plot" ),
_("Plot (HPGL, PostScript, or Gerber format)")); _( "Plot (HPGL, PostScript, or Gerber format)" ) );
item->SetBitmap(plot_xpm); item->SetBitmap( plot_xpm );
m_FilesMenu->Append(item); filesMenu->Append( item );
// Add Export menu // Add Export menu
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
wxMenu * submenuexport = new wxMenu(); wxMenu* submenuexport = new wxMenu();
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_SPECCTRA, item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_SPECCTRA,
_("&Specctra DSN"), _("Export the current board to a \"Specctra DSN\" file") ); _( "&Specctra DSN" ),
item->SetBitmap(export_xpm); _( "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_GENCADFORMAT, item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT,
_("&GenCAD"), _("Export GenCAD Format") ); _( "&GenCAD" ), _( "Export GenCAD Format" ) );
item->SetBitmap(export_xpm); item->SetBitmap( export_xpm );
submenuexport->Append(item); submenuexport->Append( item );
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT, item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT,
_("&Module Report"), _("Create a board report (footprint report)") ); _( "&Module Report" ),
item->SetBitmap(tools_xpm); _( "Create a board report (footprint report)" ) );
submenuexport->Append(item); item->SetBitmap( tools_xpm );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuexport, submenuexport->Append( item );
ID_GEN_EXPORT_FILE, _("&Export"), _("Export board"), export_xpm); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuexport,
ID_GEN_EXPORT_FILE, _( "&Export" ),
_( "Export board" ), export_xpm );
//-----<Add import menu>----------------------------------------------- //-----<Add import menu>-----------------------------------------------
// no separator, keep it next to Import // no separator, keep it next to Import
wxMenu * submenuImport = new wxMenu(); wxMenu* submenuImport = new wxMenu();
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION, item = new wxMenuItem( submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION,
_("&Specctra Session"), _("Import a routed \"Specctra Session\" (*.ses) file") ); _( "&Specctra Session" ),
item->SetBitmap(import_xpm); // @todo need better bitmap _( "Import a routed \"Specctra Session\" (*.ses) file" ) );
submenuImport->Append(item); item->SetBitmap( import_xpm ); // @todo need better bitmap
submenuImport->Append( item );
/* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in specctra_import.cpp /* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in specctra_import.cpp
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN, * item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
_("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") ); * _("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
item->SetBitmap(export_xpm); // @todo need better bitmap * item->SetBitmap(export_xpm); // @todo need better bitmap
submenuImport->Append(item); * submenuImport->Append(item);
*/ */
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuImport, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuImport,
ID_GEN_IMPORT_FILE, _("Import"), _("Import files"), import_xpm); ID_GEN_IMPORT_FILE, _( "Import" ),
//-----</Add import menu>---------------------------------------------- _( "Import files" ), import_xpm );
// Add archive footprints menu //-----</Add import menu>----------------------------------------------
m_FilesMenu->AppendSeparator();
wxMenu * submenuarchive = new wxMenu();
item = new wxMenuItem(submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES,
_("Add New Footprints"),
_("Archive new footprints only in a library (keep other footprints in this lib)") );
item->SetBitmap(library_update_xpm);
submenuarchive->Append(item);
item = new wxMenuItem(submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES,
_("Create Footprint Archive"),
_("Archive all footprints in a library(old lib will be deleted)") );
item->SetBitmap(library_xpm);
submenuarchive->Append(item);
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuarchive,
ID_MENU_ARCHIVE_MODULES,
_("Archive Footprints"),
_("Archive or add footprints in a library file"), library_xpm);
// Add exit menu // Add archive footprints menu
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit PCBNEW") ); wxMenu* submenuarchive = new wxMenu();
item->SetBitmap(exit_xpm); item = new wxMenuItem( submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES,
m_FilesMenu->Append(item); _( "Add New Footprints" ),
_( "Archive new footprints only in a library (keep other footprints in this lib)" ) );
item->SetBitmap( library_update_xpm );
submenuarchive->Append( item );
item = new wxMenuItem( submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES,
_( "Create Footprint Archive" ),
_( "Archive all footprints in a library(old lib will be deleted)" ) );
item->SetBitmap( library_xpm );
submenuarchive->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuarchive,
ID_MENU_ARCHIVE_MODULES,
_( "Archive Footprints" ),
_( "Archive or add footprints in a library file" ),
library_xpm );
// Add exit menu
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_EXIT, _( "E&xit" ),
_( "Quit PCBNEW" ) );
item->SetBitmap( exit_xpm );
filesMenu->Append( item );
// Creation des selections des anciens fichiers wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
m_FilesMenu->AppendSeparator();
int max_file = wxGetApp().m_LastProjectMaxCount;
for ( ii = 0; ii < max_file; ii++ )
{
if ( GetLastProject(ii).IsEmpty() ) break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) );
}
/////////////////////////////////// ///////////////////////////////////
// Configuration et preferences: // // Configuration et preferences: //
/////////////////////////////////// ///////////////////////////////////
wxMenu * configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
item = new wxMenuItem(configmenu, ID_CONFIG_REQ, _("&Library"), item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
_("Setting libraries, directories and others...")); _( "Setting libraries, directories and others..." ) );
item->SetBitmap(library_xpm); item->SetBitmap( library_xpm );
configmenu->Append(item); configmenu->Append( item );
item = new wxMenuItem(configmenu, ID_COLORS_SETUP, _("&Colors"), item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_("Select colors and display for board items")); _( "Select colors and display for board items" ) );
item->SetBitmap(palette_xpm); item->SetBitmap( palette_xpm );
configmenu->Append(item); configmenu->Append( item );
item = new wxMenuItem(configmenu, ID_OPTIONS_SETUP, _("&General"), item = new wxMenuItem( configmenu, ID_OPTIONS_SETUP, _( "&General" ),
_("Select general options for PCBNEW")); _( "Select general options for PCBNEW" ) );
item->SetBitmap(preference_xpm); item->SetBitmap( preference_xpm );
configmenu->Append(item); configmenu->Append( item );
item = new wxMenuItem(configmenu, ID_PCB_LOOK_SETUP, _("&Display"), item = new wxMenuItem( configmenu, ID_PCB_LOOK_SETUP, _( "&Display" ),
_("Select what items are displayed")); _( "Select what items are displayed" ) );
item->SetBitmap(display_options_xpm); item->SetBitmap( display_options_xpm );
configmenu->Append(item); configmenu->Append( item );
// Font selection and setup // Font selection and setup
AddFontSelectionMenu(configmenu); AddFontSelectionMenu( configmenu );
wxGetApp().SetLanguageList(configmenu); wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save Preferences"), item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save Preferences" ),
_("Save application preferences")); _( "Save application preferences" ) );
item->SetBitmap(save_setup_xpm); item->SetBitmap( save_setup_xpm );
configmenu->Append(item); configmenu->Append( item );
item = new wxMenuItem(configmenu, ID_CONFIG_READ, _("&Read Preferences"), item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read Preferences" ),
_("Read application preferences")); _( "Read application preferences" ) );
item->SetBitmap(read_setup_xpm); item->SetBitmap( read_setup_xpm );
configmenu->Append(item); configmenu->Append( item );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu ); AddHotkeyConfigMenu( configmenu );
///////////////////////////// /////////////////////////////
// Ajustage de dimensions: // // Ajustage de dimensions: //
///////////////////////////// /////////////////////////////
wxMenu * sizes_menu = new wxMenu; wxMenu* sizes_menu = new wxMenu;
item = new wxMenuItem(sizes_menu, ID_PCB_TRACK_SIZE_SETUP, _("Tracks and Vias"), item = new wxMenuItem( sizes_menu, ID_PCB_TRACK_SIZE_SETUP,
_("Adjust size and width for tracks and vias")); _( "Tracks and Vias" ),
item->SetBitmap(showtrack_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_USER_GRID_SETUP, _("Grid"), item = new wxMenuItem( sizes_menu, ID_PCB_USER_GRID_SETUP, _( "Grid" ),
_("Adjust User Grid")); _( "Adjust User Grid" ) );
item->SetBitmap(grid_xpm); item->SetBitmap( grid_xpm );
sizes_menu->Append(item); sizes_menu->Append( item );
item = new wxMenuItem(sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP, _("Texts and Drawings"), item = new wxMenuItem( sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP,
_("Adjust width for texts and drawings")); _( "Texts and Drawings" ),
item->SetBitmap(options_text_xpm); _( "Adjust width for texts and drawings" ) );
sizes_menu->Append(item); item->SetBitmap( options_text_xpm );
sizes_menu->Append( item );
item = new wxMenuItem(sizes_menu, ID_PCB_PAD_SETUP, _("Pads"), item = new wxMenuItem( sizes_menu, ID_PCB_PAD_SETUP, _( "Pads" ),
_("Adjust size,shape,layers... for pads")); _( "Adjust size,shape,layers... for pads" ) );
item->SetBitmap(pad_xpm); item->SetBitmap( pad_xpm );
sizes_menu->Append(item); sizes_menu->Append( item );
sizes_menu->AppendSeparator(); sizes_menu->AppendSeparator();
item = new wxMenuItem(sizes_menu, ID_CONFIG_SAVE, _("&Save Setup"), item = new wxMenuItem( sizes_menu, ID_CONFIG_SAVE, _( "&Save Setup" ),
_("Save options in current directory")); _( "Save options in current directory" ) );
item->SetBitmap(save_xpm); item->SetBitmap( save_xpm );
sizes_menu->Append(item); sizes_menu->Append( item );
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// Menu postprocess ( generation fichiers percage, placement... // // Menu postprocess ( generation fichiers percage, placement... //
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
wxMenu *postprocess_menu = new wxMenu; wxMenu* postprocess_menu = new wxMenu;
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE, item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE,
_("Generate &Modules Position"), _( "Generate &Modules Position" ),
_("Generate modules position file")); _( "Generate modules position file" ) );
item->SetBitmap(post_compo_xpm); item->SetBitmap( post_compo_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_DRILL_FILE,
_("Generate excellon2 drill file")); _( "Create &Drill File" ),
item->SetBitmap(post_drill_xpm); _( "Generate excellon2 drill file" ) );
postprocess_menu->Append(item); item->SetBitmap( post_drill_xpm );
postprocess_menu->Append( item );
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_CMP_FILE, _("Create &Component File"), item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_CMP_FILE,
_("Recreate .cmp file for CvPcb")); _( "Create &Component File" ),
item->SetBitmap(save_cmpstuff_xpm); _( "Recreate .cmp file for CvPcb" ) );
postprocess_menu->Append(item); item->SetBitmap( save_cmpstuff_xpm );
postprocess_menu->Append( item );
////////////////////////// //////////////////////////
// Menu d'outils divers // // Menu d'outils divers //
////////////////////////// //////////////////////////
wxMenu *miscellaneous_menu = new wxMenu; wxMenu* miscellaneous_menu = new wxMenu;
item = new wxMenuItem(miscellaneous_menu, ID_PCB_GLOBAL_DELETE, _("Global &Deletions"), item = new wxMenuItem( miscellaneous_menu, ID_PCB_GLOBAL_DELETE,
_("Delete tracks, modules, texts... on board")); _( "Global &Deletions" ),
item->SetBitmap(general_deletions_xpm); _( "Delete tracks, modules, texts... on board" ) );
miscellaneous_menu->Append(item); item->SetBitmap( general_deletions_xpm );
miscellaneous_menu->Append( item );
item = new wxMenuItem(miscellaneous_menu, ID_MENU_LIST_NETS, _("&List Nets"), item =
_("List nets (names and id)")); 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,
_("Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias")); _( "&Track Operations" ),
item->SetBitmap(delete_body_xpm); _( "Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias" ) );
miscellaneous_menu->Append(item); item->SetBitmap( delete_body_xpm );
miscellaneous_menu->Append( item );
item = new wxMenuItem(miscellaneous_menu, ID_MENU_PCB_SWAP_LAYERS, _("&Swap Layers"), item = new wxMenuItem( miscellaneous_menu, ID_MENU_PCB_SWAP_LAYERS,
_("Swap tracks on copper layers or drawings on others layers")); _( "&Swap Layers" ),
item->SetBitmap(swap_layer_xpm); _( "Swap tracks on copper layers or drawings on others layers" ) );
miscellaneous_menu->Append(item); item->SetBitmap( swap_layer_xpm );
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 = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About PCBNEW" ),
item->SetBitmap(info_xpm); _( "About PCBNEW printed circuit board designer" ) );
helpMenu->Append(item); item->SetBitmap( info_xpm );
helpMenu->Append( item );
////////////////////// //////////////////////
// Menu Display 3D: // // Menu Display 3D: //
////////////////////// //////////////////////
wxMenu *Display3DMenu = new wxMenu; wxMenu* Display3DMenu = new wxMenu;
item = new wxMenuItem(Display3DMenu , ID_MENU_PCB_SHOW_3D_FRAME, _("3D Display"), _("Show board in 3D viewer")); item = new wxMenuItem( Display3DMenu, ID_MENU_PCB_SHOW_3D_FRAME,
item->SetBitmap(show_3d_xpm); _( "3D Display" ), _( "Show board in 3D viewer" ) );
Display3DMenu->Append(item); item->SetBitmap( show_3d_xpm );
Display3DMenu->Append( item );
menuBar->Append(m_FilesMenu, _("&File")); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append(configmenu, _("&Preferences")); menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append(sizes_menu, _("&Dimensions")); menuBar->Append( sizes_menu, _( "&Dimensions" ) );
menuBar->Append(miscellaneous_menu, _("&Miscellaneous")); menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) );
menuBar->Append(postprocess_menu, _("P&ostprocess")); menuBar->Append( postprocess_menu, _( "P&ostprocess" ) );
menuBar->Append(Display3DMenu, _("&3D Display")); menuBar->Append( Display3DMenu, _( "&3D Display" ) );
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 // 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) );
}
}
} }

View File

@ -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;

View File

@ -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;