Code cleaning, minor fixes and minor coding style fixes. wxWidgets 2.9.4 compatibility fix( deprecated function MakeModal )

This commit is contained in:
jean-pierre charras 2012-09-11 21:03:21 +02:00
parent bb6795ddf1
commit b810135e4e
33 changed files with 741 additions and 714 deletions

View File

@ -680,7 +680,7 @@ void MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] ) if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] )
{ {
double zpos; double zpos;
if( m_Layer == LAYER_N_BACK ) if( IsFlipped() )
zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( true ); zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( true );
else else
zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( false ); zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( false );
@ -696,7 +696,7 @@ void MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 ); glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 );
} }
if( m_Layer == LAYER_N_BACK ) if( IsFlipped() )
{ {
glRotatef( 180.0, 0.0, 1.0, 0.0 ); glRotatef( 180.0, 0.0, 1.0, 0.0 );
glRotatef( 180.0, 0.0, 0.0, 1.0 ); glRotatef( 180.0, 0.0, 0.0, 1.0 );

View File

@ -57,7 +57,7 @@ END_EVENT_TABLE()
EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long style ) : EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long style ) :
wxFrame( parent, DISPLAY3D_FRAME, title, wxPoint( -1, -1 ), wxSize( -1, -1 ), style ) wxFrame( parent, DISPLAY3D_FRAME_TYPE, title, wxPoint( -1, -1 ), wxSize( -1, -1 ), style )
{ {
m_FrameName = wxT( "Frame3D" ); m_FrameName = wxT( "Frame3D" );
m_Canvas = NULL; m_Canvas = NULL;

View File

@ -56,12 +56,11 @@ static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" );
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father, EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father,
int idtype, ID_DRAWFRAME_TYPE idtype,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos, const wxSize& size,
const wxSize& size,
long style ) : long style ) :
wxFrame( father, -1, title, pos, size, style ) wxFrame( father, wxID_ANY, title, pos, size, style )
{ {
wxSize minsize; wxSize minsize;
@ -257,24 +256,6 @@ void EDA_BASE_FRAME::PrintMsg( const wxString& text )
SetStatusText( text ); SetStatusText( text );
} }
void EDA_BASE_FRAME::DisplayActivity( int PerCent, const wxString& Text )
{
wxString Line;
Line = Text;
PerCent = (PerCent < 0) ? 0 : PerCent;
PerCent = (PerCent > 100) ? 100 : PerCent;
PerCent /= 2; // Bargraph is 0 .. 50 points from 0% to 100%
if( PerCent )
Line.Pad( PerCent, '*' );
SetStatusText( Line );
}
void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName, void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
wxFileHistory * aFileHistory ) wxFileHistory * aFileHistory )
{ {
@ -540,7 +521,7 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
#endif #endif
tmp << wxT( " USE_BOOST_POLYGON_LIBRARY\n" ); tmp << wxT( " USE_BOOST_POLYGON_LIBRARY\n" );
tmp << wxT( " KICAD_SCRIPTING=" ); tmp << wxT( " KICAD_SCRIPTING=" );
#ifdef KICAD_SCRIPTING #ifdef KICAD_SCRIPTING
tmp << wxT( "ON\n" ); tmp << wxT( "ON\n" );
@ -663,3 +644,36 @@ edits you made?" ),
wxRemoveFile( autoSaveFileName.GetFullPath() ); wxRemoveFile( autoSaveFileName.GetFullPath() );
} }
} }
/**
* Function SetModalMode
* Disable or enable all other windows, to emulate a dialog behavior
* Useful when the frame is used to show and selec items
* (see FOOTPRINT_VIEWER_FRAME and LIB_VIEW_FRAME)
*
* @param aModal = true to disable all other opened windows (i.e.
* this windows is in dialog mode
* = false to enable other windows
* This function is analog to MakeModal( aModal ), deprecated since wxWidgets 2.9.4
*/
void EDA_BASE_FRAME::SetModalMode( bool aModal )
{
// Disable all other windows
#if wxCHECK_VERSION(2, 9, 4)
if ( IsTopLevel() )
{
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
while (node)
{
wxWindow *win = node->GetData();
if (win != this)
win->Enable(!aModal);
node = node->GetNext();
}
}
#else
// Deprecated since wxWidgets 2.9.4
MakeModal( aModal );
#endif
}

View File

@ -84,7 +84,8 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title, EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size, long style ) : const wxPoint& pos, const wxSize& size, long style ) :
EDA_BASE_FRAME( father, idtype, title, pos, size, style ) EDA_BASE_FRAME( father, idtype, title, pos, size, style )
{ {

View File

@ -76,7 +76,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, long style ) : const wxSize& size, long style ) :
PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME, title, pos, size, style ) PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME_TYPE, title, pos, size, style )
{ {
m_FrameName = wxT( "CmpFrame" ); m_FrameName = wxT( "CmpFrame" );
m_showAxis = true; // true to draw axis. m_showAxis = true; // true to draw axis.

View File

@ -104,7 +104,7 @@ END_EVENT_TABLE()
CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) : CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
EDA_BASE_FRAME( NULL, CVPCB_FRAME, title, wxDefaultPosition, wxDefaultSize, style ) EDA_BASE_FRAME( NULL, CVPCB_FRAME_TYPE, title, wxDefaultPosition, wxDefaultSize, style )
{ {
m_FrameName = wxT( "CvpcbFrame" ); m_FrameName = wxT( "CvpcbFrame" );

View File

@ -121,7 +121,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen();
if( aPrintAll && m_Parent->IsType( SCHEMATIC_FRAME ) ) if( aPrintAll && m_Parent->IsType( SCHEMATIC_FRAME_TYPE ) )
{ {
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent; SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
SCH_SHEET_PATH* sheetpath; SCH_SHEET_PATH* sheetpath;
@ -229,10 +229,10 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
if( frame->IsType( SCHEMATIC_FRAME ) ) if( frame->IsType( SCHEMATIC_FRAME_TYPE ) )
screen->Draw( panel, &dc, GR_COPY ); screen->Draw( panel, &dc, GR_COPY );
if( frame->IsType( LIBEDITOR_FRAME ) ) if( frame->IsType( LIBEDITOR_FRAME_TYPE ) )
((LIB_EDIT_FRAME*)frame)->RedrawComponent( &dc, ((LIB_EDIT_FRAME*)frame)->RedrawComponent( &dc,
wxPoint(sheetSize.x/2, wxPoint(sheetSize.x/2,
sheetSize.y/2) ); sheetSize.y/2) );

View File

@ -57,30 +57,22 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void )
/* Close the current Lib browser, if open, and open a new one, in "modal" mode */ /* Close the current Lib browser, if open, and open a new one, in "modal" mode */
if( m_ViewlibFrame ) if( m_ViewlibFrame )
{ {
m_ViewlibFrame->Destroy(); delete m_ViewlibFrame;
m_ViewlibFrame = NULL; m_ViewlibFrame = NULL;
} }
if( m_LibeditFrame && m_LibeditFrame->m_ViewlibFrame ) m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore,
{ KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
m_LibeditFrame->m_ViewlibFrame->Destroy();
m_LibeditFrame->m_ViewlibFrame = NULL;
}
m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore );
// Show the library viewer frame until it is closed // Show the library viewer frame until it is closed
// and disable the current frame, until the library viewer is closed
Enable(false);
// Wait for viewer closing event: // Wait for viewer closing event:
while( semaphore.TryWait() == wxSEMA_BUSY ) while( semaphore.TryWait() == wxSEMA_BUSY )
{ {
wxYield(); wxYield();
wxMilliSleep( 50 ); wxMilliSleep( 50 );
} }
Enable(true);
cmpname = m_ViewlibFrame->GetSelectedComponent(); cmpname = m_ViewlibFrame->GetSelectedComponent();
m_ViewlibFrame->Destroy(); delete m_ViewlibFrame;
return cmpname; return cmpname;
} }

View File

@ -805,7 +805,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
if( aPanel && aPanel->GetParent() ) if( aPanel && aPanel->GetParent() )
frame = (EDA_DRAW_FRAME*)aPanel->GetParent(); frame = (EDA_DRAW_FRAME*)aPanel->GetParent();
if( frame && frame->IsType( SCHEMATIC_FRAME ) && if( frame && frame->IsType( SCHEMATIC_FRAME_TYPE ) &&
! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() ) ! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
return; return;

View File

@ -191,7 +191,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
SCH_BASE_FRAME( aParent, LIBEDITOR_FRAME, title, pos, size, style ) SCH_BASE_FRAME( aParent, LIBEDITOR_FRAME_TYPE, title, pos, size, style )
{ {
wxASSERT( aParent ); wxASSERT( aParent );

View File

@ -28,7 +28,7 @@
#include <base_units.h> #include <base_units.h>
SCH_BASE_FRAME::SCH_BASE_FRAME( wxWindow* aParent, SCH_BASE_FRAME::SCH_BASE_FRAME( wxWindow* aParent,
id_drawframe aWindowType, ID_DRAWFRAME_TYPE aWindowType,
const wxString& aTitle, const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize, const wxPoint& aPosition, const wxSize& aSize,
long aStyle ) : long aStyle ) :

View File

@ -184,7 +184,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
SCH_BASE_FRAME( father, SCHEMATIC_FRAME, title, pos, size, style ) SCH_BASE_FRAME( father, SCHEMATIC_FRAME_TYPE, title, pos, size, style )
{ {
m_FrameName = wxT( "SchematicFrame" ); m_FrameName = wxT( "SchematicFrame" );
m_showAxis = false; // true to show axis m_showAxis = false; // true to show axis

View File

@ -99,9 +99,10 @@ static wxAcceleratorEntry accels[] =
#define EXTRA_BORDER_SIZE 2 #define EXTRA_BORDER_SIZE 2
LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaphore* semaphore ) : LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library,
SCH_BASE_FRAME( father, VIEWER_FRAME, _( "Library Browser" ), wxSemaphore* semaphore, long style ) :
wxDefaultPosition, wxDefaultSize ) SCH_BASE_FRAME( father, VIEWER_FRAME_TYPE, _( "Library Browser" ),
wxDefaultPosition, wxDefaultSize, style )
{ {
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
@ -120,10 +121,12 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
m_LibListWindow = NULL; m_LibListWindow = NULL;
m_CmpListWindow = NULL; m_CmpListWindow = NULL;
m_Semaphore = semaphore; m_Semaphore = semaphore;
if( m_Semaphore )
SetModalMode( true );
m_exportToEeschemaCmpName.Empty(); m_exportToEeschemaCmpName.Empty();
SetScreen( new SCH_SCREEN() ); SetScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true; // Center coordinate origins on screen. GetScreen()->m_Center = true; // Axis origin centered on screen.
LoadSettings(); LoadSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
@ -269,6 +272,7 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
m_Semaphore->Post(); m_Semaphore->Post();
// This window will be destroyed by the calling function, // This window will be destroyed by the calling function,
// if needed // if needed
SetModalMode( false );
} }
else else
{ {

View File

@ -1,158 +1,160 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here: * along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license, * or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** /**
* @file viewlib_frame.h * @file viewlib_frame.h
*/ */
#ifndef LIBVIEWFRM_H_ #ifndef LIBVIEWFRM_H_
#define LIBVIEWFRM_H_ #define LIBVIEWFRM_H_
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <sch_base_frame.h> #include <sch_base_frame.h>
#include <class_sch_screen.h> #include <class_sch_screen.h>
class wxSashLayoutWindow; class wxSashLayoutWindow;
class wxListBox; class wxListBox;
class wxSemaphore; class wxSemaphore;
class CMP_LIBRARY; class CMP_LIBRARY;
/** /**
* Component library viewer main window. * Component library viewer main window.
*/ */
class LIB_VIEW_FRAME : public SCH_BASE_FRAME class LIB_VIEW_FRAME : public SCH_BASE_FRAME
{ {
private: private:
wxComboBox* SelpartBox; wxComboBox* SelpartBox;
// List of libraries (for selection ) // List of libraries (for selection )
wxSashLayoutWindow* m_LibListWindow; wxSashLayoutWindow* m_LibListWindow;
wxListBox* m_LibList; // The list of libs wxListBox* m_LibList; // The list of libs
wxSize m_LibListSize; // size of the window wxSize m_LibListSize; // size of the window
// List of components in the selected library // List of components in the selected library
wxSashLayoutWindow* m_CmpListWindow; wxSashLayoutWindow* m_CmpListWindow;
wxListBox* m_CmpList; // The list of components wxListBox* m_CmpList; // The list of components
wxSize m_CmpListSize; // size of the window wxSize m_CmpListSize; // size of the window
// Flags // Flags
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_configPath; // subpath for configuration wxString m_configPath; // subpath for configuration
protected: protected:
static wxString m_libraryName; static wxString m_libraryName;
static wxString m_entryName; static wxString m_entryName;
static wxString m_exportToEeschemaCmpName; // When the viewer is used to select a component static wxString m_exportToEeschemaCmpName; // When the viewer is used to select a component
// in schematic, the selected component is here // in schematic, the selected component is here
static int m_unit; static int m_unit;
static int m_convert; static int m_convert;
public: public:
LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library = NULL, wxSemaphore* semaphore = NULL ); LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library = NULL,
wxSemaphore* semaphore = NULL,
~LIB_VIEW_FRAME(); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
void OnSize( wxSizeEvent& event ); ~LIB_VIEW_FRAME();
/** void OnSize( wxSizeEvent& event );
* Function OnSashDrag
* resizes the child windows when dragging a sash window border. /**
*/ * Function OnSashDrag
* resizes the child windows when dragging a sash window border.
void OnSashDrag( wxSashEvent& event ); */
/** void OnSashDrag( wxSashEvent& event );
* Function ReCreateListLib
* /**
* Creates or recreates the list of current loaded libraries. * Function ReCreateListLib
* This list is sorted, with the library cache always at end of the list *
*/ * Creates or recreates the list of current loaded libraries.
void ReCreateListLib(); * This list is sorted, with the library cache always at end of the list
*/
void ReCreateListCmp(); void ReCreateListLib();
void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos(); void ReCreateListCmp();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void Process_Special_Functions( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event ); void DisplayLibInfos();
void ReCreateHToolbar(); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateVToolbar(); void OnCloseWindow( wxCloseEvent& Event );
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void ReCreateHToolbar();
double BestZoom(); void ReCreateVToolbar();
void ClickOnLibList( wxCommandEvent& event ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void ClickOnCmpList( wxCommandEvent& event ); double BestZoom();
void OnSetRelativeOffset( wxCommandEvent& event ); void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); void OnSetRelativeOffset( wxCommandEvent& event );
/** void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
* Function LoadSettings
* loads the library viewer frame specific configuration settings. /**
* * Function LoadSettings
* Don't forget to call this base method from any derived classes or the * loads the library viewer frame specific configuration settings.
* settings will not get loaded. *
*/ * Don't forget to call this base method from any derived classes or the
void LoadSettings(); * settings will not get loaded.
*/
/** void LoadSettings();
* Function SaveSettings
* save library viewer frame specific configuration settings. /**
* * Function SaveSettings
* Don't forget to call this base method from any derived classes or the * save library viewer frame specific configuration settings.
* settings will not get saved. *
*/ * Don't forget to call this base method from any derived classes or the
void SaveSettings(); * settings will not get saved.
*/
wxString& GetEntryName( void ) const { return m_entryName; } void SaveSettings();
wxString& GetSelectedComponent( void ) const { return m_exportToEeschemaCmpName; }
wxString& GetEntryName( void ) const { return m_entryName; }
int GetUnit( void ) { return m_unit; } wxString& GetSelectedComponent( void ) const { return m_exportToEeschemaCmpName; }
int GetConvert( void ) { return m_convert; }
int GetUnit( void ) { return m_unit; }
private: int GetConvert( void ) { return m_convert; }
/**
* Function OnActivate private:
* is called when the frame frame is activate to reload the libraries and component lists /**
* that can be changed by the schematic editor or the library editor. * Function OnActivate
*/ * is called when the frame frame is activate to reload the libraries and component lists
virtual void OnActivate( wxActivateEvent& event ); * that can be changed by the schematic editor or the library editor.
*/
void SelectCurrentLibrary(); virtual void OnActivate( wxActivateEvent& event );
void SelectAndViewLibraryPart( int option );
void SelectCurrentLibrary();
/** void SelectAndViewLibraryPart( int option );
* Function ExportToSchematicLibraryPart
* exports the current component to schematic and close the library browser. /**
*/ * Function ExportToSchematicLibraryPart
void ExportToSchematicLibraryPart( wxCommandEvent& event ); * exports the current component to schematic and close the library browser.
void ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ); */
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void ExportToSchematicLibraryPart( wxCommandEvent& event );
void ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag );
DECLARE_EVENT_TABLE() bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
};
DECLARE_EVENT_TABLE()
#endif // LIBVIEWFRM_H_ };
#endif // LIBVIEWFRM_H_

View File

@ -63,7 +63,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
EDA_DRAW_FRAME( father, GERBER_FRAME, title, pos, size, style ) EDA_DRAW_FRAME( father, GERBER_FRAME_TYPE, title, pos, size, style )
{ {
m_colorsSettings = &g_ColorsSettings; m_colorsSettings = &g_ColorsSettings;
m_Layout = NULL; m_Layout = NULL;

View File

@ -57,7 +57,7 @@ protected:
public: public:
SCH_BASE_FRAME( wxWindow* aParent, SCH_BASE_FRAME( wxWindow* aParent,
id_drawframe aWindowType, ID_DRAWFRAME_TYPE aWindowType,
const wxString& aTitle, const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize, const wxPoint& aPosition, const wxSize& aSize,
long aStyle = KICAD_DEFAULT_DRAWFRAME_STYLE ); long aStyle = KICAD_DEFAULT_DRAWFRAME_STYLE );

View File

@ -96,7 +96,8 @@ protected:
virtual void unitsChangeRefresh(); virtual void unitsChangeRefresh();
public: public:
PCB_BASE_FRAME( wxWindow* father, int idtype, const wxString& title, PCB_BASE_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );

View File

@ -82,20 +82,22 @@ enum id_librarytype {
LIBRARY_TYPE_SYMBOL LIBRARY_TYPE_SYMBOL
}; };
enum id_drawframe { enum ID_DRAWFRAME_TYPE
NOT_INIT_FRAME = 0, {
SCHEMATIC_FRAME, NOT_INIT_FRAME_TYPE = 0,
LIBEDITOR_FRAME, SCHEMATIC_FRAME_TYPE,
VIEWER_FRAME, LIBEDITOR_FRAME_TYPE,
PCB_FRAME, VIEWER_FRAME_TYPE,
MODULE_EDITOR_FRAME, PCB_FRAME_TYPE,
MODULE_VIEWER_FRAME, MODULE_EDITOR_FRAME_TYPE,
CVPCB_FRAME, MODULE_VIEWER_FRAME_TYPE,
CVPCB_DISPLAY_FRAME, FOOTPRINT_WIZARD_FRAME_TYPE,
GERBER_FRAME, CVPCB_FRAME_TYPE,
TEXT_EDITOR_FRAME, CVPCB_DISPLAY_FRAME_TYPE,
DISPLAY3D_FRAME, GERBER_FRAME_TYPE,
KICAD_MAIN_FRAME TEXT_EDITOR_FRAME_TYPE,
DISPLAY3D_FRAME_TYPE,
KICAD_MAIN_FRAME_TYPE
}; };
@ -111,7 +113,7 @@ extern const wxChar* traceAutoSave;
class EDA_BASE_FRAME : public wxFrame class EDA_BASE_FRAME : public wxFrame
{ {
protected: protected:
int m_Ident; // Id Type (pcb, schematic, library..) ID_DRAWFRAME_TYPE m_Ident; // Id Type (pcb, schematic, library..)
wxPoint m_FramePos; wxPoint m_FramePos;
wxSize m_FrameSize; wxSize m_FrameSize;
int m_MsgFrameHeight; int m_MsgFrameHeight;
@ -158,7 +160,8 @@ protected:
virtual bool doAutoSave(); virtual bool doAutoSave();
public: public:
EDA_BASE_FRAME( wxWindow* father, int idtype, const wxString& title, EDA_BASE_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
@ -181,7 +184,7 @@ public:
bool IsActive() const { return m_FrameIsActive; } bool IsActive() const { return m_FrameIsActive; }
bool IsType( int aType ) const { return m_Ident == aType; } bool IsType( ID_DRAWFRAME_TYPE aType ) const { return m_Ident == aType; }
void GetKicadHelp( wxCommandEvent& event ); void GetKicadHelp( wxCommandEvent& event );
@ -306,11 +309,6 @@ public:
*/ */
void UpdateFileHistory( const wxString& FullFileName, wxFileHistory * aFileHistory = NULL ); void UpdateFileHistory( const wxString& FullFileName, wxFileHistory * aFileHistory = NULL );
/*
* Display a bargraph (0 to 50 point length) for a PerCent value from 0 to 100
*/
void DisplayActivity( int PerCent, const wxString& Text );
/** /**
* Function ReCreateMenuBar * Function ReCreateMenuBar
* Creates recreates the menu bar. * Creates recreates the menu bar.
@ -354,6 +352,19 @@ public:
* used to create the backup file name. * used to create the backup file name.
*/ */
void CheckForAutoSaveFile( const wxFileName& aFileName, const wxString& aBackupFileExtension ); void CheckForAutoSaveFile( const wxFileName& aFileName, const wxString& aBackupFileExtension );
/**
* Function SetModalMode
* Disable or enable all other windows, to emulate a dialog behavior
* Useful when the frame is used to show and selec items
* (see FOOTPRINT_VIEWER_FRAME and LIB_VIEW_FRAME)
*
* @param aModal = true to disable all other opened windows (i.e.
* this windows is in dialog mode
* = false to enable other windows
* This function is analog to MakeModal( aModal ), deprecated since wxWidgets 2.9.4
*/
void SetModalMode( bool aModal );
}; };
@ -439,7 +450,8 @@ protected:
virtual void unitsChangeRefresh(); virtual void unitsChangeRefresh();
public: public:
EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title, EDA_DRAW_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
@ -470,7 +482,7 @@ public:
void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; } void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
EDA_DRAW_PANEL* GetCanvas() { return m_canvas; } EDA_DRAW_PANEL* GetCanvas() { return m_canvas; }
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc();
/** /**

View File

@ -46,7 +46,7 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size ) : const wxSize& size ) :
EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME, title, pos, size ) EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_TYPE, title, pos, size )
{ {
wxString msg; wxString msg;
wxString line; wxString line;

View File

@ -76,12 +76,10 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype,
int idtype,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos, const wxSize& size,
const wxSize& size, long style) :
long style) :
EDA_DRAW_FRAME( father, idtype, title, pos, size, style ) EDA_DRAW_FRAME( father, idtype, title, pos, size, style )
{ {
m_Pcb = NULL; m_Pcb = NULL;
@ -853,16 +851,16 @@ FOOTPRINT_VIEWER_FRAME * PCB_BASE_FRAME::GetActiveViewerFrame()
switch( m_Ident ) switch( m_Ident )
{ {
case PCB_FRAME: case PCB_FRAME_TYPE:
if( m_ModuleEditFrame ) if( m_ModuleEditFrame )
return ((PCB_BASE_FRAME*)m_ModuleEditFrame)->m_ModuleViewerFrame; return ((PCB_BASE_FRAME*)m_ModuleEditFrame)->m_ModuleViewerFrame;
break; break;
case MODULE_EDITOR_FRAME: case MODULE_EDITOR_FRAME_TYPE:
return ((PCB_BASE_FRAME*)GetParent())->m_ModuleViewerFrame; return ((PCB_BASE_FRAME*)GetParent())->m_ModuleViewerFrame;
break; break;
case MODULE_VIEWER_FRAME: case MODULE_VIEWER_FRAME_TYPE:
return (FOOTPRINT_VIEWER_FRAME *)this; return (FOOTPRINT_VIEWER_FRAME *)this;
break; break;

View File

@ -446,7 +446,7 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->EraseMsgBox(); frame->EraseMsgBox();
if( frame->IsType( PCB_FRAME ) ) if( frame->IsType( PCB_FRAME_TYPE ) )
flag = true; flag = true;
frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN ); frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN );

View File

@ -970,7 +970,7 @@ void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame )
DisplayInfoBase( frame ); DisplayInfoBase( frame );
// Display full track length (in Pcbnew) // Display full track length (in Pcbnew)
if( frame->IsType( PCB_FRAME ) ) if( frame->IsType( PCB_FRAME_TYPE ) )
{ {
int trackLen = 0; int trackLen = 0;
int lenDie = 0; int lenDie = 0;
@ -1058,7 +1058,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN );
// Display Net Name (in Pcbnew) // Display Net Name (in Pcbnew)
if( frame->IsType( PCB_FRAME ) ) if( frame->IsType( PCB_FRAME_TYPE ) )
{ {
NETINFO_ITEM* net = board->FindNet( GetNet() ); NETINFO_ITEM* net = board->FindNet( GetNet() );

View File

@ -20,20 +20,20 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
{ {
SetFocus(); SetFocus();
int n_wizards = FOOTPRINT_WIZARDS::GetSize(); int n_wizards = FOOTPRINT_WIZARDS::GetSize();
// Current wizard selection, empty or first // Current wizard selection, empty or first
m_FootprintWizard = NULL; m_FootprintWizard = NULL;
if (n_wizards) if (n_wizards)
m_FootprintWizard = FOOTPRINT_WIZARDS::GetWizard(0); m_FootprintWizard = FOOTPRINT_WIZARDS::GetWizard(0);
// Choose selection mode and insert the needed rows // Choose selection mode and insert the needed rows
m_footprintWizardsGrid->SetColSize( 0, 0 ); // hide the preview for now m_footprintWizardsGrid->SetColSize( 0, 0 ); // hide the preview for now
m_footprintWizardsGrid->SetSelectionMode(wxGrid::wxGridSelectRows); m_footprintWizardsGrid->SetSelectionMode(wxGrid::wxGridSelectRows);
m_footprintWizardsGrid->InsertRows(0,n_wizards,true); m_footprintWizardsGrid->InsertRows(0,n_wizards,true);
// Put all wizards in the list // Put all wizards in the list
for (int i=0;i<n_wizards;i++) for (int i=0;i<n_wizards;i++)
{ {
@ -41,12 +41,12 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
wxString name = wizard->GetName(); wxString name = wizard->GetName();
wxString description = wizard->GetDescription(); wxString description = wizard->GetDescription();
wxString image = wizard->GetImage(); wxString image = wizard->GetImage();
m_footprintWizardsGrid->SetCellValue(i,1,name); m_footprintWizardsGrid->SetCellValue(i,1,name);
m_footprintWizardsGrid->SetCellValue(i,2,description); m_footprintWizardsGrid->SetCellValue(i,2,description);
} }
// Select the first row // Select the first row
m_footprintWizardsGrid->ClearSelection(); m_footprintWizardsGrid->ClearSelection();
m_footprintWizardsGrid->SelectRow(0,false); m_footprintWizardsGrid->SelectRow(0,false);
@ -68,6 +68,5 @@ FOOTPRINT_WIZARD* DIALOG_FOOTPRINT_WIZARD_LIST::GetWizard()
void DIALOG_FOOTPRINT_WIZARD_LIST::OnOpenButtonClick( wxCommandEvent& event ) void DIALOG_FOOTPRINT_WIZARD_LIST::OnOpenButtonClick( wxCommandEvent& event )
{ {
this->MakeModal(false); Close(true);
this->Close(true);
} }

View File

@ -108,7 +108,7 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
if( module && module->GetFlags() == 0 && Text->GetFlags() == 0 ) // prepare undo command if( module && module->GetFlags() == 0 && Text->GetFlags() == 0 ) // prepare undo command
{ {
if( this->m_Ident == PCB_FRAME ) if( IsType( PCB_FRAME_TYPE ) )
SaveCopyInUndoList( module, UR_CHANGED ); SaveCopyInUndoList( module, UR_CHANGED );
} }
@ -239,7 +239,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
// Prepare undo command (a rotation can be made while moving) // Prepare undo command (a rotation can be made while moving)
EXCHG( Text->m_Orient, TextInitialOrientation ); EXCHG( Text->m_Orient, TextInitialOrientation );
if( m_Ident == PCB_FRAME ) if( IsType( PCB_FRAME_TYPE ) )
SaveCopyInUndoList( Module, UR_CHANGED ); SaveCopyInUndoList( Module, UR_CHANGED );
else else
SaveCopyInUndoList( Module, UR_MODEDIT ); SaveCopyInUndoList( Module, UR_MODEDIT );

View File

@ -1,6 +1,6 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Miguel Angel Ajo Pelayo <miguelangel@nbee.es> * Copyright (C) 2012 Miguel Angel Ajo Pelayo <miguelangel@nbee.es>
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras * Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
@ -30,7 +30,6 @@
#include <fctsys.h> #include <fctsys.h>
#include <appl_wxstruct.h> #include <appl_wxstruct.h>
#include <macros.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <3d_viewer.h> #include <3d_viewer.h>
@ -38,6 +37,7 @@
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <module_editor_frame.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <pcbnew_id.h> #include <pcbnew_id.h>
@ -73,7 +73,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE, EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE,
FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint ) FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint )
EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW, EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
FOOTPRINT_WIZARD_FRAME::Show3D_Frame ) FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
/* listbox events */ /* listbox events */
@ -105,11 +105,13 @@ static wxAcceleratorEntry accels[] =
/* Function FOOTPRINT_WIZARD_FRAME /* Function FOOTPRINT_WIZARD_FRAME
* it's the constructor for the footprint wizard frame, it creates everything inside * it's the constructor for the footprint wizard frame, it creates everything inside
* *
*/ */
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* semaphore ) : FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent,
PCB_BASE_FRAME( parent, MODULE_VIEWER_FRAME, _( "Footprint Wizard" ), wxSemaphore* semaphore, long style ) :
wxDefaultPosition, wxDefaultSize ) PCB_BASE_FRAME( parent, FOOTPRINT_WIZARD_FRAME_TYPE,
_( "Footprint Wizard" ),
wxDefaultPosition, wxDefaultSize, style )
{ {
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
@ -132,7 +134,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
m_wizardName.Empty(); m_wizardName.Empty();
if( m_Semaphore ) if( m_Semaphore )
MakeModal(true); SetModalMode(true);
SetBoard( new BOARD() ); SetBoard( new BOARD() );
// Ensure all layers and items are visible: // Ensure all layers and items are visible:
@ -170,12 +172,12 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
// Creates the component window display // Creates the component window display
m_ParameterGridSize.y = size.y; m_ParameterGridSize.y = size.y;
win_pos.x = m_PageListSize.x; win_pos.x = m_PageListSize.x;
m_ParameterGridWindow = new wxSashLayoutWindow( this, m_ParameterGridWindow = new wxSashLayoutWindow( this,
ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW, ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW,
win_pos, wxDefaultSize, win_pos, wxDefaultSize,
wxCLIP_CHILDREN | wxSW_3D, wxCLIP_CHILDREN | wxSW_3D,
wxT( "ParameterList" ) ); wxT( "ParameterList" ) );
m_ParameterGridWindow->SetOrientation( wxLAYOUT_VERTICAL ); m_ParameterGridWindow->SetOrientation( wxLAYOUT_VERTICAL );
m_ParameterGridWindow->SetSashVisible( wxSASH_RIGHT, true ); m_ParameterGridWindow->SetSashVisible( wxSASH_RIGHT, true );
@ -243,7 +245,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
pane.MinSize( wxSize( m_ParameterGridSize.x, -1 ) ); pane.MinSize( wxSize( m_ParameterGridSize.x, -1 ) );
m_auimgr.Update(); m_auimgr.Update();
// Now Drawpanel is sized, we can use BestZoom to show the component (if any) // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
#ifdef USE_WX_GRAPHICS_CONTEXT #ifdef USE_WX_GRAPHICS_CONTEXT
GetScreen()->SetZoom( BestZoom() ); GetScreen()->SetZoom( BestZoom() );
@ -251,9 +253,9 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
Zoom_Automatique( false ); Zoom_Automatique( false );
#endif #endif
Show( true ); Show( true );
this->SelectFootprintWizard(); this->SelectFootprintWizard();
} }
@ -262,14 +264,12 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME()
{ {
if( m_Draw3DFrame ) if( m_Draw3DFrame )
m_Draw3DFrame->Destroy(); m_Draw3DFrame->Destroy();
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent();
frame->m_ModuleViewerFrame = NULL;
} }
/* Function OnCloseWindow /* Function OnCloseWindow
* Handles the close event, saving settings an destroying or releasing a semaphore from caller * Handles the close event, saving settings an destroying or releasing a semaphore from caller
* *
*/ */
void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event ) void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
@ -285,7 +285,7 @@ void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
if( m_Semaphore ) if( m_Semaphore )
{ {
m_Semaphore->Post(); m_Semaphore->Post();
MakeModal(false); SetModalMode(false);
// This window will be destroyed by the calling function, // This window will be destroyed by the calling function,
// to avoid side effects // to avoid side effects
} }
@ -294,12 +294,12 @@ void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
Destroy(); Destroy();
} }
} }
/* Function OnSashDrag /* Function OnSashDrag
* handles the horizontal separator (sash) drag, updating the pagelist or parameter list * handles the horizontal separator (sash) drag, updating the pagelist or parameter list
*/ */
void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event ) void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event )
{ {
@ -334,8 +334,8 @@ void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event )
/* Function OnSize /* Function OnSize
* It handles a dialog resize event, asking for an update * It handles a dialog resize event, asking for an update
* *
*/ */
void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv ) void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
{ {
@ -346,8 +346,8 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
} }
/* Function OnSetRelativeOffset /* Function OnSetRelativeOffset
* Updates the cursor position and the status bar * Updates the cursor position and the status bar
* *
*/ */
void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
{ {
@ -357,13 +357,13 @@ void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
/* Function ReCreatePageList /* Function ReCreatePageList
* It recreates the list of pages for a new loaded wizard * It recreates the list of pages for a new loaded wizard
* *
*/ */
void FOOTPRINT_WIZARD_FRAME::ReCreatePageList() void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
{ {
if( m_PageList == NULL ) if( m_PageList == NULL )
return; return;
if (m_FootprintWizard == NULL) if (m_FootprintWizard == NULL)
return; return;
@ -374,9 +374,9 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
wxString name = m_FootprintWizard->GetParameterPageName( i ); wxString name = m_FootprintWizard->GetParameterPageName( i );
m_PageList->Append( name ); m_PageList->Append( name );
} }
m_PageList->SetSelection( 0, true ); m_PageList->SetSelection( 0, true );
ReCreateParameterList(); ReCreateParameterList();
ReCreateHToolbar(); ReCreateHToolbar();
DisplayWizardInfos(); DisplayWizardInfos();
@ -385,24 +385,24 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
/* Function ReCreateParameterList /* Function ReCreateParameterList
* It creates the parameter grid for a certain wizard page of the current wizard * It creates the parameter grid for a certain wizard page of the current wizard
* *
*/ */
void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
{ {
if( m_ParameterGrid == NULL ) if( m_ParameterGrid == NULL )
return; return;
if (m_FootprintWizard == NULL ) if (m_FootprintWizard == NULL )
return; return;
int page = m_PageList->GetSelection(); int page = m_PageList->GetSelection();
if (page<0) if (page<0)
return; return;
m_ParameterGrid->ClearGrid(); m_ParameterGrid->ClearGrid();
// Columns // Columns
m_ParameterGrid->AutoSizeColumns(); m_ParameterGrid->AutoSizeColumns();
m_ParameterGrid->SetColLabelSize( 20 ); m_ParameterGrid->SetColLabelSize( 20 );
@ -410,34 +410,34 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
m_ParameterGrid->SetColLabelValue( 1, _("Value") ); m_ParameterGrid->SetColLabelValue( 1, _("Value") );
m_ParameterGrid->SetColLabelValue( 2, _("Units") ); m_ParameterGrid->SetColLabelValue( 2, _("Units") );
m_ParameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); m_ParameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
// Rows // Rows
m_ParameterGrid->AutoSizeRows(); m_ParameterGrid->AutoSizeRows();
m_ParameterGrid->EnableDragRowSize( true ); m_ParameterGrid->EnableDragRowSize( true );
m_ParameterGrid->SetRowLabelSize( 1 ); m_ParameterGrid->SetRowLabelSize( 1 );
m_ParameterGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); m_ParameterGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Get the list of names, values, and types // Get the list of names, values, and types
wxArrayString fpList = m_FootprintWizard->GetParameterNames(page); wxArrayString fpList = m_FootprintWizard->GetParameterNames(page);
wxArrayString fvList = m_FootprintWizard->GetParameterValues(page); wxArrayString fvList = m_FootprintWizard->GetParameterValues(page);
wxArrayString ptList = m_FootprintWizard->GetParameterTypes(page); wxArrayString ptList = m_FootprintWizard->GetParameterTypes(page);
// Dimension the wxGrid // Dimension the wxGrid
m_ParameterGrid->CreateGrid(fpList.size(),3); m_ParameterGrid->CreateGrid(fpList.size(),3);
for (unsigned int i=0; i<fpList.size(); i++) for (unsigned int i=0; i<fpList.size(); i++)
{ {
wxString name,value,units; wxString name,value,units;
name = fpList[i]; name = fpList[i];
value = fvList[i]; value = fvList[i];
m_ParameterGrid->SetCellValue( i, 0, name ); m_ParameterGrid->SetCellValue( i, 0, name );
m_ParameterGrid->SetReadOnly( i, 0 ); m_ParameterGrid->SetReadOnly( i, 0 );
if ( ptList[i]==wxT( "IU" ) ) if ( ptList[i]==wxT( "IU" ) )
{ {
// We are handling internal units, so convert them to the current // We are handling internal units, so convert them to the current
// system selected units and store into value. // system selected units and store into value.
double dValue; double dValue;
value.ToDouble( &dValue ); value.ToDouble( &dValue );
@ -445,10 +445,10 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
dValue = To_User_Unit( g_UserUnit, dValue ); dValue = To_User_Unit( g_UserUnit, dValue );
if ( g_UserUnit==INCHES ) // we convert inches into mils for more detail if ( g_UserUnit==INCHES ) // we convert inches into mils for more detail
{ {
dValue = dValue*1000.0; dValue = dValue*1000.0;
units = wxT( "mils" ); units = wxT( "mils" );
} }
else if ( g_UserUnit==MILLIMETRES ) else if ( g_UserUnit==MILLIMETRES )
{ {
units = wxT( "mm" ); units = wxT( "mm" );
@ -461,13 +461,13 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
units = wxT( "" ); units = wxT( "" );
} }
m_ParameterGrid->SetCellValue( i, 1 , value ); m_ParameterGrid->SetCellValue( i, 1 , value );
m_ParameterGrid->SetCellValue( i, 2 , units ); m_ParameterGrid->SetCellValue( i, 2 , units );
m_ParameterGrid->SetReadOnly( i, 2 ); m_ParameterGrid->SetReadOnly( i, 2 );
} }
m_ParameterGrid->AutoSizeColumns(); m_ParameterGrid->AutoSizeColumns();
} }
@ -476,8 +476,8 @@ void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event )
int ii = m_PageList->GetSelection(); int ii = m_PageList->GetSelection();
if( ii < 0 ) if( ii < 0 )
return; return;
ReCreateParameterList(); ReCreateParameterList();
m_canvas->Refresh(); m_canvas->Refresh();
DisplayWizardInfos(); DisplayWizardInfos();
@ -510,7 +510,7 @@ void FOOTPRINT_WIZARD_FRAME::LoadSettings( )
if ( m_ParameterGridSize.x > m_FrameSize.x/2 ) if ( m_ParameterGridSize.x > m_FrameSize.x/2 )
m_ParameterGridSize.x = m_FrameSize.x/2; m_ParameterGridSize.x = m_FrameSize.x/2;
} }
@ -544,7 +544,7 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
// If we are here, the library list has changed, rebuild it // If we are here, the library list has changed, rebuild it
ReCreatePageList(); ReCreatePageList();
DisplayWizardInfos(); DisplayWizardInfos();
} }
} }

