Commit 21faf9d3 authored by stambaughw's avatar stambaughw

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

Integrate wxFileHistory, add missing header files to fix Linux build, initial search path work, and general housekeeping.
parent 5c4c584b
......@@ -5,6 +5,23 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
++All:
......
......@@ -32,7 +32,6 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype,
m_Ident = idtype;
SetFont( *g_StdFont );
m_MenuBar = NULL; // menu du haut d'ecran
m_HToolBar = NULL;
m_FrameIsActive = TRUE;
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
*/
{
unsigned ii;
wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
ReCreateMenuBar();
}
if( FullFileName.IsEmpty() )
return;
//suppression d'une ancienne trace eventuelle du meme fichier
for( ii = 0; ii < wxGetApp().m_LastProject.GetCount(); )
{
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++;
}
/**
* Fetch the file name from the file history list.
*/
wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
const wxString& type )
{
wxString fn, msg;
size_t i;
int baseId = wxGetApp().m_fileHistory.GetBaseId();
while( wxGetApp().m_LastProject.GetCount() >= wxGetApp().m_LastProjectMaxCount )
{
wxGetApp().m_LastProject.RemoveAt( wxGetApp().m_LastProject.GetCount() - 1 );
}
wxASSERT( cmdId >= baseId
&& cmdId < baseId + ( int )wxGetApp().m_fileHistory.GetCount() );
wxGetApp().m_LastProject.Insert( FullFileName, 0 );
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();
}
}
}
/**************************************************/
wxString WinEDA_BasicFrame::GetLastProject( int rang )
/**************************************************/
{
if( rang < 0 )
rang = 0;
if( (unsigned) rang >= wxGetApp().m_LastProject.GetCount() )
return wxEmptyString;
return wxGetApp().m_LastProject[rang];
return fn;
}
......
......@@ -47,7 +47,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
DrawPanel = NULL;
MsgPanel = NULL;
m_CurrentScreen = NULL;
m_MenuBar = NULL; // main meun frame
m_ID_current_state = 0;
m_HTOOL_current_state = 0;
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
// = 1000 for schema, = 10000 for PCB
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.y = 350 + m_MsgFrameHeight;
......@@ -91,17 +86,12 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_FramePos.x = m_FramePos.y = 0;
m_FrameSize.y -= m_MsgFrameHeight;
if( m_Ident != DISPLAY3D_FRAME )
{
DrawPanel = new WinEDA_DrawPanel( this, -1, wxPoint( 0, 0 ),
m_FrameSize );
DrawPanel = new WinEDA_DrawPanel( this, -1, wxPoint( 0, 0 ), m_FrameSize );
MsgPanel = new WinEDA_MsgPanel( this, -1, wxPoint( 0, m_FrameSize.y ),
wxSize( m_FrameSize.x,
m_MsgFrameHeight ) );
wxSize( m_FrameSize.x, 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 xUnit, yUnit;
if( screen == NULL )
return;
if( DrawPanel == NULL )
if( screen == NULL || DrawPanel == NULL )
return;
draw_size = screen->ReturnPageSize();
// 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
// la surface de trace doit etre augmentee
panel_size = DrawPanel->GetClientSize();
panel_size.x *= zoom; panel_size.y *= zoom;
draw_size.x += panel_size.x / 2;
draw_size.y += panel_size.y / 2;
panel_size = DrawPanel->GetClientSize() * zoom;
draw_size += panel_size / 2;
if( screen->m_Center )
......@@ -622,8 +606,7 @@ void WinEDA_DrawFrame::AdjustScrollBars()
screen->m_DrawOrg.y -= screen->m_DrawOrg.y % 256;
// Calcul du nombre de scrolls (en unites de scrool )
scrollbar_number.x = draw_size.x / (DrawPanel->m_Scroll_unit * zoom);
scrollbar_number.y = draw_size.y / (DrawPanel->m_Scroll_unit * zoom);
scrollbar_number = draw_size / (DrawPanel->m_Scroll_unit * zoom);
xUnit = yUnit = DrawPanel->m_Scroll_unit;
......@@ -631,13 +614,12 @@ void WinEDA_DrawFrame::AdjustScrollBars()
xUnit = 1;
if( yUnit <= 1 )
yUnit = 1;
xUnit *= zoom; yUnit *= zoom;
xUnit *= zoom;
yUnit *= zoom;
// Calcul de la position, curseur place au centre d'ecran
scrollbar_pos = screen->m_Curseur;
scrollbar_pos.x -= screen->m_DrawOrg.x;
scrollbar_pos.y -= screen->m_DrawOrg.y;
scrollbar_pos -= screen->m_DrawOrg;
scrollbar_pos.x -= panel_size.x / 2;
scrollbar_pos.y -= panel_size.y / 2;
......@@ -698,7 +680,12 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
int id = event.GetId();
wxGetApp().SetLanguageIdentifier( id );
wxGetApp().SetLanguage();
if ( wxGetApp().SetLanguage() )
{
wxLogDebug( wxT( "Recreating menu bar due to language change." ) );
ReCreateMenuBar();
Refresh();
}
}
......
......@@ -97,12 +97,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
* Draw the schematic cursor which is usually on grid
*/
{
if( m_CursorLevel != 0 )
{
return;
}
if( DC == NULL )
if( m_CursorLevel != 0 || DC == NULL )
return;
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 )
/**********************************************************************/
......@@ -240,9 +205,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
* @param ScreenPos = absolute position in pixels
*/
{
wxPoint curpos = GetScreen()->CursorRealPosition( ScreenPos );
return curpos;
return GetScreen()->CursorRealPosition( ScreenPos );
}
......@@ -268,13 +231,12 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
display_rect.Inflate( -PIXEL_MARGIN, -PIXEL_MARGIN );
// Conversion en coord physiques
pos = CalcAbsolutePosition( display_rect.GetPosition() );
pos = CalcUnscrolledPosition( display_rect.GetPosition() );
pos.x *= GetZoom();
pos.y *= GetZoom();
pos.x += GetScreen()->m_DrawOrg.x;
pos.y += GetScreen()->m_DrawOrg.y;
pos += GetScreen()->m_DrawOrg;
display_rect.SetX( pos.x );
display_rect.SetY( pos.y );
......@@ -385,18 +347,13 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )
wxSize size;
wxPoint realpos;
size = GetClientSize();
size.x /= 2;
size.y /= 2;
realpos = CalcAbsolutePosition( wxPoint( size.x, size.y ) );
size = GetClientSize() / 2;
realpos = CalcUnscrolledPosition( wxPoint( size.x, size.y ) );
realpos.x *= GetZoom();
realpos.y *= GetZoom();
realpos.x += GetScreen()->m_DrawOrg.x;
realpos.y += GetScreen()->m_DrawOrg.y;
realpos += GetScreen()->m_DrawOrg;
return realpos;
}
......@@ -428,11 +385,9 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
#ifdef WX_ZOOM
CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y );
#else
mouse = Mouse;
mouse.x -= GetScreen()->m_StartVisu.x;
mouse.y -= GetScreen()->m_StartVisu.y;
mouse = Mouse - GetScreen()->m_StartVisu;
#endif
GRMouseWarp( this, mouse );
WarpPointer( mouse.x, mouse.y );
}
......@@ -543,11 +498,9 @@ void WinEDA_DrawPanel::SetBoundaryBox()
#ifdef WX_ZOOM
m_ClipBox.m_Pos.x *= GetZoom();
m_ClipBox.m_Pos.y *= GetZoom();
m_ClipBox.m_Size.x *= GetZoom();
m_ClipBox.m_Size.y *= GetZoom();
m_ClipBox.m_Size *= GetZoom();
#else
m_ClipBox.m_Pos.x -= GetScreen()->m_StartVisu.x;
m_ClipBox.m_Pos.y -= GetScreen()->m_StartVisu.y;
m_ClipBox.m_Pos -= GetScreen()->m_StartVisu;
#endif
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.y *= zoom;
org.x += screen->m_DrawOrg.x;
org.y += screen->m_DrawOrg.y;
size = GetClientSize();
org += screen->m_DrawOrg;
size.x *= zoom;
size.y *= zoom;
size = GetClientSize() * zoom;
pasx = screen->m_Grid.x * 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;
wxMenu MasterMenu;
pos.x = event.GetX();
pos.y = event.GetY();
pos = event.GetPosition();
if( !m_Parent->OnRightClick( pos, &MasterMenu ) )
return false;
......@@ -921,13 +869,20 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
{
wxRect rect = GetRect();
wxLogDebug( wxT( "OnMouseWheel() cursor position: (%d, %d)." ),
event.m_x, event.m_y );
/* This fixes a bad rectangle horizontal position returned by the
* 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. */
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !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();
return;
}
......@@ -1029,7 +984,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
localrealbutt |= localbutt; /* compensation defaut wxGTK */
/* 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: */
screen->m_MousePosition = CursorRealPosition( screen->m_MousePositionInPixels );
......@@ -1247,6 +1202,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
{
long key, localkey;
bool escape = FALSE;
wxPoint pos;
key = localkey = event.GetKeyCode();
......@@ -1295,27 +1251,17 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
}
}
/* some key commands use the mouse position: refresh it */
#if wxCHECK_VERSION( 2, 8, 0 )
wxPoint mouse_pos = wxGetMousePosition(); // Get the mouse position on screen
wxPoint win_pos = GetScreenPosition(); // get the draw area (panel)position on screen
mouse_pos -= win_pos; // mouse_pos = is the mouse position relative to the panel
/* Compute absolute m_MousePosition in pixel units (i.e. considering the current scrool) : */
Screen->m_MousePositionInPixels = CalcAbsolutePosition( mouse_pos );
/* Compute absolute m_MousePosition in user units: */
Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels );
/* Some key commands use the current mouse position: refresh it */
pos = CalcUnscrolledPosition( wxGetMousePosition() - GetScreenPosition() );
#else
/* Compute absolute mouse position in pixel units (i.e. considering the
current scrool) : */
Screen->m_MousePositionInPixels = 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
/* Compute absolute mouse position in user units: */
Screen->m_MousePosition = CursorRealPosition( pos );
m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels );
m_Parent->GeneralControle( &DC, pos );
#if 0
event.Skip(); // Allow menu shortcut processing
......
......@@ -16,7 +16,10 @@
#include "fctsys.h"
#include "wx/html/htmlwin.h"
#include "wx/fs_zip.h"
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/stdpaths.h>
#include <wx/apptrait.h>
#include "common.h"
#include "worksheet.h"
......@@ -212,13 +215,11 @@ static struct LANGUAGE_DESCR s_Language_List[] =
WinEDA_App::WinEDA_App()
{
m_Checker = NULL;
m_LastProjectMaxCount = 10;
m_HtmlCtrl = NULL;
m_EDA_CommonConfig = NULL;
m_EDA_Config = NULL;
m_Env_Defined = FALSE;
m_LanguageId = wxLANGUAGE_DEFAULT;
m_Language_Menu = NULL;
m_Locale = NULL;
m_PdfBrowserIsDefault = TRUE;
}
......@@ -281,7 +282,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
/* Init parameters for configuration */
SetVendorName( wxT( "kicad" ) );
SetAppName( name );
SetAppName( name.Lower() );
m_EDA_Config = new wxConfig( name );
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
SetBinDir();
SetDefaultSearchPaths();
ReadPdfBrowserInfos();
// Internationalisation: loading the kicad suitable Dictionnary
......@@ -438,9 +440,57 @@ bool WinEDA_App::SetBinDir()
while( m_BinDir.Last() != '/' )
m_BinDir.RemoveLast();
wxLogDebug( wxT( "Executable path the Kicad way: " ) + m_BinDir );
wxLogDebug( wxT( "Executable path the wxWidgets way: " ) +
GetTraits()->GetStandardPaths().GetExecutablePath() );
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
......@@ -450,7 +500,7 @@ bool WinEDA_App::SetBinDir()
void WinEDA_App::GetSettings()
/*********************************/
{
wxString Line, Ident;
wxString Line, entry;
unsigned ii;
m_HelpSize.x = 500;
......@@ -468,16 +518,27 @@ void WinEDA_App::GetSettings()
if( !m_EDA_Config )
return;
/* Last 10 project settings */
for( ii = 0; ii < 10; ii++ )
{
Ident = wxT( "LastProject" );
m_fileHistory.Load( *m_EDA_Config );
if( ii )
Ident << 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 )
{
for( ii = 0; ii < ( unsigned )m_fileHistory.GetMaxFiles(); ii++ )
{
entry = wxT( "LastProject" );
if( ii != 0 )
entry << ii;
if( m_EDA_Config->Read( Ident, &Line ) )
m_LastProject.Add( Line );
if( m_EDA_Config->Read( entry, &Line ) )
{
if( Line != wxEmptyString && wxFileName::FileExists( Line ) )
m_fileHistory.AddFileToHistory( Line );
else
m_EDA_Config->Write( entry, wxEmptyString );
Line = wxEmptyString;
}
}
}
/* Set default font sizes */
......@@ -550,8 +611,6 @@ void WinEDA_App::GetSettings()
void WinEDA_App::SaveSettings()
/**********************************/
{
unsigned int i;
if( m_EDA_Config == NULL )
return;
......@@ -580,18 +639,8 @@ void WinEDA_App::SaveSettings()
m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() );
/* Save last 10 project list */
for( i = 0; i < 10; i++ )
{
wxString msg = wxT( "LastProject" );
if( i )
msg << i;
if( i < m_LastProject.GetCount() )
m_EDA_Config->Write( msg, m_LastProject[i] );
else
m_EDA_Config->Write( msg, wxEmptyString );
}
/* Save the file history list */
m_fileHistory.Save( *m_EDA_Config );
}
......@@ -607,52 +656,34 @@ void WinEDA_App::SaveSettings()
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)
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 )
delete m_Locale;
m_Locale = new wxLocale();
dic_path = ReturnKicadDatasPath() + BaseDictionaryPath;
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() )
/* Add defined search paths to locale paths */
if( !m_searchPaths.IsEmpty() )
{
wxFileName fn( m_BinDir, wxEmptyString );
dic_path = fn.GetPath();
int n = dic_path.Find( wxFileName::GetPathSeparator(), true );
if( n != wxNOT_FOUND )
for( i = 0; i < m_searchPaths.GetCount(); i++ )
{
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 ) )
{
wxLogDebug( wxT( "Failed to initialize " ) + m_Locale->GetName() );
wxLogDebug( wxT( "Failed to initialize " ) +
wxLocale::GetLanguageInfo( m_LanguageId )->Description );
delete m_Locale;
m_Locale = new wxLocale();
......@@ -661,11 +692,8 @@ bool WinEDA_App::SetLanguage( bool first_time )
retv = false;
}
if( !first_time )
{
if( m_EDA_CommonConfig )
if( !first_time && m_EDA_CommonConfig )
m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId );
}
if( !m_Locale->IsLoaded( DictionaryName ) )
m_Locale->AddCatalog( DictionaryName );
......@@ -712,51 +740,45 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id )
wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
/*********************************************************/
{
wxMenu* menu;
wxMenuItem* item;
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++ )
{
wxString MenuLabel = s_Language_List[ii].m_DoNotTranslate ?
wxString label = s_Language_List[ii].m_DoNotTranslate ?
s_Language_List[ii].m_Lang_Label :
wxGetTranslation(
s_Language_List[ii].m_Lang_Label );
wxGetTranslation( s_Language_List[ii].m_Lang_Label );
item = new wxMenuItem( m_Language_Menu,
item = new wxMenuItem( menu,
s_Language_List[ii].m_KI_Lang_Identifier,
MenuLabel,
wxEmptyString,
wxITEM_CHECK );
label, wxEmptyString, wxITEM_CHECK );
SETBITMAPS( s_Language_List[ii].m_Lang_Icon );
m_Language_Menu->Append( item );
menu->Append( item );
}
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu, menu,
ID_LANGUAGE_CHOICE,
_( "Language" ),
_( "Select application language (only for testing!)" ),
language_xpm );
}
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier )
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier,
true );
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,
_( "Language" ),
_( "Select application language (only for testing!)" ),
language_xpm );
menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, false );
}
return m_Language_Menu;
return menu;
}
......
......@@ -337,17 +337,6 @@ bool GetGRForceBlackPenState( void )
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 */
......
......@@ -50,24 +50,14 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
* @param coord = coordinate to adjust
*/
{
double tmp;
wxSize grid_size = GetBaseScreen()->GetGrid();
if( !GetBaseScreen()->m_UserGridIsON )
{
tmp = (double) coord->x / (double) grid_size.x;
coord->x = ( (int) round( tmp ) ) * grid_size.x;
tmp = (double) coord->y / (double) 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 ) );
coord->x = ( (int) round( (double) coord->x /
(double) grid_size.x ) ) * grid_size.x;
coord->y = ( (int) round( (double) coord->y /
(double) grid_size.y ) ) * grid_size.y;
}
}
......
......@@ -30,7 +30,6 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) :
m_ListCmp = NULL;
m_FootprintList = NULL;
DrawFrame = NULL;
m_FilesMenu = NULL;
m_HToolBar = NULL;
// Give an icon
......@@ -121,9 +120,7 @@ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event )
/* Event table for WinEDA_CvpcbFrame */
/*************************************/
BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
EVT_MENU_RANGE( ID_LOAD_PROJECT,
ID_LOAD_FILE_10,
WinEDA_CvpcbFrame::LoadNetList )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_CvpcbFrame::LoadNetList )
// Menu events
EVT_MENU( ID_SAVE_PROJECT,
......@@ -387,39 +384,28 @@ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event )
* Lit la netliste
*/
{
int id = event.GetId();
wxString fullfilename;
wxString oldfilename;
bool newfile;
wxString oldfilename;
wxString fn;
fn = GetFileFromHistory( event.GetId(), _( "Gerber" ) );
if( !NetInNameBuffer.IsEmpty() )
{
oldfilename = NetInNameBuffer;
}
switch( id )
if( fn != wxEmptyString )
{
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:
id -= ID_LOAD_FILE_1;
fullfilename = GetLastProject( id );
break;
}
newfile = ReadInputNetList( fn );
newfile = ReadInputNetList( fullfilename );
if( newfile && !oldfilename.IsEmpty() )
{
SetLastProject( NetInNameBuffer );
ReCreateMenuBar();
}
}
ReCreateMenuBar();
}
......
......@@ -34,9 +34,6 @@ public:
WinEDA_DisplayFrame* DrawFrame;
WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran
private:
wxMenu* m_FilesMenu;
// Constructor and destructor
public:
WinEDA_CvpcbFrame( const wxString &title,
......
......@@ -187,8 +187,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur;
delta.x = GetScreen()->GetGrid().x / zoom;
delta.y = GetScreen()->GetGrid().y / zoom;
delta = GetScreen()->GetGrid() / zoom;
if( delta.x <= 0 )
delta.x = 1;
if( delta.y <= 0 )
......@@ -233,28 +233,28 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
case WXK_UP:
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y - delta.y,
&Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse );
DrawPanel->MouseTo( Mouse );
break;
case WXK_NUMPAD2: /* cursor moved down */
case WXK_DOWN:
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y + delta.y,
&Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse );
DrawPanel->MouseTo( Mouse );
break;
case WXK_NUMPAD4: /* cursor moved left */
case WXK_LEFT:
DrawPanel->CalcScrolledPosition( Mouse.x - delta.x, Mouse.y,
&Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse );
DrawPanel->MouseTo( Mouse );
break;
case WXK_NUMPAD6: /* cursor moved right */
case WXK_RIGHT:
DrawPanel->CalcScrolledPosition( Mouse.x + delta.x, Mouse.y,
&Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse );
DrawPanel->MouseTo( Mouse );
break;
}
}
......@@ -269,8 +269,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
RedrawActiveWindow( DC, TRUE );
}
if( ( oldpos.x != GetScreen()->m_Curseur.x )
|| ( oldpos.y != GetScreen()->m_Curseur.y ) )
if( oldpos != GetScreen()->m_Curseur )
{
if( flagcurseur != 2 )
{
......
......@@ -99,44 +99,37 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
/* Creation des menus de la fenetre principale
*/
{
int ii;
wxMenuBar* menuBar = GetMenuBar();
wxMenuItem* item;
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();
// Associate the menu bar with the frame
SetMenuBar( menuBar );
m_FilesMenu = new wxMenu;
wxMenuItem* item = new wxMenuItem( m_FilesMenu, ID_LOAD_PROJECT,
wxMenu* filesMenu = new wxMenu;
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a NetList file" ) );
item->SetBitmap( open_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT,
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Save As..." ),
_( "Save New NetList and Footprints List files" ) );
item->SetBitmap( save_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
_( "Quit Cvpcb" ) );
item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
// Creation des selections des anciens fichiers
m_FilesMenu->AppendSeparator();
for( ii = 0; ii < 10; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
// Creation des selections des anciens fichiers
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
// Menu Configuration:
wxMenu* configmenu = new wxMenu;
......@@ -163,36 +156,16 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
_( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item =
new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
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" ) );
menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
}
else // simple mise a jour de la liste des fichiers anciens
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
}
// Associate the menu bar with the frame
SetMenuBar( menuBar );
}
......@@ -737,7 +737,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
g_ItemToRepeat->m_Flags = 0;
// GetScreen()->Curseur = new_pos;
// GRMouseWarp(DrawPanel, DrawPanel->CursorScreenPosition() );
// DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
}
}
......
......@@ -231,8 +231,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom;
delta.y = screen->GetGrid().y / zoom;
delta = screen->GetGrid() / zoom;
if( delta.x <= 0 )
delta.x = 1;
......@@ -300,8 +299,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
if( hotkey )
{
if( screen->GetCurItem()
&& screen->GetCurItem()->m_Flags )
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() );
else
OnHotKey( DC, hotkey, NULL );
......@@ -327,8 +325,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom;
delta.y = screen->GetGrid().y / zoom;
delta = screen->GetGrid() / zoom;
if( delta.x <= 0 )
delta.x = 1;
......@@ -396,8 +393,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
if( hotkey )
{
if( screen->GetCurItem()
&& screen->GetCurItem()->m_Flags )
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() );
else
OnHotKey( DC, hotkey, NULL );
......@@ -422,8 +418,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom;
delta.y = screen->GetGrid().y / zoom;
delta = screen->GetGrid() / zoom;
if( delta.x <= 0 )
delta.x = 1;
......@@ -491,8 +486,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
if( hotkey )
{
if( screen->GetCurItem()
&& screen->GetCurItem()->m_Flags )
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() );
else
OnHotKey( DC, hotkey, NULL );
......
......@@ -11,6 +11,7 @@
#include "program.h"
#include "general.h"
#include <wx/dcps.h>
#include "dialog_print_using_printer_base.h"
......
......@@ -430,7 +430,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE );
// GetScreen()->Curseur.x = ox; GetScreen()->Curseur.x = oy;
// GRMouseWarp(DrawPanel, DrawPanel->CursorScreenPosition() );
// DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
}
}
......
......@@ -185,7 +185,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
DrawPanel->CursorOff( &dc );
if( mouseWarp )
GRMouseWarp( DrawPanel, curpos );
DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
......@@ -359,7 +359,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType )
DrawPanel->PrepareGraphicContext( &dc );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc );
GRMouseWarp( DrawPanel, curpos );
DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOn( &dc );
}
......@@ -589,7 +589,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
DrawPanel->CursorOff( &dc );
if( mouseWarp )
GRMouseWarp( DrawPanel, curpos );
DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
......
......@@ -26,165 +26,147 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
/* create or update the menubar for the schematic frame
*/
{
int ii;
wxMenuBar* menuBar = GetMenuBar();
wxString msg;
wxMenuItem *item;
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 );
if( menuBar == NULL )
{
menuBar = new wxMenuBar();
m_FilesMenu = new wxMenu;
wxMenu* filesMenu = new wxMenu;
// Menu File:
wxMenuItem* item = new wxMenuItem( m_FilesMenu, ID_NEW_PROJECT,
_( "&New" ),
item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New" ),
_( "New schematic project" ) );
item->SetBitmap( new_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
item = new wxMenuItem( m_FilesMenu, ID_LOAD_PROJECT,
_( "&Open" ),
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open" ),
_( "Open an existing schematic project" ) );
item->SetBitmap( open_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT,
_( "&Save Project" ),
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save Project" ),
_( "Save all sheets in the schematic project" ) );
item->SetBitmap( save_project_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_SAVE_ONE_SHEET,
_( "&Save" ),
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET, _( "&Save" ),
_( "Save only current schematic sheet" ) );
item->SetBitmap( save_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
item = new wxMenuItem( m_FilesMenu, ID_SAVE_ONE_SHEET_AS,
_( "Save &as.." ),
item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET_AS, _( "Save &as.." ),
_( "Save current schematic sheet as.." ) );
item->SetBitmap( save_as_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
// Print and Plot section:
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_GEN_PRINT,
_( "P&rint" ), _( "Print schematic sheet" ) );
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_GEN_PRINT, _( "P&rint" ),
_( "Print schematic sheet" ) );
item->SetBitmap( print_button );
m_FilesMenu->Append( item );
filesMenu->Append( item );
/* Plot Submenu */
wxMenu* choice_plot_fmt = new wxMenu;
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS,
_( "Plot PostScript" ), _( "Plot schematic sheet in PostScript format" ) );
_( "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_HPGL,
_( "Plot HPGL" ), _( "Plot schematic sheet in HPGL format" ) );
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_HPGL, _( "Plot HPGL" ),
_( "Plot schematic sheet in HPGL format" ) );
item->SetBitmap( plot_HPG_xpm );
choice_plot_fmt->Append( item );
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG,
_( "Plot SVG" ), _( "Plot schematic sheet in SVG format" ) );
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG, _( "Plot SVG" ),
_( "Plot schematic sheet in SVG format" ) );
item->SetBitmap( plot_xpm );
choice_plot_fmt->Append( item );
#ifdef __WINDOWS__
/* Under windows, one can draw to the clipboard */
item = new wxMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
_( "Plot to Clipboard" ), _( "Export drawings to clipboard" ) );
_( "Plot to Clipboard" ),
_( "Export drawings to clipboard" ) );
item->SetBitmap( copy_button );
choice_plot_fmt->Append( item );
#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" ),
_( "Plot schematic sheet in HPGL, PostScript or SVG format" ), plot_xpm );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_EXIT, _( "E&xit" ), _( "Quit Eeschema" ) );
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_EXIT, _( "E&xit" ),
_( "Quit Eeschema" ) );
item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item );
// Create the list of last edited schematic files
m_FilesMenu->AppendSeparator();
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 );
}
filesMenu->Append( item );
/* Add the file history */
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
// Menu Edit:
wxMenu* editMenu = new wxMenu;
msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr,
HK_UNDO );
item = new wxMenuItem( editMenu, ID_SCHEMATIC_UNDO,
msg, _( "Undo last edition" ),
wxITEM_NORMAL );
msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr, HK_UNDO );
item = new wxMenuItem( editMenu, ID_SCHEMATIC_UNDO, msg,
_( "Undo last edition" ), wxITEM_NORMAL );
item->SetBitmap( undo_xpm );
editMenu->Append( item );
msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr,
HK_REDO );
item = new wxMenuItem( editMenu, ID_SCHEMATIC_REDO,
msg, _( "Redo the last undo command" ),
wxITEM_NORMAL );
msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr, HK_REDO );
item = new wxMenuItem( editMenu, ID_SCHEMATIC_REDO, msg,
_( "Redo the last undo command" ), wxITEM_NORMAL );
item->SetBitmap( redo_xpm );
editMenu->Append( item );
editMenu->AppendSeparator();
item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT,
_( "Delete" ), _( "Delete items" ),
wxITEM_NORMAL );
_( "Delete" ), _( "Delete items" ), wxITEM_NORMAL );
item->SetBitmap( delete_body_xpm );
editMenu->Append( item );
editMenu->AppendSeparator();
item = new wxMenuItem( editMenu, ID_FIND_ITEMS,
_( "Find" ), _( "Find components and texts" ),
wxITEM_NORMAL );
item = new wxMenuItem( editMenu, ID_FIND_ITEMS, _( "Find" ),
_( "Find components and texts" ), wxITEM_NORMAL );
item->SetBitmap( find_xpm );
editMenu->Append( item );
editMenu->AppendSeparator();
item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS,
_( "Backannotate" ), _( "Back annotated footprint fields" ),
item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS, _( "Backannotate" ),
_( "Back annotated footprint fields" ),
wxITEM_NORMAL );
item->SetBitmap( backanno_xpm );
editMenu->Append( item );
// Menu View:
wxMenu* viewMenu = new wxMenu;
msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_IN);
item = new wxMenuItem( viewMenu, ID_ZOOM_IN,
msg, _( "Zoom in" ),
msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr, HK_ZOOM_IN);
item = new wxMenuItem( viewMenu, ID_ZOOM_IN, msg, _( "Zoom in" ),
wxITEM_NORMAL );
item->SetBitmap( zoom_in_xpm );
viewMenu->Append( item );
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_OUT );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT,
msg, _( "Zoom out" ),
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, msg, _( "Zoom out" ),
wxITEM_NORMAL );
item->SetBitmap( zoom_out_xpm );
viewMenu->Append( item );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE,
_( "Zoom auto" ), _( "Zoom auto" ),
wxITEM_NORMAL );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, _( "Zoom auto" ),
_( "Zoom auto" ), wxITEM_NORMAL );
item->SetBitmap( zoom_auto_xpm );
viewMenu->Append( item );
......@@ -192,8 +174,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_REDRAW );
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW,
msg, _( "Zoom auto" ),
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, msg, _( "Zoom auto" ),
wxITEM_NORMAL );
item->SetBitmap( zoom_redraw_xpm );
viewMenu->Append( item );
......@@ -202,173 +183,118 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
//TODO: Unify the ID names!
wxMenu* placeMenu = new wxMenu;
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT,
_( "&Component" ), _( "Place the component" ),
wxITEM_NORMAL );
item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, _( "&Component" ),
_( "Place the component" ), wxITEM_NORMAL );
item->SetBitmap( add_component_xpm );
placeMenu->Append( item );
item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT,
_( "&Power port" ), _( "Place the power port" ),
wxITEM_NORMAL );
item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, _( "&Power port" ),
_( "Place the power port" ), wxITEM_NORMAL );
item->SetBitmap( add_power_xpm );
placeMenu->Append( item );
item = new wxMenuItem( placeMenu, ID_WIRE_BUTT,
_( "&Wire" ), _( "Place the wire" ),
wxITEM_NORMAL );
item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, _( "&Wire" ),
_( "Place the wire" ), wxITEM_NORMAL );
item->SetBitmap( add_line_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_BUS_BUTT,
_( "&Bus" ),
_( "Place bus" ),
wxITEM_NORMAL
);
item = new wxMenuItem( placeMenu, ID_BUS_BUTT, _( "&Bus" ),
_( "Place bus" ), wxITEM_NORMAL );
item->SetBitmap( add_bus_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_WIRETOBUS_ENTRY_BUTT,
item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT,
_( "W&ire to bus entry" ),
_( "Place a wire to bus entry" ),
wxITEM_NORMAL
);
_( "Place a wire to bus entry" ), wxITEM_NORMAL );
item->SetBitmap( add_line2bus_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_BUSTOBUS_ENTRY_BUTT,
item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT,
_( "B&us to bus entry" ),
_( "Place a bus to bus entry" ),
wxITEM_NORMAL
);
_( "Place a bus to bus entry" ), wxITEM_NORMAL );
item->SetBitmap( add_bus2bus_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_NOCONN_BUTT,
_( "No connect flag" ),
_( "Place a no connect flag" ),
wxITEM_NORMAL
);
item = new wxMenuItem( placeMenu, ID_NOCONN_BUTT, _( "No connect flag" ),
_( "Place a no connect flag" ), wxITEM_NORMAL );
item->SetBitmap( noconn_button );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_LABEL_BUTT,
_( "Net name" ),
_( "Place net name" ),
wxITEM_NORMAL
);
item = new wxMenuItem( placeMenu, ID_LABEL_BUTT, _( "Net name" ),
_( "Place net name" ), wxITEM_NORMAL );
item->SetBitmap( add_line_label_xpm );
placeMenu->Append( item );
item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT,
_( "Global label" ),
item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, _( "Global label" ),
_( "Place a global label. Warning: all global labels with the same name are connected in whole hierarchy" ),
wxITEM_NORMAL
);
wxITEM_NORMAL );
item->SetBitmap( add_glabel_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_JUNCTION_BUTT,
_( "Place Junction" ),
_( "Place junction" ),
wxITEM_NORMAL
);
item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, _( "Place Junction" ),
_( "Place junction" ), wxITEM_NORMAL );
item->SetBitmap( add_junction_xpm );
placeMenu->Append( item );
placeMenu->AppendSeparator();
item = new wxMenuItem(
placeMenu,
ID_HIERLABEL_BUTT,
item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT,
_( "Hierarchical label" ),
_( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ),
wxITEM_NORMAL
);
wxITEM_NORMAL );
item->SetBitmap( add_hierarchical_label_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_SHEET_SYMBOL_BUTT,
item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT,
_( "Hierarchical sheet" ),
_( "Create a hierarchical sheet" ),
wxITEM_NORMAL
);
_( "Create a hierarchical sheet" ), wxITEM_NORMAL );
item->SetBitmap( add_hierarchical_subsheet_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_IMPORT_GLABEL_BUTT,
item = new wxMenuItem( placeMenu, ID_IMPORT_GLABEL_BUTT,
_( "Import Hierarchical Label" ),
_( "Place a pin sheet created by importing a hierarchical label from sheet" ),
wxITEM_NORMAL
);
wxITEM_NORMAL );
item->SetBitmap( import_hierarchical_label_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_SHEET_LABEL_BUTT,
item = new wxMenuItem( placeMenu, ID_SHEET_LABEL_BUTT,
_( "Add Hierarchical Pin to Sheet" ),
_( "Place a hierarchical pin to sheet" ),
wxITEM_NORMAL
);
wxITEM_NORMAL );
item->SetBitmap( add_hierar_pin_xpm );
placeMenu->Append( item );
placeMenu->AppendSeparator();
item = new wxMenuItem(
placeMenu,
ID_LINE_COMMENT_BUTT,
item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT,
_( "Graphic line or polygon" ),
_( "Place graphic lines or polygons" ),
wxITEM_NORMAL
);
wxITEM_NORMAL );
item->SetBitmap( add_dashed_line_xpm );
placeMenu->Append( item );
item = new wxMenuItem(
placeMenu,
ID_TEXT_COMMENT_BUTT,
item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT,
_( "Graphic text (comment)" ),
_( "Place graphic text (comment)" ),
wxITEM_NORMAL
);
wxITEM_NORMAL );
item->SetBitmap( add_text_xpm );
placeMenu->Append( item );
// Menu Configuration:
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ,
_( "&Library" ),
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
_( "Library preferences" ) );
item->SetBitmap( library_xpm );
configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_COLORS_SETUP,
_( "&Colors" ),
item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Color preferences" ) );
item->SetBitmap( palette_xpm );
configmenu->Append( item );
// Options
item = new wxMenuItem( configmenu, ID_OPTIONS_SETUP,
_( "&Options" ),
item = new wxMenuItem( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
_( "General options..." ) );
item->SetBitmap( preference_xpm );
configmenu->Append( item );
......@@ -383,6 +309,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
_( "Save application preferences" ) );
item->SetBitmap( save_setup_xpm );
configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ),
_( "Read application preferences" ) );
item->SetBitmap( read_setup_xpm );
......@@ -393,18 +320,18 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
// Menu Help:
wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP,
_( "&Contents" ), _( "Open the eeschema manual" ) );
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the eeschema manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT,
_( "&About" ), _( "About eeschema schematic designer" ) );
item = 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( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) );
......@@ -413,30 +340,4 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
// Associate the menu bar with the frame
SetMenuBar( menuBar );
}
else // Update the list of last edited schematic files
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
{
SAFE_DELETE( item );
}
}
}
for( ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
item = new wxMenuItem( m_FilesMenu, ID_LOAD_FILE_1 + ii,
GetLastProject( ii ) );
m_FilesMenu->Append( item );
}
}
}
......@@ -40,8 +40,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_SchematicFrame::OnLoadFile )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_SchematicFrame::OnLoadFile )
EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
......@@ -576,10 +575,15 @@ void WinEDA_SchematicFrame::OnFindItems( 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" ) );
if( fn != wxEmptyString )
{
LoadOneEEProject( fn, false );
SetToolbars();
}
}
......
......@@ -26,7 +26,7 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
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,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
......@@ -39,6 +39,25 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
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,
LibraryStruct* Library,
......@@ -47,6 +66,8 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
wxDefaultPosition, wxDefaultSize )
/******************************************************************************/
{
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
m_FrameName = wxT( "ViewlibFrame" );
m_Draw_Axis = TRUE; // TRUE to dispaly Axis
......@@ -58,6 +79,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
m_CmpList = NULL;
m_LibList = NULL;
m_Semaphore = semaphore;
if( m_Semaphore )
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
......@@ -92,6 +114,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
if( m_LibList )
ReCreateListLib();
DisplayLibInfos();
SetAcceleratorTable( table );
BestZoom();
Show( TRUE );
}
......
......@@ -15,7 +15,24 @@
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 )
/********************************************************/
......@@ -64,24 +81,6 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
GetScreen()->SetRefreshReq();
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:
DisplayError( this, _( "Not yet available..." ) );
break;
......
......@@ -49,8 +49,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW,
WinEDA_GerberFrame::ExportDataInPcbnewFormat )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_GerberFrame::Files_io )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_GerberFrame::OnFileHistory )
EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
......
......@@ -59,6 +59,8 @@ bool WinEDA_App::OnInit()
frame->Show( TRUE ); // Show GerbView mainframe
frame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame
Read_Config();
if( argc > 1 )
{
wxString fileName = MakeFileName( wxEmptyString,
......@@ -75,8 +77,6 @@ bool WinEDA_App::OnInit()
if( path != wxEmptyString )
wxSetWorkingDirectory( path );
Read_Config();
// Load all files specified on the command line.
for( int i = 1; i<argc; ++i )
{
......@@ -93,8 +93,6 @@ bool WinEDA_App::OnInit()
}
}
}
else
Read_Config();
return TRUE;
}
......@@ -23,93 +23,76 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
/* Cree ou reinitialise le menu du haut d'ecran
*/
{
int ii;
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 );
if( menuBar == NULL )
{
menuBar = new wxMenuBar();
m_FilesMenu = new wxMenu;
m_FilesMenu->Append( ID_MENU_LOAD_FILE,
_( "Clear and Load Gerber file" ),
wxMenu* filesMenu = new wxMenu;
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,
_( "Load Gerber file" ),
filesMenu->Append( ID_MENU_APPEND_FILE, _( "Load Gerber file" ),
_( "Load new Gerber file on currrent layer" ),
FALSE );
m_FilesMenu->Append( ID_MENU_INC_LAYER_AND_APPEND_FILE,
filesMenu->Append( ID_MENU_INC_LAYER_AND_APPEND_FILE,
_( "Inc Layer and load Gerber file" ),
_( "Increment layer number, and Load Gerber file" ),
FALSE );
m_FilesMenu->Append( ID_GERBVIEW_LOAD_DCODE_FILE,
_( "Load DCodes" ),
_( "Load D-Codes File" ),
FALSE );
filesMenu->Append( ID_GERBVIEW_LOAD_DCODE_FILE, _( "Load DCodes" ),
_( "Load D-Codes File" ), FALSE );
#if 0
m_FilesMenu->Append( ID_GERBVIEW_LOAD_DRILL_FILE,
_( "Load drill" ),
_( "Load excellon drill file" ),
FALSE );
filesMenu->Append( ID_GERBVIEW_LOAD_DRILL_FILE, _( "Load drill" ),
_( "Load excellon drill file" ), FALSE );
#endif
m_FilesMenu->Append( ID_MENU_NEW_BOARD,
_( "&New" ),
_( "Clear all layers" ),
FALSE );
filesMenu->Append( ID_MENU_NEW_BOARD, _( "&New" ),
_( "Clear all layers" ), FALSE );
m_FilesMenu->AppendSeparator();
m_FilesMenu->Append( ID_GERBVIEW_EXPORT_TO_PCBNEW,
_( "&Export to Pcbnew" ),
_( "Export data in pcbnew format" ),
FALSE );
filesMenu->AppendSeparator();
filesMenu->Append( ID_GERBVIEW_EXPORT_TO_PCBNEW, _( "&Export to Pcbnew" ),
_( "Export data in pcbnew format" ), FALSE );
#if 0
m_FilesMenu->AppendSeparator();
m_FilesMenu->Append( ID_MENU_SAVE_BOARD,
_( "&Save layers" ),
_( "Save current layers (GERBER format)" ),
FALSE );
filesMenu->AppendSeparator();
filesMenu->Append( ID_MENU_SAVE_BOARD, _( "&Save layers" ),
_( "Save current layers (GERBER format)" ), FALSE );
m_FilesMenu->Append( ID_MENU_SAVE_BOARD_AS,
_( "Save layers as.." ),
_( "Save current layers as.." ),
FALSE );
filesMenu->Append( ID_MENU_SAVE_BOARD_AS, _( "Save layers as.." ),
_( "Save current layers as.." ), FALSE );
#endif
m_FilesMenu->AppendSeparator();
filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_GEN_PRINT, _( "P&rint" ), _( "Print gerber" ) );
m_FilesMenu->Append( ID_GEN_PLOT,
_( "Plot" ), _( "Plotting in various formats" ) );
filesMenu->Append( ID_GEN_PRINT, _( "P&rint" ), _( "Print gerber" ) );
filesMenu->Append( ID_GEN_PLOT, _( "Plot" ),
_( "Plotting in various formats" ) );
m_FilesMenu->AppendSeparator();
m_FilesMenu->Append( ID_EXIT, _( "E&xit" ), _( "Quit Gerbview" ) );
filesMenu->AppendSeparator();
filesMenu->Append( ID_EXIT, _( "E&xit" ), _( "Quit Gerbview" ) );
// Creation des selections des anciens fichiers
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 ) );
}
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
// Configuration:
wxMenu* configmenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&File ext" ),
_( "Setting Files extension" ), config_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Select Colors and Display for layers" ), palette_xpm );
_( "Select Colors and Display for layers" ),
palette_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
_( " Select general options" ), preference_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_PCB_LOOK_SETUP, _( "Display" ),
_( " Select how items are displayed" ), display_options_xpm );
_( " Select how items are displayed" ),
display_options_xpm );
// Font selection and setup
AddFontSelectionMenu( configmenu );
......@@ -118,13 +101,13 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
configmenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ),
_( "Save application preferences" ), save_setup_xpm );
_( "Save application preferences" ),
save_setup_xpm );
configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu );
// Menu drill ( generation fichiers percage)
// Menu drill ( generation fichiers percage)
/* wxMenu *drill_menu = new wxMenu;
* postprocess_menu->Append(ID_PCB_GEN_DRILL_FILE, "Create &Drill file",
......@@ -136,22 +119,24 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES,
_( "&List DCodes" ),
_( "List and edit D-codes" ), show_dcodenumber_xpm );
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_SOURCE, _( "&Show source" ),
_( "Show source file for the current layer" ), tools_xpm );
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_SOURCE,
_( "&Show source" ),
_( "Show source file for the current layer" ),
tools_xpm );
miscellaneous_menu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_PCB_GLOBAL_DELETE, _( "&Delete layer" ),
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_PCB_GLOBAL_DELETE,
_( "&Delete layer" ),
_( "Delete current layer" ), general_deletions_xpm );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the gerbview manual" ), help_xpm );
ADD_MENUITEM_WITH_HELP(helpMenu,
ID_KICAD_ABOUT, _( "&About gerbview" ),
ADD_MENUITEM_WITH_HELP(helpMenu, ID_KICAD_ABOUT, _( "&About gerbview" ),
_( "About gerbview gerber and drill viewer" ),
info_xpm );
menuBar->Append( m_FilesMenu, _( "&File" ) );
menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) );
......@@ -160,28 +145,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
// Associate the menu bar with the frame
SetMenuBar( menuBar );
}
else // Only an update of the files list
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
}
}
......
......@@ -14,6 +14,9 @@
#define eda_global extern
#endif
/* Use wxFileHistory for most recently used file handling. */
#include <wx/docview.h>
/**********************************************/
/* Class representing the entire Application */
......@@ -36,8 +39,6 @@ public:
wxString m_BinDir; /* Chemin ou reside l'executable
* (utilis si KICAD non dfini)*/
wxArrayString m_LastProject; /* liste des derniers projets chargs */
unsigned int m_LastProjectMaxCount; /* Max histhory file length */
wxString m_KicadEnv; /* Chemin de kicad dfini dans la
* variable d'environnement KICAD,
* typiquement /usr/local/kicad ou
......@@ -46,9 +47,10 @@ public:
wxLocale* m_Locale; // Gestion de la localisation
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
bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used)
wxPathList m_searchPaths;
wxFileHistory m_fileHistory;
public:
WinEDA_App();
......@@ -57,6 +59,7 @@ public:
int OnRun();
bool SetBinDir();
void SetDefaultSearchPaths( void );
void InitEDA_Appl( const wxString& name );
bool SetLanguage( bool first_time = FALSE );
wxMenu* SetLanguageList( wxMenu* MasterMenu );
......@@ -66,7 +69,6 @@ public:
// Sauvegarde de configurations et options:
void GetSettings();
void SaveSettings();
void SetLastProject( const wxString& FullFileName );
void WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName,
PARAM_CFG_BASE** List );
......
......@@ -80,7 +80,6 @@ public:
void PrepareGraphicContext( wxDC* DC );
wxPoint CalcAbsolutePosition( const wxPoint& rel_pos );
bool IsPointOnDisplay( wxPoint ref_pos );
void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event );
......
......@@ -59,7 +59,6 @@ int GRMapX(int x);
int GRMapY(int y);
class WinEDA_DrawPanel;
void GRMouseWarp(WinEDA_DrawPanel * panel, const wxPoint& pos); /* positionne la souris au point de coord pos */
/* routines generales */
void GRSetDrawMode(wxDC * DC, int mode);
......
......@@ -57,8 +57,6 @@ public:
private:
wxMenu* m_FilesMenu;
SCH_CMP_FIELD* m_CurrentField;
int m_TextFieldSize;
......
......@@ -336,7 +336,6 @@ public:
private:
bool m_SelTrackWidthBox_Changed;
bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu;
DRC* m_drc; ///< the DRC controller, see drc.cpp
......@@ -419,6 +418,7 @@ public:
void InstallDrillFrame( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
void Files_io( wxCommandEvent& event );
int LoadOnePcbFile( const wxString& FileName, bool Append );
int ReadPcbFile( FILE* File, bool Append );
......@@ -762,8 +762,6 @@ class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelLayerTool;
private:
wxMenu* m_FilesMenu;
public:
WinEDA_GerberFrame( wxWindow* father, const wxString& title,
......@@ -817,6 +815,7 @@ public:
int garde, int tracevia, int modetrace );
void Files_io( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
int LoadOneGerberFile( const wxString& FileName, wxDC* DC, int mode );
int ReadGerberFile( wxDC* DC, FILE* File, bool Append );
bool Read_GERBER_File( wxDC* DC,
......
......@@ -127,7 +127,6 @@ public:
wxSize m_FrameSize;
int m_MsgFrameHeight;
WinEDA_MenuBar* m_MenuBar; // menu du haut d'ecran
WinEDA_Toolbar* m_HToolBar; // Standard horizontal Toolbar
bool m_FrameIsActive;
wxString m_FrameName; // name used for writting and reading setup
......@@ -161,7 +160,7 @@ public:
void SetLanguage( wxCommandEvent& event );
void ProcessFontPreferences( int id );
wxString GetLastProject( int rang );
wxString GetFileFromHistory( int cmdId, const wxString& type );
void SetLastProject( const wxString& FullFileName );
void DisplayActivity( int PerCent, const wxString& Text );
virtual void ReCreateMenuBar();
......
......@@ -6,8 +6,6 @@
*/
/*****************************************************************************/
#include "wx/spinctrl.h"
#include "fctsys.h"
#include "common.h"
......@@ -78,9 +76,8 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame )
ID_LANGUAGE_CHOICE_END,
WinEDA_MainFrame::SetLanguage )
EVT_MENU_RANGE( ID_LOAD_PROJECT,
ID_LOAD_FILE_10,
WinEDA_MainFrame::Process_Files )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9,
WinEDA_MainFrame::OnFileHistory )
/* Button events */
EVT_BUTTON( ID_TO_PCB,
......@@ -109,139 +106,107 @@ END_EVENT_TABLE()
void WinEDA_MainFrame::ReCreateMenuBar()
/*****************************************************************************/
{
int ii, jj;
wxMenuBar* menuBar = GetMenuBar();
wxMenuItem *item;
wxMenuBar *menuBar = GetMenuBar();
// Check if menubar is empty
if( menuBar == NULL )
{
m_MenuBar = menuBar = new wxMenuBar();
m_FilesMenu = new wxMenu;
/* 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
wxMenu* filesMenu = new wxMenu;
// Open project
wxMenuItem* item = new wxMenuItem( m_FilesMenu,
ID_LOAD_PROJECT,
_( "&Open" ),
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open" ),
_( "Open an existing project" ) );
item->SetBitmap( open_project_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
// New project
item = new wxMenuItem( m_FilesMenu,
ID_NEW_PROJECT,
_( "&New" ),
item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New" ),
_( "Start a new project" ) );
item->SetBitmap( new_project_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
// Save project
item = new wxMenuItem( m_FilesMenu,
ID_SAVE_PROJECT,
_( "&Save" ),
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save" ),
_( "Save current project" ) );
item->SetBitmap( save_project_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
// Separator
m_FilesMenu->AppendSeparator();
filesMenu->AppendSeparator();
// Archive project
item = new wxMenuItem( m_FilesMenu,
ID_SAVE_AND_ZIP_FILES,
item = new wxMenuItem( filesMenu, ID_SAVE_AND_ZIP_FILES,
_( "&Archive" ),
_( "Archive project files in zip archive" ) );
item->SetBitmap( zip_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
// Unarchive project
item = new wxMenuItem( m_FilesMenu,
ID_READ_ZIP_ARCHIVE,
item = new wxMenuItem( filesMenu, ID_READ_ZIP_ARCHIVE,
_( "&Unarchive" ),
_( "Unarchive project files from zip file" ) );
item->SetBitmap( unzip_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
// Separator
m_FilesMenu->AppendSeparator();
filesMenu->AppendSeparator();
// Exit
item = new wxMenuItem( m_FilesMenu,
ID_EXIT,
_( "E&xit" ),
item = new wxMenuItem( filesMenu, ID_EXIT, _( "E&xit" ),
_( "Quit kicad" ) );
item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item );
filesMenu->Append( item );
// Create last 10 project entries
m_FilesMenu->AppendSeparator();
for( ii = 0; ii < 10; ii++ )
{
m_MenuBar = menuBar = new wxMenuBar();
/* Add the file history */
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
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
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,
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 = 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,
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,
......@@ -285,62 +250,29 @@ void WinEDA_MainFrame::ReCreateMenuBar()
wxGetApp().SetLanguageList( PreferencesMenu );
/*************************************************************************/
/**********************************************************************/
wxMenu* helpMenu = new wxMenu;
/*************************************************************************/
/**********************************************************************/
// Contents
item = new wxMenuItem( helpMenu,
ID_GENERAL_HELP,
_( "&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" ),
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( filesMenu, _( "&File" ) );
menuBar->Append( browseMenu, _( "&Browse" ) );
menuBar->Append( PreferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame
SetMenuBar( menuBar );
}
else // TODO (ENGLISH!) simple mise a jour de la liste des fichiers anciens
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( jj = 0, ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + jj, GetLastProject( ii ) );
jj++;
}
}
}
......
......@@ -27,6 +27,21 @@
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 )
/***********************************************************/
......@@ -46,22 +61,6 @@ void WinEDA_MainFrame::Process_Files( wxCommandEvent& event )
Save_Prj_Config();
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:
IsNew = TRUE;
......
......@@ -385,12 +385,14 @@ bool WinEDA_App::OnInit()
if( argc > 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" ),
nameless_project );
frame->m_PrjFileName = m_fileHistory.GetHistoryFile( 0 );
if( !wxFileName::FileExists( frame->m_PrjFileName ) )
m_fileHistory.RemoveFileFromHistory( 0 );
}
else
if( !wxFileName::FileExists( frame->m_PrjFileName ) )
frame->m_PrjFileName = nameless_project;
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
......
......@@ -46,9 +46,6 @@ public:
int m_LeftWin_Width;
int m_CommandWin_Height;
private:
wxMenu* m_FilesMenu;
public:
// Constructor and destructor
......@@ -65,6 +62,7 @@ public:
void Load_Prj_Config();
void Save_Prj_Config();
void Process_Fct( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
void Process_Files( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
......
......@@ -147,8 +147,11 @@ void WinEDA_MainFrame::Process_Preferences( wxCommandEvent& event )
void WinEDA_MainFrame::SetLanguage( wxCommandEvent& event )
/********************************************************/
{
int id = event.GetId();
wxGetApp().SetLanguageIdentifier( id );
wxGetApp().SetLanguage();
wxGetApp().SetLanguageIdentifier( event.GetId() );
if ( wxGetApp().SetLanguage() )
{
wxLogDebug( wxT( "Recreating menu bar due to language change." ) );
ReCreateMenuBar();
Refresh();
}
}
......@@ -23,7 +23,7 @@ void WinEDA_MainFrame::Load_Prj_Config()
{
if( !wxFileExists( m_PrjFileName ) )
{
wxString msg = _( "Project File <" ) + m_PrjFileName +
wxString msg = _( "Kicad project file <" ) + m_PrjFileName +
_( "> not found" );
DisplayError( this, msg );
return;
......@@ -32,7 +32,7 @@ void WinEDA_MainFrame::Load_Prj_Config()
wxSetWorkingDirectory( wxPathOnly( m_PrjFileName ) );
SetTitle( g_Main_Title + wxT( " " ) + GetBuildVersion() + wxT( " " ) +
m_PrjFileName );
ReCreateMenuBar();
SetLastProject( m_PrjFileName );
m_LeftWin->ReCreateTreePrj();
wxString msg = _( "\nWorking dir: " ) + wxGetCwd();
......
......@@ -41,7 +41,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
long 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_DisplayPadFill = TRUE; // How to draw pads
......@@ -128,7 +128,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
// Put cursor on item position
DrawPanel->CursorOff( &dc );
screen->m_Curseur = aPos;
GRMouseWarp( DrawPanel, screen->m_Curseur );
DrawPanel->MouseTo( screen->m_Curseur );
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
}
......
......@@ -5,7 +5,6 @@
/* controle.cpp */
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
......@@ -516,11 +515,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
}
curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur;
delta.x = (int) round( (double) GetScreen()->GetGrid().x / zoom );
delta.y = (int) round( (double) GetScreen()->GetGrid().y / zoom );
delta = GetScreen()->GetGrid() / zoom;
if( delta.x <= 0 )
delta.x = 1;
......@@ -594,7 +591,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
// "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
if( !Drc_On || !g_CurrentTrackSegment
|| g_CurrentTrackSegment != this->GetCurItem()
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment->GetNet(),
|| !LocateIntrusion( m_Pcb->m_Track,
g_CurrentTrackSegment->GetNet(),
g_CurrentTrackSegment->m_Width ) )
{
GetScreen()->m_Curseur = on_grid;
......
......@@ -8,6 +8,8 @@
#include "fctsys.h"
#include "common.h"
#include <wx/dcps.h>
#include "dialog_print_using_printer_base.h"
#include "pcbnew.h"
......
......@@ -10,6 +10,30 @@
#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 )
/****************************************************/
......@@ -84,22 +108,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
ReCreateLayerBox( NULL );
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_MENU_SAVE_BOARD:
SavePcbFile( GetScreen()->m_FileName );
......
......@@ -21,203 +21,195 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
/***********************************************/
/* Cree ou reinitialise le menu du haut d'ecran
*/
*/
{
int ii;
wxMenuBar * menuBar = GetMenuBar();
if( menuBar == NULL )
{
menuBar = new wxMenuBar();
wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar();
//////////////////
// Menu "Files" //
//////////////////
/* 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 );
// New wxMenu (FilesMenu)
m_FilesMenu = new wxMenu;
menuBar = new wxMenuBar();
wxMenu* filesMenu = new wxMenu;
// New board
wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_MENU_NEW_BOARD,
_("&New Board"),
_("Clear old board and initialize a new one"));
item->SetBitmap(new_xpm);
m_FilesMenu->Append(item);
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 );
// Load board
item = new wxMenuItem(m_FilesMenu, ID_MENU_LOAD_FILE,
_("&Load Board"),
_("Delete old board and load new board"));
item->SetBitmap(open_xpm);
m_FilesMenu->Append(item);
item = new wxMenuItem( filesMenu, ID_MENU_LOAD_FILE, _( "&Load Board" ),
_( "Delete old board and load new board" ) );
item->SetBitmap( open_xpm );
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( filesMenu, ID_MENU_APPEND_FILE, _( "Append Board" ),
_( "Add board to old board" ) );
item->SetBitmap( import_xpm );
filesMenu->Append( item );
item = new wxMenuItem(m_FilesMenu, ID_MENU_RECOVER_BOARD,
_("&Rescue"),
_("Clear old board and get last rescue file"));
item->SetBitmap(hammer_xpm);
m_FilesMenu->Append(item);
item = new wxMenuItem( filesMenu, ID_MENU_RECOVER_BOARD, _( "&Rescue" ),
_( "Clear old board and get last rescue file" ) );
item->SetBitmap( hammer_xpm );
filesMenu->Append( item );
item = new wxMenuItem(m_FilesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD,
_("&Previous Version"),
_("Clear old board and get old version of board") );
item->SetBitmap(jigsaw_xpm);
m_FilesMenu->Append(item);
item = new wxMenuItem( filesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD,
_( "&Previous Version" ),
_( "Clear old board and get old version of board" ) );
item->SetBitmap( jigsaw_xpm );
filesMenu->Append( item );
// Add save menu
m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD,
_("&Save Board Ctrl-S"),
_("Save current board") );
item->SetBitmap(save_xpm);
m_FilesMenu->Append(item);
item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD_AS,
_("Save Board as..."),
_("Save current board as..") );
item->SetBitmap(save_as_xpm);
m_FilesMenu->Append(item);
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_MENU_SAVE_BOARD,
_( "&Save Board\tCtrl-S" ), _( "Save current board" ) );
item->SetBitmap( save_xpm );
filesMenu->Append( item );
item = new wxMenuItem( filesMenu, ID_MENU_SAVE_BOARD_AS,
_( "Save Board as..." ),
_( "Save current board as.." ) );
item->SetBitmap( save_as_xpm );
filesMenu->Append( item );
// Add print menu
m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_GEN_PRINT,
_("P&rint"), _("Print pcb board"));
item->SetBitmap(print_button);
m_FilesMenu->Append(item);
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_GEN_PRINT, _( "P&rint" ),
_( "Print pcb board" ) );
item->SetBitmap( print_button );
filesMenu->Append( item );
item = new wxMenuItem(m_FilesMenu, ID_GEN_PLOT_SVG,
_("Print S&VG"), _("Plot pcb board in SVG format"));
item->SetBitmap(print_button);
m_FilesMenu->Append(item);
item = new wxMenuItem( filesMenu, ID_GEN_PLOT_SVG, _( "Print S&VG" ),
_( "Plot pcb board in SVG format" ) );
item->SetBitmap( print_button );
filesMenu->Append( item );
// Add plot menu
item = new wxMenuItem(m_FilesMenu, ID_GEN_PLOT, _("&Plot"),
_("Plot (HPGL, PostScript, or Gerber format)"));
item->SetBitmap(plot_xpm);
m_FilesMenu->Append(item);
item = new wxMenuItem( filesMenu, ID_GEN_PLOT, _( "&Plot" ),
_( "Plot (HPGL, PostScript, or Gerber format)" ) );
item->SetBitmap( plot_xpm );
filesMenu->Append( item );
// Add Export menu
m_FilesMenu->AppendSeparator();
wxMenu * submenuexport = new wxMenu();
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_SPECCTRA,
_("&Specctra DSN"), _("Export the current board to a \"Specctra DSN\" file") );
item->SetBitmap(export_xpm);
submenuexport->Append(item);
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT,
_("&GenCAD"), _("Export GenCAD Format") );
item->SetBitmap(export_xpm);
submenuexport->Append(item);
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT,
_("&Module Report"), _("Create a board report (footprint report)") );
item->SetBitmap(tools_xpm);
submenuexport->Append(item);
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuexport,
ID_GEN_EXPORT_FILE, _("&Export"), _("Export board"), export_xpm);
filesMenu->AppendSeparator();
wxMenu* submenuexport = new wxMenu();
item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_SPECCTRA,
_( "&Specctra DSN" ),
_( "Export the current board to a \"Specctra DSN\" file" ) );
item->SetBitmap( export_xpm );
submenuexport->Append( item );
item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT,
_( "&GenCAD" ), _( "Export GenCAD Format" ) );
item->SetBitmap( export_xpm );
submenuexport->Append( item );
item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT,
_( "&Module Report" ),
_( "Create a board report (footprint report)" ) );
item->SetBitmap( tools_xpm );
submenuexport->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuexport,
ID_GEN_EXPORT_FILE, _( "&Export" ),
_( "Export board" ), export_xpm );
//-----<Add import menu>-----------------------------------------------
// no separator, keep it next to Import
wxMenu * submenuImport = new wxMenu();
wxMenu* submenuImport = new wxMenu();
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION,
_("&Specctra Session"), _("Import a routed \"Specctra Session\" (*.ses) file") );
item->SetBitmap(import_xpm); // @todo need better bitmap
submenuImport->Append(item);
item = new wxMenuItem( submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION,
_( "&Specctra Session" ),
_( "Import a routed \"Specctra Session\" (*.ses) file" ) );
item->SetBitmap( import_xpm ); // @todo need better bitmap
submenuImport->Append( item );
/* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in specctra_import.cpp
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
_("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
item->SetBitmap(export_xpm); // @todo need better bitmap
submenuImport->Append(item);
* item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
* _("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
* item->SetBitmap(export_xpm); // @todo need better bitmap
* submenuImport->Append(item);
*/
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuImport,
ID_GEN_IMPORT_FILE, _("Import"), _("Import files"), import_xpm);
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuImport,
ID_GEN_IMPORT_FILE, _( "Import" ),
_( "Import files" ), import_xpm );
//-----</Add import menu>----------------------------------------------
// Add archive footprints 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,
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( filesMenu, submenuarchive,
ID_MENU_ARCHIVE_MODULES,
_("Archive Footprints"),
_("Archive or add footprints in a library file"), library_xpm);
_( "Archive Footprints" ),
_( "Archive or add footprints in a library file" ),
library_xpm );
// Add exit menu
m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit PCBNEW") );
item->SetBitmap(exit_xpm);
m_FilesMenu->Append(item);
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
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) );
}
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
///////////////////////////////////
// Configuration et preferences: //
///////////////////////////////////
wxMenu * configmenu = new wxMenu;
item = new wxMenuItem(configmenu, ID_CONFIG_REQ, _("&Library"),
_("Setting libraries, directories and others..."));
item->SetBitmap(library_xpm);
configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_COLORS_SETUP, _("&Colors"),
_("Select colors and display for board items"));
item->SetBitmap(palette_xpm);
configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_OPTIONS_SETUP, _("&General"),
_("Select general options for PCBNEW"));
item->SetBitmap(preference_xpm);
configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_PCB_LOOK_SETUP, _("&Display"),
_("Select what items are displayed"));
item->SetBitmap(display_options_xpm);
configmenu->Append(item);
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
_( "Setting libraries, directories and others..." ) );
item->SetBitmap( library_xpm );
configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Select colors and display for board items" ) );
item->SetBitmap( palette_xpm );
configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_OPTIONS_SETUP, _( "&General" ),
_( "Select general options for PCBNEW" ) );
item->SetBitmap( preference_xpm );
configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_PCB_LOOK_SETUP, _( "&Display" ),
_( "Select what items are displayed" ) );
item->SetBitmap( display_options_xpm );
configmenu->Append( item );
// Font selection and setup
AddFontSelectionMenu(configmenu);
AddFontSelectionMenu( configmenu );
wxGetApp().SetLanguageList(configmenu);
wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save Preferences"),
_("Save application preferences"));
item->SetBitmap(save_setup_xpm);
configmenu->Append(item);
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save Preferences" ),
_( "Save application preferences" ) );
item->SetBitmap( save_setup_xpm );
configmenu->Append( item );
item = new wxMenuItem(configmenu, ID_CONFIG_READ, _("&Read Preferences"),
_("Read application preferences"));
item->SetBitmap(read_setup_xpm);
configmenu->Append(item);
item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read Preferences" ),
_( "Read application preferences" ) );
item->SetBitmap( read_setup_xpm );
configmenu->Append( item );
configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu );
......@@ -225,128 +217,117 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
/////////////////////////////
// Ajustage de dimensions: //
/////////////////////////////
wxMenu * sizes_menu = new wxMenu;
item = new wxMenuItem(sizes_menu, ID_PCB_TRACK_SIZE_SETUP, _("Tracks and Vias"),
_("Adjust size and width for tracks and vias"));
item->SetBitmap(showtrack_xpm);
sizes_menu->Append(item);
item = new wxMenuItem(sizes_menu, ID_PCB_USER_GRID_SETUP, _("Grid"),
_("Adjust User Grid"));
item->SetBitmap(grid_xpm);
sizes_menu->Append(item);
item = new wxMenuItem(sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP, _("Texts and Drawings"),
_("Adjust width for texts and drawings"));
item->SetBitmap(options_text_xpm);
sizes_menu->Append(item);
item = new wxMenuItem(sizes_menu, ID_PCB_PAD_SETUP, _("Pads"),
_("Adjust size,shape,layers... for pads"));
item->SetBitmap(pad_xpm);
sizes_menu->Append(item);
wxMenu* sizes_menu = new wxMenu;
item = new wxMenuItem( sizes_menu, ID_PCB_TRACK_SIZE_SETUP,
_( "Tracks and Vias" ),
_( "Adjust size and width for tracks and vias" ) );
item->SetBitmap( showtrack_xpm );
sizes_menu->Append( item );
item = new wxMenuItem( sizes_menu, ID_PCB_USER_GRID_SETUP, _( "Grid" ),
_( "Adjust User Grid" ) );
item->SetBitmap( grid_xpm );
sizes_menu->Append( item );
item = new wxMenuItem( sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP,
_( "Texts and Drawings" ),
_( "Adjust width for texts and drawings" ) );
item->SetBitmap( options_text_xpm );
sizes_menu->Append( item );
item = new wxMenuItem( sizes_menu, ID_PCB_PAD_SETUP, _( "Pads" ),
_( "Adjust size,shape,layers... for pads" ) );
item->SetBitmap( pad_xpm );
sizes_menu->Append( item );
sizes_menu->AppendSeparator();
item = new wxMenuItem(sizes_menu, ID_CONFIG_SAVE, _("&Save Setup"),
_("Save options in current directory"));
item->SetBitmap(save_xpm);
sizes_menu->Append(item);
item = new wxMenuItem( sizes_menu, ID_CONFIG_SAVE, _( "&Save Setup" ),
_( "Save options in current directory" ) );
item->SetBitmap( save_xpm );
sizes_menu->Append( item );
//////////////////////////////////////////////////////////////////
// Menu postprocess ( generation fichiers percage, placement... //
//////////////////////////////////////////////////////////////////
wxMenu *postprocess_menu = new wxMenu;
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE,
_("Generate &Modules Position"),
_("Generate modules position file"));
item->SetBitmap(post_compo_xpm);
postprocess_menu->Append(item);
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_DRILL_FILE, _("Create &Drill File"),
_("Generate excellon2 drill file"));
item->SetBitmap(post_drill_xpm);
postprocess_menu->Append(item);
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_CMP_FILE, _("Create &Component File"),
_("Recreate .cmp file for CvPcb"));
item->SetBitmap(save_cmpstuff_xpm);
postprocess_menu->Append(item);
wxMenu* postprocess_menu = new wxMenu;
item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE,
_( "Generate &Modules Position" ),
_( "Generate modules position file" ) );
item->SetBitmap( post_compo_xpm );
postprocess_menu->Append( item );
item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_DRILL_FILE,
_( "Create &Drill File" ),
_( "Generate excellon2 drill file" ) );
item->SetBitmap( post_drill_xpm );
postprocess_menu->Append( item );
item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_CMP_FILE,
_( "Create &Component File" ),
_( "Recreate .cmp file for CvPcb" ) );
item->SetBitmap( save_cmpstuff_xpm );
postprocess_menu->Append( item );
//////////////////////////
// Menu d'outils divers //
//////////////////////////
wxMenu *miscellaneous_menu = new wxMenu;
item = new wxMenuItem(miscellaneous_menu, ID_PCB_GLOBAL_DELETE, _("Global &Deletions"),
_("Delete tracks, modules, texts... on board"));
item->SetBitmap(general_deletions_xpm);
miscellaneous_menu->Append(item);
item = new wxMenuItem(miscellaneous_menu, ID_MENU_LIST_NETS, _("&List Nets"),
_("List nets (names and id)"));
item->SetBitmap(tools_xpm);
miscellaneous_menu->Append(item);
item = new wxMenuItem(miscellaneous_menu, ID_MENU_PCB_CLEAN, _("&Track Operations"),
_("Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias"));
item->SetBitmap(delete_body_xpm);
miscellaneous_menu->Append(item);
item = new wxMenuItem(miscellaneous_menu, ID_MENU_PCB_SWAP_LAYERS, _("&Swap Layers"),
_("Swap tracks on copper layers or drawings on others layers"));
item->SetBitmap(swap_layer_xpm);
miscellaneous_menu->Append(item);
wxMenu* miscellaneous_menu = new wxMenu;
item = new wxMenuItem( miscellaneous_menu, ID_PCB_GLOBAL_DELETE,
_( "Global &Deletions" ),
_( "Delete tracks, modules, texts... on board" ) );
item->SetBitmap( general_deletions_xpm );
miscellaneous_menu->Append( item );
item =
new wxMenuItem( miscellaneous_menu, ID_MENU_LIST_NETS, _( "&List Nets" ),
_( "List nets (names and id)" ) );
item->SetBitmap( tools_xpm );
miscellaneous_menu->Append( item );
item = new wxMenuItem( miscellaneous_menu, ID_MENU_PCB_CLEAN,
_( "&Track Operations" ),
_( "Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias" ) );
item->SetBitmap( delete_body_xpm );
miscellaneous_menu->Append( item );
item = new wxMenuItem( miscellaneous_menu, ID_MENU_PCB_SWAP_LAYERS,
_( "&Swap Layers" ),
_( "Swap tracks on copper layers or drawings on others layers" ) );
item->SetBitmap( swap_layer_xpm );
miscellaneous_menu->Append( item );
////////////////
// Menu Help: //
////////////////
wxMenu *helpMenu = new wxMenu;
item = new wxMenuItem(helpMenu , ID_GENERAL_HELP, _("&Contents"), _("Open the PCBNEW manual"));
item->SetBitmap(help_xpm);
helpMenu->Append(item);
wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the PCBNEW manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item = new wxMenuItem(helpMenu , ID_KICAD_ABOUT, _("&About PCBNEW"), _("About PCBNEW printed circuit board designer"));
item->SetBitmap(info_xpm);
helpMenu->Append(item);
item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About PCBNEW" ),
_( "About PCBNEW printed circuit board designer" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
//////////////////////
// Menu Display 3D: //
//////////////////////
wxMenu *Display3DMenu = new wxMenu;
item = new wxMenuItem(Display3DMenu , ID_MENU_PCB_SHOW_3D_FRAME, _("3D Display"), _("Show board in 3D viewer"));
item->SetBitmap(show_3d_xpm);
Display3DMenu->Append(item);
menuBar->Append(m_FilesMenu, _("&File"));
menuBar->Append(configmenu, _("&Preferences"));
menuBar->Append(sizes_menu, _("&Dimensions"));
menuBar->Append(miscellaneous_menu, _("&Miscellaneous"));
menuBar->Append(postprocess_menu, _("P&ostprocess"));
menuBar->Append(Display3DMenu, _("&3D Display"));
menuBar->Append(helpMenu, _("&Help"));
wxMenu* Display3DMenu = new wxMenu;
item = new wxMenuItem( Display3DMenu, ID_MENU_PCB_SHOW_3D_FRAME,
_( "3D Display" ), _( "Show board in 3D viewer" ) );
item->SetBitmap( show_3d_xpm );
Display3DMenu->Append( item );
menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( sizes_menu, _( "&Dimensions" ) );
menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) );
menuBar->Append( postprocess_menu, _( "P&ostprocess" ) );
menuBar->Append( Display3DMenu, _( "&3D Display" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame
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) );
}
}
SetMenuBar( menuBar );
}
......@@ -211,10 +211,10 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
m_drc = new DRC( this ); // these 2 objects point to each other
SetBoard( new BOARD( NULL, this ) );
m_drc = new DRC( this ); // these 2 objects point to each other
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
......
......@@ -184,30 +184,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
/* Create the main horizontal toolbar for the board editor */
{
int ii;
wxString msg;
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");)
SetToolbars();
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment