Changed all the wxASSERT(0) calls to use wxFAIL_MSG()

Removed the TABs in the source replacing with the standard number of spaces
Removed variable definitions from FOR statements defining the variables before the FOR statement


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
George Tasker
2001-12-03 10:54:38 +00:00
parent e6b01b78a3
commit 5515f252cb
3 changed files with 2645 additions and 2654 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
// Created: 02/01/99 // Created: 02/01/99
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas // Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -31,86 +31,86 @@
BEGIN_EVENT_TABLE( wxFrameView, wxEvtHandler ) BEGIN_EVENT_TABLE( wxFrameView, wxEvtHandler )
EVT_IDLE( wxFrameView::OnIdle ) EVT_IDLE( wxFrameView::OnIdle )
END_EVENT_TABLE() END_EVENT_TABLE()
void wxFrameView::OnIdle( wxIdleEvent& event) void wxFrameView::OnIdle( wxIdleEvent& event)
{ {
event.Skip(); event.Skip();
if ( mDoToolUpdates ) if ( mDoToolUpdates )
{ {
int o = 0; //glt int o = 0; //glt
++o; ++o;
// TBD:: // TBD::
} }
} }
/*** public methods ***/ /*** public methods ***/
wxFrameView::wxFrameView() wxFrameView::wxFrameView()
: mpLayout( NULL ), : mpLayout( NULL ),
mpFrameMgr( NULL ) mpFrameMgr( NULL )
{} {}
wxFrameView::~wxFrameView() wxFrameView::~wxFrameView()
{ {
if ( mpLayout ) delete mpLayout; if ( mpLayout ) delete mpLayout;
} }
wxFrame* wxFrameView::GetParentFrame() wxFrame* wxFrameView::GetParentFrame()
{ {
return mpFrameMgr->GetParentFrame(); return mpFrameMgr->GetParentFrame();
} }
wxWindow* wxFrameView::GetClientWindow() wxWindow* wxFrameView::GetClientWindow()
{ {
return mpFrameMgr->GetClientWindow(); return mpFrameMgr->GetClientWindow();
} }
void wxFrameView::Activate() void wxFrameView::Activate()
{ {
mpFrameMgr->ActivateView( this ); mpFrameMgr->ActivateView( this );
} }
void wxFrameView::Deactivate() void wxFrameView::Deactivate()
{ {
mpFrameMgr->DeactivateCurrentView(); mpFrameMgr->DeactivateCurrentView();
} }
void wxFrameView::CreateLayout() void wxFrameView::CreateLayout()
{ {
mpLayout = new wxFrameLayout( GetParentFrame(), mpFrameMgr->GetClientWindow(), FALSE ); mpLayout = new wxFrameLayout( GetParentFrame(), mpFrameMgr->GetClientWindow(), FALSE );
} }
wxFrameLayout* wxFrameView::GetLayout() wxFrameLayout* wxFrameView::GetLayout()
{ {
return mpLayout; return mpLayout;
} }
void wxFrameView::SetToolUpdates( bool doToolUpdates ) void wxFrameView::SetToolUpdates( bool doToolUpdates )
{ {
mDoToolUpdates = doToolUpdates; mDoToolUpdates = doToolUpdates;
} }
void wxFrameView::SetLayout( wxFrameLayout* pLayout ) void wxFrameView::SetLayout( wxFrameLayout* pLayout )
{ {
if ( mpLayout ) delete mpLayout; if ( mpLayout ) delete mpLayout;
mpLayout = pLayout; mpLayout = pLayout;
} }
wxFrameManager& wxFrameView::GetFrameManager() wxFrameManager& wxFrameView::GetFrameManager()
{ {
return *mpFrameMgr; return *mpFrameMgr;
} }
void wxFrameView::RegisterMenu( const wxString& topMenuName ) void wxFrameView::RegisterMenu( const wxString& topMenuName )
{ {
mTopMenus.Add( topMenuName ); mTopMenus.Add( topMenuName );
} }
#if 0 #if 0
@@ -121,32 +121,32 @@ void wxFrameView::RegisterMenu( const wxString& topMenuName )
class wxFrameViewSerializer : public wxEvtHandlerSerializer class wxFrameViewSerializer : public wxEvtHandlerSerializer
{ {
DECLARE_SERIALIZER_CLASS( wxFrameViewSerializer ); DECLARE_SERIALIZER_CLASS( wxFrameViewSerializer );
static void Serialize( wxObject* pObj, wxObjectStorage& store ); static void Serialize( wxObject* pObj, wxObjectStorage& store );
}; };
IMPLEMENT_SERIALIZER_CLASS( wxFrameView, IMPLEMENT_SERIALIZER_CLASS( wxFrameView,
wxFrameViewSerializer, wxFrameViewSerializer,
wxFrameViewSerializer::Serialize, wxFrameViewSerializer::Serialize,
NO_CLASS_INIT ) NO_CLASS_INIT )
void wxFrameViewSerializer::Serialize( wxObject* pObj, wxObjectStorage& store ) void wxFrameViewSerializer::Serialize( wxObject* pObj, wxObjectStorage& store )
{ {
// wxFrameViewSerializer is a kind of wxEvtHandler - peform serialization of // wxFrameViewSerializer is a kind of wxEvtHandler - peform serialization of
// the base class first // the base class first
info.SerializeInherited( pObj, store ); info.SerializeInherited( pObj, store );
wxFrameView* pView = (wxFrameView*)pObj; wxFrameView* pView = (wxFrameView*)pObj;
store.XchgObjPtr( (wxObject**) &pView->mpFrameMgr ); store.XchgObjPtr( (wxObject**) &pView->mpFrameMgr );
store.XchgObjPtr( (wxObject**) &pView->mpLayout ); store.XchgObjPtr( (wxObject**) &pView->mpLayout );
store.XchgBool ( pView->mDoToolUpdates ); store.XchgBool ( pView->mDoToolUpdates );
// serialize members in derived classes // serialize members in derived classes
pView->OnSerialize( store ); pView->OnSerialize( store );
} }
#endif #endif
@@ -156,263 +156,262 @@ void wxFrameViewSerializer::Serialize( wxObject* pObj, wxObjectStorage& store )
void wxFrameManager::DoSerialize( wxObjectStorage& store ) void wxFrameManager::DoSerialize( wxObjectStorage& store )
{ {
#if 0 #if 0
store.AddInitialRef( mpFrameWnd ); store.AddInitialRef( mpFrameWnd );
store.AddInitialRef( this ); store.AddInitialRef( this );
if ( mpClientWnd ) store.AddInitialRef( mpClientWnd ); if ( mpClientWnd ) store.AddInitialRef( mpClientWnd );
store.XchgObj( (wxObject*) &mViews ); store.XchgObj( (wxObject*) &mViews );
store.XchgInt( mActiveViewNo ); store.XchgInt( mActiveViewNo );
store.Finalize(); // finish serialization store.Finalize(); // finish serialization
#endif #endif
} }
void wxFrameManager::DestroyViews() void wxFrameManager::DestroyViews()
{ {
DeactivateCurrentView(); DeactivateCurrentView();
wxNode* pNode = mViews.First(); wxNode* pNode = mViews.First();
while( pNode ) while ( pNode )
{ {
delete (wxFrameView*)pNode->Data(); delete (wxFrameView*)pNode->Data();
pNode = pNode->Next(); pNode = pNode->Next();
} }
if ( mActiveViewNo != -1 && GetParentFrame() ) if ( mActiveViewNo != -1 && GetParentFrame() )
GetParentFrame()->SetNextHandler( NULL ); GetParentFrame()->SetNextHandler( NULL );
} }
int wxFrameManager::GetViewNo( wxFrameView* pView ) int wxFrameManager::GetViewNo( wxFrameView* pView )
{ {
wxNode* pNode = mViews.First(); wxNode* pNode = mViews.First();
int n = 0; int n = 0;
while( pNode ) while ( pNode )
{ {
if ( (wxFrameView*)pNode->Data() == pView ) if ( (wxFrameView*)pNode->Data() == pView )
return n; return n;
++n; ++n;
pNode = pNode->Next(); pNode = pNode->Next();
} }
return -1; return -1;
} }
void wxFrameManager::EnableMenusForView( wxFrameView* pView, bool enable ) void wxFrameManager::EnableMenusForView( wxFrameView* pView, bool enable )
{ {
wxMenuBar* pMenuBar = GetParentFrame()->GetMenuBar(); wxMenuBar* pMenuBar = GetParentFrame()->GetMenuBar();
int count = pMenuBar->GetMenuCount(); int count = pMenuBar->GetMenuCount();
if ( !pMenuBar ) return; if ( !pMenuBar )
return;
wxStringListNode* pNode = pView->mTopMenus.GetFirst(); wxStringListNode* pNode = pView->mTopMenus.GetFirst();
while( pNode ) int i;
{ while ( pNode )
for( int i = 0; i != count; ++i ) {
{ for ( i = 0; i != count; ++i )
if ( pMenuBar->GetMenu(i)->GetTitle() == pNode->GetData() ) {
if ( pMenuBar->GetMenu(i)->GetTitle() == pNode->GetData() )
pMenuBar->EnableTop( i, enable );
}
pMenuBar->EnableTop( i, enable ); pNode = pNode->GetNext();
} }
pNode = pNode->GetNext();
}
} }
void wxFrameManager::SyncAllMenus() void wxFrameManager::SyncAllMenus()
{ {
wxNode* pNode = mViews.First(); wxNode* pNode = mViews.First();
int i = 0; int i = 0;
while( pNode ) while ( pNode )
{ {
if ( i != mActiveViewNo ) if ( i != mActiveViewNo )
EnableMenusForView( (wxFrameView*)pNode->GetData(), FALSE ); EnableMenusForView( (wxFrameView*)pNode->GetData(), FALSE );
pNode = pNode->Next(); pNode = pNode->Next();
} }
EnableMenusForView( GetView( mActiveViewNo ), TRUE ); EnableMenusForView( GetView( mActiveViewNo ), TRUE );
} }
/*** public methods ***/ /*** public methods ***/
wxFrameManager::wxFrameManager() wxFrameManager::wxFrameManager()
: mpFrameWnd( NULL ), : mpFrameWnd( NULL ),
mActiveViewNo( -1 ), mActiveViewNo( -1 ),
mpClientWnd( NULL ) mpClientWnd( NULL )
{ {
} }
wxFrameManager::~wxFrameManager() wxFrameManager::~wxFrameManager()
{ {
SaveViewsNow(); SaveViewsNow();
DestroyViews(); DestroyViews();
} }
void wxFrameManager::Init( wxWindow* pMainFrame, const wxString& settingsFile ) void wxFrameManager::Init( wxWindow* pMainFrame, const wxString& settingsFile )
{ {
mSettingsFile = settingsFile; mSettingsFile = settingsFile;
mpFrameWnd = pMainFrame; mpFrameWnd = pMainFrame;
wxNode* pNode = mViews.First(); wxNode* pNode = mViews.First();
while( pNode ) while ( pNode )
{ {
wxFrameView* pView = (wxFrameView*)pNode->Data(); wxFrameView* pView = (wxFrameView*)pNode->Data();
pView->OnInit(); pView->OnInit();
pView->OnInitMenus(); pView->OnInitMenus();
pNode = pNode->Next(); pNode = pNode->Next();
} }
if ( !ReloadViews() ) if ( !ReloadViews() )
{ {
// if loading of settings file failed (e.g. was not found), // if loading of settings file failed (e.g. was not found),
// do recreation of items in each view // do recreation of items in each view
pNode = mViews.First(); pNode = mViews.First();
while( pNode ) while ( pNode )
{ {
wxFrameView* pView = (wxFrameView*)pNode->Data(); wxFrameView* pView = (wxFrameView*)pNode->Data();
pView->OnRecreate(); pView->OnRecreate();
pNode = pNode->Next(); pNode = pNode->Next();
} }
} }
if ( mActiveViewNo >= mViews.Number() ) if ( mActiveViewNo >= mViews.Number() )
mActiveViewNo = -1;
mActiveViewNo = -1;
ActivateView( GetView( ( mActiveViewNo == -1 ) ? 0 : mActiveViewNo ) ); ActivateView( GetView( ( mActiveViewNo == -1 ) ? 0 : mActiveViewNo ) );
SyncAllMenus(); SyncAllMenus();
} }
void wxFrameManager::AddView( wxFrameView* pFrmView ) void wxFrameManager::AddView( wxFrameView* pFrmView )
{ {
mViews.Append( pFrmView ); mViews.Append( pFrmView );
pFrmView->mpFrameMgr = this; // back ref. pFrmView->mpFrameMgr = this; // back ref.
} }
void wxFrameManager::RemoveView( wxFrameView* pFrmView ) void wxFrameManager::RemoveView( wxFrameView* pFrmView )
{ {
// TBD:: // TBD::
int avoidCompilerWarning = 0; wxFAIL_MSG("wxFrameManager::RemoveView() has not been implemented yet.");
wxASSERT(avoidCompilerWarning);
} }
int wxFrameManager::GetActiveViewNo() int wxFrameManager::GetActiveViewNo()
{ {
return mActiveViewNo; return mActiveViewNo;
} }
wxFrameView* wxFrameManager::GetActiveView() wxFrameView* wxFrameManager::GetActiveView()
{ {
wxNode* pNode = mViews.Nth( mActiveViewNo ); wxNode* pNode = mViews.Nth( mActiveViewNo );
if ( pNode ) return (wxFrameView*)pNode->Data(); if ( pNode ) return (wxFrameView*)pNode->Data();
else return NULL; else return NULL;
} }
wxNode* wxFrameManager::GetActiveViewNode() wxNode* wxFrameManager::GetActiveViewNode()
{ {
return mViews.Nth( mActiveViewNo ); return mViews.Nth( mActiveViewNo );
} }
wxFrame* wxFrameManager::GetParentFrame() wxFrame* wxFrameManager::GetParentFrame()
{ {
return ((wxFrame*)mpFrameWnd); return ((wxFrame*)mpFrameWnd);
} }
wxWindow* wxFrameManager::GetParentWindow() wxWindow* wxFrameManager::GetParentWindow()
{ {
return mpFrameWnd; return mpFrameWnd;
} }
wxFrameView* wxFrameManager::GetView( int viewNo ) wxFrameView* wxFrameManager::GetView( int viewNo )
{ {
wxNode* pNode = mViews.Nth( viewNo ); wxNode* pNode = mViews.Nth( viewNo );
if ( pNode ) return (wxFrameView*)pNode->Data(); if ( pNode ) return (wxFrameView*)pNode->Data();
else return NULL; else return NULL;
} }
void wxFrameManager::ActivateView( int viewNo ) void wxFrameManager::ActivateView( int viewNo )
{ {
ActivateView( GetView( viewNo ) ); ActivateView( GetView( viewNo ) );
} }
void wxFrameManager::ActivateView( wxFrameView* pFrmView ) void wxFrameManager::ActivateView( wxFrameView* pFrmView )
{ {
DeactivateCurrentView(); DeactivateCurrentView();
mActiveViewNo = GetViewNo( pFrmView ); mActiveViewNo = GetViewNo( pFrmView );
if ( pFrmView->mpLayout ) if ( pFrmView->mpLayout )
pFrmView->mpLayout->Activate(); pFrmView->mpLayout->Activate();
// FIXME:: we would have used PushEventHandler(), // FIXME:: we would have used PushEventHandler(),
// but wxFrame bypasses attached handlers when // but wxFrame bypasses attached handlers when
// handling wxCommand events! // handling wxCommand events!
GetParentFrame()->PushEventHandler( pFrmView ); GetParentFrame()->PushEventHandler( pFrmView );
EnableMenusForView( pFrmView, TRUE ); EnableMenusForView( pFrmView, TRUE );
} }
void wxFrameManager::SetClinetWindow( wxWindow* pFrameClient ) void wxFrameManager::SetClinetWindow( wxWindow* pFrameClient )
{ {
if ( mpClientWnd ) mpClientWnd->Destroy(); if ( mpClientWnd ) mpClientWnd->Destroy();
mpClientWnd = pFrameClient; mpClientWnd = pFrameClient;
} }
wxWindow* wxFrameManager::GetClientWindow() wxWindow* wxFrameManager::GetClientWindow()
{ {
if ( !mpClientWnd ) if ( !mpClientWnd )
mpClientWnd = new wxWindow( GetParentFrame(), -1 ); mpClientWnd = new wxWindow( GetParentFrame(), -1 );
return mpClientWnd; return mpClientWnd;
} }
void wxFrameManager::DeactivateCurrentView() void wxFrameManager::DeactivateCurrentView()
{ {
if ( mActiveViewNo == -1 ) return; if ( mActiveViewNo == -1 )
return;
wxFrameView* pView = GetActiveView(); wxFrameView* pView = GetActiveView();
// FOR NOW:: // FOR NOW::
wxASSERT( GetParentFrame()->GetEventHandler() == pView ); wxASSERT( GetParentFrame()->GetEventHandler() == pView );
GetParentFrame()->PopEventHandler(); GetParentFrame()->PopEventHandler();
if ( pView->mpLayout ) if ( pView->mpLayout )
pView->mpLayout->Deactivate();
pView->mpLayout->Deactivate(); EnableMenusForView( pView, FALSE );
EnableMenusForView( pView, FALSE );
} }
void wxFrameManager::SaveViewsNow() void wxFrameManager::SaveViewsNow()
{ {
#if 0 #if 0
if ( mSettingsFile == "" ) return; if ( mSettingsFile == "" ) return;
wxIOStreamWrapper stm; wxIOStreamWrapper stm;
stm.CreateForOutput( mSettingsFile ); stm.CreateForOutput( mSettingsFile );
@@ -424,15 +423,14 @@ void wxFrameManager::SaveViewsNow()
bool wxFrameManager::ReloadViews() bool wxFrameManager::ReloadViews()
{ {
return FALSE; return FALSE;
// TBD: ???? // TBD: ????
#if 0 #if 0
if ( mSettingsFile == "" || !wxFileExists( mSettingsFile ) ) if ( mSettingsFile == "" || !wxFileExists( mSettingsFile ) )
return FALSE;
return FALSE;
DestroyViews(); DestroyViews();
wxIOStreamWrapper stm; wxIOStreamWrapper stm;
stm.CreateForInput( mSettingsFile ); stm.CreateForInput( mSettingsFile );
@@ -440,12 +438,12 @@ bool wxFrameManager::ReloadViews()
mStore.SetDataStream( stm ); mStore.SetDataStream( stm );
DoSerialize( mStore ); DoSerialize( mStore );
return TRUE; return TRUE;
#endif #endif
} }
bool wxFrameManager::ViewsAreLoaded() bool wxFrameManager::ViewsAreLoaded()
{ {
return ( mViews.Number() != 0 ); return ( mViews.Number() != 0 );
} }

File diff suppressed because it is too large Load Diff