View File

@ -1,200 +1,202 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Miguel Angel Ajo Pelayo, miguelangel@nbee.es * Copyright (C) 2012 Miguel Angel Ajo Pelayo, miguelangel@nbee.es
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here: * along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license, * or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** /**
* @file footprint_wizard_frame.h * @file footprint_wizard_frame.h
*/ */
#ifndef FOOTPRINT_WIZARD_FRAME_H_ #ifndef FOOTPRINT_WIZARD_FRAME_H_
#define FOOTPRINT_WIZARD_FRAME_H_ #define FOOTPRINT_WIZARD_FRAME_H_
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <class_footprint_wizard.h> #include <class_footprint_wizard.h>
class wxSashLayoutWindow; class wxSashLayoutWindow;
class wxListBox; class wxListBox;
class wxSemaphore; class wxSemaphore;
class wxGrid; class wxGrid;
class wxGridEvent; class wxGridEvent;
/** /**
* Component library viewer main window. * Component library viewer main window.
*/ */
class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_FRAME class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_FRAME
{ {
private: private:
wxSashLayoutWindow* m_PageListWindow; //< List of libraries (for selection ) wxSashLayoutWindow* m_PageListWindow; //< List of libraries (for selection )
wxListBox* m_PageList; //< The list of pages wxListBox* m_PageList; //< The list of pages
wxSize m_PageListSize; //< size of the window wxSize m_PageListSize; //< size of the window
wxSashLayoutWindow* m_ParameterGridWindow; //< List of components in the selected library wxSashLayoutWindow* m_ParameterGridWindow; //< List of components in the selected library
wxGrid* m_ParameterGrid; //< The list of parameters wxGrid* m_ParameterGrid; //< The list of parameters
wxSize m_ParameterGridSize; //< size of the window wxSize m_ParameterGridSize; //< size of the window
// Flags // Flags
wxSemaphore* m_Semaphore; //< != NULL if the frame must emulate a modal dialog wxSemaphore* m_Semaphore; //< != NULL if the frame must emulate a modal dialog
wxString m_configPath; //< subpath for configuration wxString m_configPath; //< subpath for configuration
FOOTPRINT_WIZARD* m_FootprintWizard; FOOTPRINT_WIZARD* m_FootprintWizard;
protected: protected:
wxString m_wizardName; //< name of the current wizard wxString m_wizardName; //< name of the current wizard
wxString m_wizardDescription; //< description of the wizard wxString m_wizardDescription; //< description of the wizard
wxString m_wizardStatus; //< current wizard status wxString m_wizardStatus; //< current wizard status
public: public:
FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* semaphore = NULL ); FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent,
wxSemaphore* semaphore = NULL,
~FOOTPRINT_WIZARD_FRAME(); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
MODULE* GetBuiltFootprint( void ); ~FOOTPRINT_WIZARD_FRAME();
private: MODULE* GetBuiltFootprint( void );
void OnSize( wxSizeEvent& event ); private:
/**
* Function ExportSelectedFootprint(); void OnSize( wxSizeEvent& event );
* will let the caller exit from the wait loop, and get the built footprint /**
* * Function ExportSelectedFootprint();
*/ * will let the caller exit from the wait loop, and get the built footprint
void ExportSelectedFootprint( wxCommandEvent& aEvent ); *
*/
/** void ExportSelectedFootprint( wxCommandEvent& aEvent );
* Function OnSashDrag
* resizes the child windows when dragging a sash window border. /**
*/ * Function OnSashDrag
* resizes the child windows when dragging a sash window border.
void OnSashDrag( wxSashEvent& event ); */
/** void OnSashDrag( wxSashEvent& event );
* Function ReCreatePageList
* Creates or recreates the list of parameter pages for the current wizard. /**
* This list is sorted * Function ReCreatePageList
*/ * Creates or recreates the list of parameter pages for the current wizard.
void ReCreatePageList(); * This list is sorted
*/
/** void ReCreatePageList();
* Function ReCreateParameterList
* Creates the list of parameters for the current page /**
*/ * Function ReCreateParameterList
void ReCreateParameterList(); * Creates the list of parameters for the current page
*/
/** void ReCreateParameterList();
* Function SelectFootprintWizard
* Shows the list of footprint wizards available into the system /**
*/ * Function SelectFootprintWizard
void SelectFootprintWizard(); * Shows the list of footprint wizards available into the system
*/
/** void SelectFootprintWizard();
* Function ReloadFootprint
* Reloads the current footprint /**
*/ * Function ReloadFootprint
void ReloadFootprint(); * Reloads the current footprint
*/
void ReloadFootprint();
void Process_Special_Functions( wxCommandEvent& event );
/** void Process_Special_Functions( wxCommandEvent& event );
* Function DisplayWizardInfos
* Shows all the details about the current wizard /**
*/ * Function DisplayWizardInfos
void DisplayWizardInfos(); * Shows all the details about the current wizard
*/
void DisplayWizardInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar(); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateVToolbar(); void OnCloseWindow( wxCloseEvent& Event );
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void ReCreateHToolbar();
void ClickOnPageList( wxCommandEvent& event ); void ReCreateVToolbar();
void OnSetRelativeOffset( wxCommandEvent& event ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void ClickOnPageList( wxCommandEvent& event );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); void OnSetRelativeOffset( wxCommandEvent& event );
/** void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
* Function LoadSettings
* loads the library viewer frame specific configuration settings. /**
* * Function LoadSettings
* Don't forget to call this base method from any derived classes or the * loads the library viewer frame specific configuration settings.
* settings will not get loaded. *
*/ * Don't forget to call this base method from any derived classes or the
void LoadSettings(); * settings will not get loaded.
*/
/** void LoadSettings();
* Function SaveSettings
* save library viewer frame specific configuration settings. /**
* * Function SaveSettings
* Don't forget to call this base method from any derived classes or the * save library viewer frame specific configuration settings.
* settings will not get saved. *
*/ * Don't forget to call this base method from any derived classes or the
void SaveSettings(); * settings will not get saved.
*/
void SaveSettings();
/**
* Function OnActivate
* is called when the frame frame is activate to reload the libraries and component lists /**
* that can be changed by the schematic editor or the library editor. * Function OnActivate
*/ * is called when the frame frame is activate to reload the libraries and component lists
virtual void OnActivate( wxActivateEvent& event ); * that can be changed by the schematic editor or the library editor.
*/
void SelectCurrentWizard( wxCommandEvent& event ); virtual void OnActivate( wxActivateEvent& event );
void ParametersUpdated( wxGridEvent& event ); void SelectCurrentWizard( wxCommandEvent& event );
void ParametersUpdated( wxGridEvent& event );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
/** bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
* Function Show3D_Frame (virtual)
* displays 3D view of the footprint (module) being edited. /**
*/ * Function Show3D_Frame (virtual)
void Show3D_Frame( wxCommandEvent& event ); * displays 3D view of the footprint (module) being edited.
*/
/** void Show3D_Frame( wxCommandEvent& event );
* Function Update3D_Frame
* must be called after a footprint selection /**
* Updates the 3D view and 3D frame title. * Function Update3D_Frame
* @param aForceReloadFootprint = true to reload data (default) * must be called after a footprint selection
* = false to update title only -(aftre creating the 3D viewer) * Updates the 3D view and 3D frame title.
*/ * @param aForceReloadFootprint = true to reload data (default)
void Update3D_Frame( bool aForceReloadFootprint = true ); * = false to update title only -(aftre creating the 3D viewer)
*/
/* void Update3D_Frame( bool aForceReloadFootprint = true );
* Virtual functions, not used here, but needed by PCB_BASE_FRAME
* (virtual pure functions ) /*
*/ * Virtual functions, not used here, but needed by PCB_BASE_FRAME
void OnLeftDClick(wxDC*, const wxPoint&) {} * (virtual pure functions )
void SaveCopyInUndoList(BOARD_ITEM*, UNDO_REDO_T, const wxPoint&) {} */
void SaveCopyInUndoList(PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint&) {} void OnLeftDClick(wxDC*, const wxPoint&) {}
void SaveCopyInUndoList(BOARD_ITEM*, UNDO_REDO_T, const wxPoint&) {}
void SaveCopyInUndoList(PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint&) {}
DECLARE_EVENT_TABLE()
};
DECLARE_EVENT_TABLE()
#endif // FOOTPRINT_WIZARD_FRM_H_ };
#endif // FOOTPRINT_WIZARD_FRM_H_

