Minor fixes: rename cvframe.cpp to cvpcb_mainframe.cpp to be consistent with other similar files are named.

* Better name for a cvpcb_mainframe function.
* Minor fixes in comments
* Minor code cleaning and fixes
This commit is contained in:
jean-pierre charras 2016-01-06 08:36:08 +01:00
parent 89c183f041
commit dda957a048
6 changed files with 50 additions and 31 deletions

View File

@ -269,6 +269,15 @@ KIWAY::FACE_T KIWAY::KifaceType( FRAME_T aFrameType )
}
KIWAY_PLAYER* KIWAY::GetPlayerFrame( FRAME_T aFrameType )
{
if( unsigned( aFrameType ) >= KIWAY_PLAYER_COUNT )
return NULL;
return m_player[aFrameType];
}
KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
{
// Since this will be called from python, cannot assume that code will
@ -283,8 +292,10 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
}
// return the previously opened window
if( m_player[aFrameType] )
return m_player[aFrameType];
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
if( frame )
return frame;
if( doCreate )
{
@ -296,7 +307,7 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
if( kiface )
{
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow(
frame = (KIWAY_PLAYER*) kiface->CreateWindow(
m_top,
aFrameType,
this,
@ -325,18 +336,18 @@ bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
return false;
}
if( m_player[aFrameType] )
{
if( m_player[aFrameType]->Close( doForce ) )
{
m_player[aFrameType] = 0;
return true;
}
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
return false;
if( frame == NULL ) // Already closed
return true;
if( frame->Close( doForce ) )
{
m_player[aFrameType] = 0;
return true;
}
return true; // window is closed already.
return false;
}
@ -377,7 +388,8 @@ void KIWAY::SetLanguage( int aLanguage )
// the array below.
if( m_ctl & KFCTL_CPP_PROJECT_SUITE )
{
EDA_BASE_FRAME* top = (EDA_BASE_FRAME*) m_top;
EDA_BASE_FRAME* top = dynamic_cast<EDA_BASE_FRAME*>( m_top );
if( top )
top->ShowChangedLanguage();
}
@ -385,7 +397,7 @@ void KIWAY::SetLanguage( int aLanguage )
for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
{
KIWAY_PLAYER* frame = m_player[i];
KIWAY_PLAYER* frame = GetPlayerFrame( ( FRAME_T )i );
if( frame )
{

View File

@ -46,7 +46,7 @@ set( CVPCB_SRCS
class_DisplayFootprintsFrame.cpp
class_footprints_listbox.cpp
class_library_listbox.cpp
cvframe.cpp
cvpcb_mainframe.cpp
listboxes.cpp
menubar.cpp
readwrite_dlgs.cpp

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.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
@ -200,7 +200,7 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
return;
// If the footprint view window is displayed, update the footprint.
if( GetParent()->GetFpViewerFrame() )
if( GetParent()->GetFootprintViewerFrame() )
GetParent()->CreateScreenCmp();
GetParent()->DisplayStatus();

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.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
@ -262,8 +262,8 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
}
// Close module display frame
if( GetFpViewerFrame() )
GetFpViewerFrame()->Close( true );
if( GetFootprintViewerFrame() )
GetFootprintViewerFrame()->Close( true );
m_modified = false;
@ -495,7 +495,7 @@ void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
{
CreateScreenCmp();
GetFpViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
GetFootprintViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
}
@ -569,7 +569,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
if ( ii >= 0 )
m_footprintListBox->SetSelection( ii, false );
if( GetFpViewerFrame() )
if( GetFootprintViewerFrame() )
{
CreateScreenCmp();
}
@ -781,7 +781,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist )
void CVPCB_MAINFRAME::CreateScreenCmp()
{
DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFpViewerFrame();
DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFootprintViewerFrame();
if( !fpframe )
{
@ -907,7 +907,7 @@ COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
}
DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFpViewerFrame()
DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFootprintViewerFrame()
{
// returns the Footprint Viewer frame, if exists, or NULL
return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.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
@ -92,7 +92,7 @@ public:
/**
* @return a pointer on the Footprint Viewer frame, if exists, or NULL
*/
DISPLAY_FOOTPRINTS_FRAME* GetFpViewerFrame();
DISPLAY_FOOTPRINTS_FRAME* GetFootprintViewerFrame();
/**
* Function OnSelectComponent

View File

@ -4,7 +4,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2016 KiCad Developers, see CHANGELOG.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
@ -380,12 +380,19 @@ private:
return false;
}
/**
* @return the reference of the KIWAY_PLAYER having the type aFrameType
* if exists, or NULL if this KIWAY_PLAYER was not yet created, or was closed
*/
KIWAY_PLAYER* GetPlayerFrame( FRAME_T aFrameType );
static KIFACE* m_kiface[KIWAY_FACE_COUNT];
static int m_kiface_version[KIWAY_FACE_COUNT];
PGM_BASE* m_program;
int m_ctl;
wxFrame* m_top;
wxFrame* m_top; // Usually m_top is the Project manager
KIWAY_PLAYER* m_player[KIWAY_PLAYER_COUNT]; // from frame_type.h