Commit b810135e authored by jean-pierre charras's avatar jean-pierre charras

Code cleaning, minor fixes and minor coding style fixes. wxWidgets 2.9.4...

Code cleaning, minor fixes and minor coding style fixes. wxWidgets 2.9.4 compatibility fix( deprecated function MakeModal )
parent bb6795dd
...@@ -680,7 +680,7 @@ void MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -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 ) ...@@ -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 );
......
...@@ -57,7 +57,7 @@ END_EVENT_TABLE() ...@@ -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;
......
...@@ -56,12 +56,11 @@ static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" ); ...@@ -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 ) ...@@ -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 ) ...@@ -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?" ), ...@@ -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
}
...@@ -84,7 +84,8 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME ) ...@@ -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 )
{ {
......
...@@ -76,7 +76,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent, ...@@ -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.
......
...@@ -104,7 +104,7 @@ END_EVENT_TABLE() ...@@ -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" );
......
...@@ -121,7 +121,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref ) ...@@ -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, ...@@ -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) );
......
...@@ -57,30 +57,22 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void ) ...@@ -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;
} }
......
...@@ -805,7 +805,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, ...@@ -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;
......
...@@ -191,7 +191,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, ...@@ -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 );
......
...@@ -28,7 +28,7 @@ ...@@ -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 ) :
......
...@@ -184,7 +184,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, ...@@ -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
......
...@@ -99,9 +99,10 @@ static wxAcceleratorEntry accels[] = ...@@ -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 ...@@ -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 ) ...@@ -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
{ {
......
This diff is collapsed.
...@@ -63,7 +63,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, ...@@ -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;
......
...@@ -57,7 +57,7 @@ protected: ...@@ -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 );
......
...@@ -96,7 +96,8 @@ protected: ...@@ -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 );
......
...@@ -82,20 +82,22 @@ enum id_librarytype { ...@@ -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; ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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();
/** /**
......
...@@ -46,7 +46,7 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, ...@@ -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;
......
...@@ -76,12 +76,10 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME ) ...@@ -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() ...@@ -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;
......
...@@ -446,7 +446,7 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -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 );
......
...@@ -970,7 +970,7 @@ void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -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 ) ...@@ -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() );
......
...@@ -20,20 +20,20 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent ) ...@@ -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 ) ...@@ -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() ...@@ -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);
} }
...@@ -108,7 +108,7 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -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 ) ...@@ -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 );
......
/* /*
* 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 @@ ...@@ -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 @@ ...@@ -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 ) ...@@ -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[] = ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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() ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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 ) ...@@ -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( ) ...@@ -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 ) ...@@ -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();
} }
} }
......
This diff is collapsed.
...@@ -116,7 +116,7 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void ) ...@@ -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 ) ...@@ -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
......
...@@ -296,9 +296,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -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 );
......
...@@ -148,7 +148,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent, ...@@ -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
......
/* /*
* 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 @@ ...@@ -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[] = ...@@ -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 ...@@ -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 ) ...@@ -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
} }
......
This diff is collapsed.
...@@ -174,7 +174,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -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() ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 ) ...@@ -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
......
...@@ -180,7 +180,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -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 ) );
} }
......
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