Commit 21faf9d3 authored by stambaughw's avatar stambaughw

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

Integrate wxFileHistory, add missing header files to fix Linux build, initial search path work, and general housekeeping.
parent 5c4c584b
...@@ -5,6 +5,23 @@ Started 2007-June-11 ...@@ -5,6 +5,23 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-Jan-11 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++All
* Replace Kicad file history implementation with wxFileHistory.
* Laid groundwork for search paths using wxPathList in EDA_Appl.
* Made ReCreateMenuBar actually recreate the menu bar. Now language updates
to menus can be changed without restarting program.
* Lots of general housekeeping, simplification, and code beautifying.
++EESchema
* Fix zoom and pan bug in library viewer panel due to incorrect DrawPanel
rectangle.
* Add zoom accelerator keys to library viewer (works in GTK, not Windows).
* Add Postscript header to new print dialog so Linux build works.
++PcbNew
* Add Postscript header to new print dialog so Linux build works.
2009-Jan-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2009-Jan-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
++All: ++All:
......
...@@ -32,7 +32,6 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype, ...@@ -32,7 +32,6 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype,
m_Ident = idtype; m_Ident = idtype;
SetFont( *g_StdFont ); SetFont( *g_StdFont );
m_MenuBar = NULL; // menu du haut d'ecran
m_HToolBar = NULL; m_HToolBar = NULL;
m_FrameIsActive = TRUE; m_FrameIsActive = TRUE;
m_MsgFrameHeight = MSG_PANEL_DEFAULT_HEIGHT; m_MsgFrameHeight = MSG_PANEL_DEFAULT_HEIGHT;
...@@ -169,48 +168,40 @@ void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName ) ...@@ -169,48 +168,40 @@ void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
/* Met a jour la liste des anciens projets /* Met a jour la liste des anciens projets
*/ */
{ {
unsigned ii; wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
ReCreateMenuBar();
}
if( FullFileName.IsEmpty() )
return;
//suppression d'une ancienne trace eventuelle du meme fichier /**
for( ii = 0; ii < wxGetApp().m_LastProject.GetCount(); ) * Fetch the file name from the file history list.
{ */
if( wxGetApp().m_LastProject[ii].IsEmpty() ) wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
break; const wxString& type )
#ifdef __WINDOWS__ {
if( wxGetApp().m_LastProject[ii].CmpNoCase( FullFileName ) == 0 ) wxString fn, msg;
#else size_t i;
if( wxGetApp().m_LastProject[ii] == FullFileName ) int baseId = wxGetApp().m_fileHistory.GetBaseId();
#endif
{
wxGetApp().m_LastProject.RemoveAt( ii );
}
else
ii++;
}
while( wxGetApp().m_LastProject.GetCount() >= wxGetApp().m_LastProjectMaxCount ) wxASSERT( cmdId >= baseId
{ && cmdId < baseId + ( int )wxGetApp().m_fileHistory.GetCount() );
wxGetApp().m_LastProject.RemoveAt( wxGetApp().m_LastProject.GetCount() - 1 );
}
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(); ReCreateMenuBar();
} }
}
/**************************************************/ return fn;
wxString WinEDA_BasicFrame::GetLastProject( int rang )
/**************************************************/
{
if( rang < 0 )
rang = 0;
if( (unsigned) rang >= wxGetApp().m_LastProject.GetCount() )
return wxEmptyString;
return wxGetApp().m_LastProject[rang];
} }
......
...@@ -47,7 +47,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -47,7 +47,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
DrawPanel = NULL; DrawPanel = NULL;
MsgPanel = NULL; MsgPanel = NULL;
m_CurrentScreen = NULL; m_CurrentScreen = NULL;
m_MenuBar = NULL; // main meun frame
m_ID_current_state = 0; m_ID_current_state = 0;
m_HTOOL_current_state = 0; m_HTOOL_current_state = 0;
m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines
...@@ -60,10 +59,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -60,10 +59,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
// Internal units per inch // Internal units per inch
// = 1000 for schema, = 10000 for PCB // = 1000 for schema, = 10000 for PCB
m_InternalUnits = EESCHEMA_INTERNAL_UNIT; m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
if( ( m_Ident == PCB_FRAME ) || ( m_Ident == GERBER_FRAME )
|| ( m_Ident == CVPCB_DISPLAY_FRAME )
|| ( m_Ident == MODULE_EDITOR_FRAME ) )
m_InternalUnits = PCB_INTERNAL_UNIT;
minsize.x = 470; minsize.x = 470;
minsize.y = 350 + m_MsgFrameHeight; minsize.y = 350 + m_MsgFrameHeight;
...@@ -91,17 +86,12 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -91,17 +86,12 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_FramePos.x = m_FramePos.y = 0; m_FramePos.x = m_FramePos.y = 0;
m_FrameSize.y -= m_MsgFrameHeight; m_FrameSize.y -= m_MsgFrameHeight;
if( m_Ident != DISPLAY3D_FRAME ) DrawPanel = new WinEDA_DrawPanel( this, -1, wxPoint( 0, 0 ), m_FrameSize );
{
DrawPanel = new WinEDA_DrawPanel( this, -1, wxPoint( 0, 0 ),
m_FrameSize );
MsgPanel = new WinEDA_MsgPanel( this, -1, wxPoint( 0, m_FrameSize.y ), MsgPanel = new WinEDA_MsgPanel( this, -1, wxPoint( 0, m_FrameSize.y ),
wxSize( m_FrameSize.x, wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
m_MsgFrameHeight ) );
MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red, MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
ColorRefs[LIGHTGRAY].m_Green, ColorRefs[LIGHTGRAY].m_Green,
ColorRefs[LIGHTGRAY].m_Blue ) ); ColorRefs[LIGHTGRAY].m_Blue ) );
}
} }
...@@ -588,22 +578,16 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -588,22 +578,16 @@ void WinEDA_DrawFrame::AdjustScrollBars()
int zoom = screen->GetZoom(); int zoom = screen->GetZoom();
int xUnit, yUnit; int xUnit, yUnit;
if( screen == NULL ) if( screen == NULL || DrawPanel == NULL )
return;
if( DrawPanel == NULL )
return; return;
draw_size = screen->ReturnPageSize();
// La zone d'affichage est reglee a une taille double de la feuille de travail: // La zone d'affichage est reglee a une taille double de la feuille de travail:
draw_size.x *= 2; draw_size.y *= 2; draw_size = screen->ReturnPageSize() * 2;
// On utilise le centre de l'ecran comme position de reference, donc // On utilise le centre de l'ecran comme position de reference, donc
// la surface de trace doit etre augmentee // la surface de trace doit etre augmentee
panel_size = DrawPanel->GetClientSize(); panel_size = DrawPanel->GetClientSize() * zoom;
panel_size.x *= zoom; panel_size.y *= zoom; draw_size += panel_size / 2;
draw_size.x += panel_size.x / 2;
draw_size.y += panel_size.y / 2;
if( screen->m_Center ) if( screen->m_Center )
...@@ -622,8 +606,7 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -622,8 +606,7 @@ void WinEDA_DrawFrame::AdjustScrollBars()
screen->m_DrawOrg.y -= screen->m_DrawOrg.y % 256; screen->m_DrawOrg.y -= screen->m_DrawOrg.y % 256;
// Calcul du nombre de scrolls (en unites de scrool ) // Calcul du nombre de scrolls (en unites de scrool )
scrollbar_number.x = draw_size.x / (DrawPanel->m_Scroll_unit * zoom); scrollbar_number = draw_size / (DrawPanel->m_Scroll_unit * zoom);
scrollbar_number.y = draw_size.y / (DrawPanel->m_Scroll_unit * zoom);
xUnit = yUnit = DrawPanel->m_Scroll_unit; xUnit = yUnit = DrawPanel->m_Scroll_unit;
...@@ -631,13 +614,12 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -631,13 +614,12 @@ void WinEDA_DrawFrame::AdjustScrollBars()
xUnit = 1; xUnit = 1;
if( yUnit <= 1 ) if( yUnit <= 1 )
yUnit = 1; yUnit = 1;
xUnit *= zoom; yUnit *= zoom; xUnit *= zoom;
yUnit *= zoom;
// Calcul de la position, curseur place au centre d'ecran // Calcul de la position, curseur place au centre d'ecran
scrollbar_pos = screen->m_Curseur; scrollbar_pos = screen->m_Curseur;
scrollbar_pos -= screen->m_DrawOrg;
scrollbar_pos.x -= screen->m_DrawOrg.x;
scrollbar_pos.y -= screen->m_DrawOrg.y;
scrollbar_pos.x -= panel_size.x / 2; scrollbar_pos.x -= panel_size.x / 2;
scrollbar_pos.y -= panel_size.y / 2; scrollbar_pos.y -= panel_size.y / 2;
...@@ -698,7 +680,12 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event ) ...@@ -698,7 +680,12 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
int id = event.GetId(); int id = event.GetId();
wxGetApp().SetLanguageIdentifier( id ); wxGetApp().SetLanguageIdentifier( id );
wxGetApp().SetLanguage(); if ( wxGetApp().SetLanguage() )
{
wxLogDebug( wxT( "Recreating menu bar due to language change." ) );
ReCreateMenuBar();
Refresh();
}
} }
......
...@@ -97,12 +97,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color ) ...@@ -97,12 +97,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
* Draw the schematic cursor which is usually on grid * Draw the schematic cursor which is usually on grid
*/ */
{ {
if( m_CursorLevel != 0 ) if( m_CursorLevel != 0 || DC == NULL )
{
return;
}
if( DC == NULL )
return; return;
wxPoint Cursor = GetScreen()->m_Curseur; wxPoint Cursor = GetScreen()->m_Curseur;
...@@ -201,36 +196,6 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC ) ...@@ -201,36 +196,6 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC )
} }
/*********************************************************************/
wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos )
/*********************************************************************/
/** Function CalcAbsolutePosition
* @return absolute position in pixels, considering the scroll amount
* @param rel_pos = relative position (screen position) in pixel
* ( relative position = position in the panel draw area on screen )
*/
{
wxPoint pos;
#ifdef WX_ZOOM
CalcUnscrolledPosition( rel_pos.x, rel_pos.y, &pos.x, &pos.y );
#else
int ii, jj;
GetViewStart( &pos.x, &pos.y ); // pos is the origin in scroll units
GetScrollPixelsPerUnit( &ii, &jj );
pos.x *= ii;
pos.y *= jj; // pos is the origin in pixel units
pos.x += rel_pos.x;
pos.y += rel_pos.y;
#endif
return pos;
}
/**********************************************************************/ /**********************************************************************/
wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
/**********************************************************************/ /**********************************************************************/
...@@ -240,9 +205,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) ...@@ -240,9 +205,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
* @param ScreenPos = absolute position in pixels * @param ScreenPos = absolute position in pixels
*/ */
{ {
wxPoint curpos = GetScreen()->CursorRealPosition( ScreenPos ); return GetScreen()->CursorRealPosition( ScreenPos );
return curpos;
} }
...@@ -268,13 +231,12 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) ...@@ -268,13 +231,12 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
display_rect.Inflate( -PIXEL_MARGIN, -PIXEL_MARGIN ); display_rect.Inflate( -PIXEL_MARGIN, -PIXEL_MARGIN );
// Conversion en coord physiques // Conversion en coord physiques
pos = CalcAbsolutePosition( display_rect.GetPosition() ); pos = CalcUnscrolledPosition( display_rect.GetPosition() );
pos.x *= GetZoom(); pos.x *= GetZoom();
pos.y *= GetZoom(); pos.y *= GetZoom();
pos.x += GetScreen()->m_DrawOrg.x; pos += GetScreen()->m_DrawOrg;
pos.y += GetScreen()->m_DrawOrg.y;
display_rect.SetX( pos.x ); display_rect.SetX( pos.x );
display_rect.SetY( pos.y ); display_rect.SetY( pos.y );
...@@ -385,18 +347,13 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void ) ...@@ -385,18 +347,13 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )
wxSize size; wxSize size;
wxPoint realpos; wxPoint realpos;
size = GetClientSize(); size = GetClientSize() / 2;
realpos = CalcUnscrolledPosition( wxPoint( size.x, size.y ) );
size.x /= 2;
size.y /= 2;
realpos = CalcAbsolutePosition( wxPoint( size.x, size.y ) );
realpos.x *= GetZoom(); realpos.x *= GetZoom();
realpos.y *= GetZoom(); realpos.y *= GetZoom();
realpos.x += GetScreen()->m_DrawOrg.x; realpos += GetScreen()->m_DrawOrg;
realpos.y += GetScreen()->m_DrawOrg.y;
return realpos; return realpos;
} }
...@@ -428,11 +385,9 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse ) ...@@ -428,11 +385,9 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
#ifdef WX_ZOOM #ifdef WX_ZOOM
CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y ); CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y );
#else #else
mouse = Mouse; mouse = Mouse - GetScreen()->m_StartVisu;
mouse.x -= GetScreen()->m_StartVisu.x;
mouse.y -= GetScreen()->m_StartVisu.y;
#endif #endif
GRMouseWarp( this, mouse ); WarpPointer( mouse.x, mouse.y );
} }
...@@ -543,11 +498,9 @@ void WinEDA_DrawPanel::SetBoundaryBox() ...@@ -543,11 +498,9 @@ void WinEDA_DrawPanel::SetBoundaryBox()
#ifdef WX_ZOOM #ifdef WX_ZOOM
m_ClipBox.m_Pos.x *= GetZoom(); m_ClipBox.m_Pos.x *= GetZoom();
m_ClipBox.m_Pos.y *= GetZoom(); m_ClipBox.m_Pos.y *= GetZoom();
m_ClipBox.m_Size.x *= GetZoom(); m_ClipBox.m_Size *= GetZoom();
m_ClipBox.m_Size.y *= GetZoom();
#else #else
m_ClipBox.m_Pos.x -= GetScreen()->m_StartVisu.x; m_ClipBox.m_Pos -= GetScreen()->m_StartVisu;
m_ClipBox.m_Pos.y -= GetScreen()->m_StartVisu.y;
#endif #endif
m_ScrollButt_unit = MIN( Screen->m_SizeVisu.x, Screen->m_SizeVisu.y ) / 4; m_ScrollButt_unit = MIN( Screen->m_SizeVisu.x, Screen->m_SizeVisu.y ) / 4;
...@@ -767,13 +720,9 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -767,13 +720,9 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
org.x *= zoom; org.x *= zoom;
org.y *= zoom; org.y *= zoom;
org.x += screen->m_DrawOrg.x; org += screen->m_DrawOrg;
org.y += screen->m_DrawOrg.y;
size = GetClientSize();
size.x *= zoom; size = GetClientSize() * zoom;
size.y *= zoom;
pasx = screen->m_Grid.x * m_Parent->m_InternalUnits; pasx = screen->m_Grid.x * m_Parent->m_InternalUnits;
pasy = screen->m_Grid.y * m_Parent->m_InternalUnits; pasy = screen->m_Grid.y * m_Parent->m_InternalUnits;
...@@ -868,8 +817,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event ) ...@@ -868,8 +817,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
wxPoint pos; wxPoint pos;
wxMenu MasterMenu; wxMenu MasterMenu;
pos.x = event.GetX(); pos = event.GetPosition();
pos.y = event.GetY();
if( !m_Parent->OnRightClick( pos, &MasterMenu ) ) if( !m_Parent->OnRightClick( pos, &MasterMenu ) )
return false; return false;
...@@ -921,13 +869,20 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event ) ...@@ -921,13 +869,20 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
{ {
wxRect rect = GetRect(); wxRect rect = GetRect();
wxLogDebug( wxT( "OnMouseWheel() cursor position: (%d, %d)." ), /* This fixes a bad rectangle horizontal position returned by the
event.m_x, event.m_y ); * schematic library veiwer panel. It may have something to do with
* the sash window. */
rect.Offset( -rect.x, -rect.y );
/* Ignore scroll events if the cursor is outside the drawing area. */ /* Ignore scroll events if the cursor is outside the drawing area. */
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled() if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !rect.Contains( event.GetPosition() ) ) || !rect.Contains( event.GetPosition() ) )
{ {
wxLogDebug( wxT( "OnMouseWheel() position(%d, %d) " \
"rectangle(%d, %d, %d, %d)" ),
event.GetPosition().x, event.GetPosition().y,
rect.x, rect.y, rect.width, rect.height );
event.Skip(); event.Skip();
return; return;
} }
...@@ -1029,7 +984,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1029,7 +984,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
localrealbutt |= localbutt; /* compensation defaut wxGTK */ localrealbutt |= localbutt; /* compensation defaut wxGTK */
/* Compute absolute m_MousePosition in pixel units: */ /* Compute absolute m_MousePosition in pixel units: */
screen->m_MousePositionInPixels = CalcAbsolutePosition( wxPoint( event.GetX(), event.GetY() ) ); screen->m_MousePositionInPixels = CalcUnscrolledPosition( event.GetPosition() );
/* Compute absolute m_MousePosition in user units: */ /* Compute absolute m_MousePosition in user units: */
screen->m_MousePosition = CursorRealPosition( screen->m_MousePositionInPixels ); screen->m_MousePosition = CursorRealPosition( screen->m_MousePositionInPixels );
...@@ -1247,6 +1202,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) ...@@ -1247,6 +1202,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
{ {
long key, localkey; long key, localkey;
bool escape = FALSE; bool escape = FALSE;
wxPoint pos;
key = localkey = event.GetKeyCode(); key = localkey = event.GetKeyCode();
...@@ -1295,27 +1251,17 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) ...@@ -1295,27 +1251,17 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
} }
} }
/* some key commands use the mouse position: refresh it */ /* Some key commands use the current mouse position: refresh it */
#if wxCHECK_VERSION( 2, 8, 0 ) pos = CalcUnscrolledPosition( wxGetMousePosition() - GetScreenPosition() );
wxPoint mouse_pos = wxGetMousePosition(); // Get the mouse position on screen
wxPoint win_pos = GetScreenPosition(); // get the draw area (panel)position on screen
mouse_pos -= win_pos; // mouse_pos = is the mouse position relative to the panel
/* Compute absolute m_MousePosition in pixel units (i.e. considering the current scrool) : */
Screen->m_MousePositionInPixels = CalcAbsolutePosition( mouse_pos );
/* Compute absolute m_MousePosition in user units: */
Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels );
#else /* Compute absolute mouse position in pixel units (i.e. considering the
current scrool) : */
Screen->m_MousePositionInPixels = pos;
/* if wxGetMousePosition() does not exist, /* Compute absolute mouse position in user units: */
* m_Cursor should be ok, use it to calculate the cursor position on screen Screen->m_MousePosition = CursorRealPosition( pos );
*/
Screen->m_MousePositionInPixels = CursorScreenPosition();
#endif
m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels ); m_Parent->GeneralControle( &DC, pos );
#if 0 #if 0
event.Skip(); // Allow menu shortcut processing event.Skip(); // Allow menu shortcut processing
......
This diff is collapsed.
...@@ -337,17 +337,6 @@ bool GetGRForceBlackPenState( void ) ...@@ -337,17 +337,6 @@ bool GetGRForceBlackPenState( void )
return ForceBlackPen; return ForceBlackPen;
} }
/************************************************************/
/* routines de controle et positionnement du curseur souris */
/************************************************************/
/* positionne la souris au point de coord pos */
void GRMouseWarp( WinEDA_DrawPanel* panel, const wxPoint& pos )
{
if( panel == NULL )
return;
panel->WarpPointer( pos.x, pos.y );
}
/**********************************************/ /**********************************************/
/* Routine pour selectionner le mode de trace */ /* Routine pour selectionner le mode de trace */
......
...@@ -50,24 +50,14 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) ...@@ -50,24 +50,14 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
* @param coord = coordinate to adjust * @param coord = coordinate to adjust
*/ */
{ {
double tmp;
wxSize grid_size = GetBaseScreen()->GetGrid(); wxSize grid_size = GetBaseScreen()->GetGrid();
if( !GetBaseScreen()->m_UserGridIsON ) if( !GetBaseScreen()->m_UserGridIsON )
{ {
tmp = (double) coord->x / (double) grid_size.x; coord->x = ( (int) round( (double) coord->x /
coord->x = ( (int) round( tmp ) ) * grid_size.x; (double) grid_size.x ) ) * grid_size.x;
coord->y = ( (int) round( (double) coord->y /
tmp = (double) coord->y / (double) grid_size.y; (double) grid_size.y ) ) * grid_size.y;
coord->y = ( (int) round( tmp ) ) * grid_size.y;
}
else
{
double pasx = (double) ( grid_size.x * m_InternalUnits );
double pasy = (double) ( grid_size.y * m_InternalUnits );
coord->x = (int) round( pasx * ( (double) coord->x / pasx ) );
coord->y = (int) round( pasy * ( (double) coord->y / pasy ) );
} }
} }
......
...@@ -30,7 +30,6 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) : ...@@ -30,7 +30,6 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) :
m_ListCmp = NULL; m_ListCmp = NULL;
m_FootprintList = NULL; m_FootprintList = NULL;
DrawFrame = NULL; DrawFrame = NULL;
m_FilesMenu = NULL;
m_HToolBar = NULL; m_HToolBar = NULL;
// Give an icon // Give an icon
...@@ -121,9 +120,7 @@ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event ) ...@@ -121,9 +120,7 @@ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event )
/* Event table for WinEDA_CvpcbFrame */ /* Event table for WinEDA_CvpcbFrame */
/*************************************/ /*************************************/
BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
EVT_MENU_RANGE( ID_LOAD_PROJECT, EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_CvpcbFrame::LoadNetList )
ID_LOAD_FILE_10,
WinEDA_CvpcbFrame::LoadNetList )
// Menu events // Menu events
EVT_MENU( ID_SAVE_PROJECT, EVT_MENU( ID_SAVE_PROJECT,
...@@ -387,39 +384,28 @@ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event ) ...@@ -387,39 +384,28 @@ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event )
* Lit la netliste * Lit la netliste
*/ */
{ {
int id = event.GetId();
wxString fullfilename;
wxString oldfilename;
bool newfile; bool newfile;
wxString oldfilename;
wxString fn;
fn = GetFileFromHistory( event.GetId(), _( "Gerber" ) );
if( !NetInNameBuffer.IsEmpty() ) if( !NetInNameBuffer.IsEmpty() )
{ {
oldfilename = NetInNameBuffer; oldfilename = NetInNameBuffer;
} }
switch( id ) if( fn != wxEmptyString )
{ {
case ID_LOAD_FILE_1: newfile = ReadInputNetList( fn );
case ID_LOAD_FILE_2:
case ID_LOAD_FILE_3:
case ID_LOAD_FILE_4:
case ID_LOAD_FILE_5:
case ID_LOAD_FILE_6:
case ID_LOAD_FILE_7:
case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10:
id -= ID_LOAD_FILE_1;
fullfilename = GetLastProject( id );
break;
}
newfile = ReadInputNetList( fullfilename );
if( newfile && !oldfilename.IsEmpty() ) if( newfile && !oldfilename.IsEmpty() )
{ {
SetLastProject( NetInNameBuffer ); SetLastProject( NetInNameBuffer );
ReCreateMenuBar();
} }
}
ReCreateMenuBar();
} }
......
...@@ -34,9 +34,6 @@ public: ...@@ -34,9 +34,6 @@ public:
WinEDA_DisplayFrame* DrawFrame; WinEDA_DisplayFrame* DrawFrame;
WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran
private:
wxMenu* m_FilesMenu;
// Constructor and destructor // Constructor and destructor
public: public:
WinEDA_CvpcbFrame( const wxString &title, WinEDA_CvpcbFrame( const wxString &title,
......
...@@ -187,8 +187,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -187,8 +187,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
curpos = DrawPanel->CursorRealPosition( Mouse ); curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
delta.x = GetScreen()->GetGrid().x / zoom; delta = GetScreen()->GetGrid() / zoom;
delta.y = GetScreen()->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
if( delta.y <= 0 ) if( delta.y <= 0 )
...@@ -233,28 +233,28 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -233,28 +233,28 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
case WXK_UP: case WXK_UP:
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y - delta.y, DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y - delta.y,
&Mouse.x, &Mouse.y ); &Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD2: /* cursor moved down */ case WXK_NUMPAD2: /* cursor moved down */
case WXK_DOWN: case WXK_DOWN:
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y + delta.y, DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y + delta.y,
&Mouse.x, &Mouse.y ); &Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD4: /* cursor moved left */ case WXK_NUMPAD4: /* cursor moved left */
case WXK_LEFT: case WXK_LEFT:
DrawPanel->CalcScrolledPosition( Mouse.x - delta.x, Mouse.y, DrawPanel->CalcScrolledPosition( Mouse.x - delta.x, Mouse.y,
&Mouse.x, &Mouse.y ); &Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD6: /* cursor moved right */ case WXK_NUMPAD6: /* cursor moved right */
case WXK_RIGHT: case WXK_RIGHT:
DrawPanel->CalcScrolledPosition( Mouse.x + delta.x, Mouse.y, DrawPanel->CalcScrolledPosition( Mouse.x + delta.x, Mouse.y,
&Mouse.x, &Mouse.y ); &Mouse.x, &Mouse.y );
GRMouseWarp( DrawPanel, Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
} }
} }
...@@ -269,8 +269,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -269,8 +269,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
RedrawActiveWindow( DC, TRUE ); RedrawActiveWindow( DC, TRUE );
} }
if( ( oldpos.x != GetScreen()->m_Curseur.x ) if( oldpos != GetScreen()->m_Curseur )
|| ( oldpos.y != GetScreen()->m_Curseur.y ) )
{ {
if( flagcurseur != 2 ) if( flagcurseur != 2 )
{ {
......
...@@ -99,44 +99,37 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar() ...@@ -99,44 +99,37 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
/* Creation des menus de la fenetre principale /* Creation des menus de la fenetre principale
*/ */
{ {
int ii; wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar;
/* Destroy the existing menu bar so it can be rebuilt. This allows
* language changes of the menu text on the fly. */
if( menuBar )
SetMenuBar( NULL );
if( menuBar == NULL )
{
menuBar = new wxMenuBar(); menuBar = new wxMenuBar();
// Associate the menu bar with the frame wxMenu* filesMenu = new wxMenu;
SetMenuBar( menuBar ); item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT,
m_FilesMenu = new wxMenu;
wxMenuItem* item = new wxMenuItem( m_FilesMenu, ID_LOAD_PROJECT,
_( "&Open" ), _( "&Open" ),
_( "Open a NetList file" ) ); _( "Open a NetList file" ) );
item->SetBitmap( open_xpm ); item->SetBitmap( open_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT, item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Save As..." ), _( "&Save As..." ),
_( "Save New NetList and Footprints List files" ) ); _( "Save New NetList and Footprints List files" ) );
item->SetBitmap( save_xpm ); item->SetBitmap( save_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_CVPCB_QUIT, _( "E&xit" ), item = new wxMenuItem( filesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
_( "Quit Cvpcb" ) ); _( "Quit Cvpcb" ) );
item->SetBitmap( exit_xpm ); item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// Creation des selections des anciens fichiers // Creation des selections des anciens fichiers
m_FilesMenu->AppendSeparator(); wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
for( ii = 0; ii < 10; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
// Menu Configuration: // Menu Configuration:
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
...@@ -163,36 +156,16 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar() ...@@ -163,36 +156,16 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
_( "Open the cvpcb manual" ) ); _( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm ); item->SetBitmap( help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
item = item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
_( "&About cvpcb" ), _( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) ); _( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm ); item->SetBitmap( info_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
menuBar->Append( m_FilesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); 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++ ) // Associate the menu bar with the frame
{ SetMenuBar( menuBar );
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
}
} }
...@@ -737,7 +737,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) ...@@ -737,7 +737,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
g_ItemToRepeat->m_Flags = 0; g_ItemToRepeat->m_Flags = 0;
// GetScreen()->Curseur = new_pos; // GetScreen()->Curseur = new_pos;
// GRMouseWarp(DrawPanel, DrawPanel->CursorScreenPosition() ); // DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
} }
} }
......
...@@ -231,8 +231,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi ...@@ -231,8 +231,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom; delta = screen->GetGrid() / zoom;
delta.y = screen->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -300,8 +299,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi ...@@ -300,8 +299,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
if( hotkey ) if( hotkey )
{ {
if( screen->GetCurItem() if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
&& screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() ); OnHotKey( DC, hotkey, screen->GetCurItem() );
else else
OnHotKey( DC, hotkey, NULL ); OnHotKey( DC, hotkey, NULL );
...@@ -327,8 +325,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -327,8 +325,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom; delta = screen->GetGrid() / zoom;
delta.y = screen->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -396,8 +393,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -396,8 +393,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
if( hotkey ) if( hotkey )
{ {
if( screen->GetCurItem() if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
&& screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() ); OnHotKey( DC, hotkey, screen->GetCurItem() );
else else
OnHotKey( DC, hotkey, NULL ); OnHotKey( DC, hotkey, NULL );
...@@ -422,8 +418,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -422,8 +418,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom; delta = screen->GetGrid() / zoom;
delta.y = screen->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -491,8 +486,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -491,8 +486,7 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
if( hotkey ) if( hotkey )
{ {
if( screen->GetCurItem() if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
&& screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() ); OnHotKey( DC, hotkey, screen->GetCurItem() );
else else
OnHotKey( DC, hotkey, NULL ); OnHotKey( DC, hotkey, NULL );
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "program.h" #include "program.h"
#include "general.h" #include "general.h"
#include <wx/dcps.h>
#include "dialog_print_using_printer_base.h" #include "dialog_print_using_printer_base.h"
......
...@@ -430,7 +430,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) ...@@ -430,7 +430,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE );
// GetScreen()->Curseur.x = ox; GetScreen()->Curseur.x = oy; // GetScreen()->Curseur.x = ox; GetScreen()->Curseur.x = oy;
// GRMouseWarp(DrawPanel, DrawPanel->CursorScreenPosition() ); // DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
} }
} }
......
...@@ -185,7 +185,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -185,7 +185,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
if( mouseWarp ) if( mouseWarp )
GRMouseWarp( DrawPanel, curpos ); DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
...@@ -359,7 +359,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -359,7 +359,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType )
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
GRMouseWarp( DrawPanel, curpos ); DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
} }
...@@ -589,7 +589,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -589,7 +589,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
if( mouseWarp ) if( mouseWarp )
GRMouseWarp( DrawPanel, curpos ); DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
......
This diff is collapsed.
...@@ -40,8 +40,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame ) ...@@ -40,8 +40,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject ) EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10, EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_SchematicFrame::OnLoadFile )
WinEDA_SchematicFrame::OnLoadFile )
EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject ) EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
...@@ -576,10 +575,15 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event ) ...@@ -576,10 +575,15 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
{ {
int i = event.GetId() - ID_LOAD_FILE_1; wxString fn;
LoadOneEEProject( GetLastProject( i ).GetData(), false ); fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
if( fn != wxEmptyString )
{
LoadOneEEProject( fn, false );
SetToolbars(); SetToolbars();
}
} }
......
...@@ -26,7 +26,7 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame ) ...@@ -26,7 +26,7 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL, EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
WinEDA_ViewlibFrame::Process_Special_Functions ) WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DrawFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ViewlibFrame::OnZoom )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart ) WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
...@@ -39,6 +39,25 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame ) ...@@ -39,6 +39,25 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
END_EVENT_TABLE() END_EVENT_TABLE()
/*
* This emulates the zoom menu entries found in the other Kicad applications.
* The library viewer does not have any menus so add an accelerator table to
* the main frame.
*
* FIXME: For some reason this doesn't work correctly in windows. Works fine
* in GTK2 in Linux. Not tested on Mac. Adding EVT_MENU_RANGE() to
* event table doesn't solve the problem either.
*/
static wxAcceleratorEntry accels[] = {
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F1, ID_ZOOM_IN ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_ZOOM_PAGE )
};
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
/******************************************************************************/ /******************************************************************************/
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
LibraryStruct* Library, LibraryStruct* Library,
...@@ -47,6 +66,8 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -47,6 +66,8 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
wxDefaultPosition, wxDefaultSize ) wxDefaultPosition, wxDefaultSize )
/******************************************************************************/ /******************************************************************************/
{ {
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
m_FrameName = wxT( "ViewlibFrame" ); m_FrameName = wxT( "ViewlibFrame" );
m_Draw_Axis = TRUE; // TRUE to dispaly Axis m_Draw_Axis = TRUE; // TRUE to dispaly Axis
...@@ -58,6 +79,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -58,6 +79,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
m_CmpList = NULL; m_CmpList = NULL;
m_LibList = NULL; m_LibList = NULL;
m_Semaphore = semaphore; m_Semaphore = semaphore;
if( m_Semaphore ) if( m_Semaphore )
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP ); SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
...@@ -92,6 +114,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -92,6 +114,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
if( m_LibList ) if( m_LibList )
ReCreateListLib(); ReCreateListLib();
DisplayLibInfos(); DisplayLibInfos();
SetAcceleratorTable( table );
BestZoom(); BestZoom();
Show( TRUE ); Show( TRUE );
} }
......
...@@ -15,7 +15,24 @@ ...@@ -15,7 +15,24 @@
static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName, wxDC* DC ); static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName, wxDC* DC );
/********************************************************/ void WinEDA_GerberFrame::OnFileHistory( wxCommandEvent& event )
{
wxString fn;
fn = GetFileFromHistory( event.GetId(), _( "Printed circuit board" ) );
if( fn != wxEmptyString && Clear_Pcb( true ) )
{
wxClientDC dc( DrawPanel );
DrawPanel->CursorOff( &dc );
LoadOneGerberFile( fn, &dc, false );
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
}
}
/***************
***************************************/
void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
/********************************************************/ /********************************************************/
...@@ -64,24 +81,6 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) ...@@ -64,24 +81,6 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq();
break; break;
case ID_LOAD_FILE_1:
case ID_LOAD_FILE_2:
case ID_LOAD_FILE_3:
case ID_LOAD_FILE_4:
case ID_LOAD_FILE_5:
case ID_LOAD_FILE_6:
case ID_LOAD_FILE_7:
case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10:
if( Clear_Pcb( TRUE ) )
{
LoadOneGerberFile(
GetLastProject( id - ID_LOAD_FILE_1 ).GetData(),
&dc, FALSE );
}
break;
case ID_GERBVIEW_LOAD_DRILL_FILE: case ID_GERBVIEW_LOAD_DRILL_FILE:
DisplayError( this, _( "Not yet available..." ) ); DisplayError( this, _( "Not yet available..." ) );
break; break;
......
...@@ -49,8 +49,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame ) ...@@ -49,8 +49,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW,
WinEDA_GerberFrame::ExportDataInPcbnewFormat ) WinEDA_GerberFrame::ExportDataInPcbnewFormat )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10, EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_GerberFrame::OnFileHistory )
WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
......
...@@ -59,6 +59,8 @@ bool WinEDA_App::OnInit() ...@@ -59,6 +59,8 @@ bool WinEDA_App::OnInit()
frame->Show( TRUE ); // Show GerbView mainframe frame->Show( TRUE ); // Show GerbView mainframe
frame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame frame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame
Read_Config();
if( argc > 1 ) if( argc > 1 )
{ {
wxString fileName = MakeFileName( wxEmptyString, wxString fileName = MakeFileName( wxEmptyString,
...@@ -75,8 +77,6 @@ bool WinEDA_App::OnInit() ...@@ -75,8 +77,6 @@ bool WinEDA_App::OnInit()
if( path != wxEmptyString ) if( path != wxEmptyString )
wxSetWorkingDirectory( path ); wxSetWorkingDirectory( path );
Read_Config();
// Load all files specified on the command line. // Load all files specified on the command line.
for( int i = 1; i<argc; ++i ) for( int i = 1; i<argc; ++i )
{ {
...@@ -93,8 +93,6 @@ bool WinEDA_App::OnInit() ...@@ -93,8 +93,6 @@ bool WinEDA_App::OnInit()
} }
} }
} }
else
Read_Config();
return TRUE; return TRUE;
} }
...@@ -23,93 +23,76 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -23,93 +23,76 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
/* Cree ou reinitialise le menu du haut d'ecran /* Cree ou reinitialise le menu du haut d'ecran
*/ */
{ {
int ii; wxMenuBar *menuBar = GetMenuBar();
wxMenuBar* menuBar = GetMenuBar();
/* Destroy the existing menu bar so it can be rebuilt. This allows
* language changes of the menu text on the fly. */
if( menuBar )
SetMenuBar( NULL );
if( menuBar == NULL )
{
menuBar = new wxMenuBar(); menuBar = new wxMenuBar();
m_FilesMenu = new wxMenu; wxMenu* filesMenu = new wxMenu;
m_FilesMenu->Append( ID_MENU_LOAD_FILE, filesMenu->Append( ID_MENU_LOAD_FILE, _( "Clear and Load Gerber file" ),
_( "Clear and Load Gerber file" ),
_( "Clear all layers and Load new Gerber file" ), _( "Clear all layers and Load new Gerber file" ),
FALSE ); FALSE );
m_FilesMenu->Append( ID_MENU_APPEND_FILE, filesMenu->Append( ID_MENU_APPEND_FILE, _( "Load Gerber file" ),
_( "Load Gerber file" ),
_( "Load new Gerber file on currrent layer" ), _( "Load new Gerber file on currrent layer" ),
FALSE ); 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" ), _( "Inc Layer and load Gerber file" ),
_( "Increment layer number, and Load Gerber file" ), _( "Increment layer number, and Load Gerber file" ),
FALSE ); FALSE );
m_FilesMenu->Append( ID_GERBVIEW_LOAD_DCODE_FILE, filesMenu->Append( ID_GERBVIEW_LOAD_DCODE_FILE, _( "Load DCodes" ),
_( "Load DCodes" ), _( "Load D-Codes File" ), FALSE );
_( "Load D-Codes File" ),
FALSE );
#if 0 #if 0
m_FilesMenu->Append( ID_GERBVIEW_LOAD_DRILL_FILE, filesMenu->Append( ID_GERBVIEW_LOAD_DRILL_FILE, _( "Load drill" ),
_( "Load drill" ), _( "Load excellon drill file" ), FALSE );
_( "Load excellon drill file" ),
FALSE );
#endif #endif
m_FilesMenu->Append( ID_MENU_NEW_BOARD, filesMenu->Append( ID_MENU_NEW_BOARD, _( "&New" ),
_( "&New" ), _( "Clear all layers" ), FALSE );
_( "Clear all layers" ),
FALSE );
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_GERBVIEW_EXPORT_TO_PCBNEW, filesMenu->Append( ID_GERBVIEW_EXPORT_TO_PCBNEW, _( "&Export to Pcbnew" ),
_( "&Export to Pcbnew" ), _( "Export data in pcbnew format" ), FALSE );
_( "Export data in pcbnew format" ),
FALSE );
#if 0 #if 0
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_MENU_SAVE_BOARD, filesMenu->Append( ID_MENU_SAVE_BOARD, _( "&Save layers" ),
_( "&Save layers" ), _( "Save current layers (GERBER format)" ), FALSE );
_( "Save current layers (GERBER format)" ),
FALSE );
m_FilesMenu->Append( ID_MENU_SAVE_BOARD_AS, filesMenu->Append( ID_MENU_SAVE_BOARD_AS, _( "Save layers as.." ),
_( "Save layers as.." ), _( "Save current layers as.." ), FALSE );
_( "Save current layers as.." ),
FALSE );
#endif #endif
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_GEN_PRINT, _( "P&rint" ), _( "Print gerber" ) ); filesMenu->Append( ID_GEN_PRINT, _( "P&rint" ), _( "Print gerber" ) );
m_FilesMenu->Append( ID_GEN_PLOT, filesMenu->Append( ID_GEN_PLOT, _( "Plot" ),
_( "Plot" ), _( "Plotting in various formats" ) ); _( "Plotting in various formats" ) );
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
m_FilesMenu->Append( ID_EXIT, _( "E&xit" ), _( "Quit Gerbview" ) ); filesMenu->Append( ID_EXIT, _( "E&xit" ), _( "Quit Gerbview" ) );
// Creation des selections des anciens fichiers wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
m_FilesMenu->AppendSeparator();
for( int ii = 0; ii < 10; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
// Configuration: // Configuration:
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&File ext" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&File ext" ),
_( "Setting Files extension" ), config_xpm ); _( "Setting Files extension" ), config_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_COLORS_SETUP, _( "&Colors" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Select Colors and Display for layers" ), palette_xpm ); _( "Select Colors and Display for layers" ),
palette_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
_( " Select general options" ), preference_xpm ); _( " Select general options" ), preference_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_PCB_LOOK_SETUP, _( "Display" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_PCB_LOOK_SETUP, _( "Display" ),
_( " Select how items are displayed" ), display_options_xpm ); _( " Select how items are displayed" ),
display_options_xpm );
// Font selection and setup // Font selection and setup
AddFontSelectionMenu( configmenu ); AddFontSelectionMenu( configmenu );
...@@ -118,13 +101,13 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -118,13 +101,13 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
configmenu->AppendSeparator(); configmenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ),
_( "Save application preferences" ), save_setup_xpm ); _( "Save application preferences" ),
save_setup_xpm );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu ); AddHotkeyConfigMenu( configmenu );
// Menu drill ( generation fichiers percage)
// Menu drill ( generation fichiers percage)
/* wxMenu *drill_menu = new wxMenu; /* wxMenu *drill_menu = new wxMenu;
* postprocess_menu->Append(ID_PCB_GEN_DRILL_FILE, "Create &Drill file", * postprocess_menu->Append(ID_PCB_GEN_DRILL_FILE, "Create &Drill file",
...@@ -136,22 +119,24 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -136,22 +119,24 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES, ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES,
_( "&List DCodes" ), _( "&List DCodes" ),
_( "List and edit D-codes" ), show_dcodenumber_xpm ); _( "List and edit D-codes" ), show_dcodenumber_xpm );
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_SOURCE, _( "&Show source" ), ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_SOURCE,
_( "Show source file for the current layer" ), tools_xpm ); _( "&Show source" ),
_( "Show source file for the current layer" ),
tools_xpm );
miscellaneous_menu->AppendSeparator(); 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 ); _( "Delete current layer" ), general_deletions_xpm );
// Menu Help: // Menu Help:
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the gerbview manual" ), help_xpm ); _( "Open the gerbview manual" ), help_xpm );
ADD_MENUITEM_WITH_HELP(helpMenu, ADD_MENUITEM_WITH_HELP(helpMenu, ID_KICAD_ABOUT, _( "&About gerbview" ),
ID_KICAD_ABOUT, _( "&About gerbview" ),
_( "About gerbview gerber and drill viewer" ), _( "About gerbview gerber and drill viewer" ),
info_xpm ); info_xpm );
menuBar->Append( m_FilesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) ); menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) );
...@@ -160,28 +145,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -160,28 +145,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar( menuBar ); SetMenuBar( menuBar );
}
else // Only an update of the files list
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
}
} }
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
#define eda_global extern #define eda_global extern
#endif #endif
/* Use wxFileHistory for most recently used file handling. */
#include <wx/docview.h>
/**********************************************/ /**********************************************/
/* Class representing the entire Application */ /* Class representing the entire Application */
...@@ -36,8 +39,6 @@ public: ...@@ -36,8 +39,6 @@ public:
wxString m_BinDir; /* Chemin ou reside l'executable wxString m_BinDir; /* Chemin ou reside l'executable
* (utilis si KICAD non dfini)*/ * (utilis si KICAD non dfini)*/
wxArrayString m_LastProject; /* liste des derniers projets chargs */
unsigned int m_LastProjectMaxCount; /* Max histhory file length */
wxString m_KicadEnv; /* Chemin de kicad dfini dans la wxString m_KicadEnv; /* Chemin de kicad dfini dans la
* variable d'environnement KICAD, * variable d'environnement KICAD,
* typiquement /usr/local/kicad ou * typiquement /usr/local/kicad ou
...@@ -46,9 +47,10 @@ public: ...@@ -46,9 +47,10 @@ public:
wxLocale* m_Locale; // Gestion de la localisation wxLocale* m_Locale; // Gestion de la localisation
int m_LanguageId; // indicateur de choix du langage ( 0 = defaut) int m_LanguageId; // indicateur de choix du langage ( 0 = defaut)
wxMenu* m_Language_Menu; // List menu for languages
wxString m_PdfBrowser; // Name of the selected browser, for browsing pdf datasheets wxString m_PdfBrowser; // Name of the selected browser, for browsing pdf datasheets
bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used) bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used)
wxPathList m_searchPaths;
wxFileHistory m_fileHistory;
public: public:
WinEDA_App(); WinEDA_App();
...@@ -57,6 +59,7 @@ public: ...@@ -57,6 +59,7 @@ public:
int OnRun(); int OnRun();
bool SetBinDir(); bool SetBinDir();
void SetDefaultSearchPaths( void );
void InitEDA_Appl( const wxString& name ); void InitEDA_Appl( const wxString& name );
bool SetLanguage( bool first_time = FALSE ); bool SetLanguage( bool first_time = FALSE );
wxMenu* SetLanguageList( wxMenu* MasterMenu ); wxMenu* SetLanguageList( wxMenu* MasterMenu );
...@@ -66,7 +69,6 @@ public: ...@@ -66,7 +69,6 @@ public:
// Sauvegarde de configurations et options: // Sauvegarde de configurations et options:
void GetSettings(); void GetSettings();
void SaveSettings(); void SaveSettings();
void SetLastProject( const wxString& FullFileName );
void WriteProjectConfig( const wxString& local_config_filename, void WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, const wxString& GroupName,
PARAM_CFG_BASE** List ); PARAM_CFG_BASE** List );
......
...@@ -80,7 +80,6 @@ public: ...@@ -80,7 +80,6 @@ public:
void PrepareGraphicContext( wxDC* DC ); void PrepareGraphicContext( wxDC* DC );
wxPoint CalcAbsolutePosition( const wxPoint& rel_pos );
bool IsPointOnDisplay( wxPoint ref_pos ); bool IsPointOnDisplay( wxPoint ref_pos );
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
......
...@@ -59,7 +59,6 @@ int GRMapX(int x); ...@@ -59,7 +59,6 @@ int GRMapX(int x);
int GRMapY(int y); int GRMapY(int y);
class WinEDA_DrawPanel; class WinEDA_DrawPanel;
void GRMouseWarp(WinEDA_DrawPanel * panel, const wxPoint& pos); /* positionne la souris au point de coord pos */
/* routines generales */ /* routines generales */
void GRSetDrawMode(wxDC * DC, int mode); void GRSetDrawMode(wxDC * DC, int mode);
......
...@@ -57,8 +57,6 @@ public: ...@@ -57,8 +57,6 @@ public:
private: private:
wxMenu* m_FilesMenu;
SCH_CMP_FIELD* m_CurrentField; SCH_CMP_FIELD* m_CurrentField;
int m_TextFieldSize; int m_TextFieldSize;
......
...@@ -336,7 +336,6 @@ public: ...@@ -336,7 +336,6 @@ public:
private: private:
bool m_SelTrackWidthBox_Changed; bool m_SelTrackWidthBox_Changed;
bool m_SelViaSizeBox_Changed; bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu;
DRC* m_drc; ///< the DRC controller, see drc.cpp DRC* m_drc; ///< the DRC controller, see drc.cpp
...@@ -419,6 +418,7 @@ public: ...@@ -419,6 +418,7 @@ public:
void InstallDrillFrame( wxCommandEvent& event ); void InstallDrillFrame( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event ); void ToPostProcess( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
void Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
int LoadOnePcbFile( const wxString& FileName, bool Append ); int LoadOnePcbFile( const wxString& FileName, bool Append );
int ReadPcbFile( FILE* File, bool Append ); int ReadPcbFile( FILE* File, bool Append );
...@@ -762,8 +762,6 @@ class WinEDA_GerberFrame : public WinEDA_BasePcbFrame ...@@ -762,8 +762,6 @@ class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
public: public:
WinEDAChoiceBox* m_SelLayerBox; WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelLayerTool; WinEDAChoiceBox* m_SelLayerTool;
private:
wxMenu* m_FilesMenu;
public: public:
WinEDA_GerberFrame( wxWindow* father, const wxString& title, WinEDA_GerberFrame( wxWindow* father, const wxString& title,
...@@ -817,6 +815,7 @@ public: ...@@ -817,6 +815,7 @@ public:
int garde, int tracevia, int modetrace ); int garde, int tracevia, int modetrace );
void Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
int LoadOneGerberFile( const wxString& FileName, wxDC* DC, int mode ); int LoadOneGerberFile( const wxString& FileName, wxDC* DC, int mode );
int ReadGerberFile( wxDC* DC, FILE* File, bool Append ); int ReadGerberFile( wxDC* DC, FILE* File, bool Append );
bool Read_GERBER_File( wxDC* DC, bool Read_GERBER_File( wxDC* DC,
......
...@@ -127,7 +127,6 @@ public: ...@@ -127,7 +127,6 @@ public:
wxSize m_FrameSize; wxSize m_FrameSize;
int m_MsgFrameHeight; int m_MsgFrameHeight;
WinEDA_MenuBar* m_MenuBar; // menu du haut d'ecran
WinEDA_Toolbar* m_HToolBar; // Standard horizontal Toolbar WinEDA_Toolbar* m_HToolBar; // Standard horizontal Toolbar
bool m_FrameIsActive; bool m_FrameIsActive;
wxString m_FrameName; // name used for writting and reading setup wxString m_FrameName; // name used for writting and reading setup
...@@ -161,7 +160,7 @@ public: ...@@ -161,7 +160,7 @@ public:
void SetLanguage( wxCommandEvent& event ); void SetLanguage( wxCommandEvent& event );
void ProcessFontPreferences( int id ); void ProcessFontPreferences( int id );
wxString GetLastProject( int rang ); wxString GetFileFromHistory( int cmdId, const wxString& type );
void SetLastProject( const wxString& FullFileName ); void SetLastProject( const wxString& FullFileName );
void DisplayActivity( int PerCent, const wxString& Text ); void DisplayActivity( int PerCent, const wxString& Text );
virtual void ReCreateMenuBar(); virtual void ReCreateMenuBar();
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
*/ */
/*****************************************************************************/ /*****************************************************************************/
#include "wx/spinctrl.h"
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -78,9 +76,8 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame ) ...@@ -78,9 +76,8 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame )
ID_LANGUAGE_CHOICE_END, ID_LANGUAGE_CHOICE_END,
WinEDA_MainFrame::SetLanguage ) WinEDA_MainFrame::SetLanguage )
EVT_MENU_RANGE( ID_LOAD_PROJECT, EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9,
ID_LOAD_FILE_10, WinEDA_MainFrame::OnFileHistory )
WinEDA_MainFrame::Process_Files )
/* Button events */ /* Button events */
EVT_BUTTON( ID_TO_PCB, EVT_BUTTON( ID_TO_PCB,
...@@ -109,139 +106,107 @@ END_EVENT_TABLE() ...@@ -109,139 +106,107 @@ END_EVENT_TABLE()
void WinEDA_MainFrame::ReCreateMenuBar() void WinEDA_MainFrame::ReCreateMenuBar()
/*****************************************************************************/ /*****************************************************************************/
{ {
int ii, jj; wxMenuItem *item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar *menuBar = GetMenuBar();
// Check if menubar is empty /* Destroy the existing menu bar so it can be rebuilt. This allows
if( menuBar == NULL ) * language changes of the menu text on the fly. */
{ if( menuBar )
m_MenuBar = menuBar = new wxMenuBar(); SetMenuBar( NULL );
m_FilesMenu = new wxMenu;
menuBar = new wxMenuBar();
// Check if menubar is empty
wxMenu* filesMenu = new wxMenu;
// Open project // Open project
wxMenuItem* item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open" ),
ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open an existing project" ) ); _( "Open an existing project" ) );
item->SetBitmap( open_project_xpm ); item->SetBitmap( open_project_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// New project // New project
item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New" ),
ID_NEW_PROJECT,
_( "&New" ),
_( "Start a new project" ) ); _( "Start a new project" ) );
item->SetBitmap( new_project_xpm ); item->SetBitmap( new_project_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// Save project // Save project
item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save" ),
ID_SAVE_PROJECT,
_( "&Save" ),
_( "Save current project" ) ); _( "Save current project" ) );
item->SetBitmap( save_project_xpm ); item->SetBitmap( save_project_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// Separator // Separator
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
// Archive project // Archive project
item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_SAVE_AND_ZIP_FILES,
ID_SAVE_AND_ZIP_FILES,
_( "&Archive" ), _( "&Archive" ),
_( "Archive project files in zip archive" ) ); _( "Archive project files in zip archive" ) );
item->SetBitmap( zip_xpm ); item->SetBitmap( zip_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// Unarchive project // Unarchive project
item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_READ_ZIP_ARCHIVE,
ID_READ_ZIP_ARCHIVE,
_( "&Unarchive" ), _( "&Unarchive" ),
_( "Unarchive project files from zip file" ) ); _( "Unarchive project files from zip file" ) );
item->SetBitmap( unzip_xpm ); item->SetBitmap( unzip_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// Separator // Separator
m_FilesMenu->AppendSeparator(); filesMenu->AppendSeparator();
// Exit // Exit
item = new wxMenuItem( m_FilesMenu, item = new wxMenuItem( filesMenu, ID_EXIT, _( "E&xit" ),
ID_EXIT,
_( "E&xit" ),
_( "Quit kicad" ) ); _( "Quit kicad" ) );
item->SetBitmap( exit_xpm ); item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item ); filesMenu->Append( item );
// Create last 10 project entries /* Add the file history */
m_FilesMenu->AppendSeparator(); wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
for( ii = 0; ii < 10; ii++ )
{
m_MenuBar = menuBar = new wxMenuBar();
if( GetLastProject( ii ).IsEmpty() ) /**********************************************************************/
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
/*************************************************************************/
wxMenu* browseMenu = new wxMenu(); wxMenu* browseMenu = new wxMenu();
/*************************************************************************/ /**********************************************************************/
// Editor // Editor
item = new wxMenuItem( browseMenu, // Entry in menu item = new wxMenuItem( browseMenu, ID_TO_EDITOR, _( "Text E&ditor" ),
ID_TO_EDITOR, // Entry ID _( "Open prefered text editor" ) );
_( "Text E&ditor" ), // Entry text item->SetBitmap( editor_xpm );
_( "Open prefered text editor" ) ); // Status bar text browseMenu->Append( item );
item->SetBitmap( editor_xpm ); // Entry XPM Bitmap
browseMenu->Append( item ); // Append wxMenuItem to menu
// Browse files // Browse files
item = new wxMenuItem( browseMenu, item = new wxMenuItem( browseMenu, ID_BROWSE_AN_SELECT_FILE,
ID_BROWSE_AN_SELECT_FILE,
_( "&Browse Files" ), _( "&Browse Files" ),
_( "Read or edit files with text editor" ) ); _( "Read or edit files with text editor" ) );
item->SetBitmap( browse_files_xpm ); item->SetBitmap( browse_files_xpm );
browseMenu->Append( item ); browseMenu->Append( item );
/**********************************************************************/
/*************************************************************************/
wxMenu* PreferencesMenu = new wxMenu; wxMenu* PreferencesMenu = new wxMenu;
/*************************************************************************/ /**********************************************************************/
// Fonts // Fonts
item = new wxMenuItem( PreferencesMenu, item = new wxMenuItem( PreferencesMenu, ID_PREFERENCES_FONT_INFOSCREEN,
ID_PREFERENCES_FONT_INFOSCREEN, _( "Fonts" ), _( "Font preferences" ) );
_( "Fonts" ),
_( "Font preferences" ) );
item->SetBitmap( fonts_xpm ); item->SetBitmap( fonts_xpm );
PreferencesMenu->Append( item ); PreferencesMenu->Append( item );
// Prefered text editor // Prefered text editor
item = new wxMenuItem( PreferencesMenu, item = new wxMenuItem( PreferencesMenu, ID_SELECT_PREFERED_EDITOR,
ID_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ), _( "&Text Editor" ),
_( "Select your prefered text editor" ) ); _( "Select your prefered text editor" ) );
item->SetBitmap( editor_xpm ); item->SetBitmap( editor_xpm );
PreferencesMenu->Append( item ); PreferencesMenu->Append( item );
// Submenu Pdf Browser selection: system browser or user // Submenu Pdf Browser selection: system browser or user
// selected browser (and its name) // selected browser (and its name)
/*************************************************************************/ /**********************************************************************/
wxMenu* SubMenuPdfBrowserChoice = new wxMenu; wxMenu* SubMenuPdfBrowserChoice = new wxMenu;
/*************************************************************************/ /**********************************************************************/
// Default PDF viewer // Default PDF viewer
item = new wxMenuItem( SubMenuPdfBrowserChoice, item = new wxMenuItem( SubMenuPdfBrowserChoice,
...@@ -285,62 +250,29 @@ void WinEDA_MainFrame::ReCreateMenuBar() ...@@ -285,62 +250,29 @@ void WinEDA_MainFrame::ReCreateMenuBar()
wxGetApp().SetLanguageList( PreferencesMenu ); wxGetApp().SetLanguageList( PreferencesMenu );
/*************************************************************************/ /**********************************************************************/
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
/*************************************************************************/ /**********************************************************************/
// Contents // Contents
item = new wxMenuItem( helpMenu, item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
ID_GENERAL_HELP,
_( "&Contents" ),
_( "Open the kicad manual" ) ); _( "Open the kicad manual" ) );
item->SetBitmap( help_xpm ); item->SetBitmap( help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
// About Kicad // About Kicad
item = new wxMenuItem( helpMenu, item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About" ),
ID_KICAD_ABOUT,
_( "&About" ),
_( "About kicad project manager" ) ); _( "About kicad project manager" ) );
item->SetBitmap( info_xpm ); item->SetBitmap( info_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
// Append menus to menuBar // Append menus to menuBar
menuBar->Append( m_FilesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( browseMenu, _( "&Browse" ) ); menuBar->Append( browseMenu, _( "&Browse" ) );
menuBar->Append( PreferencesMenu, _( "&Preferences" ) ); menuBar->Append( PreferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame
SetMenuBar( menuBar ); SetMenuBar( menuBar );
}
else // TODO (ENGLISH!) simple mise a jour de la liste des fichiers anciens
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( jj = 0, ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + jj, GetLastProject( ii ) );
jj++;
}
}
} }
......
...@@ -27,6 +27,21 @@ ...@@ -27,6 +27,21 @@
static void Create_NewPrj_Config( const wxString PrjFullFileName ); static void Create_NewPrj_Config( const wxString PrjFullFileName );
void WinEDA_MainFrame::OnFileHistory( wxCommandEvent& event )
{
wxString fn;
fn = GetFileFromHistory( event.GetId(), _( "Printed circuit board" ) );
if( fn != wxEmptyString )
{
m_PrjFileName = fn;
Load_Prj_Config();
}
ReCreateMenuBar();
}
/***********************************************************/ /***********************************************************/
void WinEDA_MainFrame::Process_Files( wxCommandEvent& event ) void WinEDA_MainFrame::Process_Files( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
...@@ -46,22 +61,6 @@ void WinEDA_MainFrame::Process_Files( wxCommandEvent& event ) ...@@ -46,22 +61,6 @@ void WinEDA_MainFrame::Process_Files( wxCommandEvent& event )
Save_Prj_Config(); Save_Prj_Config();
break; break;
case ID_LOAD_FILE_1:
case ID_LOAD_FILE_2:
case ID_LOAD_FILE_3:
case ID_LOAD_FILE_4:
case ID_LOAD_FILE_5:
case ID_LOAD_FILE_6:
case ID_LOAD_FILE_7:
case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10:
m_PrjFileName = GetLastProject( id - ID_LOAD_FILE_1 );
SetLastProject( m_PrjFileName );
ReCreateMenuBar();
Load_Prj_Config();
break;
case ID_NEW_PROJECT: case ID_NEW_PROJECT:
IsNew = TRUE; IsNew = TRUE;
......
...@@ -385,12 +385,14 @@ bool WinEDA_App::OnInit() ...@@ -385,12 +385,14 @@ bool WinEDA_App::OnInit()
if( argc > 1 ) if( argc > 1 )
frame->m_PrjFileName = argv[1]; frame->m_PrjFileName = argv[1];
else if( m_EDA_Config ) else if( m_fileHistory.GetCount() )
{ {
frame->m_PrjFileName = m_EDA_Config->Read( wxT( "LastProject" ), frame->m_PrjFileName = m_fileHistory.GetHistoryFile( 0 );
nameless_project ); if( !wxFileName::FileExists( frame->m_PrjFileName ) )
m_fileHistory.RemoveFileFromHistory( 0 );
} }
else
if( !wxFileName::FileExists( frame->m_PrjFileName ) )
frame->m_PrjFileName = nameless_project; frame->m_PrjFileName = nameless_project;
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
......
...@@ -46,9 +46,6 @@ public: ...@@ -46,9 +46,6 @@ public:
int m_LeftWin_Width; int m_LeftWin_Width;
int m_CommandWin_Height; int m_CommandWin_Height;
private:
wxMenu* m_FilesMenu;
public: public:
// Constructor and destructor // Constructor and destructor
...@@ -65,6 +62,7 @@ public: ...@@ -65,6 +62,7 @@ public:
void Load_Prj_Config(); void Load_Prj_Config();
void Save_Prj_Config(); void Save_Prj_Config();
void Process_Fct( wxCommandEvent& event ); void Process_Fct( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
void Process_Files( wxCommandEvent& event ); void Process_Files( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
......
...@@ -147,8 +147,11 @@ void WinEDA_MainFrame::Process_Preferences( wxCommandEvent& event ) ...@@ -147,8 +147,11 @@ void WinEDA_MainFrame::Process_Preferences( wxCommandEvent& event )
void WinEDA_MainFrame::SetLanguage( wxCommandEvent& event ) void WinEDA_MainFrame::SetLanguage( wxCommandEvent& event )
/********************************************************/ /********************************************************/
{ {
int id = event.GetId(); wxGetApp().SetLanguageIdentifier( event.GetId() );
if ( wxGetApp().SetLanguage() )
wxGetApp().SetLanguageIdentifier( id ); {
wxGetApp().SetLanguage(); wxLogDebug( wxT( "Recreating menu bar due to language change." ) );
ReCreateMenuBar();
Refresh();
}
} }
...@@ -23,7 +23,7 @@ void WinEDA_MainFrame::Load_Prj_Config() ...@@ -23,7 +23,7 @@ void WinEDA_MainFrame::Load_Prj_Config()
{ {
if( !wxFileExists( m_PrjFileName ) ) if( !wxFileExists( m_PrjFileName ) )
{ {
wxString msg = _( "Project File <" ) + m_PrjFileName + wxString msg = _( "Kicad project file <" ) + m_PrjFileName +
_( "> not found" ); _( "> not found" );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
...@@ -32,7 +32,7 @@ void WinEDA_MainFrame::Load_Prj_Config() ...@@ -32,7 +32,7 @@ void WinEDA_MainFrame::Load_Prj_Config()
wxSetWorkingDirectory( wxPathOnly( m_PrjFileName ) ); wxSetWorkingDirectory( wxPathOnly( m_PrjFileName ) );
SetTitle( g_Main_Title + wxT( " " ) + GetBuildVersion() + wxT( " " ) + SetTitle( g_Main_Title + wxT( " " ) + GetBuildVersion() + wxT( " " ) +
m_PrjFileName ); m_PrjFileName );
ReCreateMenuBar(); SetLastProject( m_PrjFileName );
m_LeftWin->ReCreateTreePrj(); m_LeftWin->ReCreateTreePrj();
wxString msg = _( "\nWorking dir: " ) + wxGetCwd(); wxString msg = _( "\nWorking dir: " ) + wxGetCwd();
......
...@@ -41,7 +41,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father, ...@@ -41,7 +41,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
long style) : long style) :
WinEDA_DrawFrame( father, idtype, title, pos, size, style ) WinEDA_DrawFrame( father, idtype, title, pos, size, style )
{ {
m_InternalUnits = 10000; // Internal unit = 1/10000 inch m_InternalUnits = PCB_INTERNAL_UNIT; // Internal unit = 1/10000 inch
m_Pcb = NULL; m_Pcb = NULL;
m_DisplayPadFill = TRUE; // How to draw pads m_DisplayPadFill = TRUE; // How to draw pads
...@@ -128,7 +128,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos ) ...@@ -128,7 +128,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
// Put cursor on item position // Put cursor on item position
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
screen->m_Curseur = aPos; screen->m_Curseur = aPos;
GRMouseWarp( DrawPanel, screen->m_Curseur ); DrawPanel->MouseTo( screen->m_Curseur );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
/* controle.cpp */ /* controle.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -516,11 +515,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -516,11 +515,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
} }
curpos = DrawPanel->CursorRealPosition( Mouse ); curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
delta.x = (int) round( (double) GetScreen()->GetGrid().x / zoom ); delta = GetScreen()->GetGrid() / zoom;
delta.y = (int) round( (double) GetScreen()->GetGrid().y / zoom );
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -594,7 +591,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -594,7 +591,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
// "as is", and let ShowNewTrackWhenMovingCursor figure out what to do. // "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
if( !Drc_On || !g_CurrentTrackSegment if( !Drc_On || !g_CurrentTrackSegment
|| g_CurrentTrackSegment != this->GetCurItem() || g_CurrentTrackSegment != this->GetCurItem()
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment->GetNet(), || !LocateIntrusion( m_Pcb->m_Track,
g_CurrentTrackSegment->GetNet(),
g_CurrentTrackSegment->m_Width ) ) g_CurrentTrackSegment->m_Width ) )
{ {
GetScreen()->m_Curseur = on_grid; GetScreen()->m_Curseur = on_grid;
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include <wx/dcps.h>
#include "dialog_print_using_printer_base.h" #include "dialog_print_using_printer_base.h"
#include "pcbnew.h" #include "pcbnew.h"
......
...@@ -10,6 +10,30 @@ ...@@ -10,6 +10,30 @@
#include "id.h" #include "id.h"
void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
{
wxString fn;
wxClientDC dc( DrawPanel );
fn = GetFileFromHistory( event.GetId(), _( "Printed circuit board" ) );
if( fn != wxEmptyString )
{
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->PrepareGraphicContext( &dc );
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
LoadOnePcbFile( fn, false );
ReCreateAuxiliaryToolbar();
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
}
}
/****************************************************/ /****************************************************/
void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
/****************************************************/ /****************************************************/
...@@ -84,22 +108,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -84,22 +108,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
break; break;
case ID_LOAD_FILE_1:
case ID_LOAD_FILE_2:
case ID_LOAD_FILE_3:
case ID_LOAD_FILE_4:
case ID_LOAD_FILE_5:
case ID_LOAD_FILE_6:
case ID_LOAD_FILE_7:
case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10:
wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) );
LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(),
false );
ReCreateAuxiliaryToolbar();
break;
case ID_SAVE_BOARD: case ID_SAVE_BOARD:
case ID_MENU_SAVE_BOARD: case ID_MENU_SAVE_BOARD:
SavePcbFile( GetScreen()->m_FileName ); SavePcbFile( GetScreen()->m_FileName );
......
This diff is collapsed.
...@@ -211,10 +211,10 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -211,10 +211,10 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_SelTrackWidthBox_Changed = FALSE; m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox_Changed = FALSE;
m_drc = new DRC( this ); // these 2 objects point to each other
SetBoard( new BOARD( NULL, this ) ); SetBoard( new BOARD( NULL, this ) );
m_drc = new DRC( this ); // these 2 objects point to each other
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum; m_DisplayPadNum = DisplayOpt.DisplayPadNum;
......
...@@ -184,30 +184,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -184,30 +184,10 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
/* Create the main horizontal toolbar for the board editor */ /* Create the main horizontal toolbar for the board editor */
{ {
int ii;
wxString msg; wxString msg;
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
{ {
// simple mise a jour de la liste des fichiers anciens
wxMenuItem* item;
for( ii = 9; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( ii = 0; ii < 10; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
D(printf("ReCreateHToolbar\n");) D(printf("ReCreateHToolbar\n");)
SetToolbars(); SetToolbars();
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment