// Created: 2002-09-04
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence:
+// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// #pragma implementation
#endif
-#include "wx/wx.h"
-#include "wx/image.h"
-#include "wx/notebook.h"
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#include <math.h>
+
+#ifndef WX_PRECOMP
+
#include "wx/splitter.h"
-#include "wx/wfstream.h"
#include "wx/datstrm.h"
#include "wx/file.h"
#include "wx/listctrl.h"
-#include "wx/tokenzr.h"
#include "wx/process.h"
-#include "wx/mimetype.h"
#include "wx/variant.h"
-#include "wx/cshelp.h"
#include "wx/cmdline.h"
-#include "wx/imaglist.h"
-#include <math.h>
-
-#ifdef __WXMSW__
-#include <windows.h>
-#include "wx/msw/winundef.h"
#endif
+#include "wx/wfstream.h"
+#include "wx/cshelp.h"
+#include "wx/image.h"
+#include "wx/imaglist.h"
+#include "wx/tokenzr.h"
+#include "wx/notebook.h"
+#include "wx/mimetype.h"
#include "utils.h"
// Returns the image type, or -1, determined from the extension.
// Convert 6-digit hex string to a colour
wxColour apHexStringToColour(const wxString& hex)
{
- unsigned int r = 0;
- unsigned int g = 0;
- unsigned int b = 0;
- r = wxHexToDec(hex.Mid(0, 2));
- g = wxHexToDec(hex.Mid(2, 2));
- b = wxHexToDec(hex.Mid(4, 2));
+ unsigned int r = wxHexToDec(hex.Mid(0, 2));
+ unsigned int g = wxHexToDec(hex.Mid(2, 2));
+ unsigned int b = wxHexToDec(hex.Mid(4, 2));
return wxColour(r, g, b);
}
STARTUPINFO siStartInfo;
memset(&siStartInfo, 0, sizeof(STARTUPINFO));
siStartInfo.cb = sizeof(STARTUPINFO);
- CreateProcess(NULL, szCmdName, NULL, NULL, FALSE, 0, NULL,
+ CreateProcess(NULL, szCmdName, NULL, NULL, false, 0, NULL,
NULL, &siStartInfo, &piProcInfo );
}
if(lRes == ERROR_SUCCESS)
{
// TODO: some kind of configuration dialog here.
wxMessageBox(_("Could not determine the command for running the browser."),
- wxT("Browsing problem"), wxOK|wxICON_EXCLAMATION);
+ wxT("Browsing problem"), wxOK|wxICON_EXCLAMATION);
return ;
}
- ok = (wxExecute(cmd, FALSE) != 0);
+ ok = (wxExecute(cmd, false) != 0);
#endif
}
#if defined(__WXMAC__) && !defined(__DARWIN__)
dir = wxMacFindFolder( (short) kOnSystemDisk, kTemporaryFolderType, kCreateFolder ) ;
#else // !Mac
- dir = wxGetenv(_T("TMP"));
+ wxString dirEnv(wxGetenv(_T("TMP")));
+ dir = dirEnv;
if ( dir.empty() )
{
- dir = wxGetenv(_T("TEMP"));
+ wxString envVar(wxGetenv(_T("TEMP")));
+ dir = envVar;
}
if ( dir.empty() )
msg.Printf(wxT("Sorry, could not determine what application to invoke for extension %s\nYou may need to edit your MIME types."),
ext.c_str());
wxMessageBox(msg, wxT("Application Invocation"), wxICON_EXCLAMATION|wxOK);
- return FALSE;
+ return false;
}
wxString cmd;
- bool ok = ft->GetOpenCommand(&cmd,
- wxFileType::MessageParameters(filename, _T("")));
+ ft->GetOpenCommand(&cmd, wxFileType::MessageParameters(filename, _T("")));
delete ft;
- ok = (wxExecute(cmd, FALSE) != 0);
-
- return ok;
+ return (wxExecute(cmd, false) != 0);
}
// Find the absolute path where this application has been run from.
wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName)
{
- wxString str;
-
// Try appVariableName
if (!appVariableName.IsEmpty())
{
- str = wxGetenv(appVariableName);
- if (!str.IsEmpty())
- return str;
+ wxString strVar(wxGetenv(appVariableName.c_str()));
+ if (!strVar.IsEmpty())
+ return strVar;
}
if (wxIsAbsolutePath(argv0))
if (currentDir.Last() != wxFILE_SEP_PATH)
currentDir += wxFILE_SEP_PATH;
- str = currentDir + argv0;
- if (wxFileExists(str))
- return wxPathOnly(str);
+ currentDir += argv0;
+ if (wxFileExists(currentDir))
+ return wxPathOnly(currentDir);
}
// OK, it's neither an absolute path nor a relative path.
wxPathList pathList;
pathList.AddEnvList(wxT("PATH"));
- str = pathList.FindAbsoluteValidPath(argv0);
- if (!str.IsEmpty())
- return wxPathOnly(str);
+ wxString strPath = pathList.FindAbsoluteValidPath(argv0);
+ if (!strPath.IsEmpty())
+ return wxPathOnly(strPath);
// Failed
return wxEmptyString;
#ifdef __WXMAC__
wxSize buttonSize(20, 20);
#else
- wxSize buttonSize(-1, -1);
+ wxSize buttonSize = wxDefaultSize;
#endif
wxButton *contextButton = new wxContextHelpButton( parent, wxID_CONTEXT_HELP,
wxDefaultPosition, buttonSize);
wxIconTable::wxIconTable(wxImageList* imageList)
{
m_imageList = imageList;
- DeleteContents(TRUE);
+ WX_CLEAR_LIST(wxIconTable,*this);
}
void wxIconTable::AppendInfo(wxIconInfo* info)
Append(info);
}
info->SetIconId(state, enabled, m_imageList->Add(icon));
- return TRUE;
+ return true;
}
wxIconInfo* wxIconTable::FindInfo(const wxString& name) const
{
- wxNode* node = GetFirst();
+ wxObjectList::compatibility_iterator node = GetFirst();
while (node)
{
wxIconInfo* info = (wxIconInfo*) node->GetData();
{
wxIconInfo* info = FindInfo(name);
if (!info)
- return FALSE;
+ return false;
info->SetIconId(state, enabled, iconId);
- return TRUE;
+ return true;
}
// Output stream operators
{
// Fast operation if not matching against whole words only
if (!wholeWordOnly)
- return (matchAgainst.Find(matchText) != -1);
+ return (matchAgainst.Find(matchText) != wxNOT_FOUND);
wxString left(matchAgainst);
- bool success = FALSE;
- int pos = 0;
+ bool success = false;
int matchTextLen = (int) matchText.Length();
while (!success && !matchAgainst.IsEmpty())
{
- pos = left.Find(matchText);
- if (pos == -1)
- return FALSE;
+ int pos = left.Find(matchText);
+ if (pos == wxNOT_FOUND)
+ return false;
- bool firstCharOK = FALSE;
- bool lastCharOK = FALSE;
+ bool firstCharOK = false;
+ bool lastCharOK = false;
if (pos == 0 || !wxIsalnum(left[(size_t) (pos-1)]))
- firstCharOK = TRUE;
+ firstCharOK = true;
if (((pos + matchTextLen) == (int) left.Length()) || !wxIsalnum(left[(size_t) (pos + matchTextLen)]))
- lastCharOK = TRUE;
+ lastCharOK = true;
if (firstCharOK && lastCharOK)
- success = TRUE;
+ success = true;
left = left.Mid(pos+1);
}