Source cleaning. wxMotif/OS2 adjustements.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35778 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-10-03 16:39:45 +00:00
parent 24d88d6d46
commit 550343399a
32 changed files with 343 additions and 306 deletions

View File

@@ -1,5 +1,5 @@
/**
* Name: defs.h
* Name: wx/defs.h
* Purpose: Declarations/definitions common to all wx source files
* Author: Julian Smart and others
* Modified by: Ryan Norton (Converted to C)
@@ -2583,6 +2583,11 @@ typedef int (__stdcall *WXFARPROC)();
#endif /* __WIN32__ */
#if defined(__OS2__)
typedef unsigned long DWORD;
typedef unsigned short WORD;
#endif
#if defined(__WXPM__) || defined(__EMX__)
#ifdef __WXPM__
/* Stand-ins for OS/2 types, to avoid #including all of os2.h */
@@ -2643,8 +2648,6 @@ typedef unsigned long HCURSOR;
typedef unsigned long HINSTANCE;
typedef unsigned long HIMAGELIST;
typedef unsigned long HGLOBAL;
typedef unsigned long DWORD;
typedef unsigned short WORD;
#endif /* WXPM || EMX */
#if defined (__WXPM__)

View File

@@ -19,7 +19,7 @@
#include "wx/string.h"
#include "wx/dynarray.h"
#if defined(__WXPM__) || defined(__EMX__)
#if defined(__OS2__) || defined(__EMX__)
#include "wx/os2/private.h"
#endif
@@ -37,9 +37,9 @@ class WXDLLIMPEXP_BASE wxDynamicLibraryDetailsCreator;
// conditional compilation
// ----------------------------------------------------------------------------
// Note: WXPM/EMX has to be tested first, since we want to use
// Note: __OS2__/EMX has to be tested first, since we want to use
// native version, even if configure detected presence of DLOPEN.
#if defined(__WXPM__) || defined(__EMX__) || defined(__WINDOWS__)
#if defined(__OS2__) || defined(__EMX__) || defined(__WINDOWS__)
typedef HMODULE wxDllType;
#elif defined(HAVE_DLOPEN)
#include <dlfcn.h>

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filefn.h
// Name: wx/filefn.h
// Purpose: File- and directory-related functions
// Author: Julian Smart
// Modified by:

View File

@@ -82,7 +82,7 @@ public:
WXGC GetGC() const { return m_gc; }
WXGC GetBackingGC() const { return m_gcBacking; }
WXDisplay* GetDisplay() const { return m_display; }
bool GetAutoSetting() const { return m_autoSetting; }
bool GetAutoSetting() const { return (m_autoSetting != 0); } // See comment in dcclient.cpp
void SetAutoSetting(bool flag) { m_autoSetting = flag; }
protected:

View File

@@ -96,7 +96,7 @@ public:
WXWidget GetTopWidget() const;
#if wxUSE_CHECKLISTBOX
virtual void DoToggleItem(int item, int x) {};
virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {};
#endif
protected:
virtual wxSize DoGetBestSize() const;

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: private.h
// Name: wx/os2/private.h
// Purpose: Private declarations: as this header is only included by
// wxWidgets itself, it may contain identifiers which don't start
// with "wx".
@@ -22,6 +22,19 @@
#define INCL_DOS
#include <os2.h>
#if defined(__WATCOMC__) && defined(__WXMOTIF__)
#include <os2def.h>
#define I_NEED_OS2_H
#include <X11/Xmd.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <Xm/VendorSP.h>
#ifdef __cplusplus
}
#endif
#endif
#if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA)
typedef struct _SPBCDATA {
@@ -37,6 +50,7 @@
#endif
#include "wx/dlimpexp.h"
#include "wx/fontenc.h"
class WXDLLEXPORT wxFont;
@@ -260,21 +274,25 @@ extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0);
// global data
// ---------------------------------------------------------------------------
#ifdef __WXOS2__
// The MakeProcInstance version of the function wxSubclassedGenericControlProc
WXDLLEXPORT_DATA(extern int) wxGenericControlSubClassProc;
WXDLLEXPORT_DATA(extern wxChar*) wxBuffer;
WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance;
#endif
// ---------------------------------------------------------------------------
// global functions
// ---------------------------------------------------------------------------
#ifdef __WXOS2__
extern "C"
{
WXDLLEXPORT HINSTANCE wxGetInstance();
}
WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
#endif
#include "wx/thread.h"
static inline MRESULT MySendMsg(HWND hwnd, ULONG ulMsgid,

View File

@@ -398,14 +398,19 @@
__DARWIN__ for Darwin related corrections (wxMac, wxMotif)
*/
#elif defined(__OS2__)
# if defined(__IBMCPP__)
# define __VISAGEAVER__ __IBMCPP__
# endif
/* wxOS2 vs. non wxOS2 ports on OS2 platform */
# ifndef __WXMOTIF__
# ifndef __WXOS2__
# define __WXOS2__
# endif
# ifndef __WXPM__
# define __WXPM__
# endif
# endif
# if defined(__IBMCPP__)
# define __VISAGEAVER__ __IBMCPP__
# endif
/* Place other OS/2 compiler environment defines here */

View File

@@ -733,7 +733,7 @@ public:
#if wxUSE_THREADS
#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXPM__) || defined(__EMX__)
#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__OS2__) || defined(__EMX__)
// unlock GUI if there are threads waiting for and lock it back when
// there are no more of them - should be called periodically by the main
// thread
@@ -742,10 +742,8 @@ public:
// returns true if the main thread has GUI lock
extern bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread();
#ifndef __WXPM__
// wakes up the main thread if it's sleeping inside ::GetMessage()
extern void WXDLLIMPEXP_BASE wxWakeUpMainThread();
#endif // !OS/2
// return true if the main thread is waiting for some other to terminate:
// wxApp then should block all "dangerous" messages
@@ -755,4 +753,3 @@ public:
#endif // wxUSE_THREADS
#endif // _WX_THREAD_H_

View File

@@ -64,12 +64,12 @@ wxMutexError wxMutex::Unlock()
// wxConditionInternal
// --------------------------------------------------------------------------
#if defined(__WXMSW__) || defined(__WXPM__) || defined(__EMX__)
#if defined(__WXMSW__) || defined(__OS2__) || defined(__EMX__)
// Win32 and OS/2 don't have explicit support for the POSIX condition
// variables and their events/event semaphores have quite different semantics,
// so we reimplement the conditions from scratch using the mutexes and
// semaphores
#if defined(__WXPM__) || defined(__EMX__)
#if defined(__OS2__) || defined(__EMX__)
void InterlockedIncrement(LONG *num)
{
::DosEnterCritSec();

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: utils.h
// Name: wx/utils.h
// Purpose: Miscellaneous utilities
// Author: Julian Smart
// Modified by:
@@ -26,7 +26,9 @@ class WXDLLIMPEXP_BASE wxArrayString;
// wxLongLong
#include "wx/longlong.h"
#ifdef __X__
#ifdef __WATCOMC__
#include <direct.h>
#elif defined(__X__)
#include <dirent.h>
#include <unistd.h>
#endif

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dynlib.cpp
// Name: src/common/dynlib.cpp
// Purpose: Dynamic library management
// Author: Guilhem Lavaux
// Modified by:
@@ -141,7 +141,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags)
/* static */
void wxDynamicLibrary::Unload(wxDllType handle)
{
#if defined(__WXPM__) || defined(__EMX__)
#if defined(__OS2__) || defined(__EMX__)
DosFreeModule( handle );
#elif defined(__WXMAC__) && !defined(__DARWIN__)
CloseConnection( (CFragConnectionID*) &handle );

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Name: fileconf.cpp
// Name: src/common/fileconf.cpp
// Purpose: implementation of wxFileConfig derivation of wxConfig
// Author: Vadim Zeitlin
// Modified by:
@@ -271,7 +271,7 @@ wxString wxFileConfig::GetGlobalDir()
strDir = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ;
#elif defined( __UNIX__ )
strDir = wxT("/etc/");
#elif defined(__WXPM__)
#elif defined(__OS2__)
ULONG aulSysInfo[QSV_MAX] = {0};
UINT drive;
APIRET rc;
@@ -2076,4 +2076,3 @@ static wxString GetAppName(const wxString& appName)
}
#endif // wxUSE_CONFIG

View File

@@ -1600,7 +1600,9 @@ bool wxLocale::Init(int language, int flags)
wxString locale;
// Set the locale:
#if defined(__UNIX__) && !defined(__WXMAC__)
#if defined(__OS2__)
wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
#elif defined(__UNIX__) && !defined(__WXMAC__)
if (language == wxLANGUAGE_DEFAULT)
locale = wxEmptyString;
else
@@ -1771,8 +1773,6 @@ bool wxLocale::Init(int language, int flags)
wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str());
return false;
}
#elif defined(__WXPM__)
wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
#else
return false;
#define WX_NO_LOCALE_SUPPORT
@@ -3554,4 +3554,3 @@ void wxLocale::InitLanguagesDB()
// --- --- --- generated code ends here --- --- ---
#endif // wxUSE_INTL

