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(); )
/**
* Fetch the file name from the file history list.
*/
wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
const wxString& type )
{
wxString fn, msg;
size_t i;
int baseId = wxGetApp().m_fileHistory.GetBaseId();
wxASSERT( cmdId >= baseId
&& cmdId < baseId + ( int )wxGetApp().m_fileHistory.GetCount() );
i = ( size_t )( cmdId - baseId );
if( i < wxGetApp().m_fileHistory.GetCount() )
{
if( wxGetApp().m_LastProject[ii].IsEmpty() )
break;
#ifdef __WINDOWS__
if( wxGetApp().m_LastProject[ii].CmpNoCase( FullFileName ) == 0 )
#else
if( wxGetApp().m_LastProject[ii] == FullFileName )
#endif
fn = wxGetApp().m_fileHistory.GetHistoryFile( i );
if( !wxFileName::FileExists( fn ) )
{
wxGetApp().m_LastProject.RemoveAt( ii );
msg = type + _( " file <" ) + fn + _( "> was not found." );
DisplayError( this, msg );
wxGetApp().m_fileHistory.RemoveFileFromHistory( i );
fn = wxEmptyString;
ReCreateMenuBar();
}
else
ii++;
}
while( wxGetApp().m_LastProject.GetCount() >= wxGetApp().m_LastProjectMaxCount )
{
wxGetApp().m_LastProject.RemoveAt( wxGetApp().m_LastProject.GetCount() - 1 );
}
wxGetApp().m_LastProject.Insert( FullFileName, 0 );
ReCreateMenuBar();
}
/**************************************************/
wxString WinEDA_BasicFrame::GetLastProject( int rang )
/**************************************************/
{
if( rang < 0 )
rang = 0;
if( (unsigned) rang >= wxGetApp().m_LastProject.GetCount() )
return wxEmptyString;
return wxGetApp().m_LastProject[rang];
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 );
MsgPanel = new WinEDA_MsgPanel( this, -1, wxPoint( 0, m_FrameSize.y ),
wxSize( m_FrameSize.x,
m_MsgFrameHeight ) );
MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
ColorRefs[LIGHTGRAY].m_Green,
ColorRefs[LIGHTGRAY].m_Blue ) );
}
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 ) );
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 );
}
......@@ -541,13 +496,11 @@ void WinEDA_DrawPanel::SetBoundaryBox()
m_ClipBox.SetSize( GetClientSize() );
#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_Pos.x *= GetZoom();
m_ClipBox.m_Pos.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 );
......@@ -1126,7 +1081,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
{
if( (screen->BlockLocate.m_Command == BLOCK_IDLE)
|| (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
|| (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
{
screen->BlockLocate.SetOrigin( m_CursorStartPos );
}
......@@ -1140,9 +1095,9 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
}
}
else if( (m_CanStartBlock >= 0 )
&& ( event.LeftIsDown() || event.MiddleIsDown() )
&& ManageCurseur == NULL
&& ForceCloseManageCurseur == NULL )
&& ( event.LeftIsDown() || event.MiddleIsDown() )
&& ManageCurseur == NULL
&& ForceCloseManageCurseur == NULL )
{ // Mouse is dragging: if no block in progress: start a block command
if( screen->BlockLocate.m_State == STATE_NO_BLOCK )
{ // Start a block command
......@@ -1245,8 +1200,9 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
/****************************************************/
{
long key, localkey;
bool escape = FALSE;
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
......
This diff is collapsed.
......@@ -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();
if( newfile && !oldfilename.IsEmpty() )
{
SetLastProject( NetInNameBuffer );
}
}
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,100 +99,73 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
/* Creation des menus de la fenetre principale
*/
{
int ii;
wxMenuBar* menuBar = GetMenuBar();
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,
_( "&Open" ),
_( "Open a NetList file" ) );
item->SetBitmap( open_xpm );
m_FilesMenu->Append( item );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT,
_( "&Save As..." ),
_( "Save New NetList and Footprints List files" ) );
item->SetBitmap( save_xpm );
m_FilesMenu->Append( item );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
_( "Quit Cvpcb" ) );
item->SetBitmap( exit_xpm );
m_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 ) );
}
// Menu Configuration:
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
_( "Setting Libraries, Directories and others..." ) );
item->SetBitmap( config_xpm );
configmenu->Append( item );
// Font selection and setup
AddFontSelectionMenu( configmenu );
wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE,
_( "&Save config" ),
_( "Save configuration in current dir" ) );
item->SetBitmap( save_setup_xpm );
configmenu->Append( item );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ),
_( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item =
new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
_( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
menuBar->Append( m_FilesMenu, _( "&File" ) );
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 ) );
}
}
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 );
menuBar = new wxMenuBar();
wxMenu* filesMenu = new wxMenu;
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a NetList file" ) );
item->SetBitmap( open_xpm );
filesMenu->Append( item );
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Save As..." ),
_( "Save New NetList and Footprints List files" ) );
item->SetBitmap( save_xpm );
filesMenu->Append( item );
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
_( "Quit Cvpcb" ) );
item->SetBitmap( exit_xpm );
filesMenu->Append( item );
// Creation des selections des anciens fichiers
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
// Menu Configuration:
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
_( "Setting Libraries, Directories and others..." ) );
item->SetBitmap( config_xpm );
configmenu->Append( item );
// Font selection and setup
AddFontSelectionMenu( configmenu );
wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE,
_( "&Save config" ),
_( "Save configuration in current dir" ) );
item->SetBitmap( save_setup_xpm );
configmenu->Append( item );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ),
_( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
_( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// 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 );
......
This diff is collapsed.
......@@ -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 );
SetToolbars();
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;
}
This diff is collapsed.
......@@ -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();
......
This diff is collapsed.
......@@ -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;
......@@ -592,10 +589,11 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{
// If there's no intrusion and DRC is active, we pass the cursor
// "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(),
g_CurrentTrackSegment->m_Width ) )
if( !Drc_On || !g_CurrentTrackSegment
|| g_CurrentTrackSegment != this->GetCurItem()
|| !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 );
......
This diff is collapsed.
......@@ -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