diff options
Diffstat (limited to 'ACE/examples/ConfigViewer')
-rw-r--r-- | ACE/examples/ConfigViewer/ConfigTreeCtrl.cpp | 229 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/ConfigTreeCtrl.h | 52 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/ConfigViewer.mpc | 7 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/ConfigurationViewer.cpp | 45 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/ConfigurationViewer.rc | 9 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/MainFrame.cpp | 199 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/MainFrame.h | 72 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/Makefile.am | 54 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/README | 74 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/ValueDlg.cpp | 63 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/ValueDlg.h | 51 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/ValueListCtrl.cpp | 227 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/ValueListCtrl.h | 47 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/mondrian.ico | bin | 766 -> 0 bytes | |||
-rw-r--r-- | ACE/examples/ConfigViewer/mondrian.xpm | 44 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/stdafx.cpp | 3 | ||||
-rw-r--r-- | ACE/examples/ConfigViewer/stdafx.h | 16 |
17 files changed, 0 insertions, 1192 deletions
diff --git a/ACE/examples/ConfigViewer/ConfigTreeCtrl.cpp b/ACE/examples/ConfigViewer/ConfigTreeCtrl.cpp deleted file mode 100644 index 7700272b9ba..00000000000 --- a/ACE/examples/ConfigViewer/ConfigTreeCtrl.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// $Id$ -#include "stdafx.h" -#include "ConfigTreeCtrl.h" -#include "MainFrame.h" -#include "ValueDlg.h" -#include "ValueListCtrl.h" - -enum {CFGNEWKEY=100, CFGNEWSTRING, CFGNEWUINT, CFGNEWBINARY, CFGNEWSUBMENU, CFGFIND, CFGDELETE, CFGRENAME, CFGCOPYKEYNAME}; - - -BEGIN_EVENT_TABLE(ConfigTreeCtrl, wxTreeCtrl) - EVT_RIGHT_DOWN(ConfigTreeCtrl::OnRightDown) - EVT_RIGHT_UP(ConfigTreeCtrl::OnRightUp) - EVT_MENU(CFGNEWKEY, ConfigTreeCtrl::OnNewKey) - EVT_MENU(CFGNEWSTRING, ConfigTreeCtrl::OnNewString) - EVT_MENU(CFGNEWUINT, ConfigTreeCtrl::OnNewUINT) - EVT_MENU(CFGNEWBINARY, ConfigTreeCtrl::OnNewBinary) - EVT_MENU(CFGFIND, ConfigTreeCtrl::OnFind) - EVT_MENU(CFGDELETE, ConfigTreeCtrl::OnDelete) - EVT_TREE_SEL_CHANGED(FRAME_TREE, ConfigTreeCtrl::OnSelChanged) -END_EVENT_TABLE() - - -ConfigTreeCtrl::ConfigTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) -: wxTreeCtrl(parent, id, pos, size, style, validator, name) -{ - // Load the tree - LoadTree(); -} - -ConfigTreeCtrl::~ConfigTreeCtrl() -{ -} - -void ConfigTreeCtrl::LoadTree() -{ - m_pConfig = MainFrame::Instance()->GetpConfig(); - const ACE_Configuration_Section_Key& Key = m_pConfig->root_section(); - wxTreeItemId Root = AppendItem(GetRootItem(), "Root"); - LoadSection(Root, Key); -} - -void ConfigTreeCtrl::LoadSection(wxTreeItemId& ParentItem, const ACE_Configuration_Section_Key& Key) -{ - ACE_TString Name; - int Index = 0; - while(!m_pConfig->enumerate_sections(Key, Index, Name)) - { - wxTreeItemId Item = AppendItem(ParentItem, Name.fast_rep()); - ACE_Configuration_Section_Key Child; - m_pConfig->open_section(Key, Name.fast_rep(), 0, Child); - LoadSection( Item, Child); - ++Index; - } -} - -void ConfigTreeCtrl::OnRightDown(wxMouseEvent& event) -{ - //EndEditLabel(TRUE); - int Flags = wxTREE_HITTEST_ONITEMLABEL | wxTREE_HITTEST_ONITEMICON; - long ItemID = HitTest(wxPoint(event.m_x, event.m_y), Flags); - SelectItem(ItemID); -} - -void ConfigTreeCtrl::OnRightUp(wxMouseEvent& event) -{ - wxTreeItemId ItemID = GetSelection(); - - wxMenu* pMenu = new wxMenu; - wxMenu* pNewMenu = new wxMenu; - pNewMenu->Append(CFGNEWKEY, "Key"); - pNewMenu->AppendSeparator(); - pNewMenu->Append(CFGNEWSTRING, "String"); - pNewMenu->Append(CFGNEWUINT, "Unsigned Int"); - //pNewMenu->Append(CFGNEWBINARY, "Binary"); - pMenu->Append(CFGNEWSUBMENU, "New", pNewMenu); - pMenu->Append(CFGFIND, "Find"); - pMenu->AppendSeparator(); - pMenu->Append(CFGDELETE, "Delete"); - //pMenu->Append(CFGRENAME, "Rename"); // not supported - //pMenu->AppendSeparator(); - //pMenu->Append(CFGCOPYKEYNAME, "Copy Key Name"); // not supported - PopupMenu(pMenu, event.m_x, event.m_y); - delete pMenu; -} - -void ConfigTreeCtrl::ResolveKey(wxTreeItemId Item, ACE_Configuration_Section_Key& Key) -{ - wxTreeItemId OriginalItem = Item; - ACE_TString Path(""); - ACE_TString Temp; - while(Item != GetRootItem()) - { - wxString Text = GetItemText(Item); - Temp = Path; - Path = Text.c_str(); - if(Temp.length()) - { - Path += "\\"; - Path += Temp; - } - Item = GetParent(Item); - } - if(Path.length()) - { - m_pConfig->expand_path(m_pConfig->root_section(), Path, Key, 0); - } - else - { - Key = m_pConfig->root_section(); - } -} - - -void ConfigTreeCtrl::OnNewKey(wxCommandEvent& event) -{ - wxTextEntryDialog Dlg(this, "Test", "Key Name"); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - - wxString Value = Dlg.GetValue(); - - // Get the key for this node - wxTreeItemId ItemID = GetSelection(); - ACE_Configuration_Section_Key Key, NewKey; - ResolveKey(ItemID, Key); - m_pConfig->open_section(Key, Value, 1, NewKey); - wxTreeItemId NewItemID = AppendItem(ItemID, Value); - EnsureVisible(NewItemID); -} - -void ConfigTreeCtrl::OnNewString(wxCommandEvent& event) -{ - ValueDlg Dlg(this, true); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - - ACE_TString Value = Dlg.GetStringValue(); - ACE_TString Name = Dlg.GetName(); - - // Get the key for this node - wxTreeItemId ItemID = GetSelection(); - ACE_Configuration_Section_Key Key; - ResolveKey(ItemID, Key); - m_pConfig->set_string_value(Key, Name.fast_rep(), Value); - m_pListCtrl->DisplaySection(Key); -} - -void ConfigTreeCtrl::OnNewUINT(wxCommandEvent& event) -{ - ValueDlg Dlg(this, false); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - - u_int Value = Dlg.GetUINTValue(); - ACE_TString Name = Dlg.GetName(); - - // Get the key for this node - wxTreeItemId ItemID = GetSelection(); - ACE_Configuration_Section_Key Key; - ResolveKey(ItemID, Key); - m_pConfig->set_integer_value(Key, Name.fast_rep(), Value); - m_pListCtrl->DisplaySection(Key); -} - -void ConfigTreeCtrl::OnNewBinary(wxCommandEvent& event) -{ - assert(0); - /* - ValueDlg Dlg(this, true); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - - ACE_TString Value = Dlg.GetStringValue(); - ACE_TString Name = Dlg.GetName(); - - // Get the key for this node - wxTreeItemId ItemID = GetSelection(); - ACE_Configuration_Section_Key Key; - ResolveKey(ItemID, Key); - m_pConfig->set_string_value(Key, Name.fast_rep(), Value); - m_pListCtrl->DisplaySection(Key); - */ -} - -void ConfigTreeCtrl::OnSelChanged(wxTreeEvent& event) -{ - wxTreeItemId ItemID = GetSelection(); - ACE_Configuration_Section_Key Key; - ResolveKey(ItemID, Key); - m_pListCtrl->DisplaySection(Key); -} - -void ConfigTreeCtrl::OnFind(wxCommandEvent& event) -{ -} - -void ConfigTreeCtrl::OnDelete(wxCommandEvent& event) -{ - wxTreeItemId ItemID = GetSelection(); - wxTreeItemId Parent = GetParent(ItemID); - ACE_Configuration_Section_Key Key; - ResolveKey(Parent, Key); - wxMessageDialog Dlg(this, "Are you sure you want to delete this section?", "Confirm Section Delete", wxYES_NO | wxICON_EXCLAMATION ); - if(Dlg.ShowModal() != wxID_YES) - { - return; - } - wxString Text = GetItemText(ItemID); - m_pConfig->remove_section(Key, Text, 1); - // Reload parent - Delete(ItemID); -} - -void ConfigTreeCtrl::ChangeConfig(ACE_Configuration* pConfig) -{ - m_pConfig = pConfig; - DeleteAllItems(); - LoadTree(); -} - diff --git a/ACE/examples/ConfigViewer/ConfigTreeCtrl.h b/ACE/examples/ConfigViewer/ConfigTreeCtrl.h deleted file mode 100644 index e44eb837384..00000000000 --- a/ACE/examples/ConfigViewer/ConfigTreeCtrl.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef _ConfigurationViewer_ConfigTreeCtrl_H -#define _ConfigurationViewer_ConfigTreeCtrl_H - -class ValueListCtrl; - -class ConfigTreeCtrl : public wxTreeCtrl -{ -public: - /////////////////////////////////////////// - // Initializers - /////////////////////////////////////////// - ConfigTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl"); - virtual ~ConfigTreeCtrl(); - - /////////////////////////////////////////// - // Methods - /////////////////////////////////////////// - void LoadTree(); - void OnRightDown(wxMouseEvent& event); - void OnRightUp(wxMouseEvent& event); - void OnNewKey(wxCommandEvent& event); - void OnNewString(wxCommandEvent& event); - void OnNewUINT(wxCommandEvent& event); - void OnNewBinary(wxCommandEvent& event); - void OnFind(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); - void OnSelChanged(wxTreeEvent& event); - void ChangeConfig(ACE_Configuration* pConfig); - /////////////////////////////////////////// - // Attribute Accessors - /////////////////////////////////////////// - void SetpListCtrl(ValueListCtrl* pListCtrl) {m_pListCtrl = pListCtrl;}; - -protected: - // Not Used - ConfigTreeCtrl(const ConfigTreeCtrl& RHS); - const ConfigTreeCtrl& operator=(const ConfigTreeCtrl& RHS); - - void LoadSection(wxTreeItemId& ParentItem, const ACE_Configuration_Section_Key& Key); - void ResolveKey(wxTreeItemId Item, ACE_Configuration_Section_Key& Key); -private: - DECLARE_EVENT_TABLE() - - ACE_Configuration* m_pConfig; - ValueListCtrl* m_pListCtrl; -}; - -#endif - diff --git a/ACE/examples/ConfigViewer/ConfigViewer.mpc b/ACE/examples/ConfigViewer/ConfigViewer.mpc deleted file mode 100644 index 7927fb9b694..00000000000 --- a/ACE/examples/ConfigViewer/ConfigViewer.mpc +++ /dev/null @@ -1,7 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project : aceexe, wxwindows { - pch_header = stdafx.h - pch_source = stdafx.cpp -}
\ No newline at end of file diff --git a/ACE/examples/ConfigViewer/ConfigurationViewer.cpp b/ACE/examples/ConfigViewer/ConfigurationViewer.cpp deleted file mode 100644 index 20d3dc02d2e..00000000000 --- a/ACE/examples/ConfigViewer/ConfigurationViewer.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// $Id$ -#ifdef __GNUG__ - #pragma implementation "minimal.cpp" - #pragma interface "minimal.cpp" -#endif - -#include "stdafx.h" -#include "MainFrame.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// the application icon -#if defined(__WXGTK__) || defined(__WXMOTIF__) - #include "mondrian.xpm" -#endif - -class ConfigurationViewerApp : public wxApp -{ -public: - virtual bool OnInit(); -}; - -IMPLEMENT_APP(ConfigurationViewerApp) - -bool ConfigurationViewerApp::OnInit() -{ - // Create the main application window - MainFrame *frame = new MainFrame("Configuration Viewer", - wxPoint(50, 50), wxSize(450, 340)); - - // Give it an icon -#ifdef __WXMSW__ - frame->SetIcon(wxIcon("mondrian")); -#else - frame->SetIcon(wxIcon( mondrian_xpm )); -#endif - - frame->Show(TRUE); - SetTopWindow(frame); - - return TRUE; -} - diff --git a/ACE/examples/ConfigViewer/ConfigurationViewer.rc b/ACE/examples/ConfigViewer/ConfigurationViewer.rc deleted file mode 100644 index f490ccefc2d..00000000000 --- a/ACE/examples/ConfigViewer/ConfigurationViewer.rc +++ /dev/null @@ -1,9 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#include "wx/msw/wx.rc" -mondrian ICON "mondrian.ico" - -#define MINIMAL_QUIT 1 -#define MINIMAL_ABOUT 102 - diff --git a/ACE/examples/ConfigViewer/MainFrame.cpp b/ACE/examples/ConfigViewer/MainFrame.cpp deleted file mode 100644 index 6db44856160..00000000000 --- a/ACE/examples/ConfigViewer/MainFrame.cpp +++ /dev/null @@ -1,199 +0,0 @@ -// $Id$ -#include "stdafx.h" -#include "MainFrame.h" -#include "ConfigTreeCtrl.h" -#include "ValueListCtrl.h" - -// Singleton -MainFrame* MainFrame::m_pInstance = 0; - -// IDs for the controls and the menu commands - -BEGIN_EVENT_TABLE(MainFrame, wxFrame) - EVT_MENU(FILE_NEW_PERSISTENT_HEAP, MainFrame::OnFileNewPersistentHeap) - EVT_MENU(FILE_NEW_TRANSIENT_HEAP, MainFrame::OnFileNewTransientHeap) - EVT_MENU(FILE_OPEN_PERSISTENT_HEAP, MainFrame::OnFileOpenPersistentHeap) - EVT_MENU(FILE_OPEN_REGISTRY, MainFrame::OnFileOpenRegistry) - EVT_MENU(FILE_EXPORT, MainFrame::OnFileExport) - EVT_MENU(FILE_IMPORT, MainFrame::OnFileImport) - EVT_MENU(QUIT, MainFrame::OnQuit) - EVT_MENU(ABOUT, MainFrame::OnAbout) -END_EVENT_TABLE() - -// frame constructor -MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size) -: wxFrame((wxFrame *)0, -1, title, pos, size), - m_pConfig(0) -{ - m_pInstance = this; - - // Create a persistent heap based configuration - - ACE_Configuration_Heap* pHeapConfig = new ACE_Configuration_Heap; - pHeapConfig->open(); - m_pConfig = pHeapConfig; - - // set the frame icon - SetIcon(wxICON(mondrian)); - - // Create Splitter - m_pSplitter = new wxSplitterWindow(this, -1); - wxSize sz( m_pSplitter->GetSize() ); - sz.SetWidth(sz.GetWidth() / 2); - - // List Control - m_pListCtrl = new ValueListCtrl(m_pSplitter, -1, wxDefaultPosition, sz); - - // Tree Control - m_pTreeCtrl = new ConfigTreeCtrl(m_pSplitter, FRAME_TREE, wxDefaultPosition, sz, - wxTR_EDIT_LABELS | wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT); - m_pTreeCtrl->SetpListCtrl(m_pListCtrl); - - - // Setup splitter - m_pSplitter->SplitVertically(m_pTreeCtrl, m_pListCtrl); - m_pSplitter->SetMinimumPaneSize(100); - m_pSplitter->SetSashPosition(size.GetWidth() / 3); - - // create a menu bar - wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF); - menuFile->Append(FILE_NEW_PERSISTENT_HEAP, "New Persistent Heap", "Create a new persistent heap"); - menuFile->Append(FILE_NEW_TRANSIENT_HEAP, "New Transient Heap", "Create a new transient heap"); - menuFile->Append(FILE_OPEN_PERSISTENT_HEAP, "Open Persistent Heap", "Open Persistent Heap"); -#if defined (ACE_WIN32) - menuFile->Append(FILE_OPEN_REGISTRY, "Open Win32 Registry", "Open Win32 Registry"); -#endif - menuFile->AppendSeparator(); - menuFile->Append(FILE_IMPORT, "Import from INI file", "Import from INI file"); - menuFile->Append(FILE_EXPORT, "Export to INI file", "Export to INI file"); - menuFile->AppendSeparator(); - menuFile->Append(ABOUT, "&About...\tCtrl-A", "Show about dialog"); - menuFile->AppendSeparator(); - menuFile->Append(QUIT, "E&xit\tAlt-X", "Quit this program"); - - // now append the freshly created menu to the menu bar... - wxMenuBar *menuBar = new wxMenuBar(); - menuBar->Append(menuFile, "&File"); - - // ... and attach this menu bar to the frame - SetMenuBar(menuBar); - -#if wxUSE_STATUSBAR - CreateStatusBar(2); - SetStatusText("Ready"); -#endif // wxUSE_STATUSBAR -} - - -MainFrame::~MainFrame() -{ - delete m_pConfig; - m_pInstance = 0; -} - -MainFrame* MainFrame::Instance() -{ - assert(m_pInstance); - return m_pInstance; -} - - -// event handlers - -void MainFrame::OnSize(wxSizeEvent& event) -{ - wxLayoutAlgorithm layout; - layout.LayoutFrame(this, m_pListCtrl); -} - - -void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) -{ - // TRUE is to force the frame to close - Close(TRUE); -} - -void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) -{ - wxString msg; - msg.Printf( _T("Configuration Viewer v1.0\nWritten by Chris Hafey (chris@stentorsoft.com)\n")); - wxMessageBox(msg, "About", wxOK | wxICON_INFORMATION, this); -} - -void MainFrame::OnFileNewPersistentHeap(wxCommandEvent& event) -{ - wxFileDialog Dlg(this, "Enter Filename:", "", "", "*.*", 0); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - delete m_pConfig; - ACE_Configuration_Heap* pHeapConfig = new ACE_Configuration_Heap; - pHeapConfig->open(Dlg.GetFilename()); - SetNewConfig(pHeapConfig); -} - -void MainFrame::OnFileNewTransientHeap(wxCommandEvent& event) -{ - delete m_pConfig; - ACE_Configuration_Heap* pHeapConfig = new ACE_Configuration_Heap; - pHeapConfig->open(); - SetNewConfig(pHeapConfig); -} - -void MainFrame::OnFileOpenPersistentHeap(wxCommandEvent& event) -{ - wxFileDialog Dlg(this, "Choose a file", "", "", "*.*", wxOPEN); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - delete m_pConfig; - ACE_Configuration_Heap* pHeapConfig = new ACE_Configuration_Heap; - pHeapConfig->open(Dlg.GetFilename()); - SetNewConfig(pHeapConfig); -} - -void MainFrame::OnFileOpenRegistry(wxCommandEvent& event) -{ -#if defined (ACE_WIN32) - wxTextEntryDialog Dlg(this, "Enter Root:"); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - HKEY Root = ACE_Configuration_Win32Registry::resolve_key(HKEY_LOCAL_MACHINE, Dlg.GetValue(), 0); - ACE_Configuration_Win32Registry* pWin32Reg = new ACE_Configuration_Win32Registry(Root);; - delete m_pConfig; - SetNewConfig(pWin32Reg); -#endif -} - -void MainFrame::OnFileExport(wxCommandEvent& event) -{ - wxFileDialog Dlg(this, "Enter Filename:", "", "", "*.*",0); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - m_pConfig->export_config(Dlg.GetFilename()); -} - -void MainFrame::OnFileImport(wxCommandEvent& event) -{ - wxFileDialog Dlg(this, "Choose a file", "", "", "*.*", wxOPEN); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - m_pConfig->import_config(Dlg.GetFilename()); - SetNewConfig(m_pConfig); -} - -void MainFrame::SetNewConfig(ACE_Configuration* pConfig) -{ - m_pConfig = pConfig; - m_pListCtrl->ChangeConfig(pConfig); - m_pTreeCtrl->ChangeConfig(pConfig); -} - diff --git a/ACE/examples/ConfigViewer/MainFrame.h b/ACE/examples/ConfigViewer/MainFrame.h deleted file mode 100644 index 1ae7725fe80..00000000000 --- a/ACE/examples/ConfigViewer/MainFrame.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef _ConfigurationViewer_MainFrame_H -#define _ConfigurationViewer_MainFrame_H - -class ConfigTreeCtrl; -class ValueListCtrl; - -enum -{ - // menu items - QUIT = 1, - ABOUT, - FILE_NEW_PERSISTENT_HEAP, - FILE_NEW_TRANSIENT_HEAP, - FILE_OPEN_PERSISTENT_HEAP, - FILE_OPEN_REGISTRY, - FILE_EXPORT, - FILE_IMPORT, - LEFT_SASH, - FRAME_TREE -}; - - -class MainFrame : public wxFrame -{ -public: - /////////////////////////////////////////// - // Initializers - /////////////////////////////////////////// - MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size); - virtual ~MainFrame(); - - /////////////////////////////////////////// - // Methods - /////////////////////////////////////////// - static MainFrame* Instance(); - void OnQuit(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - void OnFileNewPersistentHeap(wxCommandEvent& event); - void OnFileNewTransientHeap(wxCommandEvent& event); - void OnFileOpenPersistentHeap(wxCommandEvent& event); - void OnFileOpenRegistry(wxCommandEvent& event); - void OnFileExport(wxCommandEvent& event); - void OnFileImport(wxCommandEvent& event); - void OnSize(wxSizeEvent& event); - - /////////////////////////////////////////// - // Attribute Accessors - /////////////////////////////////////////// - ACE_Configuration* GetpConfig() {return m_pConfig;}; -protected: - // Not Used - MainFrame(const MainFrame& RHS); - const MainFrame& operator=(const MainFrame& RHS); - - // Operations - void SetNewConfig(ACE_Configuration* pConfig); - - // Attributes - wxSplitterWindow* m_pSplitter; - ConfigTreeCtrl* m_pTreeCtrl; - ValueListCtrl* m_pListCtrl; -private: - DECLARE_EVENT_TABLE() - ACE_Configuration* m_pConfig; - static MainFrame* m_pInstance; -}; - -#endif - diff --git a/ACE/examples/ConfigViewer/Makefile.am b/ACE/examples/ConfigViewer/Makefile.am deleted file mode 100644 index af88c534c34..00000000000 --- a/ACE/examples/ConfigViewer/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id$ -## -## This file was generated by MPC. Any changes made directly to -## this file will be lost the next time it is generated. -## -## MPC Command: -## ./bin/mwc.pl -type automake -noreldefs ACE.mwc - -ACE_BUILDDIR = $(top_builddir) -ACE_ROOT = $(top_srcdir) - - -## Makefile.ConfigViewer.am - -if BUILD_WXWINDOWS - -noinst_LTLIBRARIES = libConfigViewer.la - -libConfigViewer_la_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - $(ACE_WX_CPPFLAGS) - -libConfigViewer_la_SOURCES = \ - ConfigTreeCtrl.cpp \ - ConfigurationViewer.cpp \ - MainFrame.cpp \ - ValueDlg.cpp \ - ValueListCtrl.cpp - -libConfigViewer_la_LDFLAGS = \ - $(ACE_WX_LDFLAGS) - -noinst_HEADERS = \ - ConfigTreeCtrl.h \ - MainFrame.h \ - ValueDlg.h \ - ValueListCtrl.h - -endif BUILD_WXWINDOWS - -EXTRA_DIST = \ - ConfigurationViewer.rc - - -## Clean up template repositories, etc. -clean-local: - -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* - -rm -f gcctemp.c gcctemp so_locations *.ics - -rm -rf cxx_repository ptrepository ti_files - -rm -rf templateregistry ir.out - -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/ACE/examples/ConfigViewer/README b/ACE/examples/ConfigViewer/README deleted file mode 100644 index 1f83c2dc848..00000000000 --- a/ACE/examples/ConfigViewer/README +++ /dev/null @@ -1,74 +0,0 @@ -Configuration Viewer 1.0 -======================== - -This is something I quickly threw together to allow GUI editing of -ACE_Configuration files. I thought it would be useful and serve as a -better example of how to use ACE_Configuration. I developed this under -Windows 2000, but it should easily port to any platform that wxWindows -supports (see http://www.wxwindows.org.). - -============== - Usage -============== -All functionality is delivered through the file menu and right mouse button -context menus. The file menu lets you create the different types of -ACE_Configurations such as a transient heap, persistent heap or Win32 -Registry heap. A new persistent heap may be created, or an older one -may be opened. The win32 registry will require you to enter the path -from HKEY_LOCAL_MACHINE that you want to open. For example: "Software/TAO" -would set the Win32Registry's root to HKEY_LOCAL_MACHINE/Software/TAO. -Note that this quick implementation loads the entire tree, so if you -enter "Software" it may take a minute to load up - beware! Next you -may import or export entries from a heap to an INI file using the -Import/Export file commands. - -The right mouse button opens up a context menu in both the tree control -and the list control. -From the tree context menu, you can: -1) Create new keys (these hold name/value pairs) -2) Create new string values -3) Create new integer values -4) Delete a key (beware, everything beneath it will be removed as well) - -From the list control context menu, you can: -1) Modify a the value of an entry -2) Delete the entry -3) Rename the entry - -Known Bugs/Issues: -*) You cannot enter/edit binary types -*) Adding a new string/integer value with the same name as an existing - entry will overwrite the existing entry without warning. I think there - is a memory leak that occurs as well. -*) You can add entries to the root key, but they will not be imported - or exported. I think this is by design and the GUI should prevent - this. I need to investigate this further. -*) The entire configuration file is loaded into the tree when it is opened. - For large configurations, this may take a while. A good improvement - would be to load items as the user expands them. -*) At the time of this writing, there is a nasty bug in - ACE_Configuration_Heap that has to do with changing the value - of an existing entry. I have submitted a patch to fix this, but - it may not go in until 5.1.3 (current version is 5.1.2). I strongly - recommend that you get the patch/newer version! -*) Renaming of Keys is not supported. This requires an enhancement to - ACE_Configuration first. -*) No makefiles for other platforms exist, can you donate one? -*) This has only been tested for non MFC DLL builds of ACE, it - should work fine in the other configurations, but I haven't tested it. - -============================================= - -This was developed using: -*) wxWindows 2.1.15 -*) ACE 5.0.16 + My patch to fix a bug in ACE_Configuration_Heap -*) Windows 2000 -*) MSVC 6.0 + SP3 - -If you have any questions or comments, please send me an email. I really -enjoy hearing about others that find this contribution useful! - -Chris Hafey -May 2, 2000 -chris@stentorsoft.com - diff --git a/ACE/examples/ConfigViewer/ValueDlg.cpp b/ACE/examples/ConfigViewer/ValueDlg.cpp deleted file mode 100644 index 2ebcb07120f..00000000000 --- a/ACE/examples/ConfigViewer/ValueDlg.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ -#include "stdafx.h" -#include "ValueDlg.h" - -ValueDlg::ValueDlg(wxWindow* pParent, bool String) -: wxDialog(pParent, -1, String ? "New String" : "New Value", wxDefaultPosition, wxSize(300,140)) -{ - m_pName= new wxStaticText(this, -1, "Name:", wxPoint(20, 20)); - m_pNameText = new wxTextCtrl(this, -1, "", wxPoint(60, 20), wxDefaultSize, 0, wxTextValidator(wxFILTER_NONE, &m_Name)); - m_pValue = new wxStaticText(this, -1, "Value:", wxPoint(20, 50)); - m_pValueText = new wxTextCtrl(this, -1, "", wxPoint(60, 50), wxDefaultSize, 0, wxTextValidator(String ? wxFILTER_NONE : wxFILTER_NUMERIC, &m_Value)); - m_pOK = new wxButton(this, wxID_OK, "OK", wxPoint(60, 80)); - m_pCancel = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(160, 80)); -} - -ValueDlg::ValueDlg(wxWindow* pParent, wxString& Name, wxString& Value) -: wxDialog(pParent, -1, "Edit String", wxDefaultPosition, wxSize(300,140)) -{ - m_Name = Name; - m_Value = Value; - m_pName= new wxStaticText(this, -1, "Name:", wxPoint(20, 20)); - m_pNameText = new wxTextCtrl(this, -1, "", wxPoint(60, 20), wxDefaultSize, 0, wxTextValidator(wxFILTER_NONE, &m_Name)); - m_pNameText->SetEditable(false); - m_pValue = new wxStaticText(this, -1, "Value:", wxPoint(20, 50)); - m_pValueText = new wxTextCtrl(this, -1, Value, wxPoint(60, 50), wxDefaultSize, 0, wxTextValidator(wxFILTER_NONE, &m_Value)); - m_pOK = new wxButton(this, wxID_OK, "OK", wxPoint(60, 80)); - m_pCancel = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(160, 80)); -} - -ValueDlg::ValueDlg(wxWindow* pParent, wxString& Name, u_int Value) -: wxDialog(pParent, -1, "Edit String", wxDefaultPosition, wxSize(300,140)) -{ - m_Name = Name; - m_Value.sprintf("%d", Value); - m_pName= new wxStaticText(this, -1, "Name:", wxPoint(20, 20)); - m_pNameText = new wxTextCtrl(this, -1, "", wxPoint(60, 20), wxDefaultSize, 0, wxTextValidator(wxFILTER_NONE, &m_Name)); - m_pNameText->SetEditable(false); - m_pValue = new wxStaticText(this, -1, "Value:", wxPoint(20, 50)); - m_pValueText = new wxTextCtrl(this, -1, m_Value, wxPoint(60, 50), wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC, &m_Value)); - m_pOK = new wxButton(this, wxID_OK, "OK", wxPoint(60, 80)); - m_pCancel = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(160, 80)); -} - - -ValueDlg::~ValueDlg() -{ -} - -const wxString& ValueDlg::GetName() -{ - return m_Name; -} - -const wxString& ValueDlg::GetStringValue() -{ - return m_Value; -} - -u_int ValueDlg::GetUINTValue() -{ - return ACE_OS::atoi(m_Value); -} - diff --git a/ACE/examples/ConfigViewer/ValueDlg.h b/ACE/examples/ConfigViewer/ValueDlg.h deleted file mode 100644 index 2ea4f026567..00000000000 --- a/ACE/examples/ConfigViewer/ValueDlg.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef _ConfigurationViewer_ValueDlg_H -#define _ConfigurationViewer_ValueDlg_H - -class ValueDlg : public wxDialog -{ -public: - /////////////////////////////////////////// - // Initializers - /////////////////////////////////////////// - ValueDlg(wxWindow* pParent, bool String); - // New Value Ctor - ValueDlg(wxWindow* pParent, wxString& Name, wxString& Value); - // Edit String Ctor - ValueDlg(wxWindow* pParent, wxString& Name, u_int Value); - // Edit UINT Ctor - virtual ~ValueDlg(); - - /////////////////////////////////////////// - // Methods - /////////////////////////////////////////// - const wxString& GetName(); - const wxString& GetStringValue(); - u_int GetUINTValue(); - - /////////////////////////////////////////// - // Attribute Accessors - /////////////////////////////////////////// - wxButton* m_pOK; - wxButton* m_pCancel; - wxStaticText* m_pName; - wxTextCtrl* m_pNameText; - wxStaticText* m_pValue; - wxTextCtrl* m_pValueText; -protected: - // Not Used - ValueDlg(const ValueDlg& RHS); - const ValueDlg& operator=(const ValueDlg& RHS); - - wxString m_Name; - wxString m_Value; - u_int m_UINTValue; - -private: - -}; - -#endif - diff --git a/ACE/examples/ConfigViewer/ValueListCtrl.cpp b/ACE/examples/ConfigViewer/ValueListCtrl.cpp deleted file mode 100644 index 93c9af14fcb..00000000000 --- a/ACE/examples/ConfigViewer/ValueListCtrl.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// $Id$ -#include "stdafx.h" -#include "ValueListCtrl.h" -#include "MainFrame.h" -#include "ValueDlg.h" - - -enum {VALUEMODIFY=200, VALUEDELETE, VALUERENAME}; - -BEGIN_EVENT_TABLE(ValueListCtrl, wxListCtrl) - EVT_RIGHT_DOWN(ValueListCtrl::OnRightDown) - EVT_MENU(VALUEMODIFY, ValueListCtrl::OnModify) - EVT_MENU(VALUEDELETE, ValueListCtrl::OnDelete) - EVT_MENU(VALUERENAME, ValueListCtrl::OnRename) -END_EVENT_TABLE() - - -ValueListCtrl::ValueListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) -: wxListCtrl(parent, id, pos, size, style | wxLC_REPORT | wxLC_SINGLE_SEL, validator, name) -{ - InsertColumn(0, "Name"); - InsertColumn(1, "Type"); - InsertColumn(2, "Data"); -} - -ValueListCtrl::~ValueListCtrl() -{ -} - -void ValueListCtrl::DisplaySection(const ACE_Configuration_Section_Key& Key) -{ - m_Key = Key; - DeleteAllItems(); - m_pConfig = MainFrame::Instance()->GetpConfig(); - ACE_TString Name; - int Index = 0; - ACE_Configuration::VALUETYPE Type; - ACE_TString StringValue; - u_int UINTValue; - while(!m_pConfig->enumerate_values(Key, Index, Name, Type)) - { - int Row = InsertItem(0, Name.fast_rep()); - switch(Type) - { - case ACE_Configuration::STRING: - SetItem(Row, 1, "String"); - m_pConfig->get_string_value(Key, Name.fast_rep(), StringValue); - SetItem(Row, 2, StringValue.fast_rep()); - break; - case ACE_Configuration::INTEGER: - { - SetItem(Row, 1, "Integer"); - m_pConfig->get_integer_value(Key, Name.fast_rep(), UINTValue); - wxString Text; - Text.sprintf("%d", UINTValue); - SetItem(Row, 2, Text); - } - break; - case ACE_Configuration::BINARY: - SetItem(Row, 1, "Binary"); - break; - } - SetItemData(Row, Type); - ++Index; - } -} - -long ValueListCtrl::GetSelectedItem() -{ - return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); -} - -void ValueListCtrl::SelectItem(long ItemID) -{ - // XXX Something isn't right here... When I use a mask it doesn't work at - // all someone explain.. - long State = wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED; - SetItemState(ItemID, State, State); -} - -void ValueListCtrl::OnRightDown(wxMouseEvent& event) -{ - int Flags = wxLIST_HITTEST_ONITEM; - long ItemID = HitTest(wxPoint(event.m_x, event.m_y), Flags); - if(ItemID < 0) - { - return; - } - SelectItem(ItemID); - - wxMenu* pMenu = new wxMenu; - pMenu->Append(VALUEMODIFY, "Modify"); - pMenu->AppendSeparator(); - pMenu->Append(VALUEDELETE, "Delete"); - pMenu->Append(VALUERENAME, "Rename"); - PopupMenu(pMenu, event.m_x, event.m_y); - delete pMenu; -} - -void ValueListCtrl::OnModify(wxCommandEvent& event) -{ - long Item = GetSelectedItem(); - if(Item == -1) - { - return ; - } - wxListItem ListItem; - ACE_Configuration::VALUETYPE Type = (ACE_Configuration::VALUETYPE)GetItemData(Item); - wxString Name = GetItemText(Item); - - switch(Type) - { - case ACE_Configuration::STRING: - { - ACE_TString Value; - m_pConfig->get_string_value(m_Key, Name, Value); - wxString ValueText(Value.fast_rep()); - ValueDlg Dlg(this, Name, ValueText); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - - Value = (const char*)Dlg.GetStringValue(); - m_pConfig->set_string_value(m_Key, Name, Value); - } - break; - case ACE_Configuration::INTEGER: - { - u_int Value; - m_pConfig->get_integer_value(m_Key, Name, Value); - ValueDlg Dlg(this, Name, Value); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - - Value = Dlg.GetUINTValue(); - m_pConfig->set_integer_value(m_Key, Name, Value); - - } - break; - case ACE_Configuration::BINARY: - { - wxMessageBox("Binary modification not supported (why don't you implement it?)"); - //assert(0); - } - break; - } - DisplaySection(m_Key); -} - -void ValueListCtrl::OnDelete(wxCommandEvent& event) -{ - wxMessageDialog Dlg(this, "Are you sure you want to delete this value?", "Confirm Value Delete", wxYES_NO | wxICON_EXCLAMATION ); - if(Dlg.ShowModal() != wxID_YES) - { - return; - } - long Item = GetSelectedItem(); - if(Item == -1) - { - return ; - } - wxString Text = GetItemText(Item); - m_pConfig->remove_value(m_Key, Text); - DeleteItem(Item); -} - -void ValueListCtrl::OnRename(wxCommandEvent& event) -{ - long Item = GetSelectedItem(); - if(Item == -1) - { - return ; - } - wxListItem ListItem; - ACE_Configuration::VALUETYPE Type = (ACE_Configuration::VALUETYPE)GetItemData(Item); - wxString Name = GetItemText(Item); - wxString Message; - Message.sprintf("Enter new name for '%s'", Name); - wxTextEntryDialog Dlg(this, Message, "Please enter text", Name); - if(Dlg.ShowModal() != wxID_OK) - { - return; - } - wxString NewName = Dlg.GetValue(); - if(NewName == Name) - { - return; - } - - // XXX Check to see if an entry with this new name already exists - - switch(Type) - { - case ACE_Configuration::STRING: - { - ACE_TString Value; - m_pConfig->get_string_value(m_Key, Name, Value); - m_pConfig->set_string_value(m_Key, NewName, Value); - } - break; - case ACE_Configuration::INTEGER: - { - u_int Value; - m_pConfig->get_integer_value(m_Key, Name, Value); - m_pConfig->set_integer_value(m_Key, NewName, Value); - } - break; - case ACE_Configuration::BINARY: - { - wxMessageBox("Rename binary not supported (Why don't you implement it?)"); - assert(0); - } - } - m_pConfig->remove_value(m_Key, Name); - DisplaySection(m_Key); -} - -void ValueListCtrl::ChangeConfig(ACE_Configuration* pConfig) -{ - m_pConfig = pConfig; - DisplaySection(pConfig->root_section()); -} - - diff --git a/ACE/examples/ConfigViewer/ValueListCtrl.h b/ACE/examples/ConfigViewer/ValueListCtrl.h deleted file mode 100644 index ce802e67e96..00000000000 --- a/ACE/examples/ConfigViewer/ValueListCtrl.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef _ConfigurationViewer_ValueListCtrl_H -#define _ConfigurationViewer_ValueListCtrl_H - -class ValueListCtrl : public wxListCtrl -{ -public: - /////////////////////////////////////////// - // Initializers - /////////////////////////////////////////// - ValueListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxLC_ICON, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = "listCtrl"); - virtual ~ValueListCtrl(); - - /////////////////////////////////////////// - // Methods - /////////////////////////////////////////// - void DisplaySection(const ACE_Configuration_Section_Key& Key); - long GetSelectedItem(); - void SelectItem(long ItemID); - void OnRightDown(wxMouseEvent& event); - void OnModify(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); - void OnRename(wxCommandEvent& event); - void ChangeConfig(ACE_Configuration* pConfig); - /////////////////////////////////////////// - // Attribute Accessors - /////////////////////////////////////////// - -protected: - // Not Used - ValueListCtrl(const ValueListCtrl& RHS); - const ValueListCtrl& operator=(const ValueListCtrl& RHS); - - DECLARE_EVENT_TABLE() -private: - - ACE_Configuration* m_pConfig; - ACE_Configuration_Section_Key m_Key; -}; - -#endif - diff --git a/ACE/examples/ConfigViewer/mondrian.ico b/ACE/examples/ConfigViewer/mondrian.ico Binary files differdeleted file mode 100644 index 2310c5d275a..00000000000 --- a/ACE/examples/ConfigViewer/mondrian.ico +++ /dev/null diff --git a/ACE/examples/ConfigViewer/mondrian.xpm b/ACE/examples/ConfigViewer/mondrian.xpm deleted file mode 100644 index 409f27a843c..00000000000 --- a/ACE/examples/ConfigViewer/mondrian.xpm +++ /dev/null @@ -1,44 +0,0 @@ -/* XPM */ -static char *mondrian_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 6 1", -" c Black", -". c Blue", -"X c #00bf00", -"o c Red", -"O c Yellow", -"+ c Gray100", -/* pixels */ -" ", -" oooooo +++++++++++++++++++++++ ", -" oooooo +++++++++++++++++++++++ ", -" oooooo +++++++++++++++++++++++ ", -" oooooo +++++++++++++++++++++++ ", -" oooooo +++++++++++++++++++++++ ", -" oooooo +++++++++++++++++++++++ ", -" oooooo +++++++++++++++++++++++ ", -" ", -" ++++++ ++++++++++++++++++ .... ", -" ++++++ ++++++++++++++++++ .... ", -" ++++++ ++++++++++++++++++ .... ", -" ++++++ ++++++++++++++++++ .... ", -" ++++++ ++++++++++++++++++ .... ", -" ++++++ ++++++++++++++++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++ ", -" ++++++ OOOOOOOOOOOO XXXXX ++++ ", -" ++++++ OOOOOOOOOOOO XXXXX ++++ ", -" ++++++ OOOOOOOOOOOO XXXXX ++++ ", -" ++++++ OOOOOOOOOOOO XXXXX ++++ ", -" ++++++ OOOOOOOOOOOO XXXXX ++++ ", -" ++++++ OOOOOOOOOOOO XXXXX ++++ ", -" " -}; diff --git a/ACE/examples/ConfigViewer/stdafx.cpp b/ACE/examples/ConfigViewer/stdafx.cpp deleted file mode 100644 index 0c0c239bca0..00000000000 --- a/ACE/examples/ConfigViewer/stdafx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// $Id$ -#include "stdafx.h" - diff --git a/ACE/examples/ConfigViewer/stdafx.h b/ACE/examples/ConfigViewer/stdafx.h deleted file mode 100644 index 565059d0dd3..00000000000 --- a/ACE/examples/ConfigViewer/stdafx.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#include "ace/ace.h" -#include "ace/os.h" -#include "ace/Configuration.h" -#include "wx/wxprec.h" -#include "wx/laywin.h" -#include "wx/treectrl.h" -#include "wx/listctrl.h" -#include "wx/splitter.h" - - - - - |