// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Put in standard place for resource files if not absolute
strcpy(buf, DEFAULT_XRESOURCE_DIR);
strcat(buf, "/");
strcat(buf, FileNameFromPath(name));
}
// Put in standard place for resource files if not absolute
strcpy(buf, DEFAULT_XRESOURCE_DIR);
strcat(buf, "/");
strcat(buf, FileNameFromPath(name));
}
// Touch the file to create it
FILE *fd = fopen(buf, "w");
if (fd) fclose(fd);
// Touch the file to create it
FILE *fd = fopen(buf, "w");
if (fd) fclose(fd);
// the Real User, then determine the Real home dir.
static char *GetIniFile(char *dest, const char *filename)
{
// the Real User, then determine the Real home dir.
static char *GetIniFile(char *dest, const char *filename)
{
// window when the server initializes and loaded into the display
// structure on XOpenDisplay;
// if not defined, use .Xdefaults
// window when the server initializes and loaded into the display
// structure on XOpenDisplay;
// if not defined, use .Xdefaults
// Open XENVIRONMENT file, or if not defined, the .Xdefaults,
// and merge into existing database
// Open XENVIRONMENT file, or if not defined, the .Xdefaults,
// and merge into existing database
len = strlen(environment);
#if !defined(SVR4) || defined(__sgi)
(void)gethostname(environment + len, 1024 - len);
len = strlen(environment);
#if !defined(SVR4) || defined(__sgi)
(void)gethostname(environment + len, 1024 - len);
// called on application exit
//-----------------------------------------------------------------------------
// called on application exit
//-----------------------------------------------------------------------------
// If file doesn't exist, create it first.
(void)GetResourcePath(nameBuffer, file, TRUE);
// If file doesn't exist, create it first.
(void)GetResourcePath(nameBuffer, file, TRUE);
char buffer[500];
// Is this right? Trying to get it to look in the user's
// home directory instead of current directory -- JACS
(void)GetIniFile(buffer, file);
char buffer[500];
// Is this right? Trying to get it to look in the user's
// home directory instead of current directory -- JACS
(void)GetIniFile(buffer, file);
database = XrmGetFileDatabase(buffer);
wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database);
database = XrmGetFileDatabase(buffer);
wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database);
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
// Try different combinations of upper/lower case, just in case...
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
// Try different combinations of upper/lower case, just in case...
buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
success = XrmGetResource(database, buf, "*", str_type, &xvalue);
}
buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
success = XrmGetResource(database, buf, "*", str_type, &xvalue);
}
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file )
{
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file )
{
bool succ = wxGetResource(section, entry, &s, file);
bool succ = wxGetResource(section, entry, &s, file);
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file )
{
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file )
{
bool succ = wxGetResource(section, entry, &s, file);
bool succ = wxGetResource(section, entry, &s, file);
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file )
{
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file )
{
bool succ = wxGetResource(section, entry, &s, file);
bool succ = wxGetResource(section, entry, &s, file);
// Handle True, False here
// True, Yes, Enables, Set or Activated
if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
// Handle True, False here
// True, Yes, Enables, Set or Activated
if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')