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 )
{
......@@ -540,7 +521,7 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
#endif
tmp << wxT( " USE_BOOST_POLYGON_LIBRARY\n" );
tmp << wxT( " KICAD_SCRIPTING=" );
#ifdef KICAD_SCRIPTING
tmp << wxT( "ON\n" );
......@@ -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
{
......
This diff is collapsed.
......@@ -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 );
......@@ -470,7 +482,7 @@ public:
void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
EDA_DRAW_PANEL* GetCanvas() { return m_canvas; }
virtual wxString GetScreenDesc();
/**
......
......@@ -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,12 +76,10 @@ 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,
long style) :
const wxPoint& pos, const wxSize& size,
long style) :
EDA_DRAW_FRAME( father, idtype, title, pos, size, style )
{
m_Pcb = NULL;
......@@ -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() );
......
......@@ -20,20 +20,20 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
{
SetFocus();
int n_wizards = FOOTPRINT_WIZARDS::GetSize();
// Current wizard selection, empty or first
m_FootprintWizard = NULL;
if (n_wizards)
m_FootprintWizard = FOOTPRINT_WIZARDS::GetWizard(0);
// Choose selection mode and insert the needed rows
m_footprintWizardsGrid->SetColSize( 0, 0 ); // hide the preview for now
m_footprintWizardsGrid->SetSelectionMode(wxGrid::wxGridSelectRows);
m_footprintWizardsGrid->InsertRows(0,n_wizards,true);
// Put all wizards in the list
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 description = wizard->GetDescription();
wxString image = wizard->GetImage();
m_footprintWizardsGrid->SetCellValue(i,1,name);
m_footprintWizardsGrid->SetCellValue(i,2,description);
}
// Select the first row
m_footprintWizardsGrid->ClearSelection();
m_footprintWizardsGrid->SelectRow(0,false);
......@@ -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 );
......
/*
* 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 Jean-Pierre Charras, jaen-pierre.charras
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
......@@ -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>
......@@ -73,7 +73,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE,
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 )
/* listbox events */
......@@ -105,11 +105,13 @@ static wxAcceleratorEntry accels[] =
/* Function FOOTPRINT_WIZARD_FRAME
* 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:
......@@ -170,12 +172,12 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
// Creates the component window display
m_ParameterGridSize.y = size.y;
win_pos.x = m_PageListSize.x;
m_ParameterGridWindow = new wxSashLayoutWindow( this,
m_ParameterGridWindow = new wxSashLayoutWindow( this,
ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW,
win_pos, wxDefaultSize,
wxCLIP_CHILDREN | wxSW_3D,
wxT( "ParameterList" ) );
m_ParameterGridWindow->SetOrientation( wxLAYOUT_VERTICAL );
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 ) );
m_auimgr.Update();
// Now Drawpanel is sized, we can use BestZoom to show the component (if any)
#ifdef USE_WX_GRAPHICS_CONTEXT
GetScreen()->SetZoom( BestZoom() );
......@@ -251,9 +253,9 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
Zoom_Automatique( false );
#endif
Show( true );
this->SelectFootprintWizard();
}
......@@ -262,14 +264,12 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME()
{
if( m_Draw3DFrame )
m_Draw3DFrame->Destroy();
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent();
frame->m_ModuleViewerFrame = NULL;
}
/* Function OnCloseWindow
* Handles the close event, saving settings an destroying or releasing a semaphore from caller
*
*
*/
void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
......@@ -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
}
......@@ -294,12 +294,12 @@ void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
Destroy();
}
}
/* 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 )
{
......@@ -334,8 +334,8 @@ void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event )
/* 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 )
{
......@@ -346,8 +346,8 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
}
/* 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 )
{
......@@ -357,13 +357,13 @@ void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
/* Function ReCreatePageList
* It recreates the list of pages for a new loaded wizard
*
*
*/
void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
{
if( m_PageList == NULL )
return;
if (m_FootprintWizard == NULL)
return;
......@@ -374,9 +374,9 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
wxString name = m_FootprintWizard->GetParameterPageName( i );
m_PageList->Append( name );
}
m_PageList->SetSelection( 0, true );
ReCreateParameterList();
ReCreateHToolbar();
DisplayWizardInfos();
......@@ -385,24 +385,24 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
/* Function ReCreateParameterList
* It creates the parameter grid for a certain wizard page of the current wizard
*
*
*/
void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
{
if( m_ParameterGrid == NULL )
return;
if (m_FootprintWizard == NULL )
return;
int page = m_PageList->GetSelection();
if (page<0)
return;
m_ParameterGrid->ClearGrid();
// Columns
m_ParameterGrid->AutoSizeColumns();
m_ParameterGrid->SetColLabelSize( 20 );
......@@ -410,34 +410,34 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
m_ParameterGrid->SetColLabelValue( 1, _("Value") );
m_ParameterGrid->SetColLabelValue( 2, _("Units") );
m_ParameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
// Rows
m_ParameterGrid->AutoSizeRows();
m_ParameterGrid->EnableDragRowSize( true );
m_ParameterGrid->SetRowLabelSize( 1 );
m_ParameterGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Get the list of names, values, and types
wxArrayString fpList = m_FootprintWizard->GetParameterNames(page);
wxArrayString fvList = m_FootprintWizard->GetParameterValues(page);
wxArrayString ptList = m_FootprintWizard->GetParameterTypes(page);
// Dimension the wxGrid
// Dimension the wxGrid
m_ParameterGrid->CreateGrid(fpList.size(),3);
for (unsigned int i=0; i<fpList.size(); i++)
{
wxString name,value,units;
name = fpList[i];
value = fvList[i];
m_ParameterGrid->SetCellValue( i, 0, name );
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.
double dValue;
value.ToDouble( &dValue );
......@@ -445,10 +445,10 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
dValue = To_User_Unit( g_UserUnit, dValue );
if ( g_UserUnit==INCHES ) // we convert inches into mils for more detail
{
{
dValue = dValue*1000.0;
units = wxT( "mils" );
}
}
else if ( g_UserUnit==MILLIMETRES )
{
units = wxT( "mm" );
......@@ -461,13 +461,13 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
units = wxT( "" );
}
m_ParameterGrid->SetCellValue( i, 1 , value );
m_ParameterGrid->SetCellValue( i, 1 , value );
m_ParameterGrid->SetCellValue( i, 2 , units );
m_ParameterGrid->SetReadOnly( i, 2 );
}
m_ParameterGrid->AutoSizeColumns();
}
......@@ -476,8 +476,8 @@ void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event )
int ii = m_PageList->GetSelection();
if( ii < 0 )
return;
return;
ReCreateParameterList();
m_canvas->Refresh();
DisplayWizardInfos();
......@@ -510,7 +510,7 @@ void FOOTPRINT_WIZARD_FRAME::LoadSettings( )
if ( 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
ReCreatePageList();
DisplayWizardInfos();
}
}
......
This diff is collapsed.
......@@ -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
}
......
This diff is collapsed.
......@@ -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_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode )
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 )
#endif
// Option toolbar
......@@ -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
......@@ -285,7 +285,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_RecordingMacros = -1;
m_microWaveToolBar = NULL;
m_autoPlaceModeId = 0;
#ifdef KICAD_SCRIPTING_WXPYTHON
#ifdef KICAD_SCRIPTING_WXPYTHON
m_pythonPanel = NULL;
#endif
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,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
#ifdef KICAD_SCRIPTING_WXPYTHON
// Add the scripting panel
EDA_PANEINFO pythonAuiInfo;
......@@ -413,7 +413,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
pythonAuiInfo.MinSize( wxSize( 200, 100 ) );
pythonAuiInfo.BestSize( wxSize( GetClientSize().x/2, 200 ) );
pythonAuiInfo.Hide();
m_pythonPanel = CreatePythonShellWindow( this );
m_auimgr.AddPane( m_pythonPanel,
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_pythonPanelHidden = true;
}
m_auimgr.Update();
}
#endif
......
......@@ -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