View File

@@ -3,6 +3,7 @@
// Purpose: implementation of wxTextBuffer class
// Created: 14.11.01
// Author: Morten Hanssen, Vadim Zeitlin
// RCS-ID: $Id$
// Copyright: (c) 1998-2001 wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@@ -45,7 +46,7 @@ const wxTextFileType wxTextBuffer::typeDefault =
wxTextFileType_Unix;
#elif defined(__WXMAC__)
wxTextFileType_Mac;
#elif defined(__WXPM__)
#elif defined(__OS2__)
wxTextFileType_Os2;
#else
wxTextFileType_None;
@@ -283,4 +284,3 @@ bool wxTextBuffer::Write(wxTextFileType typeNew, wxMBConv& conv)
}
#endif // wxUSE_TEXTBUFFER

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: accel.cpp
// Name: src/motif/accel.cpp
// Purpose: wxAcceleratorTable
// Author: Julian Smart
// Modified by:
@@ -112,4 +112,3 @@ bool wxAcceleratorEntry::MatchesEvent(const wxKeyEvent& event) const
(eventShiftDown == accShiftDown) &&
((eventKeyCode == accKeyCode || eventKeyCode == accKeyCode2))) ;
}

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: app.cpp
// Name: src/motif/app.cpp
// Purpose: wxApp
// Author: Julian Smart
// Modified by:
@@ -292,8 +292,8 @@ wxXVisualInfo* wxApp::GetVisualInfo( WXDisplay* display )
return vi;
}
static void wxTLWidgetDestroyCallback(Widget w, XtPointer clientData,
XtPointer ptr)
static void wxTLWidgetDestroyCallback(Widget w, XtPointer WXUNUSED(clientData),
XtPointer WXUNUSED(ptr))
{
if( wxTheApp )
{
@@ -322,7 +322,7 @@ WXWidget wxCreateTopLevelWidget( WXDisplay* display )
return (WXWidget)tlw;
}
WXWidget wxCreateTopLevelRealizedWidget( WXDisplay* display )
WXWidget wxCreateTopLevelRealizedWidget( WXDisplay* WXUNUSED(display) )
{
Widget rTlw = XtVaCreateWidget( "dummy_widget", topLevelShellWidgetClass,
(Widget)wxTheApp->GetTopLevelWidget(),

View File

@@ -352,7 +352,7 @@ void wxChoice::SetColumns(int n)
{
if (n<1) n = 1 ;
short numColumns = n ;
short numColumns = (short)n ;
Arg args[3];
XtSetArg(args[0], XmNnumColumns, numColumns);

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: clipbrd.cpp
// Name: src/motif/clipbrd.cpp
// Purpose: Clipboard functionality
// Author: Julian Smart
// Modified by: Mattia Barbon (added support for generic wxDataObjects)
@@ -236,10 +236,10 @@ wxDEFINE_SCOPED_ARRAY( wxDataFormat, wxDataFormatScopedArray );
#if wxCHECK_LESSTIF()
void wxClipboardCallback( Widget xwidget, int* data_id,
int* priv, int* reason )
int* priv, int* WXUNUSED(reason) )
#else
void wxClipboardCallback( Widget xwidget, long* data_id,
long* priv, int* reason )
long* priv, int* WXUNUSED(reason) )
#endif
{
Display* xdisplay = XtDisplay( xwidget );

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: colour.cpp
// Name: src/motif/colour.cpp
// Purpose: wxColour class
// Author: Julian Smart
// Modified by:
@@ -88,9 +88,9 @@ wxColour wxColour::CreateByName(const wxString& name)
XColor xcol;
if ( XParseColor( dpy, (Colormap)colormap, name.mb_str(), &xcol ) )
{
col.m_red = xcol.red & 0xff;
col.m_green = xcol.green & 0xff;
col.m_blue = xcol.blue & 0xff;
col.m_red = (unsigned char)(xcol.red & 0xff);
col.m_green = (unsigned char)(xcol.green & 0xff);
col.m_blue = (unsigned char)(xcol.blue & 0xff);
col.m_isInit = true;
col.m_pixel = -1;
}
@@ -126,11 +126,11 @@ int wxColour::AllocColour(WXDisplay* display, bool realloc)
XColor color;
color.red = (unsigned short) Red ();
color.red |= color.red << 8;
color.red |= (unsigned short)(color.red << 8);
color.green = (unsigned short) Green ();
color.green |= color.green << 8;
color.green |= (unsigned short)(color.green << 8);
color.blue = (unsigned short) Blue ();
color.blue |= color.blue << 8;
color.blue |= (unsigned short)(color.blue << 8);
color.flags = DoRed | DoGreen | DoBlue;

View File

@@ -166,7 +166,7 @@ wxComboBox::~wxComboBox()
m_clientDataDict.DestroyData();
}
void wxComboBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
void wxComboBox::DoSetSize(int x, int y, int width, int WXUNUSED(height), int sizeFlags)
{
// Necessary so it doesn't call wxChoice::SetSize
wxWindow::DoSetSize(x, y, width, DoGetBestSize().y, sizeFlags);
@@ -292,7 +292,7 @@ wxString wxComboBox::GetString(int n) const
return wxDoGetStringInList( GetXmList(this), n );
}
int wxComboBox::FindString(const wxString& s, bool bCase) const
int wxComboBox::FindString(const wxString& s, bool WXUNUSED(bCase)) const
{
// FIXME: back to base class for not supported value of bCase

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cursor.cpp
// Name: src/motif/cursor.cpp
// Purpose: wxCursor class
// Author: Julian Smart
// Modified by:
@@ -94,7 +94,8 @@ wxCursor::wxCursor(const wxImage & image)
unsigned char * bits = new unsigned char [imagebitcount];
unsigned char * maskBits = new unsigned char [imagebitcount];
int i, j, i8; unsigned char c, cMask;
int i, j, i8;
unsigned char c, cMask;
for (i=0; i<imagebitcount; i++)
{
bits[i] = 0xff;
@@ -104,11 +105,11 @@ wxCursor::wxCursor(const wxImage & image)
for (j=0; j<8; j++)
{
// possible overflow if we do the summation first ?
c = rgbBits[(i8+j)*3]/3 + rgbBits[(i8+j)*3+1]/3 + rgbBits[(i8+j)*3+2]/3;
//if average value is > mid grey
c = (unsigned char)(rgbBits[(i8+j)*3]/3 + rgbBits[(i8+j)*3+1]/3 + rgbBits[(i8+j)*3+2]/3);
// if average value is > mid grey
if (c>127)
bits[i] = bits[i] & cMask;
cMask = (cMask << 1) | 1;
cMask = (unsigned char)((cMask << 1) | 1);
}
}
@@ -129,7 +130,7 @@ wxCursor::wxCursor(const wxImage & image)
{
if (rgbBits[(i8+j)*3] != r || rgbBits[(i8+j)*3+1] != g || rgbBits[(i8+j)*3+2] != b)
maskBits[i] = maskBits[i] | cMask;
cMask = (cMask << 1);
cMask = (unsigned char)(cMask << 1);
}
}
}
@@ -337,9 +338,10 @@ WXCursor wxCursor::MakeCursor(WXDisplay* display, wxStockCursor id) const
switch (id)
{
case wxCURSOR_CHAR: return (WXCursor)cursor;
case wxCURSOR_WAIT: x_cur = XC_watch; break;
case wxCURSOR_CROSS: x_cur = XC_crosshair; break;
case wxCURSOR_CHAR: return (WXCursor)cursor; break;
case wxCURSOR_HAND: x_cur = XC_hand1; break;
case wxCURSOR_BULLSEYE: x_cur = XC_target; break;
case wxCURSOR_PENCIL: x_cur = XC_pencil; break;

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcclient.cpp
// Name: src/motif/dcclient.cpp
// Purpose: wxClientDC class
// Author: Julian Smart
// Modified by:
@@ -10,7 +10,7 @@
/////////////////////////////////////////////////////////////////////////////
/*
About pens, brushes, and the autoSetting flag:
About pens, brushes, and the m_autoSetting flag:
Under X, pens and brushes control some of the same X drawing
parameters. Therefore, it is impossible to independently maintain
@@ -18,9 +18,9 @@
the current logical function. The m_currentFill, etc. instance
variables remember state across the brush and pen.
Since pens are used more than brushes, the autoSetting flag is used to
Since pens are used more than brushes, the m_autoSetting flag is used to
indicate that a brush was recently used, and SetPen must be called to
reinstall the current pen's parameters. If autoSetting includes 0x2, then the
reinstall the current pen's parameters. If m_autoSetting includes 0x2, then the
pens color may need to be set based on XOR.
There is, unfortunately, some confusion between setting the current pen/brush

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog.cpp
// Name: src/motif/dialog.cpp
// Purpose: wxDialog class
// Author: Julian Smart
// Modified by:

View File

@@ -381,9 +381,7 @@ private:
unsigned int m_nPriority; // thread priority in "wx" units
};
void wxThreadInternal::OS2ThreadStart(
void * pParam
)
void wxThreadInternal::OS2ThreadStart( void * pParam )
{
DWORD dwRet;
bool bWasCancelled;

View File

@@ -41,7 +41,7 @@
#ifdef __WXGTK20__
#include "gtk/gtk.h"
extern GtkWidget *wxGetRootWindow();
#endif
#endif // __WXGTK20__
extern "C" int wxCMPFUNC_CONV
wxCompareFamilies (const void *a, const void *b)
@@ -66,7 +66,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
OnFacename( wxT("monospace") );
}
else
#endif
#endif // __WXGTK20__ || !HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
{
PangoFontFamily **families = NULL;
gint n_families = 0;
@@ -97,12 +97,12 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
g_free(families);
}
return TRUE;
return true;
}
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
{
return FALSE;
return false;
}
@@ -205,7 +205,7 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This,
if ( !This->OnFacename(fam) )
{
// stop enumerating
return FALSE;
return false;
}
families.Add(fam);
@@ -213,7 +213,7 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This,
//else: already seen
}
return TRUE;
return true;
}
#endif
// wxUSE_NANOX
@@ -226,14 +226,14 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
bool fixedWidthOnly)
{
#if wxUSE_NANOX
return FALSE;
return false;
#else
int nFonts;
char **fonts;
if ( fixedWidthOnly )
{
bool cont = TRUE;
bool cont = true;
fonts = CreateFontList(wxT('m'), encoding, &nFonts);
if ( fonts )
{
@@ -244,13 +244,13 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
if ( !cont )
{
return TRUE;
return true;
}
fonts = CreateFontList(wxT('c'), encoding, &nFonts);
if ( !fonts )
{
return TRUE;
return true;
}
}
else
@@ -264,14 +264,14 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
wxASSERT_MSG(encoding != wxFONTENCODING_SYSTEM,
wxT("No fonts at all on this system?"));
return FALSE;
return false;
}
}
(void)ProcessFamiliesFromFontList(this, fonts, nFonts);
XFreeFontNames(fonts);
return TRUE;
return true;
#endif
// wxUSE_NANOX
}
@@ -279,11 +279,11 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
{
#if wxUSE_NANOX
return FALSE;
return false;
#else
wxString pattern;
pattern.Printf(wxT("-*-%s-*-*-*-*-*-*-*-*-*-*-*-*"),
family.IsEmpty() ? wxT("*") : family.c_str());
family.empty() ? wxT("*") : family.c_str());
// get the list of all fonts
int nFonts;
@@ -293,7 +293,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
if ( !fonts )
{
// unknown family?
return FALSE;
return false;
}
// extract the list of (unique) encodings
@@ -313,7 +313,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
dash = strchr(familyFont, '-');
*dash = '\0'; // !NULL because Matches() above succeeded
if ( !family.IsEmpty() && (family != familyFont) )
if ( !family.empty() && (family != familyFont) )
{
// family doesn't match
continue;
@@ -344,10 +344,9 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
XFreeFontNames(fonts);
return TRUE;
return true;
#endif
// wxUSE_NANOX
}
#endif
// __WXGTK20__
#endif // !wxUSE_PANGO

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: unix/fontutil.cpp
// Name: src/unix/fontutil.cpp
// Purpose: Font helper functions for X11 (GDK/X)
// Author: Vadim Zeitlin
// Modified by:
@@ -122,7 +122,7 @@ wxFontWeight wxNativeFontInfo::GetWeight() const
bool wxNativeFontInfo::GetUnderlined() const
{
return FALSE;
return false;
}
wxString wxNativeFontInfo::GetFaceName() const
@@ -278,7 +278,7 @@ bool wxNativeFontInfo::FromString(const wxString& s)
description = pango_font_description_from_string( wxGTK_CONV( s ) );
return TRUE;
return true;
}
wxString wxNativeFontInfo::ToString() const
@@ -306,7 +306,7 @@ wxString wxNativeFontInfo::ToUserString() const
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
return FALSE;
return false;
}
wxString wxNativeEncodingInfo::ToString() const
@@ -316,7 +316,7 @@ wxString wxNativeEncodingInfo::ToString() const
bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
{
return TRUE;
return true;
}
bool wxGetNativeFontEncoding(wxFontEncoding encoding,
@@ -431,28 +431,28 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
wxString encid = tokenizer.GetNextToken();
long enc;
if ( !encid.ToLong(&enc) )
return FALSE;
return false;
encoding = (wxFontEncoding)enc;
xregistry = tokenizer.GetNextToken();
if ( !xregistry )
return FALSE;
return false;
xencoding = tokenizer.GetNextToken();
if ( !xencoding )
return FALSE;
return false;
// ok even if empty
facename = tokenizer.GetNextToken();
return TRUE;
return true;
}
wxString wxNativeEncodingInfo::ToString() const
{
wxString s;
s << (long)encoding << _T(';') << xregistry << _T(';') << xencoding;
if ( !!facename )
if ( !facename.empty() )
{
s << _T(';') << facename;
}
@@ -466,7 +466,7 @@ wxString wxNativeEncodingInfo::ToString() const
void wxNativeFontInfo::Init()
{
m_isDefault = TRUE;
m_isDefault = true;
}
bool wxNativeFontInfo::FromString(const wxString& s)
@@ -476,13 +476,13 @@ bool wxNativeFontInfo::FromString(const wxString& s)
// check the version
wxString token = tokenizer.GetNextToken();
if ( token != _T('0') )
return FALSE;
return false;
xFontName = tokenizer.GetNextToken();
// this should be the end
if ( tokenizer.HasMoreTokens() )
return FALSE;
return false;
return FromXFontName(xFontName);
}
@@ -512,13 +512,13 @@ bool wxNativeFontInfo::HasElements() const
wxString wxNativeFontInfo::GetXFontComponent(wxXLFDField field) const
{
wxCHECK_MSG( field < wxXLFD_MAX, _T(""), _T("invalid XLFD field") );
wxCHECK_MSG( field < wxXLFD_MAX, wxEmptyString, _T("invalid XLFD field") );
if ( !HasElements() )
{
// const_cast
if ( !((wxNativeFontInfo *)this)->FromXFontName(xFontName) )
return _T("");
return wxEmptyString;
}
return fontElements[field];
@@ -531,7 +531,7 @@ bool wxNativeFontInfo::FromXFontName(const wxString& fontname)
// skip the leading, usually empty field (font name registry)
if ( !tokenizer.HasMoreTokens() )
return FALSE;
return false;
(void)tokenizer.GetNextToken();
@@ -540,14 +540,14 @@ bool wxNativeFontInfo::FromXFontName(const wxString& fontname)
if ( !tokenizer.HasMoreTokens() )
{
// not enough elements in the XLFD - or maybe an alias
return FALSE;
return false;
}
wxString field = tokenizer.GetNextToken();
if ( !field.empty() && field != _T('*') )
{
// we're really initialized now
m_isDefault = FALSE;
m_isDefault = false;
}
fontElements[n] = field;
@@ -555,9 +555,9 @@ bool wxNativeFontInfo::FromXFontName(const wxString& fontname)
// this should be all
if ( tokenizer.HasMoreTokens() )
return FALSE;
return false;
return TRUE;
return true;
}
wxString wxNativeFontInfo::GetXFontName() const
@@ -615,7 +615,7 @@ void wxNativeFontInfo::SetXFontName(const wxString& xFontName_)
xFontName = xFontName_;
m_isDefault = FALSE;
m_isDefault = false;
}
int wxNativeFontInfo::GetPointSize() const
@@ -668,7 +668,7 @@ wxFontWeight wxNativeFontInfo::GetWeight() const
bool wxNativeFontInfo::GetUnderlined() const
{
// X fonts are never underlined
return FALSE;
return false;
}
wxString wxNativeFontInfo::GetFaceName() const
@@ -758,7 +758,7 @@ void wxNativeFontInfo::SetFaceName(const wxString& facename)
SetXFontComponent(wxXLFD_FAMILY, facename);
}
void wxNativeFontInfo::SetFamily(wxFontFamily family)
void wxNativeFontInfo::SetFamily(wxFontFamily WXUNUSED(family))
{
// wxFontFamily -> X foundry, anyone?
wxFAIL_MSG( _T("not implemented") );
@@ -783,7 +783,7 @@ void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding)
bool wxGetNativeFontEncoding(wxFontEncoding encoding,
wxNativeEncodingInfo *info)
{
wxCHECK_MSG( info, FALSE, _T("bad pointer in wxGetNativeFontEncoding") );
wxCHECK_MSG( info, false, _T("bad pointer in wxGetNativeFontEncoding") );
if ( encoding == wxFONTENCODING_DEFAULT )
{
@@ -860,12 +860,12 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
default:
// don't know how to translate this encoding into X fontspec
return FALSE;
return false;
}
info->encoding = encoding;
return TRUE;
return true;
}
bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
@@ -929,7 +929,7 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize,
wxNativeFont font = 0;
// if we already have the X font name, try to use it
if( xFontName && !xFontName->IsEmpty() )
if( xFontName && !xFontName->empty() )
{
//
// Make sure point size is correct for scale factor.
@@ -1042,7 +1042,7 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize,
if ( !font )
{
font = wxLoadQueryFont(-1, wxDEFAULT, wxNORMAL, wxNORMAL,
FALSE, wxEmptyString,
false, wxEmptyString,
info.xregistry, info.xencoding,
xFontName);
@@ -1055,7 +1055,7 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize,
font = wxLoadQueryFont(-1,
wxDEFAULT, wxNORMAL, wxNORMAL,
FALSE, wxEmptyString,
false, wxEmptyString,
_T("*"), _T("*"),
xFontName);
}
@@ -1071,20 +1071,20 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize,
// private functions
// ----------------------------------------------------------------------------
// returns TRUE if there are any fonts matching this font spec
// returns true if there are any fonts matching this font spec
static bool wxTestFontSpec(const wxString& fontspec)
{
// some X servers will fail to load this font because there are too many
// matches so we must test explicitly for this
if ( fontspec == _T("-*-*-*-*-*-*-*-*-*-*-*-*-*-*") )
{
return TRUE;
return true;
}
wxNativeFont test = (wxNativeFont) g_fontHash->Get( fontspec );
if (test)
{
return TRUE;
return true;
}
test = wxLoadFont(fontspec);
@@ -1094,11 +1094,11 @@ static bool wxTestFontSpec(const wxString& fontspec)
{
wxFreeFont(test);
return TRUE;
return true;
}
else
{
return FALSE;
return false;
}
}
@@ -1195,7 +1195,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize,
#else
wxString fontSpec;
if (!facename.IsEmpty())
if (!facename.empty())
{
fontSpec.Printf(wxT("-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*"),
facename.c_str());
@@ -1393,7 +1393,7 @@ bool wxFontModule::OnInit()
{
g_fontHash = new wxHashTable( wxKEY_STRING );
return TRUE;
return true;
}
void wxFontModule::OnExit()
@@ -1404,4 +1404,3 @@ void wxFontModule::OnExit()
}
#endif // GTK 2.0/1.x

View File

@@ -297,7 +297,7 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature)
False, XA_WINDOW, &type, &format, &nwins,
&after, (unsigned char **)&wins);
if ( type != XA_WINDOW || nwins <= 0 || wins[0] == None )
return FALSE;
return false;
XFree(wins);
// Query for supported features:
@@ -306,7 +306,7 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature)
False, XA_ATOM, &type, &format, &natoms,
&after, (unsigned char **)&atoms);
if ( type != XA_ATOM || atoms == NULL )
return FALSE;
return false;
// Lookup the feature we want:
for (unsigned i = 0; i < natoms; i++)
@@ -314,11 +314,11 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature)
if ( atoms[i] == feature )
{
XFree(atoms);
return TRUE;
return true;
}
}
XFree(atoms);
return FALSE;
return false;
}
#endif
@@ -381,7 +381,7 @@ static bool wxKwinRunning(Display *display, Window rootWnd)
&type, &format, &nitems, &after,
(unsigned char**)&data) != Success)
{
return FALSE;
return false;
}
bool retval = (type == KWIN_RUNNING &&
@@ -427,7 +427,7 @@ static void wxSetKDEFullscreen(Display *display, Window rootWnd,
}
XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
PropModeReplace, (unsigned char *) &data, lng);
PropModeReplace, (unsigned char *) &data[0], lng);
XSync(display, False);
if (wasMapped)
@@ -812,8 +812,3 @@ bool wxGetKeyState(wxKeyCode key)
}
#endif // __WXX11__ || __WXGTK__ || __WXMOTIF__

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bitmap.cpp
// Name: src/x11/bitmap.cpp
// Purpose: wxBitmap
// Author: Julian Smart, Robert Roebling
// Modified by:
@@ -9,6 +9,9 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/bitmap.h"
#include "wx/icon.h"
#include "wx/log.h"
@@ -88,7 +91,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
m_display = bitmap.GetDisplay();
wxImage image = bitmap.ConvertToImage();
if (!image.Ok()) return FALSE;
if (!image.Ok()) return false;
m_display = bitmap.GetDisplay();
@@ -114,21 +117,21 @@ bool wxMask::Create( const wxBitmap& bitmap,
if (bpp == 15)
{
red = red & 0xf8;
green = green & 0xf8;
blue = blue & 0xf8;
red &= 0xf8;
green &= 0xf8;
blue &= 0xf8;
} else
if (bpp == 16)
{
red = red & 0xf8;
green = green & 0xfc;
blue = blue & 0xf8;
red &= 0xf8;
green &= 0xfc;
blue &= 0xf8;
} else
if (bpp == 12)
{
red = red & 0xf0;
green = green & 0xf0;
blue = blue & 0xf0;
red &= 0xf0;
green &= 0xf0;
blue &= 0xf0;
}
XSetForeground( xdisplay, gc, BlackPixel(xdisplay,xscreen) );
@@ -164,9 +167,9 @@ bool wxMask::Create( const wxBitmap& bitmap,
XFreeGC( xdisplay, gc );
return TRUE;
return true;
#else
return FALSE;
return false;
#endif
// wxUSE_NANOX
}
@@ -176,7 +179,7 @@ bool wxMask::Create( const wxBitmap& bitmap, int paletteIndex )
unsigned char r,g,b;
wxPalette *pal = bitmap.GetPalette();
wxCHECK_MSG( pal, FALSE, wxT("Cannot create mask from bitmap without palette") );
wxCHECK_MSG( pal, false, wxT("Cannot create mask from bitmap without palette") );
pal->GetRGB(paletteIndex, &r, &g, &b);
@@ -192,9 +195,9 @@ bool wxMask::Create( const wxBitmap& bitmap )
m_bitmap = NULL;
}
if (!bitmap.Ok()) return FALSE;
if (!bitmap.Ok()) return false;
wxCHECK_MSG( bitmap.GetBitmap(), FALSE, wxT("Cannot create mask from colour bitmap") );
wxCHECK_MSG( bitmap.GetBitmap(), false, wxT("Cannot create mask from colour bitmap") );
m_display = bitmap.GetDisplay();
@@ -203,7 +206,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
m_bitmap = (WXPixmap) XCreatePixmap( (Display*) m_display, xroot, bitmap.GetWidth(), bitmap.GetHeight(), 1 );
if (!m_bitmap) return FALSE;
if (!m_bitmap) return false;
GC gc = XCreateGC( (Display*) m_display, (Pixmap) m_bitmap, 0, NULL );
@@ -212,9 +215,9 @@ bool wxMask::Create( const wxBitmap& bitmap )
XFreeGC( (Display*) m_display, gc );
return TRUE;
return true;
#else
return FALSE;
return false;
#endif
// wxUSE_NANOX
}
@@ -309,7 +312,7 @@ bool wxBitmap::Create( int width, int height, int depth )
{
UnRef();
wxCHECK_MSG( (width > 0) && (height > 0), FALSE, wxT("invalid bitmap size") )
wxCHECK_MSG( (width > 0) && (height > 0), false, wxT("invalid bitmap size") )
m_refData = new wxBitmapRefData();
@@ -324,7 +327,7 @@ bool wxBitmap::Create( int width, int height, int depth )
if (depth == -1) depth = bpp;
wxCHECK_MSG( (depth == bpp) ||
(depth == 1), FALSE, wxT("invalid bitmap depth") )
(depth == 1), false, wxT("invalid bitmap depth") )
M_BMPDATA->m_mask = (wxMask *) NULL;
M_BMPDATA->m_width = width;
@@ -367,7 +370,7 @@ bool wxBitmap::Create(void *data, wxBitmapType type,
wxLogWarning(wxT("no data bitmap handler for type %ld defined."),
(long)type);
return FALSE;
return false;
}
return handler->Create(this, data, type, width, height, depth);
@@ -415,7 +418,7 @@ bool wxBitmap::Create(WXPixmap pixmap)
bool wxBitmap::CreateFromXpm( const char **bits )
{
wxCHECK_MSG( bits, FALSE, wxT("NULL pointer in wxBitmap::CreateFromXpm") );
wxCHECK_MSG( bits, false, wxT("NULL pointer in wxBitmap::CreateFromXpm") );
return Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
@@ -426,14 +429,14 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
if (!image.Ok())
{
wxASSERT_MSG(image.Ok(), wxT("Invalid wxImage passed to wxBitmap::CreateFromImage."));
return FALSE;
return false;
}
int w = image.GetWidth();
int h = image.GetHeight();
if (!Create(w, h, depth))
return FALSE;
return false;
// Unfortunately the mask has to be screen-depth since
// 1-bpp bitmaps don't seem to be supported
@@ -467,7 +470,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
maskGC = GrNewGC();
maskPixmap = GrNewPixmap(w, h, 0);
if (!maskPixmap)
hasMask = FALSE;
hasMask = false;
else
{
wxMask* mask = new wxMask;
@@ -525,14 +528,14 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
if (hasMask)
GrDestroyGC(maskGC);
return TRUE;
return true;
#else
// !wxUSE_NANOX
UnRef();
wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") )
wxCHECK_MSG( depth == -1, FALSE, wxT("invalid bitmap depth") )
wxCHECK_MSG( image.Ok(), false, wxT("invalid image") )
wxCHECK_MSG( depth == -1, false, wxT("invalid bitmap depth") )
m_refData = new wxBitmapRefData();
@@ -568,7 +571,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
if (data_image->data == NULL)
{
wxLogError( wxT("Out of memory.") ); // TODO clean
return FALSE;
return false;
}
M_BMPDATA->m_pixmap = (WXPixmap) XCreatePixmap( xdisplay, xroot, width, height, depth );
@@ -584,7 +587,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
if (mask_image->data == NULL)
{
wxLogError( wxT("Out of memory.") ); // TODO clean
return FALSE;
return false;
}
wxMask *mask = new wxMask();
@@ -743,7 +746,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
}
}
return TRUE;
return true;
#endif
// wxUSE_NANOX
}
@@ -812,7 +815,7 @@ wxImage wxBitmap::ConvertToImage() const
int red_shift_left = 0;
int green_shift_left = 0;
int blue_shift_left = 0;
bool use_shift = FALSE;
bool use_shift = false;
if (GetPixmap())
{
@@ -862,15 +865,15 @@ wxImage wxBitmap::ConvertToImage() const
}
else if (use_shift)
{
data[pos] = (pixel >> red_shift_right) << red_shift_left;
data[pos+1] = (pixel >> green_shift_right) << green_shift_left;
data[pos+2] = (pixel >> blue_shift_right) << blue_shift_left;
data[pos] = (unsigned char)((pixel >> red_shift_right) << red_shift_left);
data[pos+1] = (unsigned char)((pixel >> green_shift_right) << green_shift_left);
data[pos+2] = (unsigned char)((pixel >> blue_shift_right) << blue_shift_left);
}
else if (colors)
{
data[pos] = colors[pixel].red >> 8;
data[pos+1] = colors[pixel].green >> 8;
data[pos+2] = colors[pixel].blue >> 8;
data[pos] = (unsigned char)(colors[pixel].red >> 8);
data[pos+1] = (unsigned char)(colors[pixel].green >> 8);
data[pos+2] = (unsigned char)(colors[pixel].blue >> 8);
}
else
{
@@ -983,7 +986,7 @@ void wxBitmap::SetMask( wxMask *mask )
bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{
*this = icon;
return TRUE;
return true;
}
wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
@@ -1034,7 +1037,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type,
const wxPalette *palette ) const
{
wxCHECK_MSG( Ok(), FALSE, wxT("invalid bitmap") );
wxCHECK_MSG( Ok(), false, wxT("invalid bitmap") );
wxBitmapHandler *handler = FindHandler(type);
@@ -1044,7 +1047,7 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type,
wxImage image(this->ConvertToImage());
if (image.Ok()) return image.SaveFile( name, type );
return FALSE;
return false;
}
return handler->SaveFile(this, name, type, palette);
@@ -1054,7 +1057,7 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
{
UnRef();
if (!wxFileExists(name)) return FALSE;
if (!wxFileExists(name)) return false;
wxBitmapHandler *handler = FindHandler(type);
@@ -1062,14 +1065,14 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
{
wxImage image;
if (!image.LoadFile( name, type ))
return FALSE;
return false;
if (image.Ok())
{
*this = wxBitmap(image);
return TRUE;
return true;
}
else return FALSE;
else return false;
}
return handler->LoadFile(this, name, type, -1, -1);
@@ -1173,14 +1176,14 @@ bool wxGetImageFromDrawable(GR_DRAW_ID drawable, int srcX, int srcY, int width,
if (sinfo.pixtype == MWPF_PALETTE) {
if(!(palette = (GR_PALETTE*) malloc(sizeof(GR_PALETTE)))) {
return FALSE;
return false;
}
GrGetSystemPalette(palette);
}
if(!(pixels = (GR_PIXELVAL*) malloc(sizeof(GR_PIXELVAL) * width * height)))
{
return FALSE;
return false;
}
image.Create(width, height);
@@ -1238,7 +1241,7 @@ bool wxGetImageFromDrawable(GR_DRAW_ID drawable, int srcX, int srcY, int width,
free(pixels);
if(palette) free(palette);
return TRUE;
return true;
}
#if 0
@@ -1329,16 +1332,16 @@ public:
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette *palette = NULL);
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
int width, int height, int depth = 1)
{ return FALSE; }
virtual bool Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(flags),
int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth) = 1)
{ return false; }
};
IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler);
bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
long flags, int desiredWidth,
int desiredHeight)
long WXUNUSED(flags), int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
#if wxHAVE_LIB_XPM
if (!bitmap->GetRefData())
@@ -1385,10 +1388,10 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
{
UnRef();
return FALSE;
return false;
}
return TRUE;
return true;
#elif wxUSE_STREAMS
wxXPMDecoder decoder;
wxFileInputStream stream(name);
@@ -1398,9 +1401,9 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
return image.Ok() && bitmap->CreateFromImage(image);
}
return FALSE;
return false;
#else // !wxHAVE_LIB_XPM && !wxUSE_STREAMS
return FALSE;
return false;
#endif // wxHAVE_LIB_XPM / wxUSE_STREAMS
}
@@ -1411,7 +1414,7 @@ bool wxXPMFileHandler::SaveFile(const wxBitmap *bitmap, const wxString& name,
wxImage image(bitmap->ConvertToImage());
if (image.Ok()) return image.SaveFile( name, (wxBitmapType)type );
return FALSE;
return false;
}
#endif // wxHAVE_LIB_XPM || wxUSE_STREAMS
@@ -1431,13 +1434,18 @@ public:
SetType( wxBITMAP_TYPE_XPM_DATA );
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{ return FALSE; }
virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
long WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{ return false; }
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette *palette = NULL)
{ return FALSE; }
virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
int WXUNUSED(type),
const wxPalette *WXUNUSED(palette) = NULL)
{ return false; }
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
int width, int height, int depth = 1);
@@ -1447,10 +1455,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler);
bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *bits,
long WXUNUSED(flags),
int width, int height, int WXUNUSED(depth))
int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth))
{
#if wxHAVE_LIB_XPM
wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") )
wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") )
if (!bitmap->GetRefData())
bitmap->SetRefData( new wxBitmapRefData() );
@@ -1500,13 +1508,13 @@ bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *bits,
M_BMPHANDLERDATA->m_mask->SetBitmap( (WXPixmap) mask );
M_BMPHANDLERDATA->m_mask->SetDisplay( xdisplay );
}
return TRUE;
return true;
}
else
{
bitmap->UnRef();
return FALSE;
return false;
}
#else // !wxHAVE_LIB_XPM
wxXPMDecoder decoder;
@@ -1532,13 +1540,18 @@ public:
SetType( wxBITMAP_TYPE_XBM_DATA );
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{ return FALSE; }
virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
long WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{ return false; }
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette *palette = NULL)
{ return FALSE; }
virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
int WXUNUSED(type),
const wxPalette *WXUNUSED(palette) = NULL)
{ return false; }
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
int width, int height, int depth = 1);
@@ -1569,9 +1582,9 @@ bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *bits,
M_BMPHANDLERDATA->m_height = height;
M_BMPHANDLERDATA->m_bpp = 1;
return TRUE;
return true;
#else
wxCHECK_MSG( M_BMPHANDLERDATA->m_bitmap, FALSE,
wxCHECK_MSG( M_BMPHANDLERDATA->m_bitmap, false,
wxT("couldn't create bitmap") );
#endif
}

View File

@@ -9,7 +9,9 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/setup.h"
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/utils.h"
#include "wx/brush.h"
#include "wx/bitmap.h"
@@ -89,9 +91,9 @@ wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const
bool wxBrush::operator == ( const wxBrush& brush ) const
{
if (m_refData == brush.m_refData) return TRUE;
if (m_refData == brush.m_refData) return true;
if (!m_refData || !brush.m_refData) return FALSE;
if (!m_refData || !brush.m_refData) return false;
return ( *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData );
}

View File

@@ -9,7 +9,9 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/setup.h"
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/utils.h"
#include "wx/pen.h"
#include "wx/colour.h"
@@ -98,9 +100,9 @@ wxObjectRefData *wxPen::CloneRefData(const wxObjectRefData *data) const
bool wxPen::operator == ( const wxPen& pen ) const
{
if (m_refData == pen.m_refData) return TRUE;
if (m_refData == pen.m_refData) return true;
if (!m_refData || !pen.m_refData) return FALSE;
if (!m_refData || !pen.m_refData) return false;
return ( *(wxPenRefData*)m_refData == *(wxPenRefData*)pen.m_refData );
}

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// File: region.cpp
// File: src/x11/region.cpp
// Purpose: Region class
// Author: Julian Smart, Robert Roebling
// Created: Fri Oct 24 10:46:34 MET 1997
@@ -8,6 +8,9 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/region.h"
#include "wx/gdicmn.h"
#include "wx/log.h"
@@ -67,10 +70,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
void wxRegion::InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
XRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
rect.x = (short)x;
rect.y = (short)y;
rect.width = (unsigned short)w;
rect.height = (unsigned short)h;
m_refData = new wxRegionRefData();
@@ -78,7 +81,7 @@ void wxRegion::InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
}
wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
wxRegion::wxRegion( size_t WXUNUSED(n), const wxPoint *WXUNUSED(points), int WXUNUSED(fillStyle) )
{
#if 0
XPoint *xpoints = new XPoint[n];
@@ -125,13 +128,13 @@ wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const
bool wxRegion::operator==( const wxRegion& region ) const
{
if (m_refData == region.m_refData) return TRUE;
if (m_refData == region.m_refData) return true;
if (!m_refData || !region.m_refData) return FALSE;
if (!m_refData || !region.m_refData) return false;
// compare the regions themselves, not the pointers to ref data!
return XEqualRegion( M_REGIONDATA->m_region,
M_REGIONDATA_OF(region)->m_region );
M_REGIONDATA_OF(region)->m_region ) == True;
}
// ----------------------------------------------------------------------------
@@ -149,13 +152,13 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
// rect results in an empty region (at least XFree 3.3.6 and 4.0 have this
// problem)
if ( !width || !height )
return TRUE;
return true;
XRectangle rect;
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
rect.x = (short)x;
rect.y = (short)y;
rect.width = (unsigned short)width;
rect.height = (unsigned short)height;
if (!m_refData)
{
@@ -170,7 +173,7 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
}
return TRUE;
return true;
}
bool wxRegion::Union( const wxRect& rect )
@@ -181,7 +184,7 @@ bool wxRegion::Union( const wxRect& rect )
bool wxRegion::Union( const wxRegion& region )
{
if (region.IsNull())
return FALSE;
return false;
if (!m_refData)
{
@@ -197,7 +200,7 @@ bool wxRegion::Union( const wxRegion& region )
M_REGIONDATA_OF(region)->m_region,
M_REGIONDATA->m_region );
return TRUE;
return true;
}
bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
@@ -217,7 +220,7 @@ bool wxRegion::Intersect( const wxRect& rect )
bool wxRegion::Intersect( const wxRegion& region )
{
if (region.IsNull())
return FALSE;
return false;
if (!m_refData)
{
@@ -225,7 +228,7 @@ bool wxRegion::Intersect( const wxRegion& region )
M_REGIONDATA->m_region = XCreateRegion();
// leave here
return TRUE;
return true;
}
else
{
@@ -236,7 +239,7 @@ bool wxRegion::Intersect( const wxRegion& region )
M_REGIONDATA_OF(region)->m_region,
M_REGIONDATA->m_region );
return TRUE;
return true;
}
bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
@@ -254,7 +257,7 @@ bool wxRegion::Subtract( const wxRect& rect )
bool wxRegion::Subtract( const wxRegion& region )
{
if (region.IsNull())
return FALSE;
return false;
if (!m_refData)
{
@@ -270,7 +273,7 @@ bool wxRegion::Subtract( const wxRegion& region )
M_REGIONDATA_OF(region)->m_region,
M_REGIONDATA->m_region );
return TRUE;
return true;
}
bool wxRegion::Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
@@ -288,7 +291,7 @@ bool wxRegion::Xor( const wxRect& rect )
bool wxRegion::Xor( const wxRegion& region )
{
if (region.IsNull())
return FALSE;
return false;
if (!m_refData)
{
@@ -304,7 +307,7 @@ bool wxRegion::Xor( const wxRegion& region )
M_REGIONDATA_OF(region)->m_region,
M_REGIONDATA->m_region );
return TRUE;
return true;
}
// ----------------------------------------------------------------------------
@@ -341,21 +344,21 @@ wxRect wxRegion::GetBox() const
bool wxRegion::Offset( wxCoord x, wxCoord y )
{
if (!m_refData)
return FALSE;
return false;
AllocExclusive();
XOffsetRegion( M_REGIONDATA->m_region, x, y );
return TRUE;
return true;
}
bool wxRegion::Empty() const
{
if (!m_refData)
return TRUE;
return true;
return XEmptyRegion( M_REGIONDATA->m_region );
return XEmptyRegion( M_REGIONDATA->m_region ) == True;
}
wxRegionContain wxRegion::Contains( wxCoord x, wxCoord y ) const
@@ -551,4 +554,3 @@ wxRect wxRegionIterator::GetRect() const
return r;
}

View File

@@ -9,6 +9,9 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __VMS
#define XShapeQueryExtension XSHAPEQUERYEXTENSION
#define XtDisplay XTDISPLAY
@@ -222,7 +225,7 @@ void wxXVisualInfo::Init( Display* dpy, XVisualInfo* vi )
index |= (g >> (5 - m_visualGreenPrec)) << m_visualGreenShift;
index |= (b >> (5 - m_visualBluePrec)) << m_visualBlueShift;
}
m_colorCube[ (r*1024) + (g*32) + b ] = index;
m_colorCube[ (r*1024) + (g*32) + b ] = (unsigned char)index;
}
}
}