// Licence:
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "configtooldoc.h"
#endif
-#include "wx/wx.h"
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
-#include "wx/config.h"
-#include "wx/textfile.h"
+#ifndef WX_PRECOMP
+
#include "wx/process.h"
#include "wx/mimetype.h"
#include "wx/process.h"
-#include "wx/wfstream.h"
-#ifdef __BORLANDC__
-#pragma hdrstop
#endif
+#include "wx/textfile.h"
+#include "wx/wfstream.h"
+#include "wx/config.h"
#include "configtooldoc.h"
#include "configtoolview.h"
#include "configtree.h"
UpdateAllViews (NULL, & hint);
DeleteItems();
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
// Saves the doc
bool ctConfigToolDoc::Save()
{
- bool ret = FALSE;
+ if (!IsModified() && m_savedYet) return true;
- if (!IsModified() && m_savedYet) return TRUE;
- if (m_documentFile == wxT("") || !m_savedYet)
- ret = SaveAs();
- else
- ret = OnSaveDocument(m_documentFile);
+ bool ret = (m_documentFile == wxT("") || !m_savedYet) ?
+ SaveAs() :
+ OnSaveDocument(m_documentFile);
if ( ret )
- SetDocumentSaved(TRUE);
+ SetDocumentSaved(true);
return ret;
}
SetTopItem(rootItem);
- Modify(FALSE);
- SetDocumentSaved(FALSE);
+ Modify(false);
+ SetDocumentSaved(false);
wxString rootName(wxT("untitled"));
wxStripExtension(rootName);
ctConfigToolHint hint(NULL, ctInitialUpdate);
UpdateAllViews (NULL, & hint);
- SetFilename(GetFilename(), TRUE);
+ SetFilename(GetFilename(), true);
}
}
return success;
if (wxFileExists(tempFilename))
wxRemoveFile(tempFilename);
- bool leaveBackup = TRUE;
+ bool leaveBackup = true;
bool saved = DoSave(tempFilename);
wxRemoveFile(tempFilename);
}
- Modify(FALSE);
+ Modify(false);
((ctConfigToolView*)GetFirstView())->OnChangeFilename();
- SetDocumentSaved(TRUE);
+ SetDocumentSaved(true);
SetFilename(filename);
wxGetApp().GetSettings().m_lastFilename = filename;
} else
UpdateAllViews (NULL, & hint);
}
- SetDocumentSaved(TRUE); // Necessary or it will pop up the Save As dialog
+ SetDocumentSaved(true); // Necessary or it will pop up the Save As dialog
return opened;
}
{
wxFileOutputStream stream(filename);
if (!stream.Ok())
- return FALSE;
+ return false;
stream << wxT("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
- stream << wxT("<settings xmlns=\"http://www.wxwindows.org/wxs\" version=\"2.5.0.1\">");
+ stream << wxT("<settings xmlns=\"http://www.wxwidgets.org/wxs\" version=\"2.5.0.1\">");
DoSave(m_topItem, stream, 1);
stream << wxT("\n</settings>\n");
- return TRUE;
+ return true;
}
inline static void OutputIndentation(wxOutputStream& stream, int indent)
stream << wxT("<enabled>0</enabled>");
// Output properties
- wxNode* node = item->GetProperties().GetList().GetFirst();
+ wxObjectList::compatibility_iterator node = item->GetProperties().GetList().GetFirst();
while (node)
{
ctProperty* prop = (ctProperty*) node->GetData();
OutputIndentation(stream, indent*2);
stream << wxT("</setting>");
- return TRUE;
+ return true;
}
/// Open the settings file
wxSimpleHtmlTag* firstSettingTag = settingsTag->GetChildren();
if (firstSettingTag)
DoOpen(firstSettingTag, NULL);
- return TRUE;
+ return true;
}
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
static bool GetHtmlBoolValue(const wxString& value)
{
if (value == wxT("true") || value == wxT("TRUE") || value == wxT("1"))
- return TRUE;
+ return true;
else
- return FALSE;
+ return false;
}
static int GetHtmlIntegerValue(const wxString& value)
childTag->GetAttributeValue(description, wxT("description"));
if (type == wxT("bool"))
- prop->GetVariant() = wxVariant((bool) FALSE, name);
+ prop->GetVariant() = wxVariant(false, name);
else if (type == wxT("double"))
prop->GetVariant() = wxVariant((double) 0.0, name);
else if (type == wxT("long"))
else
prop->GetVariant() = wxVariant(wxT(""), name);
prop->SetDescription(description);
- prop->SetCustom(TRUE);
+ prop->SetCustom(true);
prop->SetEditorType(editorType);
if (!choices.IsEmpty())
{
else if (prop->GetVariant().GetType() == wxT("long"))
prop->GetVariant() = (long) GetHtmlIntegerValue(childTag->GetNext()->GetTagText());
else if (prop->GetVariant().GetType() == wxT("bool"))
- prop->GetVariant() = (bool) GetHtmlBoolValue(childTag->GetNext()->GetTagText());
+ prop->GetVariant() = GetHtmlBoolValue(childTag->GetNext()->GetTagText());
else if (prop->GetVariant().GetType() == wxT("double"))
prop->GetVariant() = (double) GetHtmlDoubleValue(childTag->GetNext()->GetTagText());
}
}
childTag = childTag->GetNext();
}
- return TRUE;
+ return true;
}
/// Clear dependencies
item = GetTopItem();
item->GetDependents().Clear();
- for ( wxNode* node = item->GetChildren().GetFirst(); node; node = node->GetNext() )
+ for ( wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); node; node = node->GetNext() )
{
ctConfigItem* child = (ctConfigItem*) node->GetData();
ClearDependencies(child);
otherItem->GetDependents().Append(item);
}
}
- for ( wxNode* node = item->GetChildren().GetFirst(); node; node = node->GetNext() )
+ for ( wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); node; node = node->GetNext() )
{
ctConfigItem* child = (ctConfigItem*) node->GetData();
RefreshDependencies(child);
}
}
- for ( wxNode* node = item->GetChildren().GetFirst(); node; node = node->GetNext() )
+ for ( wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); node; node = node->GetNext() )
{
ctConfigItem* child = (ctConfigItem*) node->GetData();
GenerateSetup(child, str);
wxString str;
str << wxT("# configurewx\n# Generated by wxConfigTool\n\n");
- wxString path = GetFrameworkDir(TRUE);
- bool makeUnix = TRUE;
+ wxString path = GetFrameworkDir(true);
+ bool makeUnix = true;
if (!path.IsEmpty())
{
if (makeUnix)
ctConfigItem* platformsFolder = GetTopItem()->FindItem(wxT("Target"));
if (platformsFolder)
{
- for ( wxNode* node = platformsFolder->GetChildren().GetFirst(); node; node = node->GetNext() )
+ for ( wxObjectList::compatibility_iterator node = platformsFolder->GetChildren().GetFirst(); node; node = node->GetNext() )
{
ctConfigItem* child = (ctConfigItem*) node->GetData();
if (child->GetType() == ctTypeBoolRadio && child->IsEnabled())
}
}
- for ( wxNode* node = item->GetChildren().GetFirst(); node; node = node->GetNext() )
+ for ( wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); node; node = node->GetNext() )
{
ctConfigItem* child = (ctConfigItem*) node->GetData();
GenerateConfigureCommand(child, str);
{
// Should probably allow other variables
// to be used, and maybe expand variables within m_frameworkDir
- path = wxGetenv(wxT("WXWIN"));
+ wxString pathEnv(wxGetenv(wxT("WXWIN")));
+ path = pathEnv;
#ifdef __WXMSW__
if (makeUnix)
path.Replace(wxT("\\"), wxT("/"));
{
if (item->GetParent())
{
- wxNode* node = item->GetParent()->GetChildren().Member(item);
+ wxObjectList::compatibility_iterator node = item->GetParent()->GetChildren().Member(item);
if (node && node->GetNext())
{
ctConfigItem* nextItem = (ctConfigItem*) node->GetNext()->GetData();
ctConfigCommand::ctConfigCommand(const wxString& name, int cmdId,
ctConfigItem* activeState, ctConfigItem* savedState,
ctConfigItem* parent, ctConfigItem* insertBefore,
- bool ignoreFirstTime): wxCommand(TRUE, name)
+ bool ignoreFirstTime): wxCommand(true, name)
{
m_activeState = activeState;
m_savedState = savedState;
ctConfigCommand::ctConfigCommand(const wxString& name, int cmdId,
ctConfigItem* activeState, ctProperties* properties,
- bool ignoreFirstTime): wxCommand(TRUE, name)
+ bool ignoreFirstTime): wxCommand(true, name)
{
m_activeState = activeState;
m_savedState = NULL;
bool ctConfigCommand::Do()
{
- return DoAndUndo(TRUE);
+ return DoAndUndo(true);
}
bool ctConfigCommand::Undo()
{
- return DoAndUndo(FALSE);
+ return DoAndUndo(false);
}
// Combine Do and Undo into one
m_savedState = m_activeState;
m_activeState = NULL;
- m_savedState->GetDocument()->Modify(TRUE);
+ m_savedState->GetDocument()->Modify(true);
ctConfigToolView* view = (ctConfigToolView*) m_savedState->GetDocument()->GetFirstView();
view->OnChangeFilename();
}
wxASSERT(m_savedState != NULL);
wxASSERT(m_activeState == NULL);
- m_savedState->GetDocument()->Modify(TRUE);
+ m_savedState->GetDocument()->Modify(true);
m_savedState->Attach(m_parent, m_insertBefore);
ctConfigToolView* view = (ctConfigToolView*) m_savedState->GetDocument()->GetFirstView();
view->AddItems(wxGetApp().GetMainFrame()->GetConfigTreeCtrl(), m_savedState);
wxASSERT(m_savedState != NULL);
wxASSERT(m_activeState == NULL);
- m_savedState->GetDocument()->Modify(TRUE);
+ m_savedState->GetDocument()->Modify(true);
m_savedState->Attach(m_parent, m_insertBefore);
ctConfigToolView* view = (ctConfigToolView*) m_savedState->GetDocument()->GetFirstView();
view->AddItems(wxGetApp().GetMainFrame()->GetConfigTreeCtrl(), m_savedState);
wxASSERT(m_savedState == NULL);
wxASSERT(m_activeState != NULL);
- m_activeState->GetDocument()->Modify(TRUE);
+ m_activeState->GetDocument()->Modify(true);
ctConfigToolView* view = (ctConfigToolView*) m_activeState->GetDocument()->GetFirstView();
m_activeState->Detach();
m_savedState = m_activeState;
wxASSERT(m_savedState != NULL);
wxASSERT(m_activeState == NULL);
- m_savedState->GetDocument()->Modify(TRUE);
+ m_savedState->GetDocument()->Modify(true);
m_savedState->Attach(m_parent, m_insertBefore);
ctConfigToolView* view = (ctConfigToolView*) m_savedState->GetDocument()->GetFirstView();
view->AddItems(wxGetApp().GetMainFrame()->GetConfigTreeCtrl(), m_savedState);
wxASSERT(m_savedState == NULL);
wxASSERT(m_activeState != NULL);
- m_activeState->GetDocument()->Modify(TRUE);
+ m_activeState->GetDocument()->Modify(true);
m_activeState->Detach();
m_savedState = m_activeState;
m_activeState = NULL;
// Apply only those that need applying
// (those properties in activeState that are not in propsTemp)
- wxNode* node = m_activeState->GetProperties().GetList().GetFirst();
+ wxObjectList::compatibility_iterator node = m_activeState->GetProperties().GetList().GetFirst();
while (node)
{
ctProperty* prop = (ctProperty*) node->GetData();
}
node = node->GetNext();
}
- m_activeState->GetDocument()->Modify(TRUE);
+ m_activeState->GetDocument()->Modify(true);
ctConfigToolView* view = (ctConfigToolView*) m_activeState->GetDocument()->GetFirstView();
if (view)
{
m_activeState->GetDocument()->UpdateAllViews (NULL, & hint);
}
}
- m_ignoreThis = FALSE;
+ m_ignoreThis = false;
break;
}
}
- return TRUE;
+ return true;
}
IMPLEMENT_CLASS(ctConfiguration, wxObject)
/// Clear children
void ctConfiguration::Clear()
{
- wxNode* node = m_children.GetFirst();
+ wxObjectList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
- wxNode* next = node->GetNext();
+ wxObjectList::compatibility_iterator next = node->GetNext();
ctConfiguration* child = (ctConfiguration*) node->GetData();
// This should delete 'node' too, assuming
if (GetName() == name)
return this;
- for ( wxNode* node = GetChildren().GetFirst(); node; node = node->GetNext() )
+ for ( wxObjectList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext() )
{
ctConfiguration* child = (ctConfiguration*) node->GetData();
ctConfiguration* found = child->FindConfiguration(name);
{
if (!GetParent())
return NULL;
- wxNode* node = GetParent()->GetChildren().Member(this);
+ wxObjectList::compatibility_iterator node = GetParent()->GetChildren().Member(this);
if (node && node->GetNext())
{
return (ctConfiguration*) node->GetNext()->GetData();
{
if (!GetParent())
return NULL;
- wxNode* node = GetParent()->GetChildren().Member(this);
+ wxObjectList::compatibility_iterator node = GetParent()->GetChildren().Member(this);
if (node && node->GetPrevious())
{
return (ctConfiguration*) node->GetPrevious()->GetData();
{
ctConfiguration* newItem = Clone();
- for ( wxNode* node = GetChildren().GetFirst(); node; node = node->GetNext() )
+ for ( wxObjectList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext() )
{
ctConfiguration* child = (ctConfiguration*) node->GetData();
ctConfiguration* newChild = child->DeepClone();
/// the config items
void ctConfiguration::DetachFromTree()
{
+/*
wxTreeItemId item = GetTreeItemId();
// TODO
-/*
ctTreeItemData* data = (ctTreeItemData*) wxGetApp().GetMainFrame()->GetConfigTreeCtrl()->GetItemData(item);
data->SetConfigItem(NULL);
m_treeItemId = wxTreeItemId();