Removed Persistance Framework code/files from FrameLayout
Corrected makefiles to match git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2046 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -43,7 +43,6 @@
|
||||
#include "barhintspl.h"
|
||||
#include "hintanimpl.h"
|
||||
#include "controlarea.h"
|
||||
#include "objstore.h"
|
||||
|
||||
#include "dyntbar.h"
|
||||
#include "dyntbarhnd.h" // fl-dimension-handler for dynamic toolbar
|
||||
@@ -99,8 +98,6 @@ bool MyApp::OnInit(void)
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
wxMenu *active_menu = new wxMenu;
|
||||
|
||||
file_menu->Append( ID_LOAD, "&Load layouts" );
|
||||
file_menu->Append( ID_STORE, "&Store layouts" );
|
||||
file_menu->AppendSeparator();
|
||||
|
||||
file_menu->Append( ID_AUTOSAVE, "&Auto Save Layouts", "save layouts on exit", TRUE );
|
||||
@@ -258,9 +255,6 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU( MINIMAL_QUIT, MyFrame::OnQuit )
|
||||
EVT_MENU( MINIMAL_ABOUT, MyFrame::OnAbout )
|
||||
|
||||
EVT_MENU( ID_LOAD, MyFrame::OnLoad )
|
||||
EVT_MENU( ID_STORE, MyFrame::OnStore )
|
||||
EVT_MENU( ID_AUTOSAVE, MyFrame::OnAutoSave )
|
||||
EVT_MENU( ID_SETTINGS, MyFrame::OnSettings )
|
||||
EVT_MENU( ID_REMOVE, MyFrame::OnRemove )
|
||||
EVT_MENU( ID_REMOVEALL, MyFrame::OnRemoveAll )
|
||||
@@ -322,38 +316,28 @@ MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
||||
int idx1 = mImageList.Add( bmp1 );
|
||||
int idx2 = mImageList.Add( bmp2 );
|
||||
|
||||
// load configuation if present
|
||||
InitAboutBox();
|
||||
|
||||
if ( wxFileExists( "layouts_for_demo.dat" ) )
|
||||
{
|
||||
wxCommandEvent evt;
|
||||
this->OnLoad( evt );
|
||||
}
|
||||
else
|
||||
{
|
||||
InitAboutBox();
|
||||
// create multiple layouts
|
||||
|
||||
// create multiple layouts
|
||||
mpNestedLayout = 0;
|
||||
|
||||
mpNestedLayout = 0;
|
||||
mpClntWindow = CreateTxtCtrl("client window");
|
||||
|
||||
mpClntWindow = CreateTxtCtrl("client window");
|
||||
for( i = 0; i != MAX_LAYOUTS; ++i )
|
||||
|
||||
for( i = 0; i != MAX_LAYOUTS; ++i )
|
||||
|
||||
CreateLayout( i );
|
||||
CreateLayout( i );
|
||||
|
||||
for( i = SECOND_LAYOUT; i != MAX_LAYOUTS; ++i )
|
||||
for( i = SECOND_LAYOUT; i != MAX_LAYOUTS; ++i )
|
||||
|
||||
// hide others
|
||||
mLayouts[i]->HideBarWindows();
|
||||
// hide others
|
||||
mLayouts[i]->HideBarWindows();
|
||||
|
||||
// activate first one
|
||||
// activate first one
|
||||
|
||||
mLayouts[FIRST_LAYOUT]->Activate();
|
||||
mLayouts[FIRST_LAYOUT]->Activate();
|
||||
|
||||
mActiveLayoutNo = FIRST_LAYOUT;
|
||||
}
|
||||
mActiveLayoutNo = FIRST_LAYOUT;
|
||||
}
|
||||
|
||||
/*** event handlers ***/
|
||||
@@ -366,65 +350,11 @@ bool MyFrame::OnClose(void)
|
||||
this->Show(FALSE);
|
||||
|
||||
|
||||
if ( (mAutoSave && mSavedAlready) || !mAutoSave );
|
||||
else
|
||||
{
|
||||
wxCommandEvent evt;
|
||||
this->OnStore(evt);
|
||||
}
|
||||
|
||||
mAboutBox.Destroy();
|
||||
this->Destroy();
|
||||
mAboutBox.Destroy();
|
||||
this->Destroy();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MyFrame::OnLoad( wxCommandEvent& event )
|
||||
{
|
||||
if ( !wxFileExists( "layouts_for_demo.dat" ) )
|
||||
{
|
||||
wxMessageBox(
|
||||
|
||||
"File \"layouts_for_demo.dat\" was not found,\n select\
|
||||
(File|Store Layouts) menu item to store layout information first"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
DestroyEverything();
|
||||
|
||||
wxIOStreamWrapper stm;
|
||||
stm.CreateForInput( "layouts_for_demo.dat" );
|
||||
|
||||
wxObjectStorage store( stm );
|
||||
|
||||
SerializeMe( store );
|
||||
|
||||
if ( mLayouts[mActiveLayoutNo] )
|
||||
|
||||
mLayouts[mActiveLayoutNo]->Activate();
|
||||
}
|
||||
|
||||
void MyFrame::OnStore( wxCommandEvent& event )
|
||||
{
|
||||
wxIOStreamWrapper stm;
|
||||
stm.CreateForOutput( "layouts_for_demo.dat" );
|
||||
|
||||
wxObjectStorage store( stm );
|
||||
|
||||
SerializeMe( store );
|
||||
|
||||
mSavedAlready = TRUE;
|
||||
}
|
||||
|
||||
void MyFrame::OnAutoSave( wxCommandEvent& event )
|
||||
{
|
||||
mAutoSave = !mAutoSave;
|
||||
|
||||
wxCommandEvent evt;
|
||||
this->OnStore(evt);
|
||||
|
||||
SyncMenuBarItems();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MyFrame::OnSettings( wxCommandEvent& event )
|
||||
@@ -499,14 +429,8 @@ void MyFrame::OnQuit( wxCommandEvent& event )
|
||||
|
||||
this->Show(FALSE);
|
||||
|
||||
if ( (mAutoSave && mSavedAlready) || !mAutoSave );
|
||||
else
|
||||
{
|
||||
wxCommandEvent evt;
|
||||
this->OnStore(evt);
|
||||
}
|
||||
|
||||
Destroy();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void set_dlg_font( wxWindow* pParent, wxFont& font )
|
||||
@@ -588,28 +512,21 @@ void MyFrame::OnChar( wxKeyEvent& event )
|
||||
// "AI" :-)
|
||||
wxMessageBox("There are only 3 layouts in this demo :-(");
|
||||
else
|
||||
if ( event.m_keyCode == WXK_TAB )
|
||||
if ( event.m_keyCode == WXK_TAB )
|
||||
{
|
||||
// USEFUL TRICK:: avoids flickering of application's frame
|
||||
// when closing NN windows on exit:
|
||||
// USEFUL TRICK:: avoids flickering of application's frame
|
||||
// when closing NN windows on exit:
|
||||
|
||||
this->Show(FALSE);
|
||||
this->Show(FALSE);
|
||||
|
||||
if ( (mAutoSave && mSavedAlready) || !mAutoSave );
|
||||
else
|
||||
{
|
||||
wxCommandEvent evt;
|
||||
this->OnStore(evt);
|
||||
}
|
||||
|
||||
Destroy();
|
||||
Destroy();
|
||||
}
|
||||
else
|
||||
if ( event.m_keyCode == WXK_CONTROL )
|
||||
|
||||
this->OnSettings( evt );
|
||||
else
|
||||
event.Skip();
|
||||
else
|
||||
if ( event.m_keyCode == WXK_CONTROL )
|
||||
|
||||
this->OnSettings( evt );
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void MyFrame::OnSayItsOk( wxCommandEvent& event )
|
||||
@@ -924,7 +841,6 @@ wxWindow* MyFrame::CreateDevLayout( wxFrameLayout& layout, wxWindow* pParent )
|
||||
|
||||
// functions from "wxinfo.h"
|
||||
::wxCreateClassInfoTree( pClassView, cinfId, 1 );
|
||||
::wxCreateSerializerInfoTree( pClassView, serId, 1 );
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// (default arg anyway)
|
||||
@@ -1217,32 +1133,6 @@ void MyFrame::ActivateLayout( int layoutNo )
|
||||
SyncMenuBarItems();
|
||||
}
|
||||
|
||||
void MyFrame::SerializeMe( wxObjectStorage& store )
|
||||
{
|
||||
store.AddInitialRef( this );
|
||||
store.AddInitialRef( mpInternalFrm );
|
||||
store.AddInitialRef( &mAboutBox );
|
||||
store.AddInitialRef( &mImageList );
|
||||
|
||||
store.XchgInt ( mActiveLayoutNo );
|
||||
store.XchgBool( mAutoSave );
|
||||
|
||||
store.XchgObjPtr( (wxObject**) &mpClntWindow );
|
||||
|
||||
for( int i = 0; i != MAX_LAYOUTS; ++i )
|
||||
{
|
||||
if ( i == THIRD_LAYOUT )
|
||||
|
||||
store.XchgObjPtr( (wxObject**) &(mpNestedLayout) );
|
||||
|
||||
store.XchgObjPtr( (wxObject**) &(mLayouts[i]) );
|
||||
}
|
||||
|
||||
store.XchgObjPtr( (wxObject**) &(mpAboutBoxLayout) );
|
||||
|
||||
store.Finalize(); // finish serialization
|
||||
}
|
||||
|
||||
#ifdef __HACK_MY_MSDEV40__
|
||||
|
||||
////////////// new 2.0-magic (linker errors...) ////////////////
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#define THIRD_LAYOUT 2
|
||||
|
||||
class wxFrameLayout;
|
||||
class wxObjectStorage;
|
||||
|
||||
// FOR NOW::
|
||||
typedef wxPanel MyTestPanel;
|
||||
@@ -50,15 +49,15 @@ typedef wxPanel MyTestPanel;
|
||||
|
||||
class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit(void);
|
||||
public:
|
||||
bool OnInit(void);
|
||||
};
|
||||
|
||||
// Define a new frame type
|
||||
|
||||
class MyFrame: public wxFrame
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
|
||||
wxFrameLayout* mLayouts[MAX_LAYOUTS];
|
||||
|
||||
@@ -100,7 +99,6 @@ protected:
|
||||
|
||||
void ActivateLayout( int layoutNo );
|
||||
|
||||
void SerializeMe( wxObjectStorage& store );
|
||||
|
||||
public: /* public */
|
||||
|
||||
@@ -115,9 +113,6 @@ public: /* public */
|
||||
|
||||
bool OnClose(void);
|
||||
|
||||
void OnLoad( wxCommandEvent& event );
|
||||
void OnStore( wxCommandEvent& event );
|
||||
void OnAutoSave( wxCommandEvent& event );
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnSettings( wxCommandEvent& event );
|
||||
|
@@ -135,25 +135,4 @@ void wxCreateClassInfoTree( wxTreeCtrl* pTree,
|
||||
} while( nHanged != 0 );
|
||||
}
|
||||
|
||||
void wxCreateSerializerInfoTree( wxTreeCtrl* pTree,
|
||||
wxTreeItemId parentBranchId,
|
||||
long classImageNo
|
||||
)
|
||||
{
|
||||
expand_item( pTree, parentBranchId );
|
||||
|
||||
wxSerializerInfo::InitializeSerializers();
|
||||
|
||||
// FOR NOW:: no hierarchy - one branch
|
||||
|
||||
wxSerializerInfo* pCur = wxSerializerInfo::first;
|
||||
|
||||
while( pCur )
|
||||
{
|
||||
wxString fullName = pCur->className + wxString( "Serializer" );
|
||||
|
||||
pTree->AppendItem( parentBranchId, fullName, classImageNo );
|
||||
|
||||
pCur = pCur->next;
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#include "wx/object.h"
|
||||
#include "wx/treectrl.h"
|
||||
|
||||
#include "objstore.h"
|
||||
|
||||
/*
|
||||
* creates tree with hierarchically cauptured
|
||||
@@ -33,9 +32,4 @@ void wxCreateClassInfoTree( wxTreeCtrl* pTree,
|
||||
* NOTE:: "objstore.cpp" should be compiled in
|
||||
*/
|
||||
|
||||
void wxCreateSerializerInfoTree( wxTreeCtrl* pTree, // existing tree control
|
||||
wxTreeItemId parentBranchId,
|
||||
long classImageNo = -1 // (-1) - text only
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#endif
|
||||
|
||||
#include "controlbar.h"
|
||||
#include "objstore.h"
|
||||
|
||||
// plugins used
|
||||
#include "barhintspl.h"
|
||||
@@ -58,7 +57,6 @@ protected:
|
||||
wxWindow* mpClientWnd;
|
||||
wxPanel* mpInternalFrm;
|
||||
|
||||
void SerializeMe( wxObjectStorage& store );
|
||||
|
||||
wxTextCtrl* CreateTextCtrl( const wxString& value );
|
||||
|
||||
@@ -67,8 +65,6 @@ public:
|
||||
MyFrame( wxWindow* parent, char *title );
|
||||
~MyFrame();
|
||||
|
||||
void OnLoad( wxCommandEvent& event );
|
||||
void OnStore( wxCommandEvent& event );
|
||||
void OnQuit( wxCommandEvent& event );
|
||||
|
||||
bool OnClose(void) { return TRUE; }
|
||||
@@ -112,8 +108,6 @@ bool MyApp::OnInit(void)
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
|
||||
EVT_MENU( ID_LOAD, MyFrame::OnLoad )
|
||||
EVT_MENU( ID_STORE, MyFrame::OnStore )
|
||||
EVT_MENU( ID_QUIT, MyFrame::OnQuit )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
@@ -204,46 +198,6 @@ wxTextCtrl* MyFrame::CreateTextCtrl( const wxString& value )
|
||||
return pCtrl;
|
||||
}
|
||||
|
||||
void MyFrame::OnLoad( wxCommandEvent& event )
|
||||
{
|
||||
if ( !wxFileExists( LAYOUT_FILE ) )
|
||||
{
|
||||
wxMessageBox( "layout data file `layout.dat' not found\n\n store layout first" );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mpLayout->HideBarWindows(); // hide first, to avoid flickered destruction
|
||||
mpLayout->DestroyBarWindows();
|
||||
|
||||
if ( mpClientWnd )
|
||||
{
|
||||
mpClientWnd->Destroy();
|
||||
delete mpLayout;
|
||||
|
||||
mpClientWnd = NULL;
|
||||
}
|
||||
|
||||
wxIOStreamWrapper stm;
|
||||
stm.CreateForInput( LAYOUT_FILE ); // TRUE - create stream for input
|
||||
|
||||
wxObjectStorage store( stm );
|
||||
|
||||
SerializeMe( store );
|
||||
|
||||
mpLayout->Activate();
|
||||
}
|
||||
|
||||
void MyFrame::OnStore( wxCommandEvent& event )
|
||||
{
|
||||
wxIOStreamWrapper stm;
|
||||
stm.CreateForOutput( LAYOUT_FILE ); // FALSE - create stream for output
|
||||
|
||||
wxObjectStorage store( stm );
|
||||
|
||||
SerializeMe( store );
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit( wxCommandEvent& event )
|
||||
{
|
||||
Show( FALSE ); // TRICK:: hide it, to avoid flickered destruction
|
||||
@@ -251,21 +205,6 @@ void MyFrame::OnQuit( wxCommandEvent& event )
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::SerializeMe( wxObjectStorage& store )
|
||||
{
|
||||
// mark contaienr-frames as not serializable
|
||||
|
||||
store.AddInitialRef( mpInternalFrm );
|
||||
store.AddInitialRef( this );
|
||||
|
||||
// does all the rest for as
|
||||
|
||||
store.XchgObjPtr( (wxObject**) &(mpLayout) );
|
||||
store.XchgObjPtr( (wxObject**) &(mpClientWnd) );
|
||||
|
||||
store.Finalize(); // finish serialization
|
||||
}
|
||||
|
||||
#ifdef __HACK_MY_MSDEV40__
|
||||
|
||||
////////////// new 2.0-magic (linker errors...) ////////////////
|
||||
|
@@ -63,8 +63,6 @@ bool MyApp::OnInit(void)
|
||||
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append( NEW_TEST_LOAD, "&Load layouts" );
|
||||
file_menu->Append( NEW_TEST_SAVE, "&Store layouts" );
|
||||
file_menu->Append( NEW_TEST_EXIT, "E&xit" );
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
@@ -100,52 +98,10 @@ BEGIN_EVENT_TABLE( MyFrame, wxFrame )
|
||||
|
||||
// EVT_CHAR_HOOK(MyFrame::OnKeyDown)
|
||||
// EVT_PAINT( MyFrame::OnPaint )
|
||||
EVT_MENU( NEW_TEST_SAVE, MyFrame::OnSave )
|
||||
EVT_MENU( NEW_TEST_LOAD, MyFrame::OnLoad )
|
||||
EVT_MENU( NEW_TEST_EXIT, MyFrame::OnExit )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
void MyFrame::OnLoad( wxCommandEvent& event )
|
||||
{
|
||||
mpLayout->HideBarWindows();
|
||||
mpLayout->DestroyBarWindows();
|
||||
delete mpLayout;
|
||||
|
||||
if ( mpClientWnd )
|
||||
{
|
||||
mpClientWnd->Destroy();
|
||||
mpClientWnd = NULL;
|
||||
}
|
||||
|
||||
mpLayout = NULL;
|
||||
|
||||
wxIOStreamWrapper& stm = *(new wxIOStreamWrapper());
|
||||
|
||||
stm.CreateForInput( "layouts1.dat" );
|
||||
|
||||
mStore.SetDataStream( stm );
|
||||
|
||||
mStore.XchgObjPtr( (wxObject**) &mpLayout );
|
||||
|
||||
mStore.Finalize(); // finish serialization
|
||||
|
||||
mpLayout->Activate();
|
||||
}
|
||||
|
||||
void MyFrame::OnSave( wxCommandEvent& event )
|
||||
{
|
||||
wxIOStreamWrapper& stm = *(new wxIOStreamWrapper());
|
||||
|
||||
stm.CreateForOutput( "layouts1.dat" );
|
||||
|
||||
mStore.SetDataStream( stm );
|
||||
|
||||
mStore.XchgObjPtr( (wxObject**) &mpLayout );
|
||||
|
||||
mStore.Finalize(); // finish serialization
|
||||
}
|
||||
|
||||
void MyFrame::OnExit( wxCommandEvent& event )
|
||||
{
|
||||
Destroy();
|
||||
@@ -180,9 +136,6 @@ MyFrame::MyFrame(wxFrame *frame)
|
||||
|
||||
mpClientWnd = CreateTextCtrl( "Client window" );
|
||||
|
||||
mStore.AddInitialRef( this );
|
||||
mStore.AddInitialRef( mpInternalFrm );
|
||||
//mStore.AddInitialRef( mpClientWnd );
|
||||
|
||||
mpLayout = new wxFrameLayout( mpInternalFrm, mpClientWnd );
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#ifndef __NEW_TEST_G__
|
||||
#define __NEW_TEST_G__
|
||||
|
||||
#include "objstore.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
// Define a new application type
|
||||
@@ -13,7 +12,6 @@ class MyApp: public wxApp
|
||||
class MyFrame: public wxFrame
|
||||
{
|
||||
public:
|
||||
wxObjectStorage mStore;
|
||||
|
||||
wxFrameLayout* mpLayout;
|
||||
wxTextCtrl* mpClientWnd;
|
||||
@@ -27,15 +25,11 @@ public:
|
||||
|
||||
bool OnClose(void) { Show(FALSE); return TRUE; }
|
||||
|
||||
void OnLoad( wxCommandEvent& event );
|
||||
void OnSave( wxCommandEvent& event );
|
||||
void OnExit( wxCommandEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define NEW_TEST_SAVE 1101
|
||||
#define NEW_TEST_LOAD 1102
|
||||
#define NEW_TEST_EXIT 1103
|
||||
#define NEW_TEST_EXIT 1101
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user