View File

@ -116,7 +116,7 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void )
{ {
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
// Close the current Lib browser, if open, and open a new one, in "modal" mode: // Close the current Lib browser, if opened, and open a new one, in "modal" mode:
FOOTPRINT_VIEWER_FRAME * viewer = GetActiveViewerFrame(); FOOTPRINT_VIEWER_FRAME * viewer = GetActiveViewerFrame();
if( viewer ) if( viewer )
{ {
@ -127,7 +127,8 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void )
m_ModuleEditFrame->m_ModuleViewerFrame = NULL; m_ModuleEditFrame->m_ModuleViewerFrame = NULL;
} }
m_ModuleViewerFrame = new FOOTPRINT_VIEWER_FRAME( this, &semaphore ); m_ModuleViewerFrame = new FOOTPRINT_VIEWER_FRAME( this, &semaphore,
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
// Show the library viewer frame until it is closed // Show the library viewer frame until it is closed
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event

View File

@ -296,9 +296,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( NULL ); SetCurItem( NULL );
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) ); GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
FOOTPRINT_WIZARD_FRAME *wizard = new FOOTPRINT_WIZARD_FRAME( this, &semaphore ); FOOTPRINT_WIZARD_FRAME *wizard = new FOOTPRINT_WIZARD_FRAME( this, &semaphore,
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
wizard->Show( true ); wizard->Show( true );
wizard->Zoom_Automatique( false ); wizard->Zoom_Automatique( false );

View File

@ -148,7 +148,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
PCB_BASE_FRAME( aParent, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style ) PCB_BASE_FRAME( aParent, MODULE_EDITOR_FRAME_TYPE, wxEmptyString, pos, size, style )
{ {
m_FrameName = wxT( "ModEditFrame" ); m_FrameName = wxT( "ModEditFrame" );
m_showBorderAndTitleBlock = false; // true to show the frame references m_showBorderAndTitleBlock = false; // true to show the frame references

View File

@ -1,9 +1,9 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -29,7 +29,6 @@
#include <fctsys.h> #include <fctsys.h>
#include <appl_wxstruct.h> #include <appl_wxstruct.h>
#include <macros.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <3d_viewer.h> #include <3d_viewer.h>
@ -109,9 +108,10 @@ static wxAcceleratorEntry accels[] =
#define EXTRA_BORDER_SIZE 2 #define EXTRA_BORDER_SIZE 2
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* semaphore ) : FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* parent,
PCB_BASE_FRAME( parent, MODULE_VIEWER_FRAME, _( "Footprint Library Browser" ), wxSemaphore* semaphore, long style ) :
wxDefaultPosition, wxDefaultSize ) PCB_BASE_FRAME( parent, MODULE_VIEWER_FRAME_TYPE, _( "Footprint Library Browser" ),
wxDefaultPosition, wxDefaultSize, style )
{ {
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
@ -133,7 +133,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* s
m_selectedFootprintName.Empty(); m_selectedFootprintName.Empty();
if( m_Semaphore ) if( m_Semaphore )
MakeModal(true); SetModalMode(true);
SetBoard( new BOARD() ); SetBoard( new BOARD() );
// Ensure all layers and items are visible: // Ensure all layers and items are visible:
@ -276,7 +276,7 @@ void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event )
if( m_Semaphore ) if( m_Semaphore )
{ {
m_Semaphore->Post(); m_Semaphore->Post();
MakeModal(false); SetModalMode(false);
// This window will be destroyed by the calling function, // This window will be destroyed by the calling function,
// to avoid side effects // to avoid side effects
} }

View File

@ -1,180 +1,181 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here: * along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license, * or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** /**
* @file modview_frame.h * @file modview_frame.h
*/ */
#ifndef MODVIEWFRM_H_ #ifndef MODVIEWFRM_H_
#define MODVIEWFRM_H_ #define MODVIEWFRM_H_
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
class wxSashLayoutWindow; class wxSashLayoutWindow;
class wxListBox; class wxListBox;
class wxSemaphore; class wxSemaphore;
/** /**
* Component library viewer main window. * Component library viewer main window.
*/ */
class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME
{ {
private: private:
// List of libraries (for selection ) // List of libraries (for selection )
wxSashLayoutWindow* m_LibListWindow; wxSashLayoutWindow* m_LibListWindow;
wxListBox* m_LibList; // The list of libs names wxListBox* m_LibList; // The list of libs names
wxSize m_LibListSize; // size of the window wxSize m_LibListSize; // size of the window
// List of components in the selected library // List of components in the selected library
wxSashLayoutWindow* m_FootprintListWindow; wxSashLayoutWindow* m_FootprintListWindow;
wxListBox* m_FootprintList; // The list of footprint names wxListBox* m_FootprintList; // The list of footprint names
wxSize m_FootprintListSize; // size of the window wxSize m_FootprintListSize; // size of the window
// Flags // Flags
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_configPath; // subpath for configuration wxString m_configPath; // subpath for configuration
protected: protected:
static wxString m_libraryName; // Current selected libary static wxString m_libraryName; // Current selected libary
static wxString m_footprintName; // Current selected footprint static wxString m_footprintName; // Current selected footprint
static wxString m_selectedFootprintName; // When the viewer is used to select a footprint static wxString m_selectedFootprintName; // When the viewer is used to select a footprint
// the selected footprint is here // the selected footprint is here
public: public:
FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* semaphore = NULL ); FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* parent, wxSemaphore* semaphore = NULL,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~FOOTPRINT_VIEWER_FRAME();
~FOOTPRINT_VIEWER_FRAME();
wxString& GetSelectedFootprint( void ) const { return m_selectedFootprintName; }
wxString& GetSelectedFootprint( void ) const { return m_selectedFootprintName; }
private:
private:
void OnSize( wxSizeEvent& event );
void OnSize( wxSizeEvent& event );
/**
* Function OnSashDrag /**
* resizes the child windows when dragging a sash window border. * Function OnSashDrag
*/ * resizes the child windows when dragging a sash window border.
*/
void OnSashDrag( wxSashEvent& event );
void OnSashDrag( wxSashEvent& event );
/**
* Function ReCreateLibraryList /**
* * Function ReCreateLibraryList
* Creates or recreates the list of current loaded libraries. *
* This list is sorted, with the library cache always at end of the list * Creates or recreates the list of current loaded libraries.
*/ * This list is sorted, with the library cache always at end of the list
void ReCreateLibraryList(); */
void ReCreateLibraryList();
void ReCreateFootprintList();
void Process_Special_Functions( wxCommandEvent& event ); void ReCreateFootprintList();
void DisplayLibInfos(); void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void DisplayLibInfos();
void OnCloseWindow( wxCloseEvent& Event ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar(); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateVToolbar(); void ReCreateHToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void ReCreateVToolbar();
void ClickOnLibList( wxCommandEvent& event ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void ClickOnFootprintList( wxCommandEvent& event ); void ClickOnLibList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event ); void ClickOnFootprintList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
/**
* Function LoadSettings /**
* loads the library viewer frame specific configuration settings. * Function LoadSettings
* * loads the library viewer frame specific configuration settings.
* Don't forget to call this base method from any derived classes or the *
* settings will not get loaded. * Don't forget to call this base method from any derived classes or the
*/ * settings will not get loaded.
void LoadSettings(); */
void LoadSettings();
/**
* Function SaveSettings /**
* save library viewer frame specific configuration settings. * Function SaveSettings
* * save library viewer frame specific configuration settings.
* Don't forget to call this base method from any derived classes or the *
* settings will not get saved. * Don't forget to call this base method from any derived classes or the
*/ * settings will not get saved.
void SaveSettings(); */
void SaveSettings();
wxString& GetFootprintName( void ) const { return m_footprintName; }
wxString& GetFootprintName( void ) const { return m_footprintName; }
/**
* Function OnActivate /**
* is called when the frame frame is activate to reload the libraries and component lists * Function OnActivate
* that can be changed by the schematic editor or the library editor. * is called when the frame frame is activate to reload the libraries and component lists
*/ * that can be changed by the schematic editor or the library editor.
virtual void OnActivate( wxActivateEvent& event ); */
virtual void OnActivate( wxActivateEvent& event );
void SelectCurrentLibrary( wxCommandEvent& event );
void SelectCurrentLibrary( wxCommandEvent& event );
void SelectCurrentFootprint( wxCommandEvent& event );
void SelectCurrentFootprint( wxCommandEvent& event );
/**
* Function ExportSelectedFootprint /**
* exports the current footprint name and close the library browser. * Function ExportSelectedFootprint
*/ * exports the current footprint name and close the library browser.
void ExportSelectedFootprint( wxCommandEvent& event ); */
void ExportSelectedFootprint( wxCommandEvent& event );
/**
* Function SelectAndViewFootprint /**
* Select and load the next or the previous footprint * Function SelectAndViewFootprint
* if no current footprint, Rebuild the list of footprints availlable in a given footprint library * Select and load the next or the previous footprint
* @param aMode = NEXT_PART or PREVIOUS_PART * if no current footprint, Rebuild the list of footprints availlable in a given footprint library
*/ * @param aMode = NEXT_PART or PREVIOUS_PART
void SelectAndViewFootprint( int aMode ); */
void SelectAndViewFootprint( int aMode );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
/**
* Function Show3D_Frame (virtual) /**
* displays 3D view of the footprint (module) being edited. * Function Show3D_Frame (virtual)
*/ * displays 3D view of the footprint (module) being edited.
void Show3D_Frame( wxCommandEvent& event ); */
void Show3D_Frame( wxCommandEvent& event );
/**
* Function Update3D_Frame /**
* must be called after a footprint selection * Function Update3D_Frame
* Updates the 3D view and 3D frame title. * must be called after a footprint selection
* @param aForceReloadFootprint = true to reload data (default) * Updates the 3D view and 3D frame title.
* = false to update title only -(aftre creating the 3D viewer) * @param aForceReloadFootprint = true to reload data (default)
*/ * = false to update title only -(aftre creating the 3D viewer)
void Update3D_Frame( bool aForceReloadFootprint = true ); */
void Update3D_Frame( bool aForceReloadFootprint = true );
/*
* Virtual functions, not used here, but needed by PCB_BASE_FRAME /*
* (virtual pure functions ) * Virtual functions, not used here, but needed by PCB_BASE_FRAME
*/ * (virtual pure functions )
void OnLeftDClick(wxDC*, const wxPoint&) {} */
void SaveCopyInUndoList(BOARD_ITEM*, UNDO_REDO_T, const wxPoint&) {} void OnLeftDClick(wxDC*, const wxPoint&) {}
void SaveCopyInUndoList(PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint&) {} void SaveCopyInUndoList(BOARD_ITEM*, UNDO_REDO_T, const wxPoint&) {}
void SaveCopyInUndoList(PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint&) {}
DECLARE_EVENT_TABLE()
}; DECLARE_EVENT_TABLE()
};
#endif // MODVIEWFRM_H_
#endif // MODVIEWFRM_H_

View File

@ -174,7 +174,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode )
EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode )
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool ) EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool )
#ifdef KICAD_SCRIPTING_WXPYTHON #ifdef KICAD_SCRIPTING_WXPYTHON
EVT_TOOL( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, PCB_EDIT_FRAME::ScriptingConsoleEnableDisable ) EVT_TOOL( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, PCB_EDIT_FRAME::ScriptingConsoleEnableDisable )
#endif #endif
// Option toolbar // Option toolbar
@ -268,7 +268,7 @@ END_EVENT_TABLE()
PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style ) : long style ) :
PCB_BASE_FRAME( parent, PCB_FRAME, title, pos, size, style ) PCB_BASE_FRAME( parent, PCB_FRAME_TYPE, title, pos, size, style )
{ {
m_FrameName = wxT( "PcbFrame" ); m_FrameName = wxT( "PcbFrame" );
m_showBorderAndTitleBlock = true; // true to display sheet references m_showBorderAndTitleBlock = true; // true to display sheet references
@ -285,7 +285,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_RecordingMacros = -1; m_RecordingMacros = -1;
m_microWaveToolBar = NULL; m_microWaveToolBar = NULL;
m_autoPlaceModeId = 0; m_autoPlaceModeId = 0;
#ifdef KICAD_SCRIPTING_WXPYTHON #ifdef KICAD_SCRIPTING_WXPYTHON
m_pythonPanel = NULL; m_pythonPanel = NULL;
#endif #endif
for ( int i = 0; i < 10; i++ ) for ( int i = 0; i < 10; i++ )
@ -404,7 +404,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_auimgr.AddPane( m_messagePanel, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
#ifdef KICAD_SCRIPTING_WXPYTHON #ifdef KICAD_SCRIPTING_WXPYTHON
// Add the scripting panel // Add the scripting panel
EDA_PANEINFO pythonAuiInfo; EDA_PANEINFO pythonAuiInfo;
@ -413,7 +413,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
pythonAuiInfo.MinSize( wxSize( 200, 100 ) ); pythonAuiInfo.MinSize( wxSize( 200, 100 ) );
pythonAuiInfo.BestSize( wxSize( GetClientSize().x/2, 200 ) ); pythonAuiInfo.BestSize( wxSize( GetClientSize().x/2, 200 ) );
pythonAuiInfo.Hide(); pythonAuiInfo.Hide();
m_pythonPanel = CreatePythonShellWindow( this ); m_pythonPanel = CreatePythonShellWindow( this );
m_auimgr.AddPane( m_pythonPanel, m_auimgr.AddPane( m_pythonPanel,
pythonAuiInfo.Name( wxT( "PythonPanel" ) ).Bottom().Layer(9) ); pythonAuiInfo.Name( wxT( "PythonPanel" ) ).Bottom().Layer(9) );
@ -804,9 +804,9 @@ void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable( wxCommandEvent& aEvent )
m_auimgr.GetPane( m_pythonPanel ).Hide(); m_auimgr.GetPane( m_pythonPanel ).Hide();
m_pythonPanelHidden = true; m_pythonPanelHidden = true;
} }
m_auimgr.Update(); m_auimgr.Update();
} }
#endif #endif

View File

@ -180,7 +180,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
// In module editor, the module is located at 0,0 but for printing // In module editor, the module is located at 0,0 but for printing
// it is moved to pageSizeIU.x/2, pageSizeIU.y/2. // it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
// So the equivalent board must be moved: // So the equivalent board must be moved:
if( m_Parent->IsType( MODULE_EDITOR_FRAME ) ) if( m_Parent->IsType( MODULE_EDITOR_FRAME_TYPE ) )
{ {
bbbox.Move( wxPoint( pageSizeIU.x/2, pageSizeIU.y/2 ) ); bbbox.Move( wxPoint( pageSizeIU.x/2, pageSizeIU.y/2 ) );
} }