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 )
if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] )
{
double zpos;
if( m_Layer == LAYER_N_BACK )
if( IsFlipped() )
zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( true );
else
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 );
}
if( m_Layer == LAYER_N_BACK )
if( IsFlipped() )
{
glRotatef( 180.0, 0.0, 1.0, 0.0 );
glRotatef( 180.0, 0.0, 0.0, 1.0 );
......
......@@ -57,7 +57,7 @@ END_EVENT_TABLE()
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_Canvas = NULL;
......
......@@ -56,12 +56,11 @@ static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" );
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father,
int idtype,
ID_DRAWFRAME_TYPE idtype,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
const wxPoint& pos, const wxSize& size,
long style ) :
wxFrame( father, -1, title, pos, size, style )
wxFrame( father, wxID_ANY, title, pos, size, style )
{
wxSize minsize;
......@@ -257,24 +256,6 @@ void EDA_BASE_FRAME::PrintMsg( const wxString& 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,
wxFileHistory * aFileHistory )
{
......@@ -663,3 +644,36 @@ edits you made?" ),
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 )
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 ) :
EDA_BASE_FRAME( father, idtype, title, pos, size, style )
{
......
......@@ -76,7 +76,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent,
const wxString& title,
const wxPoint& pos,
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_showAxis = true; // true to draw axis.
......
......@@ -104,7 +104,7 @@ END_EVENT_TABLE()
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" );
......
......@@ -121,7 +121,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
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_SHEET_PATH* sheetpath;
......@@ -229,10 +229,10 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
screen->m_IsPrinting = true;
if( frame->IsType( SCHEMATIC_FRAME ) )
if( frame->IsType( SCHEMATIC_FRAME_TYPE ) )
screen->Draw( panel, &dc, GR_COPY );
if( frame->IsType( LIBEDITOR_FRAME ) )
if( frame->IsType( LIBEDITOR_FRAME_TYPE ) )
((LIB_EDIT_FRAME*)frame)->RedrawComponent( &dc,
wxPoint(sheetSize.x/2,
sheetSize.y/2) );
......
......@@ -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 */
if( m_ViewlibFrame )
{
m_ViewlibFrame->Destroy();
delete m_ViewlibFrame;
m_ViewlibFrame = NULL;
}
if( m_LibeditFrame && m_LibeditFrame->m_ViewlibFrame )
{
m_LibeditFrame->m_ViewlibFrame->Destroy();
m_LibeditFrame->m_ViewlibFrame = NULL;
}
m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore );
m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore,
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
// 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:
while( semaphore.TryWait() == wxSEMA_BUSY )
{
wxYield();
wxMilliSleep( 50 );
}
Enable(true);
cmpname = m_ViewlibFrame->GetSelectedComponent();
m_ViewlibFrame->Destroy();
delete m_ViewlibFrame;
return cmpname;
}
......
......@@ -805,7 +805,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
if( aPanel && 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() )
return;
......
......@@ -191,7 +191,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
const wxPoint& pos,
const wxSize& size,
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 );
......
......@@ -28,7 +28,7 @@
#include <base_units.h>
SCH_BASE_FRAME::SCH_BASE_FRAME( wxWindow* aParent,
id_drawframe aWindowType,
ID_DRAWFRAME_TYPE aWindowType,
const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize,
long aStyle ) :
......
......@@ -184,7 +184,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
const wxPoint& pos,
const wxSize& size,
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_showAxis = false; // true to show axis
......
......@@ -99,9 +99,10 @@ static wxAcceleratorEntry accels[] =
#define EXTRA_BORDER_SIZE 2
LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaphore* semaphore ) :
SCH_BASE_FRAME( father, VIEWER_FRAME, _( "Library Browser" ),
wxDefaultPosition, wxDefaultSize )
LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library,
wxSemaphore* semaphore, long style ) :
SCH_BASE_FRAME( father, VIEWER_FRAME_TYPE, _( "Library Browser" ),
wxDefaultPosition, wxDefaultSize, style )
{
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_CmpListWindow = NULL;
m_Semaphore = semaphore;
if( m_Semaphore )
SetModalMode( true );
m_exportToEeschemaCmpName.Empty();
SetScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true; // Center coordinate origins on screen.
GetScreen()->m_Center = true; // Axis origin centered on screen.
LoadSettings();
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();
// This window will be destroyed by the calling function,
// if needed
SetModalMode( false );
}
else
{
......
......@@ -73,7 +73,9 @@ protected:
static int m_convert;
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,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~LIB_VIEW_FRAME();
......
......@@ -63,7 +63,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
const wxPoint& pos,
const wxSize& size,
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_Layout = NULL;
......
......@@ -57,7 +57,7 @@ protected:
public:
SCH_BASE_FRAME( wxWindow* aParent,
id_drawframe aWindowType,
ID_DRAWFRAME_TYPE aWindowType,
const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize,
long aStyle = KICAD_DEFAULT_DRAWFRAME_STYLE );
......
......@@ -96,7 +96,8 @@ protected:
virtual void unitsChangeRefresh();
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,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
......
......@@ -82,20 +82,22 @@ enum id_librarytype {
LIBRARY_TYPE_SYMBOL
};
enum id_drawframe {
NOT_INIT_FRAME = 0,
SCHEMATIC_FRAME,
LIBEDITOR_FRAME,
VIEWER_FRAME,
PCB_FRAME,
MODULE_EDITOR_FRAME,
MODULE_VIEWER_FRAME,
CVPCB_FRAME,
CVPCB_DISPLAY_FRAME,
GERBER_FRAME,
TEXT_EDITOR_FRAME,
DISPLAY3D_FRAME,
KICAD_MAIN_FRAME
enum ID_DRAWFRAME_TYPE
{
NOT_INIT_FRAME_TYPE = 0,
SCHEMATIC_FRAME_TYPE,
LIBEDITOR_FRAME_TYPE,
VIEWER_FRAME_TYPE,
PCB_FRAME_TYPE,
MODULE_EDITOR_FRAME_TYPE,
MODULE_VIEWER_FRAME_TYPE,
FOOTPRINT_WIZARD_FRAME_TYPE,
CVPCB_FRAME_TYPE,
CVPCB_DISPLAY_FRAME_TYPE,
GERBER_FRAME_TYPE,
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
{
protected:
int m_Ident; // Id Type (pcb, schematic, library..)
ID_DRAWFRAME_TYPE m_Ident; // Id Type (pcb, schematic, library..)
wxPoint m_FramePos;
wxSize m_FrameSize;
int m_MsgFrameHeight;
......@@ -158,7 +160,8 @@ protected:
virtual bool doAutoSave();
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,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
......@@ -181,7 +184,7 @@ public:
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 );
......@@ -306,11 +309,6 @@ public:
*/
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
* Creates recreates the menu bar.
......@@ -354,6 +352,19 @@ public:
* used to create the backup file name.
*/
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();
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,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
......
......@@ -46,7 +46,7 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
const wxString& title,
const wxPoint& pos,
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 line;
......
......@@ -76,11 +76,9 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
END_EVENT_TABLE()
PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
int idtype,
PCB_BASE_FRAME::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) :
EDA_DRAW_FRAME( father, idtype, title, pos, size, style )
{
......@@ -853,16 +851,16 @@ FOOTPRINT_VIEWER_FRAME * PCB_BASE_FRAME::GetActiveViewerFrame()
switch( m_Ident )
{
case PCB_FRAME:
case PCB_FRAME_TYPE:
if( m_ModuleEditFrame )
return ((PCB_BASE_FRAME*)m_ModuleEditFrame)->m_ModuleViewerFrame;
break;
case MODULE_EDITOR_FRAME:
case MODULE_EDITOR_FRAME_TYPE:
return ((PCB_BASE_FRAME*)GetParent())->m_ModuleViewerFrame;
break;
case MODULE_VIEWER_FRAME:
case MODULE_VIEWER_FRAME_TYPE:
return (FOOTPRINT_VIEWER_FRAME *)this;
break;
......
......@@ -446,7 +446,7 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->EraseMsgBox();
if( frame->IsType( PCB_FRAME ) )
if( frame->IsType( PCB_FRAME_TYPE ) )
flag = true;
frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN );
......
......@@ -970,7 +970,7 @@ void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame )
DisplayInfoBase( frame );
// Display full track length (in Pcbnew)
if( frame->IsType( PCB_FRAME ) )
if( frame->IsType( PCB_FRAME_TYPE ) )
{
int trackLen = 0;
int lenDie = 0;
......@@ -1058,7 +1058,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN );
// Display Net Name (in Pcbnew)
if( frame->IsType( PCB_FRAME ) )
if( frame->IsType( PCB_FRAME_TYPE ) )
{
NETINFO_ITEM* net = board->FindNet( GetNet() );
......
......@@ -68,6 +68,5 @@ FOOTPRINT_WIZARD* DIALOG_FOOTPRINT_WIZARD_LIST::GetWizard()
void DIALOG_FOOTPRINT_WIZARD_LIST::OnOpenButtonClick( wxCommandEvent& event )
{
this->MakeModal(false);
this->Close(true);
Close(true);
}
......@@ -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( this->m_Ident == PCB_FRAME )
if( IsType( PCB_FRAME_TYPE ) )
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)
EXCHG( Text->m_Orient, TextInitialOrientation );
if( m_Ident == PCB_FRAME )
if( IsType( PCB_FRAME_TYPE ) )
SaveCopyInUndoList( Module, UR_CHANGED );
else
SaveCopyInUndoList( Module, UR_MODEDIT );
......
......@@ -30,7 +30,6 @@
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <macros.h>
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <3d_viewer.h>
......@@ -38,6 +37,7 @@
#include <class_board.h>
#include <class_module.h>
#include <module_editor_frame.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
......@@ -107,9 +107,11 @@ static wxAcceleratorEntry accels[] =
* it's the constructor for the footprint wizard frame, it creates everything inside
*
*/
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* semaphore ) :
PCB_BASE_FRAME( parent, MODULE_VIEWER_FRAME, _( "Footprint Wizard" ),
wxDefaultPosition, wxDefaultSize )
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent,
wxSemaphore* semaphore, long style ) :
PCB_BASE_FRAME( parent, FOOTPRINT_WIZARD_FRAME_TYPE,
_( "Footprint Wizard" ),
wxDefaultPosition, wxDefaultSize, style )
{
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
......@@ -132,7 +134,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
m_wizardName.Empty();
if( m_Semaphore )
MakeModal(true);
SetModalMode(true);
SetBoard( new BOARD() );
// Ensure all layers and items are visible:
......@@ -262,8 +264,6 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME()
{
if( m_Draw3DFrame )
m_Draw3DFrame->Destroy();
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent();
frame->m_ModuleViewerFrame = NULL;
}
......@@ -285,7 +285,7 @@ void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
if( m_Semaphore )
{
m_Semaphore->Post();
MakeModal(false);
SetModalMode(false);
// This window will be destroyed by the calling function,
// to avoid side effects
}
......
......@@ -68,7 +68,9 @@ protected:
wxString m_wizardStatus; //< current wizard status
public:
FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* semaphore = NULL );
FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent,
wxSemaphore* semaphore = NULL,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~FOOTPRINT_WIZARD_FRAME();
......
......@@ -116,7 +116,7 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void )
{
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();
if( viewer )
{
......@@ -127,7 +127,8 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void )
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
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
......
......@@ -296,9 +296,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( NULL );
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
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->Zoom_Automatique( false );
......
......@@ -148,7 +148,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent,
const wxPoint& pos,
const wxSize& size,
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_showBorderAndTitleBlock = false; // true to show the frame references
......
/*
* 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) 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
* modify it under the terms of the GNU General Public License
......@@ -29,7 +29,6 @@
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <macros.h>
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <3d_viewer.h>
......@@ -109,9 +108,10 @@ static wxAcceleratorEntry accels[] =
#define EXTRA_BORDER_SIZE 2
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* semaphore ) :
PCB_BASE_FRAME( parent, MODULE_VIEWER_FRAME, _( "Footprint Library Browser" ),
wxDefaultPosition, wxDefaultSize )
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* parent,
wxSemaphore* semaphore, long style ) :
PCB_BASE_FRAME( parent, MODULE_VIEWER_FRAME_TYPE, _( "Footprint Library Browser" ),
wxDefaultPosition, wxDefaultSize, style )
{
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
......@@ -133,7 +133,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* s
m_selectedFootprintName.Empty();
if( m_Semaphore )
MakeModal(true);
SetModalMode(true);
SetBoard( new BOARD() );
// Ensure all layers and items are visible:
......@@ -276,7 +276,7 @@ void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event )
if( m_Semaphore )
{
m_Semaphore->Post();
MakeModal(false);
SetModalMode(false);
// This window will be destroyed by the calling function,
// to avoid side effects
}
......
......@@ -64,7 +64,8 @@ protected:
// the selected footprint is here
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();
......
......@@ -268,7 +268,7 @@ END_EVENT_TABLE()
PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
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_showBorderAndTitleBlock = true; // true to display sheet references
......
......@@ -180,7 +180,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
// In module editor, the module is located at 0,0 but for printing
// it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
// 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 ) );
}
......
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