2000-07-25 14:47:21 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Purpose: XML resources editor
|
|
|
|
// Author: Vaclav Slavik
|
|
|
|
// Created: 2000/05/05
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2000 Vaclav Slavik
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2002-09-07 08:28:46 -04:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
2000-07-25 14:47:21 -04:00
|
|
|
#pragma interface "editor.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _EDITOR_H_
|
|
|
|
#define _EDITOR_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include "wx/frame.h"
|
2000-07-26 08:40:49 -04:00
|
|
|
#include "wx/treectrl.h"
|
|
|
|
#include "wx/imaglist.h"
|
|
|
|
#include "wx/listctrl.h"
|
2000-07-25 14:47:21 -04:00
|
|
|
|
2000-07-27 05:35:16 -04:00
|
|
|
class WXDLLEXPORT wxXmlNode;
|
|
|
|
class WXDLLEXPORT wxTreeCtrl;
|
|
|
|
class WXDLLEXPORT wxScrolledWindow;
|
|
|
|
class WXDLLEXPORT wxSplitterWindow;
|
2000-07-25 14:47:21 -04:00
|
|
|
class NodeHandler;
|
2000-07-27 05:35:16 -04:00
|
|
|
class WXDLLEXPORT wxXmlNode;
|
|
|
|
class WXDLLEXPORT wxXmlDocument;
|
2000-07-25 14:47:21 -04:00
|
|
|
class EditorTreeCtrl;
|
2000-07-27 05:35:16 -04:00
|
|
|
class WXDLLEXPORT wxTreeCtrl;
|
|
|
|
class WXDLLEXPORT wxListCtrl;
|
|
|
|
class WXDLLEXPORT wxTreeItemId;
|
|
|
|
class WXDLLEXPORT wxImageList;
|
|
|
|
class WXDLLEXPORT wxTreeEvent;
|
|
|
|
class WXDLLEXPORT wxListEvent;
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
enum ChangeType
|
|
|
|
{
|
|
|
|
CHANGED_NOTHING = 0,
|
|
|
|
CHANGED_TREE = 1,
|
|
|
|
CHANGED_TREE_SELECTED = 2,
|
|
|
|
CHANGED_TREE_SELECTED_ICON = 4,
|
|
|
|
CHANGED_PROPS = 8,
|
|
|
|
CHANGED_PROPS_PANEL = 16,
|
|
|
|
CHANGED_EVERYTHING = CHANGED_TREE | CHANGED_PROPS | CHANGED_PROPS_PANEL,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-05-29 14:21:09 -04:00
|
|
|
class wxXmlRcEditDocument : public wxXmlDocument
|
|
|
|
{
|
|
|
|
// Helper functions for Upgrade()
|
|
|
|
void UpgradeNodeValue(wxXmlNode *node);
|
|
|
|
void UpgradeNode(wxXmlNode *node);
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Upgrades older versions
|
|
|
|
void Upgrade();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2000-07-25 14:47:21 -04:00
|
|
|
class EditorFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
friend class EditorTreeCtrl;
|
|
|
|
|
|
|
|
EditorFrame(wxFrame *parent, const wxString& filename);
|
|
|
|
~EditorFrame();
|
|
|
|
|
|
|
|
void LoadFile(const wxString& filename);
|
|
|
|
void NewFile();
|
|
|
|
void SaveFile(const wxString& filename);
|
2000-10-07 17:56:37 -04:00
|
|
|
wxString GetFileName() { return m_FileName; }
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
void RefreshTree();
|
2000-11-24 12:19:48 -05:00
|
|
|
void RefreshTitle();
|
2000-07-25 14:47:21 -04:00
|
|
|
bool SelectNode(wxXmlNode *node, wxTreeItemId *root = NULL);
|
|
|
|
|
|
|
|
wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent, wxXmlNode *node);
|
|
|
|
|
|
|
|
void NotifyChanged(int change_type);
|
|
|
|
|
|
|
|
static EditorFrame *Get() { return ms_Instance; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
static EditorFrame *ms_Instance;
|
|
|
|
|
|
|
|
wxTreeCtrl *m_TreeCtrl;
|
|
|
|
|
|
|
|
wxXmlNode *m_SelectedNode;
|
2000-08-06 12:51:32 -04:00
|
|
|
|
|
|
|
wxXmlNode *m_Clipboard;
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
wxString m_FileName;
|
2001-05-29 14:21:09 -04:00
|
|
|
wxXmlRcEditDocument *m_Resource;
|
2000-11-24 12:19:48 -05:00
|
|
|
|
|
|
|
bool m_Modified;
|
|
|
|
|
|
|
|
bool AskToSave();
|
|
|
|
void DeleteSelectedNode();
|
2000-07-25 14:47:21 -04:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
void OnTreeSel(wxTreeEvent& event);
|
|
|
|
void OnToolbar(wxCommandEvent& event);
|
|
|
|
void OnNew(wxCommandEvent& event);
|
|
|
|
void OnNewNode(wxCommandEvent& event);
|
|
|
|
void OnRightClickTree(wxPoint pos);
|
2000-08-06 12:51:32 -04:00
|
|
|
void OnClipboardAction(wxCommandEvent& event);
|
2000-11-24 12:19:48 -05:00
|
|
|
void OnCloseWindow(wxCloseEvent&);
|
2000-07-25 14:47:21 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|