]>
git.saurik.com Git - wxWidgets.git/blob - utils/configtool/src/configtooldoc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: configtooldoc.h
3 // Purpose: Document class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _CT_CONFIGTOOLDOC_H_
13 #define _CT_CONFIGTOOLDOC_H_
16 #pragma interface "configtooldoc.cpp"
19 #include "wx/docview.h"
20 #include "wx/cmdproc.h"
22 #include "configitem.h"
24 class wxSimpleHtmlTag
;
30 class ctConfigToolDoc
: public wxDocument
32 DECLARE_DYNAMIC_CLASS(ctConfigToolDoc
)
38 virtual bool OnCreate(const wxString
& path
, long flags
);
39 virtual bool OnOpenDocument(const wxString
& filename
);
40 virtual bool OnSaveDocument(const wxString
& filename
);
41 virtual bool OnNewDocument() { return TRUE
; }
42 virtual bool OnCloseDocument() ;
43 virtual bool Save(); // Overridden only to correct bug in wxWindows, docview.cpp
47 /// Returns the top item.
48 ctConfigItem
* GetTopItem() const { return m_topItem
; }
50 /// Sets the top item.
51 void SetTopItem(ctConfigItem
* item
) { m_topItem
= item
; }
53 /// Returns the clipboard item.
54 ctConfigItem
* GetClipboardItem() const { return m_clipboardItem
; }
56 /// Sets the clipboard item.
57 void SetClipboardItem(ctConfigItem
* item
) ;
59 /// Clears the clipboard item.
60 void ClearClipboard() ;
62 /// Gets the current framework directory
63 wxString
GetFrameworkDir(bool makeUnix
);
73 /// Save the settings file
74 bool DoSave(const wxString
& filename
);
76 /// Recursive helper function for file saving
77 bool DoSave(ctConfigItem
* item
, wxOutputStream
& stream
, int indent
);
79 /// Open the settings file
80 bool DoOpen(const wxString
& filename
);
82 /// Helper for file opening.
83 bool DoOpen(wxSimpleHtmlTag
* tag
, ctConfigItem
* parent
);
85 /// Refresh dependencies
86 void RefreshDependencies();
87 void RefreshDependencies(ctConfigItem
* item
);
89 /// Clear dependencies
90 void ClearDependencies(ctConfigItem
* item
);
92 /// Generate the text of a setup.h
93 wxString
GenerateSetup();
96 void GenerateSetup(ctConfigItem
* item
, wxString
& str
);
98 /// Generate a configure command
99 wxString
GenerateConfigureCommand();
102 void GenerateConfigureCommand(ctConfigItem
* item
, wxString
& str
);
104 /// Finds the next item in the tree
105 ctConfigItem
* FindNextItem(ctConfigItem
* item
, bool wrap
);
107 /// Finds the next sibling in the tree
108 ctConfigItem
* FindNextSibling(ctConfigItem
* item
);
111 ctConfigItem
* m_topItem
;
112 ctConfigItem
* m_clipboardItem
;
117 * Implements a document editing command.
118 * We only need to store one state at a time,
119 * since we don't have (or need) multiple selection.
122 #define ctCMD_NEW_ELEMENT 1
123 #define ctCMD_PASTE 2
125 #define ctCMD_APPLY_PROPERTY 4
127 class ctConfigCommand
: public wxCommand
130 ctConfigCommand(const wxString
& name
, int cmdId
,
131 ctConfigItem
* activeState
, ctConfigItem
* savedState
,
132 ctConfigItem
* parent
= NULL
, ctConfigItem
* insertBefore
= NULL
,
133 bool ignoreFirstTime
= FALSE
);
134 ctConfigCommand(const wxString
& name
, int cmdId
,
135 ctConfigItem
* activeState
, ctProperties
* properties
,
136 bool ignoreFirstTime
= FALSE
);
141 bool DoAndUndo(bool doCmd
); // Combine Do and Undo into one
144 ctConfigItem
* m_activeState
;
145 ctConfigItem
* m_savedState
;
146 ctProperties
* m_properties
;
147 bool m_ignoreThis
; // Ignore 1st Do because we already did it
149 ctConfigItem
* m_parent
;
150 ctConfigItem
* m_insertBefore
;
155 // _CT_CONFIGTOOLDOC_H_